@genesislcap/grid-tabulator 14.262.1 → 14.262.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +2613 -117
- package/dist/dts/cell/cell.d.ts +50 -0
- package/dist/dts/cell/cell.d.ts.map +1 -0
- package/dist/dts/cell/index.d.ts +1 -1
- package/dist/dts/cell/index.d.ts.map +1 -1
- package/dist/dts/cell-editors/date.editor.d.ts +75 -0
- package/dist/dts/cell-editors/date.editor.d.ts.map +1 -0
- package/dist/dts/cell-editors/index.d.ts +6 -0
- package/dist/dts/cell-editors/index.d.ts.map +1 -0
- package/dist/dts/cell-editors/multiselect.editor.d.ts +79 -0
- package/dist/dts/cell-editors/multiselect.editor.d.ts.map +1 -0
- package/dist/dts/cell-editors/number.editor.d.ts +76 -0
- package/dist/dts/cell-editors/number.editor.d.ts.map +1 -0
- package/dist/dts/cell-editors/select.editor.d.ts +83 -0
- package/dist/dts/cell-editors/select.editor.d.ts.map +1 -0
- package/dist/dts/cell-editors/string.editor.d.ts +67 -0
- package/dist/dts/cell-editors/string.editor.d.ts.map +1 -0
- package/dist/dts/cell-formatters/action.formatter.d.ts +45 -0
- package/dist/dts/cell-formatters/action.formatter.d.ts.map +1 -0
- package/dist/dts/cell-formatters/actions-menu.formatter.d.ts +57 -0
- package/dist/dts/cell-formatters/actions-menu.formatter.d.ts.map +1 -0
- package/dist/dts/cell-formatters/boolean.formatter.d.ts +27 -0
- package/dist/dts/cell-formatters/boolean.formatter.d.ts.map +1 -0
- package/dist/dts/cell-formatters/constants.d.ts +31 -0
- package/dist/dts/cell-formatters/constants.d.ts.map +1 -0
- package/dist/dts/cell-formatters/editable.formatter.d.ts +40 -0
- package/dist/dts/cell-formatters/editable.formatter.d.ts.map +1 -0
- package/dist/dts/cell-formatters/index.d.ts +27 -0
- package/dist/dts/cell-formatters/index.d.ts.map +1 -0
- package/dist/dts/cell-formatters/select.formatter.d.ts +43 -0
- package/dist/dts/cell-formatters/select.formatter.d.ts.map +1 -0
- package/dist/dts/cell-formatters/text.formatter.d.ts +36 -0
- package/dist/dts/cell-formatters/text.formatter.d.ts.map +1 -0
- package/dist/dts/column/column.d.ts +340 -0
- package/dist/dts/column/column.d.ts.map +1 -0
- package/dist/dts/column/index.d.ts +1 -1
- package/dist/dts/column/index.d.ts.map +1 -1
- package/dist/dts/datasource/client-side.datasource.d.ts +42 -16
- package/dist/dts/datasource/client-side.datasource.d.ts.map +1 -1
- package/dist/dts/grid-tabulator.components.d.ts +52 -4
- package/dist/dts/grid-tabulator.components.d.ts.map +1 -1
- package/dist/dts/grid-tabulator.d.ts +119 -11
- package/dist/dts/grid-tabulator.d.ts.map +1 -1
- package/dist/dts/grid-tabulator.definitions.d.ts +35 -0
- package/dist/dts/grid-tabulator.definitions.d.ts.map +1 -1
- package/dist/dts/grid-tabulator.styles.d.ts.map +1 -1
- package/dist/dts/grid-tabulator.types.d.ts +13 -1
- package/dist/dts/grid-tabulator.types.d.ts.map +1 -1
- package/dist/dts/index.d.ts +3 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/types.d.ts +27 -0
- package/dist/dts/types.d.ts.map +1 -0
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/dts/utils/index.d.ts.map +1 -1
- package/dist/dts/utils/string-utils.d.ts +17 -0
- package/dist/dts/utils/string-utils.d.ts.map +1 -0
- package/dist/esm/cell/cell.js +66 -0
- package/dist/esm/cell/index.js +1 -1
- package/dist/esm/cell-editors/date.editor.js +92 -0
- package/dist/esm/cell-editors/index.js +5 -0
- package/dist/esm/cell-editors/multiselect.editor.js +105 -0
- package/dist/esm/cell-editors/number.editor.js +84 -0
- package/dist/esm/cell-editors/select.editor.js +91 -0
- package/dist/esm/cell-editors/string.editor.js +82 -0
- package/dist/esm/cell-formatters/action.formatter.js +73 -0
- package/dist/esm/cell-formatters/actions-menu.formatter.js +68 -0
- package/dist/esm/cell-formatters/boolean.formatter.js +25 -0
- package/dist/esm/cell-formatters/constants.js +31 -0
- package/dist/esm/cell-formatters/editable.formatter.js +21 -0
- package/dist/esm/cell-formatters/index.js +26 -0
- package/dist/esm/cell-formatters/select.formatter.js +32 -0
- package/dist/esm/cell-formatters/text.formatter.js +30 -0
- package/dist/esm/column/column.js +51 -0
- package/dist/esm/column/index.js +1 -1
- package/dist/esm/datasource/client-side.datasource.js +219 -91
- package/dist/esm/grid-tabulator.components.js +24 -11
- package/dist/esm/grid-tabulator.definitions.js +30 -0
- package/dist/esm/grid-tabulator.js +392 -27
- package/dist/esm/grid-tabulator.styles.js +15 -0
- package/dist/esm/grid-tabulator.types.js +13 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/string-utils.js +32 -0
- package/dist/grid-tabulator.api.json +1703 -466
- package/dist/grid-tabulator.d.ts +1237 -124
- package/docs/api/grid-tabulator.actionformatter.md +27 -0
- package/docs/api/grid-tabulator.actionsmenuformatter.md +27 -0
- package/docs/api/grid-tabulator.booleanformatter.md +27 -0
- package/docs/api/grid-tabulator.cellrendererfunc.md +15 -0
- package/docs/api/grid-tabulator.cellrendererparams.cell.md +13 -0
- package/docs/api/grid-tabulator.cellrendererparams.data.md +13 -0
- package/docs/api/grid-tabulator.cellrendererparams.formatterparams.md +13 -0
- package/docs/api/grid-tabulator.cellrendererparams.md +23 -0
- package/docs/api/grid-tabulator.cellrendererparams.value.md +13 -0
- package/docs/api/grid-tabulator.editableformatter.md +27 -0
- package/docs/api/grid-tabulator.foundationgridtabulatorcomponents.md +50 -4
- package/docs/api/grid-tabulator.gridtabulatorcell.connectedcallback.md +15 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.destroy.md +15 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.getelement.md +15 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.init.md +22 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.md +38 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.refresh.md +22 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.renderer.md +11 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.rendererparams.md +11 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.slottedrenderer.md +11 -0
- package/docs/api/grid-tabulator.gridtabulatorcell.slottedrendererchanged.md +15 -0
- package/docs/api/grid-tabulator.gridtabulatorcelleditortypes.md +24 -0
- package/docs/api/grid-tabulator.gridtabulatorcellrenderertypes.md +1 -0
- package/docs/api/grid-tabulator.gridtabulatorcolumn.deepclone.md +15 -0
- package/docs/api/grid-tabulator.gridtabulatorcolumn.definition.md +11 -0
- package/docs/api/grid-tabulator.gridtabulatorcolumn.md +33 -0
- package/docs/api/grid-tabulator.gridtabulatorcolumn.slottedcell.md +11 -0
- package/docs/api/grid-tabulator.gridtabulatorcolumn.slottedcellchanged.md +15 -0
- package/docs/api/grid-tabulator.md +11 -5
- package/docs/api/grid-tabulator.selectformatter.md +27 -0
- package/docs/api/grid-tabulator.textformatter.md +27 -0
- package/docs/api-report.md +328 -36
- package/package.json +16 -15
- package/dist/dts/cell-renderers/action.renderer.d.ts +0 -80
- package/dist/dts/cell-renderers/action.renderer.d.ts.map +0 -1
- package/dist/dts/cell-renderers/index.d.ts +0 -2
- package/dist/dts/cell-renderers/index.d.ts.map +0 -1
- package/dist/esm/cell-renderers/action.renderer.js +0 -107
- package/dist/esm/cell-renderers/index.js +0 -1
- package/docs/api/grid-tabulator.actionheightmultiplier.md +0 -18
- package/docs/api/grid-tabulator.actionrenderer.clickhandler.md +0 -15
- package/docs/api/grid-tabulator.actionrenderer.datatestid.md +0 -11
- package/docs/api/grid-tabulator.actionrenderer.init.md +0 -22
- package/docs/api/grid-tabulator.actionrenderer.md +0 -30
- package/docs/api/grid-tabulator.actionrenderer.params.md +0 -11
- package/docs/api/grid-tabulator.actionrenderer.pendingaction.md +0 -11
- package/docs/api/grid-tabulator.actionrendererparams.md +0 -26
- package/docs/api/grid-tabulator.foundationgridtabulatoractionrenderer.md +0 -26
- package/docs/api/grid-tabulator.tabulatoractionrendererstyles.md +0 -13
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, observable, ref, repeat } from '@microsoft/fast-element';
|
|
3
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
+
/**
|
|
5
|
+
* The multiselect editor class for grid-tabulator
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export class MultiselectEditor extends FoundationElement {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the editor with parameters
|
|
11
|
+
*/
|
|
12
|
+
init(params) {
|
|
13
|
+
this.params = params;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get current values
|
|
17
|
+
*/
|
|
18
|
+
getValues() {
|
|
19
|
+
if (!this.select)
|
|
20
|
+
return [];
|
|
21
|
+
return this.select.selectedValues;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Set focus to the select
|
|
25
|
+
*/
|
|
26
|
+
focus() {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = this.select) === null || _a === void 0 ? void 0 : _a.focus();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if a value is selected
|
|
32
|
+
*/
|
|
33
|
+
isSelected(value) {
|
|
34
|
+
var _a;
|
|
35
|
+
if (!((_a = this.params) === null || _a === void 0 ? void 0 : _a.value))
|
|
36
|
+
return false;
|
|
37
|
+
return this.params.value.includes(value);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Process key down events
|
|
41
|
+
*/
|
|
42
|
+
handleKeyDown(event) {
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
|
+
if (event.key === 'Enter') {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
(_b = (_a = this.params).success) === null || _b === void 0 ? void 0 : _b.call(_a, this.getValues());
|
|
47
|
+
}
|
|
48
|
+
else if (event.key === 'Escape') {
|
|
49
|
+
(_d = (_c = this.params).cancel) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Handle change event to save when selection changes
|
|
54
|
+
*/
|
|
55
|
+
handleChange() {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
(_b = (_a = this.params).success) === null || _b === void 0 ? void 0 : _b.call(_a, this.getValues());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
__decorate([
|
|
61
|
+
observable
|
|
62
|
+
], MultiselectEditor.prototype, "params", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
observable
|
|
65
|
+
], MultiselectEditor.prototype, "select", void 0);
|
|
66
|
+
/**
|
|
67
|
+
* Styles for the multiselect editor
|
|
68
|
+
* @alpha
|
|
69
|
+
*/
|
|
70
|
+
export const multiselectEditorStyles = css `
|
|
71
|
+
:host {
|
|
72
|
+
display: block;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
/**
|
|
78
|
+
* Get a Design System prefixed Select template.
|
|
79
|
+
* @param prefix - The design system prefix to use. Defaults to 'foundation'.
|
|
80
|
+
* @returns A Select component template prefixed with the correct design system.
|
|
81
|
+
* @alpha
|
|
82
|
+
*/
|
|
83
|
+
export const getMultiselectEditorTemplate = (prefix = 'foundation') => html `
|
|
84
|
+
<${prefix}-select
|
|
85
|
+
${ref('select')}
|
|
86
|
+
multiple
|
|
87
|
+
@keydown="${(x, c) => x.handleKeyDown(c.event)}"
|
|
88
|
+
@change="${(x) => x.handleChange()}"
|
|
89
|
+
>
|
|
90
|
+
${repeat((x) => { var _a; return ((_a = x.params) === null || _a === void 0 ? void 0 : _a.options) || []; }, html `
|
|
91
|
+
<${prefix}-option value="${(option) => option.value}" ?selected="${(option, c) => c.parent.isSelected(option.value)}">
|
|
92
|
+
${(option) => option.label}
|
|
93
|
+
</${prefix}-option>
|
|
94
|
+
`)}
|
|
95
|
+
</${prefix}-select>
|
|
96
|
+
`;
|
|
97
|
+
/**
|
|
98
|
+
* Definition for the multiselect editor component
|
|
99
|
+
* @alpha
|
|
100
|
+
*/
|
|
101
|
+
export const foundationMultiselectEditor = MultiselectEditor.compose({
|
|
102
|
+
baseName: 'grid-tabulator-multiselect-editor',
|
|
103
|
+
styles: multiselectEditorStyles,
|
|
104
|
+
template: getMultiselectEditorTemplate(),
|
|
105
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, observable, ref } from '@microsoft/fast-element';
|
|
3
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
+
/**
|
|
5
|
+
* The number editor class for grid-tabulator
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export class NumberEditor extends FoundationElement {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the editor with parameters
|
|
11
|
+
*/
|
|
12
|
+
init(params) {
|
|
13
|
+
this.params = params;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get current value
|
|
17
|
+
*/
|
|
18
|
+
getValue() {
|
|
19
|
+
var _a;
|
|
20
|
+
const value = parseFloat(((_a = this.numberField) === null || _a === void 0 ? void 0 : _a.value) || '0');
|
|
21
|
+
return isNaN(value) ? 0 : value;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Set focus to the input
|
|
25
|
+
*/
|
|
26
|
+
focus() {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = this.numberField) === null || _a === void 0 ? void 0 : _a.focus();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Process key down events
|
|
32
|
+
*/
|
|
33
|
+
handleKeyDown(event) {
|
|
34
|
+
var _a, _b, _c, _d;
|
|
35
|
+
if (event.key === 'Enter') {
|
|
36
|
+
(_b = (_a = this.params).success) === null || _b === void 0 ? void 0 : _b.call(_a, this.getValue());
|
|
37
|
+
}
|
|
38
|
+
else if (event.key === 'Escape') {
|
|
39
|
+
(_d = (_c = this.params).cancel) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
__decorate([
|
|
44
|
+
observable
|
|
45
|
+
], NumberEditor.prototype, "params", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
observable
|
|
48
|
+
], NumberEditor.prototype, "numberField", void 0);
|
|
49
|
+
/**
|
|
50
|
+
* Styles for the number editor
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export const numberEditorStyles = css `
|
|
54
|
+
:host {
|
|
55
|
+
display: block;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
/**
|
|
61
|
+
* Get a Design System prefixed number field template.
|
|
62
|
+
* @param prefix - The design system prefix to use. Defaults to 'foundation'.
|
|
63
|
+
* @returns A number field component template prefixed with the correct design system.
|
|
64
|
+
* @alpha
|
|
65
|
+
*/
|
|
66
|
+
export const getNumberEditorTemplate = (prefix = 'foundation') => html `
|
|
67
|
+
<${prefix}-number-field
|
|
68
|
+
${ref('numberField')}
|
|
69
|
+
:value="${(x) => { var _a, _b; return (_b = (_a = x.params) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ''; }}"
|
|
70
|
+
:min="${(x) => { var _a, _b; return (_b = (_a = x.params) === null || _a === void 0 ? void 0 : _a.min) !== null && _b !== void 0 ? _b : ''; }}"
|
|
71
|
+
:max="${(x) => { var _a, _b; return (_b = (_a = x.params) === null || _a === void 0 ? void 0 : _a.max) !== null && _b !== void 0 ? _b : ''; }}"
|
|
72
|
+
:step="${(x) => { var _a, _b; return (_b = (_a = x.params) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 1; }}"
|
|
73
|
+
@keydown="${(x, c) => x.handleKeyDown(c.event)}"
|
|
74
|
+
></${prefix}-number-field>
|
|
75
|
+
`;
|
|
76
|
+
/**
|
|
77
|
+
* Definition for the number editor component
|
|
78
|
+
* @alpha
|
|
79
|
+
*/
|
|
80
|
+
export const foundationNumberEditor = NumberEditor.compose({
|
|
81
|
+
baseName: 'grid-tabulator-number-editor',
|
|
82
|
+
styles: numberEditorStyles,
|
|
83
|
+
template: getNumberEditorTemplate(),
|
|
84
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, observable, ref, repeat } from '@microsoft/fast-element';
|
|
3
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
+
/**
|
|
5
|
+
* The select editor class for grid-tabulator
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export class SelectEditor extends FoundationElement {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the editor with parameters
|
|
11
|
+
*/
|
|
12
|
+
init(params) {
|
|
13
|
+
this.params = params;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get current value
|
|
17
|
+
*/
|
|
18
|
+
getValue() {
|
|
19
|
+
var _a;
|
|
20
|
+
return (_a = this.select) === null || _a === void 0 ? void 0 : _a.value;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Set focus to the select
|
|
24
|
+
*/
|
|
25
|
+
focus() {
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = this.select) === null || _a === void 0 ? void 0 : _a.focus();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Process key down events
|
|
31
|
+
*/
|
|
32
|
+
handleKeyDown(event) {
|
|
33
|
+
var _a, _b, _c, _d;
|
|
34
|
+
if (event.key === 'Enter') {
|
|
35
|
+
(_b = (_a = this.params).success) === null || _b === void 0 ? void 0 : _b.call(_a, this.getValue());
|
|
36
|
+
}
|
|
37
|
+
else if (event.key === 'Escape') {
|
|
38
|
+
(_d = (_c = this.params).cancel) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Handle change event
|
|
43
|
+
*/
|
|
44
|
+
handleChange() {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
(_b = (_a = this.params).success) === null || _b === void 0 ? void 0 : _b.call(_a, this.getValue());
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
__decorate([
|
|
50
|
+
observable
|
|
51
|
+
], SelectEditor.prototype, "params", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
observable
|
|
54
|
+
], SelectEditor.prototype, "select", void 0);
|
|
55
|
+
/**
|
|
56
|
+
* Styles for the select editor
|
|
57
|
+
*/
|
|
58
|
+
export const selectEditorStyles = css `
|
|
59
|
+
:host {
|
|
60
|
+
display: block;
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 100%;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
/**
|
|
66
|
+
* Get a Design System prefixed Select template.
|
|
67
|
+
* @param prefix - The design system prefix to use. Defaults to 'foundation'.
|
|
68
|
+
* @returns A Select component template prefixed with the correct design system.
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
export const getSelectEditorTemplate = (prefix = 'foundation') => html `
|
|
72
|
+
<${prefix}-select
|
|
73
|
+
${ref('select')}
|
|
74
|
+
@keydown="${(x, c) => x.handleKeyDown(c.event)}"
|
|
75
|
+
@change="${(x) => x.handleChange()}"
|
|
76
|
+
>
|
|
77
|
+
${repeat((x) => { var _a; return ((_a = x.params) === null || _a === void 0 ? void 0 : _a.options) || []; }, html `
|
|
78
|
+
<${prefix}-option value="${(option) => option.value}" ?selected="${(option, c) => { var _a; return option.value === ((_a = c.parent.params) === null || _a === void 0 ? void 0 : _a.value); }}">
|
|
79
|
+
${(option) => option.label}
|
|
80
|
+
</${prefix}-option>
|
|
81
|
+
`)}
|
|
82
|
+
</${prefix}-select>
|
|
83
|
+
`;
|
|
84
|
+
/**
|
|
85
|
+
* Definition for the select editor component
|
|
86
|
+
*/
|
|
87
|
+
export const foundationSelectEditor = SelectEditor.compose({
|
|
88
|
+
baseName: 'grid-tabulator-select-editor',
|
|
89
|
+
styles: selectEditorStyles,
|
|
90
|
+
template: getSelectEditorTemplate(),
|
|
91
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { sync } from '@genesislcap/foundation-utils';
|
|
3
|
+
import { css, html, observable, ref } from '@microsoft/fast-element';
|
|
4
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
5
|
+
/**
|
|
6
|
+
* The string editor class for grid-tabulator
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export class StringEditor extends FoundationElement {
|
|
10
|
+
/**
|
|
11
|
+
* Initialize the editor with parameters
|
|
12
|
+
*/
|
|
13
|
+
init(params) {
|
|
14
|
+
this.params = params;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get current value
|
|
18
|
+
*/
|
|
19
|
+
getValue() {
|
|
20
|
+
var _a;
|
|
21
|
+
return (_a = this.textField) === null || _a === void 0 ? void 0 : _a.value;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Set focus to the input
|
|
25
|
+
*/
|
|
26
|
+
focus() {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = this.textField) === null || _a === void 0 ? void 0 : _a.focus();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Process key down events
|
|
32
|
+
*/
|
|
33
|
+
handleKeyDown(event) {
|
|
34
|
+
var _a, _b, _c, _d;
|
|
35
|
+
if (event.key === 'Enter') {
|
|
36
|
+
(_b = (_a = this.params).success) === null || _b === void 0 ? void 0 : _b.call(_a, this.getValue());
|
|
37
|
+
}
|
|
38
|
+
else if (event.key === 'Escape') {
|
|
39
|
+
(_d = (_c = this.params).cancel) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
__decorate([
|
|
44
|
+
observable
|
|
45
|
+
], StringEditor.prototype, "params", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
observable
|
|
48
|
+
], StringEditor.prototype, "textField", void 0);
|
|
49
|
+
/**
|
|
50
|
+
* Styles for the string editor
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export const stringEditorStyles = css `
|
|
54
|
+
:host {
|
|
55
|
+
display: block;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
/**
|
|
61
|
+
* Get a Design System prefixed text field template.
|
|
62
|
+
* @param prefix - The design system prefix to use. Defaults to 'foundation'.
|
|
63
|
+
* @returns A text field component template prefixed with the correct design system.
|
|
64
|
+
* @alpha
|
|
65
|
+
*/
|
|
66
|
+
export const getStringEditorTemplate = (prefix = 'foundation') => html `
|
|
67
|
+
<${prefix}-text-field
|
|
68
|
+
${ref('textField')}
|
|
69
|
+
type="text"
|
|
70
|
+
:value="${sync((x) => { var _a; return (_a = x.params) === null || _a === void 0 ? void 0 : _a.value; }) || ''}"
|
|
71
|
+
@keydown="${(x, c) => x.handleKeyDown(c.event)}"
|
|
72
|
+
></${prefix}-text-field>
|
|
73
|
+
`;
|
|
74
|
+
/**
|
|
75
|
+
* Definition for the string editor component
|
|
76
|
+
* @alpha
|
|
77
|
+
*/
|
|
78
|
+
export const foundationStringEditor = StringEditor.compose({
|
|
79
|
+
baseName: 'grid-tabulator-string-editor',
|
|
80
|
+
styles: stringEditorStyles,
|
|
81
|
+
template: getStringEditorTemplate(),
|
|
82
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { DOM } from '@microsoft/fast-element';
|
|
2
|
+
/**
|
|
3
|
+
* Formatter that displays an action button in the cell.
|
|
4
|
+
* Styled to match grid-pro action renderer.
|
|
5
|
+
*
|
|
6
|
+
* @param cell - The cell component provided by Tabulator
|
|
7
|
+
* @param formatterParams - Action formatter parameters
|
|
8
|
+
* @returns HTML content for the action button
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export function actionFormatter(cell, formatterParams = {}) {
|
|
12
|
+
const rowData = cell.getData();
|
|
13
|
+
const { actionName = 'Single Action', appearance = 'secondary-orange', isDisabled, dataTestId, uniqueFieldName, prefix = 'foundation', actionClick, actionButtonStyle = '', } = formatterParams;
|
|
14
|
+
// The element tagname should be exactly "{prefix}-button"
|
|
15
|
+
const elementTagName = `${prefix}-button`;
|
|
16
|
+
// Create container div for centering
|
|
17
|
+
const containerDiv = document.createElement('div');
|
|
18
|
+
containerDiv.className = 'action-container';
|
|
19
|
+
containerDiv.style.alignItems = 'center';
|
|
20
|
+
containerDiv.style.display = 'flex';
|
|
21
|
+
containerDiv.style.height = '100%';
|
|
22
|
+
containerDiv.style.justifyContent = 'center';
|
|
23
|
+
// Create button element
|
|
24
|
+
const actionButton = document.createElement(elementTagName);
|
|
25
|
+
actionButton.className = 'action-renderer';
|
|
26
|
+
actionButton.style.cssText = `align-self: center; display: flex; ${actionButtonStyle}`;
|
|
27
|
+
// Set appearance
|
|
28
|
+
actionButton.setAttribute('appearance', appearance);
|
|
29
|
+
// Set data-test-id if provided
|
|
30
|
+
if (dataTestId) {
|
|
31
|
+
actionButton.setAttribute('data-test-id', dataTestId);
|
|
32
|
+
}
|
|
33
|
+
// Set content
|
|
34
|
+
actionButton.textContent = actionName;
|
|
35
|
+
// Set disabled state if needed
|
|
36
|
+
if (isDisabled && typeof isDisabled === 'function') {
|
|
37
|
+
try {
|
|
38
|
+
// Make sure rowData exists before calling isDisabled
|
|
39
|
+
if (rowData) {
|
|
40
|
+
actionButton.disabled = !!isDisabled(rowData);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Default to enabled if rowData is undefined
|
|
44
|
+
actionButton.disabled = false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.warn('Error in isDisabled function:', error);
|
|
49
|
+
actionButton.disabled = false; // Default to enabled on error
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Add click handler from the parameter
|
|
53
|
+
if (actionClick && typeof actionClick === 'function') {
|
|
54
|
+
actionButton.addEventListener('click', () => {
|
|
55
|
+
try {
|
|
56
|
+
// Call the action click handler with rowData (may be undefined)
|
|
57
|
+
actionClick(rowData);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.warn('Error in actionClick handler:', error);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// Get and modify the cell element
|
|
65
|
+
const cellElement = cell.getElement();
|
|
66
|
+
// Append button to container
|
|
67
|
+
containerDiv.appendChild(actionButton);
|
|
68
|
+
// Using DOM.queueUpdate to ensure the element is appended properly
|
|
69
|
+
DOM.queueUpdate(() => {
|
|
70
|
+
cellElement.appendChild(containerDiv);
|
|
71
|
+
});
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DOM } from '@microsoft/fast-element';
|
|
2
|
+
/**
|
|
3
|
+
* Formatter that displays a dropdown menu of actions in the cell.
|
|
4
|
+
* Styled to match grid-pro actions-menu renderer.
|
|
5
|
+
*
|
|
6
|
+
* @param cell - The cell component provided by Tabulator
|
|
7
|
+
* @param formatterParams - Actions menu formatter parameters
|
|
8
|
+
* @returns HTML content for the actions menu
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export function actionsMenuFormatter(cell, formatterParams = {}) {
|
|
12
|
+
const { actions = [], prefix = 'foundation', menuName, isVertical = false, buttonAppearance, } = formatterParams;
|
|
13
|
+
// Create container for styling (similar to grid-pro implementation)
|
|
14
|
+
const containerDiv = document.createElement('div');
|
|
15
|
+
containerDiv.style.cssText =
|
|
16
|
+
'display: flex; justify-content: center; align-items: center; height: 100%; overflow: visible; border: none;';
|
|
17
|
+
// The element tagname should be exactly "{prefix}-actions-menu"
|
|
18
|
+
const elementTagName = `${prefix}-actions-menu`;
|
|
19
|
+
// Create actions menu element - using 'as any' to match main.ts
|
|
20
|
+
const actionsMenu = document.createElement(elementTagName);
|
|
21
|
+
actionsMenu.style.width = '100%';
|
|
22
|
+
// Set the menu name based on prefix (this exactly matches main.ts)
|
|
23
|
+
actionsMenu.name = prefix === 'foundation' ? '⋮' : '+';
|
|
24
|
+
// Override with custom name if provided
|
|
25
|
+
if (menuName) {
|
|
26
|
+
actionsMenu.name = menuName;
|
|
27
|
+
}
|
|
28
|
+
// Set button appearance if provided
|
|
29
|
+
if (buttonAppearance) {
|
|
30
|
+
actionsMenu.buttonAppearance = buttonAppearance;
|
|
31
|
+
}
|
|
32
|
+
// Set vertical orientation if needed
|
|
33
|
+
if (isVertical) {
|
|
34
|
+
actionsMenu.isVertical = isVertical;
|
|
35
|
+
}
|
|
36
|
+
// Set the actions
|
|
37
|
+
actionsMenu.actions = actions.map((action) => {
|
|
38
|
+
// Create a safe copy of the action to prevent errors when isDisabled is called
|
|
39
|
+
const safeAction = Object.assign({}, action);
|
|
40
|
+
// If the action has an isDisabled function, wrap it in a safe function
|
|
41
|
+
if (safeAction.isDisabled) {
|
|
42
|
+
const originalIsDisabled = safeAction.isDisabled;
|
|
43
|
+
safeAction.isDisabled = (rowData) => {
|
|
44
|
+
try {
|
|
45
|
+
// Make sure rowData exists and the original function is callable
|
|
46
|
+
if (!rowData || typeof originalIsDisabled !== 'function') {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return originalIsDisabled(rowData);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.warn('Error in isDisabled function:', error);
|
|
53
|
+
return false; // Default to enabled on error
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return safeAction;
|
|
58
|
+
});
|
|
59
|
+
// Add the actions menu to the container
|
|
60
|
+
containerDiv.appendChild(actionsMenu);
|
|
61
|
+
// Get the cell element
|
|
62
|
+
const cellElement = cell.getElement();
|
|
63
|
+
// Use DOM.queueUpdate exactly as in main.ts
|
|
64
|
+
DOM.queueUpdate(() => {
|
|
65
|
+
cellElement.appendChild(containerDiv);
|
|
66
|
+
});
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatter that displays boolean values using a checkbox component.
|
|
3
|
+
* Styled to match grid-pro boolean renderer.
|
|
4
|
+
*
|
|
5
|
+
* @param cell - The cell component provided by Tabulator
|
|
6
|
+
* @param formatterParams - Boolean formatter parameters
|
|
7
|
+
* @returns HTML content for the boolean value
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export function booleanFormatter(cell, formatterParams = {}) {
|
|
11
|
+
const value = cell.getValue();
|
|
12
|
+
const rowData = cell.getData();
|
|
13
|
+
const boolValue = Boolean(value);
|
|
14
|
+
const { prefix = 'foundation', dataTestId, isDisabled } = formatterParams;
|
|
15
|
+
// Determine if the checkbox should be disabled
|
|
16
|
+
const disabled = isDisabled && isDisabled(rowData);
|
|
17
|
+
// Generate test ID if needed
|
|
18
|
+
const testIdAttr = dataTestId ? ` data-test-id="${dataTestId}"` : '';
|
|
19
|
+
// The element tagname should be exactly "{prefix}-checkbox"
|
|
20
|
+
const elementTagName = `${prefix}-checkbox`;
|
|
21
|
+
// Container div with flex styling to match grid-pro
|
|
22
|
+
return `<div style="align-center: center; display: flex; height: 100%;">
|
|
23
|
+
<${elementTagName}${testIdAttr}${disabled ? ' disabled' : ''}${boolValue ? ' checked' : ''}></${elementTagName}>
|
|
24
|
+
</div>`;
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumeration of formatter types for grid-tabulator.
|
|
3
|
+
* @alpha
|
|
4
|
+
*/
|
|
5
|
+
export var FormatterTypes;
|
|
6
|
+
(function (FormatterTypes) {
|
|
7
|
+
/**
|
|
8
|
+
* Action button formatter
|
|
9
|
+
*/
|
|
10
|
+
FormatterTypes["action"] = "action";
|
|
11
|
+
/**
|
|
12
|
+
* Actions menu formatter with dropdown options
|
|
13
|
+
*/
|
|
14
|
+
FormatterTypes["actionsMenu"] = "actionsMenu";
|
|
15
|
+
/**
|
|
16
|
+
* Boolean formatter for true/false values
|
|
17
|
+
*/
|
|
18
|
+
FormatterTypes["boolean"] = "boolean";
|
|
19
|
+
/**
|
|
20
|
+
* Editable formatter for cells that can be edited
|
|
21
|
+
*/
|
|
22
|
+
FormatterTypes["editable"] = "editable";
|
|
23
|
+
/**
|
|
24
|
+
* Select formatter for displaying option values
|
|
25
|
+
*/
|
|
26
|
+
FormatterTypes["select"] = "select";
|
|
27
|
+
/**
|
|
28
|
+
* Text formatter for basic text display with optional formatting
|
|
29
|
+
*/
|
|
30
|
+
FormatterTypes["text"] = "text";
|
|
31
|
+
})(FormatterTypes || (FormatterTypes = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatter that displays an editable cell with validation state
|
|
3
|
+
* @param cell - The cell component provided by Tabulator
|
|
4
|
+
* @param formatterParams - Editable formatter parameters
|
|
5
|
+
* @returns HTML content for the editable cell
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export function editableFormatter(cell, formatterParams = {}) {
|
|
9
|
+
const value = cell.getValue();
|
|
10
|
+
const { cssClass, nullText = '', dataTestId, icon = 'edit', prefix = 'foundation', } = formatterParams;
|
|
11
|
+
// Generate test ID if needed
|
|
12
|
+
const testIdAttr = dataTestId ? ` data-test-id="${dataTestId}"` : '';
|
|
13
|
+
// Handle null/undefined values
|
|
14
|
+
const displayValue = value === null || value === undefined ? nullText : value;
|
|
15
|
+
// Create class with proper prefix
|
|
16
|
+
const containerClass = `${prefix}-editable-formatter ${cssClass || ''}`;
|
|
17
|
+
return `<div${testIdAttr} class="${containerClass}" style="display: flex; justify-content: space-between; align-items: center; overflow: hidden;">
|
|
18
|
+
<span class="${prefix}-editable-formatter-value" style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">${displayValue}</span>
|
|
19
|
+
<${prefix}-progress-ring class="${prefix}-editable-formatter-indicator" style="margin: 0; width: 20px; height: 20px;"></${prefix}-progress-ring>
|
|
20
|
+
</div>`;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cell formatters for the grid-tabulator component.
|
|
3
|
+
* These formatters match Tabulator's approach of providing formatter functions
|
|
4
|
+
* and correspond to the cell renderers in grid-tabulator.
|
|
5
|
+
* @module cell-formatters
|
|
6
|
+
*/
|
|
7
|
+
import { actionFormatter } from './action.formatter';
|
|
8
|
+
import { actionsMenuFormatter } from './actions-menu.formatter';
|
|
9
|
+
import { booleanFormatter } from './boolean.formatter';
|
|
10
|
+
import { editableFormatter } from './editable.formatter';
|
|
11
|
+
import { selectFormatter } from './select.formatter';
|
|
12
|
+
import { textFormatter } from './text.formatter';
|
|
13
|
+
export * from './constants';
|
|
14
|
+
export { actionFormatter, actionsMenuFormatter, booleanFormatter, editableFormatter, selectFormatter, textFormatter, };
|
|
15
|
+
/**
|
|
16
|
+
* Zero formatters for Tabulator grid
|
|
17
|
+
* @alpha
|
|
18
|
+
*/
|
|
19
|
+
export const formatters = {
|
|
20
|
+
action: actionFormatter,
|
|
21
|
+
actionsMenu: actionsMenuFormatter,
|
|
22
|
+
boolean: booleanFormatter,
|
|
23
|
+
editable: editableFormatter,
|
|
24
|
+
select: selectFormatter,
|
|
25
|
+
text: textFormatter,
|
|
26
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatter that displays a value from a select list of options
|
|
3
|
+
* Styled to match grid-pro select renderer.
|
|
4
|
+
*
|
|
5
|
+
* @param cell - The cell component provided by Tabulator
|
|
6
|
+
* @param formatterParams - Select formatter parameters
|
|
7
|
+
* @returns Text content for the selected option
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export function selectFormatter(cell, formatterParams) {
|
|
11
|
+
const value = cell.getValue();
|
|
12
|
+
const { options = [], prefix = 'foundation', nullText = '', dataTestId } = formatterParams;
|
|
13
|
+
// Generate test ID if needed
|
|
14
|
+
const testIdAttr = dataTestId ? ` data-test-id="${dataTestId}"` : '';
|
|
15
|
+
// Handle null/undefined values
|
|
16
|
+
if (value === null || value === undefined) {
|
|
17
|
+
return `<div style="display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;">
|
|
18
|
+
<span${testIdAttr} class="${prefix}-select-formatter ${prefix}-select-formatter--null">${nullText}</span>
|
|
19
|
+
</div>`;
|
|
20
|
+
}
|
|
21
|
+
// If using standard options
|
|
22
|
+
const matchingOption = options.find((option) => option.value === value);
|
|
23
|
+
if (matchingOption) {
|
|
24
|
+
return `<div style="display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;">
|
|
25
|
+
<span${testIdAttr} class="${prefix}-select-formatter">${matchingOption.label}</span>
|
|
26
|
+
</div>`;
|
|
27
|
+
}
|
|
28
|
+
// If no matching option found, return the original value as string
|
|
29
|
+
return `<div style="display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;">
|
|
30
|
+
<span${testIdAttr} class="${prefix}-select-formatter">${String(value)}</span>
|
|
31
|
+
</div>`;
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text formatter for customized display of values.
|
|
3
|
+
* Styled to match grid-pro text renderer.
|
|
4
|
+
*
|
|
5
|
+
* @param cell - The cell component provided by Tabulator
|
|
6
|
+
* @param formatterParams - Text formatter parameters
|
|
7
|
+
* @returns Text content for the cell
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export function textFormatter(cell, formatterParams = {}) {
|
|
11
|
+
const value = cell.getValue();
|
|
12
|
+
const { specialValue = 2012, specialColor = 'orange', specialFontWeight = 'bold', prefix = 'foundation', dataTestId, nullText = '', } = formatterParams;
|
|
13
|
+
// Generate test ID if needed
|
|
14
|
+
const testIdAttr = dataTestId ? ` data-test-id="${dataTestId}"` : '';
|
|
15
|
+
// Handle null/undefined values
|
|
16
|
+
if (value === null || value === undefined) {
|
|
17
|
+
return `<div style="display: flex; width: 100%; height: 100%; align-items: center;">
|
|
18
|
+
<span${testIdAttr} class="${prefix}-text-formatter ${prefix}-text-formatter--null" style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">${nullText}</span>
|
|
19
|
+
</div>`;
|
|
20
|
+
}
|
|
21
|
+
// Match the exact implementation from main.ts for handling special values (like Year 2012)
|
|
22
|
+
if (value === specialValue) {
|
|
23
|
+
return `<div style="display: flex; width: 100%; height: 100%; align-items: center;">
|
|
24
|
+
<span${testIdAttr} style="color: ${specialColor}; font-weight: ${specialFontWeight}; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">${value}</span>
|
|
25
|
+
</div>`;
|
|
26
|
+
}
|
|
27
|
+
return `<div style="display: flex; width: 100%; height: 100%; align-items: center;">
|
|
28
|
+
<span${testIdAttr} class="${prefix}-text-formatter" style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">${value}</span>
|
|
29
|
+
</div>`;
|
|
30
|
+
}
|