angular-slickgrid 4.1.4 → 4.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/.browserslistrc +12 -0
- package/.codecov.yml +17 -0
- package/.editorconfig +18 -0
- package/.eslintrc.json +50 -0
- package/.github/CODE_OF_CONDUCT.md +76 -0
- package/.github/FUNDING.yml +8 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +54 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +44 -0
- package/.github/renovate.json5 +26 -0
- package/.github/stale.yml +7 -0
- package/.github/workflows/main.yml +83 -0
- package/.vscode/extensions.json +9 -0
- package/.vscode/launch.json +72 -0
- package/.vscode/settings.json +7 -0
- package/.vscode/tasks.json +77 -0
- package/CHANGELOG.md +1172 -0
- package/LICENSE +20 -20
- package/README.md +182 -180
- package/angular.json +148 -0
- package/dist/LICENSE +20 -0
- package/dist/README.md +182 -0
- package/{angular-slickgrid.d.ts → dist/angular-slickgrid.d.ts} +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/constants.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/extensions/index.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/global-grid-options.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/index.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/angularComponentOutput.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/angularGridInstance.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/externalTestingDependencies.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/gridOption.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/index.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/rowDetailView.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/slickGrid.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/modules/angular-slickgrid.module.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/angularUtil.service.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/bsDropdown.service.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/container.service.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/index.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/translater.service.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/utilities.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/slickgrid-config.d.ts +0 -0
- package/{esm2020 → dist/esm2020}/angular-slickgrid.mjs +0 -0
- package/dist/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +1171 -0
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/constants.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/extensions/index.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +2 -2
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/global-grid-options.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/index.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/models/angularComponentOutput.interface.mjs +1 -1
- package/dist/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +2 -0
- package/dist/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +2 -0
- package/dist/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +2 -0
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/models/index.mjs +1 -1
- package/dist/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +2 -0
- package/dist/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +2 -0
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +5 -5
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/angularUtil.service.mjs +4 -4
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +4 -4
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/container.service.mjs +4 -4
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/index.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/translater.service.mjs +4 -4
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/utilities.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/slickgrid-config.mjs +1 -1
- package/{esm2020 → dist/esm2020}/public_api.mjs +1 -1
- package/{fesm2015 → dist/fesm2015}/angular-slickgrid.mjs +25 -22
- package/dist/fesm2015/angular-slickgrid.mjs.map +1 -0
- package/{fesm2020 → dist/fesm2020}/angular-slickgrid.mjs +25 -22
- package/dist/fesm2020/angular-slickgrid.mjs.map +1 -0
- package/{i18n → dist/i18n}/en.json +89 -89
- package/{i18n → dist/i18n}/fr.json +90 -90
- package/dist/package.json +79 -0
- package/{public_api.d.ts → dist/public_api.d.ts} +0 -0
- package/global.d.ts +1 -0
- package/ngcc.config.js +13 -0
- package/package.json +121 -37
- package/screenshots/column-picker.png +0 -0
- package/screenshots/composite-editor.png +0 -0
- package/screenshots/draggable-grouping.png +0 -0
- package/screenshots/editors.png +0 -0
- package/screenshots/export-to-file.png +0 -0
- package/screenshots/filter_and_sort.png +0 -0
- package/screenshots/formatters.png +0 -0
- package/screenshots/frozen.png +0 -0
- package/screenshots/multipleSelectFilter.png +0 -0
- package/screenshots/pagination.png +0 -0
- package/screenshots/selectFilter.png +0 -0
- package/screenshots/singleFilter.png +0 -0
- package/src/app/app-routing.module.ts +83 -0
- package/src/app/app.component.html +160 -0
- package/src/app/app.component.scss +65 -0
- package/src/app/app.component.ts +10 -0
- package/src/app/app.module.ts +175 -0
- package/src/app/examples/custom-angularComponentEditor.ts +184 -0
- package/src/app/examples/custom-angularComponentFilter.ts +126 -0
- package/src/app/examples/custom-inputEditor.ts +124 -0
- package/src/app/examples/custom-inputFilter.ts +142 -0
- package/src/app/examples/custom-titleFormatter.component.ts +8 -0
- package/src/app/examples/editor-ng-select.component.ts +37 -0
- package/src/app/examples/filter-ng-select.component.ts +32 -0
- package/src/app/examples/grid-additem.component.html +48 -0
- package/src/app/examples/grid-additem.component.ts +272 -0
- package/src/app/examples/grid-angular.component.html +79 -0
- package/src/app/examples/grid-angular.component.scss +28 -0
- package/src/app/examples/grid-angular.component.ts +370 -0
- package/src/app/examples/grid-autoheight.component.html +52 -0
- package/src/app/examples/grid-autoheight.component.ts +147 -0
- package/src/app/examples/grid-basic.component.html +29 -0
- package/src/app/examples/grid-basic.component.ts +82 -0
- package/src/app/examples/grid-clientside.component.html +51 -0
- package/src/app/examples/grid-clientside.component.ts +293 -0
- package/src/app/examples/grid-colspan.component.html +39 -0
- package/src/app/examples/grid-colspan.component.scss +11 -0
- package/src/app/examples/grid-colspan.component.ts +155 -0
- package/src/app/examples/grid-composite-editor.component.html +79 -0
- package/src/app/examples/grid-composite-editor.component.scss +19 -0
- package/src/app/examples/grid-composite-editor.component.ts +948 -0
- package/src/app/examples/grid-contextmenu.component.html +62 -0
- package/src/app/examples/grid-contextmenu.component.scss +44 -0
- package/src/app/examples/grid-contextmenu.component.ts +473 -0
- package/src/app/examples/grid-custom-tooltip.component.html +25 -0
- package/src/app/examples/grid-custom-tooltip.component.scss +77 -0
- package/src/app/examples/grid-custom-tooltip.component.ts +483 -0
- package/src/app/examples/grid-draggrouping.component.html +93 -0
- package/src/app/examples/grid-draggrouping.component.ts +397 -0
- package/src/app/examples/grid-editor.component.html +88 -0
- package/src/app/examples/grid-editor.component.ts +699 -0
- package/src/app/examples/grid-formatter.component.html +26 -0
- package/src/app/examples/grid-formatter.component.ts +162 -0
- package/src/app/examples/grid-frozen.component.html +65 -0
- package/src/app/examples/grid-frozen.component.scss +11 -0
- package/src/app/examples/grid-frozen.component.ts +303 -0
- package/src/app/examples/grid-graphql-nopage.component.html +33 -0
- package/src/app/examples/grid-graphql-nopage.component.scss +9 -0
- package/src/app/examples/grid-graphql-nopage.component.ts +242 -0
- package/src/app/examples/grid-graphql.component.html +87 -0
- package/src/app/examples/grid-graphql.component.ts +304 -0
- package/src/app/examples/grid-grouping.component.html +80 -0
- package/src/app/examples/grid-grouping.component.ts +313 -0
- package/src/app/examples/grid-headerbutton.component.html +31 -0
- package/src/app/examples/grid-headerbutton.component.scss +10 -0
- package/src/app/examples/grid-headerbutton.component.ts +233 -0
- package/src/app/examples/grid-headermenu.component.html +31 -0
- package/src/app/examples/grid-headermenu.component.scss +25 -0
- package/src/app/examples/grid-headermenu.component.ts +159 -0
- package/src/app/examples/grid-localization.component.html +54 -0
- package/src/app/examples/grid-localization.component.ts +293 -0
- package/src/app/examples/grid-menu.component.html +37 -0
- package/src/app/examples/grid-menu.component.scss +28 -0
- package/src/app/examples/grid-menu.component.ts +229 -0
- package/src/app/examples/grid-odata.component.html +116 -0
- package/src/app/examples/grid-odata.component.ts +441 -0
- package/src/app/examples/grid-range.component.html +74 -0
- package/src/app/examples/grid-range.component.ts +291 -0
- package/src/app/examples/grid-remote.component.html +37 -0
- package/src/app/examples/grid-remote.component.ts +153 -0
- package/src/app/examples/grid-resize-by-content.component.html +62 -0
- package/src/app/examples/grid-resize-by-content.component.scss +19 -0
- package/src/app/examples/grid-resize-by-content.component.ts +780 -0
- package/src/app/examples/grid-rowdetail.component.html +35 -0
- package/src/app/examples/grid-rowdetail.component.ts +205 -0
- package/src/app/examples/grid-rowmove.component.html +49 -0
- package/src/app/examples/grid-rowmove.component.ts +234 -0
- package/src/app/examples/grid-rowselection.component.html +76 -0
- package/src/app/examples/grid-rowselection.component.ts +267 -0
- package/src/app/examples/grid-state.component.html +36 -0
- package/src/app/examples/grid-state.component.ts +259 -0
- package/src/app/examples/grid-tabs.component.html +35 -0
- package/src/app/examples/grid-tabs.component.ts +115 -0
- package/src/app/examples/grid-trading.component.html +58 -0
- package/src/app/examples/grid-trading.component.scss +49 -0
- package/src/app/examples/grid-trading.component.ts +319 -0
- package/src/app/examples/grid-tree-data-hierarchical.component.html +79 -0
- package/src/app/examples/grid-tree-data-hierarchical.component.scss +47 -0
- package/src/app/examples/grid-tree-data-hierarchical.component.ts +311 -0
- package/src/app/examples/grid-tree-data-parent-child.component.html +108 -0
- package/src/app/examples/grid-tree-data-parent-child.component.scss +10 -0
- package/src/app/examples/grid-tree-data-parent-child.component.ts +351 -0
- package/src/app/examples/home.component.html +41 -0
- package/src/app/examples/home.component.ts +9 -0
- package/src/app/examples/rowdetail-preload.component.ts +10 -0
- package/src/app/examples/rowdetail-view.component.html +36 -0
- package/src/app/examples/rowdetail-view.component.ts +54 -0
- package/src/app/examples/swt-common-grid-pagination.component.ts +156 -0
- package/src/app/examples/swt-common-grid-test.component.html +30 -0
- package/src/app/examples/swt-common-grid-test.component.ts +219 -0
- package/src/app/examples/swt-common-grid.component.ts +436 -0
- package/src/app/examples/swt-logger.service.ts +165 -0
- package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.html +4 -0
- package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts +1395 -0
- package/src/app/modules/angular-slickgrid/constants.ts +97 -0
- package/src/app/modules/angular-slickgrid/extensions/index.ts +1 -0
- package/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts +375 -0
- package/src/app/modules/angular-slickgrid/global-grid-options.ts +245 -0
- package/src/app/modules/angular-slickgrid/index.ts +11 -0
- package/src/app/modules/angular-slickgrid/models/angularComponentOutput.interface.ts +6 -0
- package/src/app/modules/angular-slickgrid/models/angularGridInstance.interface.ts +68 -0
- package/src/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.ts +37 -0
- package/src/app/modules/angular-slickgrid/models/gridOption.interface.ts +12 -0
- package/src/app/modules/angular-slickgrid/models/index.ts +6 -0
- package/src/app/modules/angular-slickgrid/models/rowDetailView.interface.ts +33 -0
- package/src/app/modules/angular-slickgrid/models/slickGrid.interface.ts +7 -0
- package/src/app/modules/angular-slickgrid/modules/angular-slickgrid.module.ts +37 -0
- package/src/app/modules/angular-slickgrid/services/angularUtil.service.ts +48 -0
- package/src/app/modules/angular-slickgrid/services/bsDropdown.service.ts +142 -0
- package/src/app/modules/angular-slickgrid/services/container.service.ts +24 -0
- package/src/app/modules/angular-slickgrid/services/index.ts +5 -0
- package/src/app/modules/angular-slickgrid/services/translater.service.ts +38 -0
- package/src/app/modules/angular-slickgrid/services/utilities.ts +19 -0
- package/src/app/modules/angular-slickgrid/slickgrid-config.ts +10 -0
- package/src/app/slickgrid-custom-variables.scss +10 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/data/collection_100_numbers.json +12 -0
- package/src/assets/data/collection_500_numbers.json +52 -0
- package/src/assets/data/countries.json +245 -0
- package/src/assets/data/country_names.json +245 -0
- package/src/assets/data/customers_100.json +102 -0
- package/src/assets/i18n/en.json +90 -0
- package/src/assets/i18n/fr.json +91 -0
- package/src/environments/environment.prod.ts +3 -0
- package/src/environments/environment.ts +8 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +18 -0
- package/src/main.ts +13 -0
- package/src/polyfills.ts +52 -0
- package/src/public_api.ts +1 -0
- package/src/styles.scss +66 -0
- package/src/typings.d.ts +10 -0
- package/tsconfig.app.json +25 -0
- package/tsconfig.json +40 -0
- package/tsconfig.spec.json +23 -0
- package/docs/assets/lib/multiple-select/README.md +0 -17
- package/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +0 -1168
- package/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +0 -2
- package/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +0 -2
- package/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +0 -2
- package/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +0 -2
- package/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +0 -2
- package/fesm2015/angular-slickgrid.mjs.map +0 -1
- package/fesm2020/angular-slickgrid.mjs.map +0 -1
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { ExcelExportService } from '@slickgrid-universal/excel-export';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
AngularGridInstance,
|
|
6
|
+
Column,
|
|
7
|
+
FieldType,
|
|
8
|
+
Filters,
|
|
9
|
+
Formatter,
|
|
10
|
+
Formatters,
|
|
11
|
+
GridOption,
|
|
12
|
+
findItemInTreeStructure,
|
|
13
|
+
} from './../modules/angular-slickgrid';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
templateUrl: './grid-tree-data-hierarchical.component.html',
|
|
17
|
+
styleUrls: ['grid-tree-data-hierarchical.component.scss'],
|
|
18
|
+
encapsulation: ViewEncapsulation.None
|
|
19
|
+
})
|
|
20
|
+
export class GridTreeDataHierarchicalComponent implements OnInit {
|
|
21
|
+
title = 'Example 29: Tree Data <small> <span class="mdi mdi-file-tree mdi-27px"></span> (from a Hierarchical Dataset - <a href="https://github.com/ghiscoding/Angular-Slickgrid/wiki/Tree-Data-Grid" target="_blank">Wiki</a>)</small>';
|
|
22
|
+
subTitle = `<ul>
|
|
23
|
+
<li><b>NOTE:</b> The grid will automatically sort Ascending with the column that has the Tree Data, you could add a "sortByFieldId" in your column "treeData" option if you wish to sort on a different column</li>
|
|
24
|
+
<li><b>Styling - Salesforce Theme</b></li>
|
|
25
|
+
<ul>
|
|
26
|
+
<li>The Salesforce Theme was created with SASS and compiled in CSS (<a href="https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/modules/angular-slickgrid/styles/slickgrid-theme-salesforce.scss" target="_blank">slickgrid-theme-salesforce.scss</a>), you can override any of its SASS variables</li>
|
|
27
|
+
<li>We use a small subset of <a href="https://materialdesignicons.com/" target="_blank">Material Design Icons</a></li>
|
|
28
|
+
<li>you might need to refresh the page to clear the browser cache and see the correct theme</li>
|
|
29
|
+
</ul>
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
angularGrid!: AngularGridInstance;
|
|
33
|
+
dataViewObj: any;
|
|
34
|
+
gridObj: any;
|
|
35
|
+
gridOptions!: GridOption;
|
|
36
|
+
columnDefinitions!: Column[];
|
|
37
|
+
datasetHierarchical: any[] = [];
|
|
38
|
+
isExcludingChildWhenFiltering = false;
|
|
39
|
+
isAutoApproveParentItemWhenTreeColumnIsValid = true;
|
|
40
|
+
searchString = '';
|
|
41
|
+
|
|
42
|
+
constructor() { }
|
|
43
|
+
|
|
44
|
+
ngOnInit(): void {
|
|
45
|
+
// define the grid options & columns and then create the grid itself
|
|
46
|
+
this.defineGrid();
|
|
47
|
+
|
|
48
|
+
// mock a dataset
|
|
49
|
+
this.datasetHierarchical = this.mockDataset();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
defineGrid() {
|
|
53
|
+
this.columnDefinitions = [
|
|
54
|
+
{
|
|
55
|
+
id: 'file', name: 'Files', field: 'file',
|
|
56
|
+
type: FieldType.string, width: 150, formatter: this.treeFormatter,
|
|
57
|
+
filterable: true, sortable: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'dateModified', name: 'Date Modified', field: 'dateModified',
|
|
61
|
+
formatter: Formatters.dateIso, type: FieldType.dateUtc, outputType: FieldType.dateIso, minWidth: 90,
|
|
62
|
+
exportWithFormatter: true, filterable: true, filter: { model: Filters.compoundDate }
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'description', name: 'Description', field: 'description', minWidth: 90,
|
|
66
|
+
filterable: true, sortable: true,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'size', name: 'Size', field: 'size', minWidth: 90,
|
|
70
|
+
type: FieldType.number, exportWithFormatter: true,
|
|
71
|
+
filterable: true, filter: { model: Filters.compoundInputNumber },
|
|
72
|
+
formatter: (row, cell, value) => isNaN(value) ? '' : `${value} MB`,
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
this.gridOptions = {
|
|
77
|
+
autoResize: {
|
|
78
|
+
container: '#demo-container',
|
|
79
|
+
rightPadding: 10
|
|
80
|
+
},
|
|
81
|
+
enableAutoSizeColumns: true,
|
|
82
|
+
enableAutoResize: true,
|
|
83
|
+
enableExcelExport: true,
|
|
84
|
+
excelExportOptions: {
|
|
85
|
+
exportWithFormatter: true,
|
|
86
|
+
sanitizeDataExport: true
|
|
87
|
+
},
|
|
88
|
+
registerExternalResources: [new ExcelExportService()],
|
|
89
|
+
enableFiltering: true,
|
|
90
|
+
enableTreeData: true, // you must enable this flag for the filtering & sorting to work as expected
|
|
91
|
+
multiColumnSort: false, // multi-column sorting is not supported with Tree Data, so you need to disable it
|
|
92
|
+
treeDataOptions: {
|
|
93
|
+
columnId: 'file',
|
|
94
|
+
childrenPropName: 'files',
|
|
95
|
+
excludeChildrenWhenFilteringTree: this.isExcludingChildWhenFiltering, // defaults to false
|
|
96
|
+
|
|
97
|
+
// skip any other filter criteria(s) if the column holding the Tree (file) passes its own filter criteria
|
|
98
|
+
// (e.g. filtering with "Files = music AND Size > 7", the row "Music" and children will only show up when this flag is enabled
|
|
99
|
+
// this flag only works with the other flag set to `excludeChildrenWhenFilteringTree: false`
|
|
100
|
+
autoApproveParentItemWhenTreeColumnIsValid: this.isAutoApproveParentItemWhenTreeColumnIsValid,
|
|
101
|
+
|
|
102
|
+
// you can also optionally sort by a different column and/or change sort direction
|
|
103
|
+
// initialSort: {
|
|
104
|
+
// columnId: 'file',
|
|
105
|
+
// direction: 'DESC'
|
|
106
|
+
// }
|
|
107
|
+
},
|
|
108
|
+
// change header/cell row height for salesforce theme
|
|
109
|
+
headerRowHeight: 35,
|
|
110
|
+
rowHeight: 33,
|
|
111
|
+
showCustomFooter: true,
|
|
112
|
+
|
|
113
|
+
// we can also preset collapsed items via Grid Presets (parentId: 4 => is the "pdf" folder)
|
|
114
|
+
presets: {
|
|
115
|
+
treeData: { toggledItems: [{ itemId: 4, isCollapsed: true }] },
|
|
116
|
+
},
|
|
117
|
+
// use Material Design SVG icons
|
|
118
|
+
contextMenu: {
|
|
119
|
+
iconCollapseAllGroupsCommand: 'mdi mdi-arrow-collapse',
|
|
120
|
+
iconExpandAllGroupsCommand: 'mdi mdi-arrow-expand',
|
|
121
|
+
iconClearGroupingCommand: 'mdi mdi-close',
|
|
122
|
+
iconCopyCellValueCommand: 'mdi mdi-content-copy',
|
|
123
|
+
iconExportCsvCommand: 'mdi mdi-download',
|
|
124
|
+
iconExportExcelCommand: 'mdi mdi-file-excel-outline',
|
|
125
|
+
iconExportTextDelimitedCommand: 'mdi mdi-download',
|
|
126
|
+
},
|
|
127
|
+
gridMenu: {
|
|
128
|
+
iconCssClass: 'mdi mdi-menu',
|
|
129
|
+
iconClearAllFiltersCommand: 'mdi mdi-filter-remove-outline',
|
|
130
|
+
iconClearAllSortingCommand: 'mdi mdi-swap-vertical',
|
|
131
|
+
iconExportCsvCommand: 'mdi mdi-download',
|
|
132
|
+
iconExportExcelCommand: 'mdi mdi-file-excel-outline',
|
|
133
|
+
iconExportTextDelimitedCommand: 'mdi mdi-download',
|
|
134
|
+
iconRefreshDatasetCommand: 'mdi mdi-sync',
|
|
135
|
+
iconToggleFilterCommand: 'mdi mdi-flip-vertical',
|
|
136
|
+
iconTogglePreHeaderCommand: 'mdi mdi-flip-vertical',
|
|
137
|
+
},
|
|
138
|
+
headerMenu: {
|
|
139
|
+
iconClearFilterCommand: 'mdi mdi mdi-filter-remove-outline',
|
|
140
|
+
iconClearSortCommand: 'mdi mdi-swap-vertical',
|
|
141
|
+
iconSortAscCommand: 'mdi mdi-sort-ascending',
|
|
142
|
+
iconSortDescCommand: 'mdi mdi-flip-v mdi-sort-descending',
|
|
143
|
+
iconColumnHideCommand: 'mdi mdi-close',
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
angularGridReady(angularGrid: AngularGridInstance) {
|
|
149
|
+
this.angularGrid = angularGrid;
|
|
150
|
+
this.gridObj = angularGrid.slickGrid;
|
|
151
|
+
this.dataViewObj = angularGrid.dataView;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
changeAutoApproveParentItem() {
|
|
155
|
+
this.isAutoApproveParentItemWhenTreeColumnIsValid = !this.isAutoApproveParentItemWhenTreeColumnIsValid;
|
|
156
|
+
this.gridOptions.treeDataOptions!.autoApproveParentItemWhenTreeColumnIsValid = this.isAutoApproveParentItemWhenTreeColumnIsValid;
|
|
157
|
+
this.angularGrid.slickGrid.setOptions(this.gridOptions);
|
|
158
|
+
this.angularGrid.filterService.refreshTreeDataFilters();
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
changeExcludeChildWhenFiltering() {
|
|
163
|
+
this.isExcludingChildWhenFiltering = !this.isExcludingChildWhenFiltering;
|
|
164
|
+
this.gridOptions.treeDataOptions!.excludeChildrenWhenFilteringTree = this.isExcludingChildWhenFiltering;
|
|
165
|
+
this.angularGrid.slickGrid.setOptions(this.gridOptions);
|
|
166
|
+
this.angularGrid.filterService.refreshTreeDataFilters();
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
clearSearch() {
|
|
171
|
+
this.searchString = '';
|
|
172
|
+
this.updateFilter();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
searchStringChanged() {
|
|
176
|
+
this.updateFilter();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
updateFilter() {
|
|
180
|
+
this.angularGrid.filterService.updateFilters([{ columnId: 'file', searchTerms: [this.searchString] }], true, false, true);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
treeFormatter: Formatter = (_row, _cell, value, _columnDef, dataContext, grid) => {
|
|
184
|
+
const gridOptions = grid.getOptions() as GridOption;
|
|
185
|
+
const treeLevelPropName = gridOptions.treeDataOptions && gridOptions.treeDataOptions.levelPropName || '__treeLevel';
|
|
186
|
+
if (value === null || value === undefined || dataContext === undefined) {
|
|
187
|
+
return '';
|
|
188
|
+
}
|
|
189
|
+
const dataView = grid.getData();
|
|
190
|
+
const data = dataView.getItems();
|
|
191
|
+
const identifierPropName = dataView.getIdPropertyName() || 'id';
|
|
192
|
+
const idx = dataView.getIdxById(dataContext[identifierPropName]) as number;
|
|
193
|
+
const prefix = this.getFileIcon(value);
|
|
194
|
+
|
|
195
|
+
value = value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
196
|
+
const spacer = `<span style="display:inline-block; width:${(15 * dataContext[treeLevelPropName])}px;"></span>`;
|
|
197
|
+
|
|
198
|
+
if (data[idx + 1] && data[idx + 1][treeLevelPropName] > data[idx][treeLevelPropName]) {
|
|
199
|
+
const folderPrefix = `<span class="mdi icon color-alt-warning ${dataContext.__collapsed ? 'mdi-folder' : 'mdi-folder-open'}"></span>`;
|
|
200
|
+
if (dataContext.__collapsed) {
|
|
201
|
+
return `${spacer} <span class="slick-group-toggle collapsed" level="${dataContext[treeLevelPropName]}"></span>${folderPrefix} ${prefix} ${value}`;
|
|
202
|
+
} else {
|
|
203
|
+
return `${spacer} <span class="slick-group-toggle expanded" level="${dataContext[treeLevelPropName]}"></span>${folderPrefix} ${prefix} ${value}`;
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
return `${spacer} <span class="slick-group-toggle" level="${dataContext[treeLevelPropName]}"></span>${prefix} ${value}`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
getFileIcon(value: string) {
|
|
211
|
+
let prefix = '';
|
|
212
|
+
if (value.includes('.pdf')) {
|
|
213
|
+
prefix = '<span class="mdi icon mdi-file-pdf-outline color-danger"></span>';
|
|
214
|
+
} else if (value.includes('.txt')) {
|
|
215
|
+
prefix = '<span class="mdi icon mdi-file-document-outline color-muted-light"></span>';
|
|
216
|
+
} else if (value.includes('.xls')) {
|
|
217
|
+
prefix = '<span class="mdi icon mdi-file-excel-outline color-success"></span>';
|
|
218
|
+
} else if (value.includes('.mp3')) {
|
|
219
|
+
prefix = '<span class="mdi icon mdi-file-music-outline color-info"></span>';
|
|
220
|
+
}
|
|
221
|
+
return prefix;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* A simple method to add a new item inside the first group that we find.
|
|
226
|
+
* After adding the item, it will sort by parent/child recursively
|
|
227
|
+
*/
|
|
228
|
+
addNewFile() {
|
|
229
|
+
const newId = this.dataViewObj.getLength() + 100;
|
|
230
|
+
|
|
231
|
+
// find first parent object and add the new item as a child
|
|
232
|
+
const tmpDatasetHierarchical = [...this.datasetHierarchical];
|
|
233
|
+
const popItem = findItemInTreeStructure(tmpDatasetHierarchical, x => x.file === 'pop', 'files');
|
|
234
|
+
|
|
235
|
+
if (popItem && Array.isArray(popItem.files)) {
|
|
236
|
+
popItem.files.push({
|
|
237
|
+
id: newId,
|
|
238
|
+
file: `pop-${newId}.mp3`,
|
|
239
|
+
dateModified: new Date(),
|
|
240
|
+
size: Math.floor(Math.random() * 100) + 50,
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// overwrite hierarchical dataset which will also trigger a grid sort and rendering
|
|
244
|
+
this.datasetHierarchical = tmpDatasetHierarchical;
|
|
245
|
+
|
|
246
|
+
// scroll into the position, after insertion cycle, where the item was added
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
const rowIndex = this.dataViewObj.getRowById(popItem.id);
|
|
249
|
+
this.gridObj.scrollRowIntoView(rowIndex + 3);
|
|
250
|
+
}, 10);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
collapseAll() {
|
|
255
|
+
this.angularGrid.treeDataService.toggleTreeDataCollapse(true);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
expandAll() {
|
|
259
|
+
this.angularGrid.treeDataService.toggleTreeDataCollapse(false);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
logHierarchicalStructure() {
|
|
263
|
+
console.log('exploded array', this.angularGrid.treeDataService.datasetHierarchical);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
logFlatStructure() {
|
|
267
|
+
console.log('flat array', this.angularGrid.treeDataService.dataset);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
mockDataset() {
|
|
271
|
+
return [
|
|
272
|
+
{ id: 24, file: 'bucket-list.txt', dateModified: '2012-03-05T12:44:00.123Z', size: 0.5 },
|
|
273
|
+
{ id: 18, file: 'something.txt', dateModified: '2015-03-03T03:50:00.123Z', size: 90 },
|
|
274
|
+
{
|
|
275
|
+
id: 21, file: 'documents', files: [
|
|
276
|
+
{ id: 2, file: 'txt', files: [{ id: 3, file: 'todo.txt', description: 'things to do someday maybe', dateModified: '2015-05-12T14:50:00.123Z', size: 0.7, }] },
|
|
277
|
+
{
|
|
278
|
+
id: 4, file: 'pdf', files: [
|
|
279
|
+
{ id: 22, file: 'map2.pdf', dateModified: '2015-07-21T08:22:00.123Z', size: 2.9, },
|
|
280
|
+
{ id: 5, file: 'map.pdf', dateModified: '2015-05-21T10:22:00.123Z', size: 3.1, },
|
|
281
|
+
{ id: 6, file: 'internet-bill.pdf', dateModified: '2015-05-12T14:50:00.123Z', size: 1.4, },
|
|
282
|
+
{ id: 23, file: 'phone-bill.pdf', dateModified: '2015-05-01T07:50:00.123Z', size: 1.4, },
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{ id: 9, file: 'misc', files: [{ id: 10, file: 'todo.txt', dateModified: '2015-02-26T16:50:00.123Z', size: 0.4, }] },
|
|
286
|
+
{ id: 7, file: 'xls', files: [{ id: 8, file: 'compilation.xls', description: 'movie compilation', dateModified: '2014-10-02T14:50:00.123Z', size: 2.3, }] },
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: 11, file: 'music', files: [{
|
|
291
|
+
id: 12, file: 'mp3', files: [
|
|
292
|
+
{ id: 16, file: 'rock', files: [{ id: 17, file: 'soft.mp3', dateModified: '2015-05-13T13:50:00Z', size: 98, }] },
|
|
293
|
+
{
|
|
294
|
+
id: 14, file: 'pop', files: [
|
|
295
|
+
{ id: 15, file: 'theme.mp3', description: 'Movie Theme Song', dateModified: '2015-03-01T17:05:00Z', size: 47, },
|
|
296
|
+
{ id: 25, file: 'song.mp3', description: 'it is a song...', dateModified: '2016-10-04T06:33:44Z', size: 6.3, }
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
]
|
|
300
|
+
}]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
id: 26, file: 'recipes', description: 'Cake Recipes', dateModified: '2012-03-05T12:44:00.123Z', files: [
|
|
304
|
+
{ id: 29, file: 'cheesecake', description: 'strawberry cheesecake', dateModified: '2012-04-04T13:52:00.123Z', size: 0.2 },
|
|
305
|
+
{ id: 30, file: 'chocolate-cake', description: 'tasty sweet chocolate cake', dateModified: '2012-05-05T09:22:00.123Z', size: 0.2 },
|
|
306
|
+
{ id: 31, file: 'coffee-cake', description: 'chocolate coffee cake', dateModified: '2012-01-01T08:08:48.123Z', size: 0.2 },
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
];
|
|
310
|
+
}
|
|
311
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<div class="container-fluid">
|
|
2
|
+
<h2>
|
|
3
|
+
<span [innerHTML]="title"></span>
|
|
4
|
+
<span class="float-end">
|
|
5
|
+
<a style="font-size: 18px"
|
|
6
|
+
target="_blank"
|
|
7
|
+
href="https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/examples/grid-tree-data-parent-child.component.ts">
|
|
8
|
+
<span class="mdi mdi-link mdi-v-align-sub"></span> code
|
|
9
|
+
</a>
|
|
10
|
+
</span>
|
|
11
|
+
</h2>
|
|
12
|
+
<div class="subtitle" [innerHTML]="subTitle"></div>
|
|
13
|
+
|
|
14
|
+
<div class="row" style="margin-bottom: 4px;">
|
|
15
|
+
<div class="col-md-12">
|
|
16
|
+
<button class="btn btn-outline-secondary btn-sm" data-test="add-500-rows-btn" (click)="loadData(500)">
|
|
17
|
+
500 rows
|
|
18
|
+
</button>
|
|
19
|
+
<button class="btn btn-outline-secondary btn-sm" data-test="add-50k-rows-btn" (click)="loadData(25000)">
|
|
20
|
+
25k rows
|
|
21
|
+
</button>
|
|
22
|
+
<button (click)="dynamicallyChangeFilter()" class="btn btn-outline-secondary btn-sm"
|
|
23
|
+
data-test="change-filter-dynamically">
|
|
24
|
+
<span class="mdi mdi-filter-outline"></span>
|
|
25
|
+
<span>Dynamically Change Filter (% complete < 40)</span>
|
|
26
|
+
</button>
|
|
27
|
+
<button (click)="collapseAllWithoutEvent()" data-test="collapse-all-noevent-btn"
|
|
28
|
+
class="btn btn-outline-secondary btn-sm">
|
|
29
|
+
<span class="icon mdi mdi-arrow-collapse"></span>
|
|
30
|
+
<span>Collapse All (without triggering event)</span>
|
|
31
|
+
</button>
|
|
32
|
+
<button (click)="reapplyToggledItems()" data-test="reapply-toggled-items-btn"
|
|
33
|
+
class="btn btn-outline-secondary btn-sm"
|
|
34
|
+
[disabled]="hasNoExpandCollapseChanged">
|
|
35
|
+
<span class="icon mdi mdi-history"></span>
|
|
36
|
+
<span>Reapply Previous Toggled Items</span>
|
|
37
|
+
</button>
|
|
38
|
+
<button (click)="collapseAllWithoutEvent()" class="btn btn-outline-secondary btn-sm"
|
|
39
|
+
data-test="collapse-all-noevent-btn">
|
|
40
|
+
<span class="mdi mdi-arrow-collapse"></span>
|
|
41
|
+
<span>Collapse All (without triggering event)</span>
|
|
42
|
+
</button>
|
|
43
|
+
<button (click)="dynamicallyToggledFirstParent()" class="btn btn-outline-secondary btn-sm"
|
|
44
|
+
data-test="dynamically-toggle-first-parent-btn">
|
|
45
|
+
<span>Dynamically Toggle First Parent</span>
|
|
46
|
+
</button>
|
|
47
|
+
<button (click)="reapplyToggledItems()" data-test="reapply-toggled-items-btn"
|
|
48
|
+
class="btn btn-outline-secondary btn-sm"
|
|
49
|
+
disabled.bind="hasNoExpandCollapseChanged">
|
|
50
|
+
<span class="mdi mdi-history"></span>
|
|
51
|
+
<span>Reapply Previous Toggled Items</span>
|
|
52
|
+
</button>
|
|
53
|
+
<div class.bind="loadingClass"></div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div class="row">
|
|
58
|
+
<div class="col-md-12">
|
|
59
|
+
<button (click)="addNewRow()" data-test="add-item-btn" class="btn btn-primary btn-sm">
|
|
60
|
+
<span class="icon mdi mdi-plus color-white"></span>
|
|
61
|
+
<span>Add New Item (in 1st group)</span>
|
|
62
|
+
</button>
|
|
63
|
+
<button (click)="collapseAll()" data-test="collapse-all-btn" class="btn btn-outline-secondary btn-sm">
|
|
64
|
+
<span class="icon mdi mdi-arrow-collapse"></span>
|
|
65
|
+
<span>Collapse All</span>
|
|
66
|
+
</button>
|
|
67
|
+
<button (click)="expandAll()" data-test="expand-all-btn" class="btn btn-outline-secondary btn-sm">
|
|
68
|
+
<span class="icon mdi mdi-arrow-expand"></span>
|
|
69
|
+
<span>Expand All</span>
|
|
70
|
+
</button>
|
|
71
|
+
<button (click)="logTreeDataToggledItems()" class="btn btn-outline-secondary btn-sm">
|
|
72
|
+
<span>Log Tree Toggled Items</span>
|
|
73
|
+
</button>
|
|
74
|
+
<button (click)="logFlatStructure()" class="btn btn-outline-secondary btn-sm"
|
|
75
|
+
title="console.log of the Flat dataset">
|
|
76
|
+
<span>Log Flat Structure</span>
|
|
77
|
+
</button>
|
|
78
|
+
<button (click)="logHierarchicalStructure()" class="btn btn-outline-secondary btn-sm"
|
|
79
|
+
title="console.log of the Hierarchical Tree dataset">
|
|
80
|
+
<span>Log Hierarchical Structure</span>
|
|
81
|
+
</button>
|
|
82
|
+
<button (click)="dynamicallyChangeFilter()" class="btn btn-outline-secondary btn-sm">
|
|
83
|
+
<span>Dynamically Change Filter (% complete < 40)</span>
|
|
84
|
+
</button>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<br />
|
|
89
|
+
|
|
90
|
+
<angular-slickgrid gridId="grid28"
|
|
91
|
+
[columnDefinitions]="columnDefinitions"
|
|
92
|
+
[gridOptions]="gridOptions"
|
|
93
|
+
[dataset]="dataset"
|
|
94
|
+
(onGridStateChanged)="handleOnGridStateChanged($event.detail)"
|
|
95
|
+
(onAngularGridCreated)="angularGridReady($event.detail)"
|
|
96
|
+
(onBeforeFilterChange)="showSpinner()"
|
|
97
|
+
(onFilterChanged)="hideSpinner()"
|
|
98
|
+
(onBeforeFilterClear)="showSpinner()"
|
|
99
|
+
(onFilterCleared)="hideSpinner()"
|
|
100
|
+
(onBeforeSortChange)="showSpinner()"
|
|
101
|
+
(onSortChanged)="hideSpinner()"
|
|
102
|
+
(onBeforeToggleTreeCollapse)="showSpinner()"
|
|
103
|
+
(onToggle-tree-collapsed)="hideSpinner()"
|
|
104
|
+
(onTree-full-toggle-start)="showSpinner()"
|
|
105
|
+
(onTree-full-toggle-end)="handleOnTreeFullToggleEnd($event.detail)"
|
|
106
|
+
(onTree-item-toggled)="handleOnTreeItemToggled($event.detail)">
|
|
107
|
+
</angular-slickgrid>
|
|
108
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* make sure to add the @import the SlickGrid Theme AFTER the variables changes */
|
|
2
|
+
@import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-material.lite.scss';
|
|
3
|
+
|
|
4
|
+
.icon {
|
|
5
|
+
align-items: center;
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
height: 1rem;
|
|
9
|
+
width: 1rem;
|
|
10
|
+
}
|