@vaadin/vaadin-grid-pro 22.0.0-alpha5 → 22.0.0-alpha9
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/package.json +23 -39
- package/src/vaadin-grid-pro-edit-checkbox.js +1 -15
- package/src/vaadin-grid-pro-edit-column.d.ts +15 -80
- package/src/vaadin-grid-pro-edit-column.js +4 -272
- package/src/vaadin-grid-pro-edit-select.js +1 -122
- package/src/vaadin-grid-pro-edit-text-field.js +1 -20
- package/src/vaadin-grid-pro.d.ts +11 -86
- package/src/vaadin-grid-pro.js +4 -58
- package/theme/lumo/vaadin-grid-pro-edit-checkbox.js +1 -2
- package/theme/lumo/vaadin-grid-pro-edit-column.js +1 -4
- package/theme/lumo/vaadin-grid-pro-edit-select.js +1 -5
- package/theme/lumo/vaadin-grid-pro-edit-text-field.js +1 -3
- package/theme/lumo/vaadin-grid-pro.js +1 -3
- package/theme/material/vaadin-grid-pro-edit-checkbox.js +1 -2
- package/theme/material/vaadin-grid-pro-edit-column.js +1 -4
- package/theme/material/vaadin-grid-pro-edit-select.js +1 -5
- package/theme/material/vaadin-grid-pro-edit-text-field.js +1 -3
- package/theme/material/vaadin-grid-pro.js +1 -3
- package/vaadin-grid-pro.d.ts +0 -1
- package/src/interfaces.d.ts +0 -1
- package/src/vaadin-grid-pro-inline-editing-mixin.d.ts +0 -40
- package/src/vaadin-grid-pro-inline-editing-mixin.js +0 -477
- package/theme/lumo/vaadin-grid-pro-edit-select-styles.js +0 -24
- package/theme/lumo/vaadin-grid-pro-edit-text-field-styles.js +0 -6
- package/theme/lumo/vaadin-grid-pro-editor-styles.js +0 -41
- package/theme/lumo/vaadin-grid-pro-styles.js +0 -19
- package/theme/material/vaadin-grid-pro-edit-select-styles.js +0 -17
- package/theme/material/vaadin-grid-pro-edit-text-field-styles.js +0 -6
- package/theme/material/vaadin-grid-pro-editor-styles.js +0 -21
- package/theme/material/vaadin-grid-pro-styles.js +0 -13
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/vaadin-grid-pro",
|
|
3
|
-
"version": "22.0.0-
|
|
3
|
+
"version": "22.0.0-alpha9",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "vaadin-grid-pro",
|
|
8
|
+
"license": "https://raw.githubusercontent.com/vaadin/web-components/master/packages/vaadin-grid-pro/LICENSE",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/vaadin/web-components.git",
|
|
12
|
+
"directory": "packages/vaadin-grid-pro"
|
|
13
|
+
},
|
|
14
|
+
"author": "Vaadin Ltd",
|
|
15
|
+
"homepage": "https://vaadin.com/components",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/vaadin/vaadin-grid-pro/issues"
|
|
18
|
+
},
|
|
5
19
|
"main": "vaadin-grid-pro.js",
|
|
6
20
|
"module": "vaadin-grid-pro.js",
|
|
7
|
-
"
|
|
21
|
+
"files": [
|
|
22
|
+
"src",
|
|
23
|
+
"theme",
|
|
24
|
+
"vaadin-*.d.ts",
|
|
25
|
+
"vaadin-*.js"
|
|
26
|
+
],
|
|
8
27
|
"keywords": [
|
|
9
28
|
"Vaadin",
|
|
10
29
|
"vaadin-grid-pro",
|
|
@@ -12,43 +31,8 @@
|
|
|
12
31
|
"web-component",
|
|
13
32
|
"polymer"
|
|
14
33
|
],
|
|
15
|
-
"author": "Vaadin Ltd",
|
|
16
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/vaadin/vaadin-grid-pro/issues"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://vaadin.com/components",
|
|
21
|
-
"files": [
|
|
22
|
-
"vaadin-*.d.ts",
|
|
23
|
-
"vaadin-*.js",
|
|
24
|
-
"src",
|
|
25
|
-
"theme"
|
|
26
|
-
],
|
|
27
34
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@vaadin/checkbox": "^22.0.0-alpha5",
|
|
30
|
-
"@vaadin/select": "^22.0.0-alpha5",
|
|
31
|
-
"@vaadin/vaadin-element-mixin": "^22.0.0-alpha5",
|
|
32
|
-
"@vaadin/vaadin-grid": "^22.0.0-alpha5",
|
|
33
|
-
"@vaadin/vaadin-item": "^22.0.0-alpha5",
|
|
34
|
-
"@vaadin/vaadin-license-checker": "^2.1.0",
|
|
35
|
-
"@vaadin/vaadin-list-box": "^22.0.0-alpha5",
|
|
36
|
-
"@vaadin/vaadin-lumo-styles": "^22.0.0-alpha5",
|
|
37
|
-
"@vaadin/vaadin-material-styles": "^22.0.0-alpha5",
|
|
38
|
-
"@vaadin/vaadin-text-field": "^22.0.0-alpha5",
|
|
39
|
-
"@vaadin/vaadin-themable-mixin": "^22.0.0-alpha5"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@esm-bundle/chai": "^4.3.4",
|
|
43
|
-
"@vaadin/testing-helpers": "^0.2.1",
|
|
44
|
-
"@vaadin/vaadin-date-picker": "^22.0.0-alpha5",
|
|
45
|
-
"@vaadin/vaadin-dialog": "^22.0.0-alpha5",
|
|
46
|
-
"@vaadin/vaadin-template-renderer": "^22.0.0-alpha5",
|
|
47
|
-
"lit": "^2.0.0-rc.1",
|
|
48
|
-
"sinon": "^9.2.1"
|
|
49
|
-
},
|
|
50
|
-
"publishConfig": {
|
|
51
|
-
"access": "public"
|
|
35
|
+
"@vaadin/grid-pro": "22.0.0-alpha9"
|
|
52
36
|
},
|
|
53
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "6e8c899dc65918f97e3c0acb2076122c4b2ef274"
|
|
54
38
|
}
|
|
@@ -4,18 +4,4 @@
|
|
|
4
4
|
* This program is available under Commercial Vaadin Developer License 4.0 (CVDLv4).
|
|
5
5
|
* See <a href="https://vaadin.com/license/cvdl-4.0">the website</a> for the complete license.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* An element used internally by `<vaadin-grid-pro>`. Not intended to be used separately.
|
|
11
|
-
*
|
|
12
|
-
* @extends CheckboxElement
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
class GridProEditCheckboxElement extends CheckboxElement {
|
|
16
|
-
static get is() {
|
|
17
|
-
return 'vaadin-grid-pro-edit-checkbox';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
customElements.define(GridProEditCheckboxElement.is, GridProEditCheckboxElement);
|
|
7
|
+
export * from '@vaadin/grid-pro/src/vaadin-grid-pro-edit-checkbox.js';
|
|
@@ -1,85 +1,20 @@
|
|
|
1
|
-
import { GridColumnElement } from '@vaadin/vaadin-grid/src/vaadin-grid-column.js';
|
|
2
|
-
|
|
3
|
-
import { GridDefaultItem, GridBodyRenderer, GridItemModel } from '@vaadin/vaadin-grid';
|
|
4
|
-
|
|
5
|
-
import { GridProEditorType } from './interfaces';
|
|
6
|
-
|
|
7
1
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* #### Example:
|
|
14
|
-
* ```html
|
|
15
|
-
* <vaadin-grid-pro items="[[items]]">
|
|
16
|
-
* <vaadin-grid-pro-edit-column path="name.first"></vaadin-grid-pro-edit-column>
|
|
17
|
-
*
|
|
18
|
-
* <vaadin-grid-column>
|
|
19
|
-
* ...
|
|
20
|
-
* ```
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2019 - 2021 Vaadin Ltd.
|
|
4
|
+
* This program is available under Commercial Vaadin Developer License 4.0 (CVDLv4).
|
|
5
|
+
* See <a href="https://vaadin.com/license/cvdl-4.0">the website</a> for the complete license.
|
|
21
6
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* JS Path of the property in the item used for the editable content.
|
|
25
|
-
*/
|
|
26
|
-
path: string | null | undefined;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Custom function for rendering the cell content in edit mode.
|
|
30
|
-
* Receives three arguments:
|
|
31
|
-
*
|
|
32
|
-
* - `root` The cell content DOM element. Append your editor component to it.
|
|
33
|
-
* - `column` The `<vaadin-grid-pro-edit-column>` element.
|
|
34
|
-
* - `model` The object with the properties related with
|
|
35
|
-
* the rendered item, contains:
|
|
36
|
-
* - `model.index` The index of the item.
|
|
37
|
-
* - `model.item` The item.
|
|
38
|
-
* - `model.expanded` Sublevel toggle state.
|
|
39
|
-
* - `model.level` Level of the tree represented with a horizontal offset of the toggle button.
|
|
40
|
-
* - `model.selected` Selected state.
|
|
41
|
-
* - `model.detailsOpened` Details opened state.
|
|
42
|
-
*/
|
|
43
|
-
editModeRenderer: GridBodyRenderer<TItem> | null | undefined;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The list of options which should be passed to cell editor component.
|
|
47
|
-
* Used with the `select` editor type, to provide a list of items.
|
|
48
|
-
*/
|
|
49
|
-
editorOptions: string[];
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Type of the cell editor component to be rendered. Allowed values:
|
|
53
|
-
* - `text` (default) - renders a text field
|
|
54
|
-
* - `checkbox` - renders a checkbox
|
|
55
|
-
* - `select` - renders a select with a list of items passed as `editorOptions`
|
|
56
|
-
*
|
|
57
|
-
* Editor type is set to `custom` when `editModeRenderer` is set.
|
|
58
|
-
* @attr {text|checkbox|select|custom} editor-type
|
|
59
|
-
*/
|
|
60
|
-
editorType: GridProEditorType;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Path of the property used for the value of the editor component.
|
|
64
|
-
* @attr {string} editor-value-path
|
|
65
|
-
*/
|
|
66
|
-
editorValuePath: string;
|
|
67
|
-
|
|
68
|
-
_getEditorTagName(cell: HTMLElement): string;
|
|
7
|
+
import { GridDefaultItem } from '@vaadin/grid/src/vaadin-grid.js';
|
|
8
|
+
import { GridProEditColumn } from '@vaadin/grid-pro/src/vaadin-grid-pro-edit-column.js';
|
|
69
9
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
_startCellEdit(cell: HTMLElement, model: GridItemModel<TItem>): void;
|
|
75
|
-
|
|
76
|
-
_stopCellEdit(cell: HTMLElement, model: GridItemModel<TItem>): void;
|
|
77
|
-
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Import `GridProEditColumn` from `@vaadin/grid-pro/vaadin-grid-pro-edit-column` instead.
|
|
12
|
+
*/
|
|
13
|
+
export type GridProEditColumnElement<TItem = GridDefaultItem> = GridProEditColumn<TItem>;
|
|
78
14
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Import `GridProEditColumn` from `@vaadin/grid-pro/vaadin-grid-pro-edit-column` instead.
|
|
17
|
+
*/
|
|
18
|
+
export const GridProEditColumnElement: typeof GridProEditColumn;
|
|
84
19
|
|
|
85
|
-
export
|
|
20
|
+
export * from '@vaadin/grid-pro/src/vaadin-grid-pro-edit-column.js';
|
|
@@ -4,279 +4,11 @@
|
|
|
4
4
|
* This program is available under Commercial Vaadin Developer License 4.0 (CVDLv4).
|
|
5
5
|
* See <a href="https://vaadin.com/license/cvdl-4.0">the website</a> for the complete license.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { GridColumnElement } from '@vaadin/vaadin-grid/src/vaadin-grid-column.js';
|
|
9
|
-
import './vaadin-grid-pro-edit-checkbox.js';
|
|
10
|
-
import './vaadin-grid-pro-edit-select.js';
|
|
11
|
-
import './vaadin-grid-pro-edit-text-field.js';
|
|
7
|
+
import { GridProEditColumn } from '@vaadin/grid-pro/src/vaadin-grid-pro-edit-column.js';
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
|
-
*
|
|
15
|
-
* that provides default inline editing for the items.
|
|
16
|
-
*
|
|
17
|
-
* __Note that the `path` property must be explicitly specified for edit column.__
|
|
18
|
-
*
|
|
19
|
-
* #### Example:
|
|
20
|
-
* ```html
|
|
21
|
-
* <vaadin-grid-pro items="[[items]]">
|
|
22
|
-
* <vaadin-grid-pro-edit-column path="name.first"></vaadin-grid-pro-edit-column>
|
|
23
|
-
*
|
|
24
|
-
* <vaadin-grid-column>
|
|
25
|
-
* ...
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @extends GridColumnElement
|
|
10
|
+
* @deprecated Import `GridProEditColumn` from `@vaadin/grid-pro/vaadin-grid-pro-edit-column` instead.
|
|
29
11
|
*/
|
|
30
|
-
|
|
31
|
-
static get is() {
|
|
32
|
-
return 'vaadin-grid-pro-edit-column';
|
|
33
|
-
}
|
|
12
|
+
export const GridProEditColumnElement = GridProEditColumn;
|
|
34
13
|
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
/**
|
|
38
|
-
* Custom function for rendering the cell content in edit mode.
|
|
39
|
-
* Receives three arguments:
|
|
40
|
-
*
|
|
41
|
-
* - `root` The cell content DOM element. Append your editor component to it.
|
|
42
|
-
* - `column` The `<vaadin-grid-pro-edit-column>` element.
|
|
43
|
-
* - `model` The object with the properties related with
|
|
44
|
-
* the rendered item, contains:
|
|
45
|
-
* - `model.index` The index of the item.
|
|
46
|
-
* - `model.item` The item.
|
|
47
|
-
* - `model.expanded` Sublevel toggle state.
|
|
48
|
-
* - `model.level` Level of the tree represented with a horizontal offset of the toggle button.
|
|
49
|
-
* - `model.selected` Selected state.
|
|
50
|
-
* - `model.detailsOpened` Details opened state.
|
|
51
|
-
* @type {!GridBodyRenderer | null | undefined}
|
|
52
|
-
*/
|
|
53
|
-
editModeRenderer: Function,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The list of options which should be passed to cell editor component.
|
|
57
|
-
* Used with the `select` editor type, to provide a list of items.
|
|
58
|
-
* @type {!Array<string>}
|
|
59
|
-
*/
|
|
60
|
-
editorOptions: {
|
|
61
|
-
type: Array,
|
|
62
|
-
value: () => []
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Type of the cell editor component to be rendered. Allowed values:
|
|
67
|
-
* - `text` (default) - renders a text field
|
|
68
|
-
* - `checkbox` - renders a checkbox
|
|
69
|
-
* - `select` - renders a select with a list of items passed as `editorOptions`
|
|
70
|
-
*
|
|
71
|
-
* Editor type is set to `custom` when `editModeRenderer` is set.
|
|
72
|
-
* @attr {text|checkbox|select|custom} editor-type
|
|
73
|
-
* @type {!GridProEditorType}
|
|
74
|
-
*/
|
|
75
|
-
editorType: {
|
|
76
|
-
type: String,
|
|
77
|
-
notify: true, // FIXME(web-padawan): needed by Flow counterpart
|
|
78
|
-
value: 'text'
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Path of the property used for the value of the editor component.
|
|
83
|
-
* @attr {string} editor-value-path
|
|
84
|
-
* @type {string}
|
|
85
|
-
*/
|
|
86
|
-
editorValuePath: {
|
|
87
|
-
type: String,
|
|
88
|
-
value: 'value'
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* JS Path of the property in the item used for the editable content.
|
|
93
|
-
*/
|
|
94
|
-
path: {
|
|
95
|
-
type: String,
|
|
96
|
-
observer: '_pathChanged'
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
/** @private */
|
|
100
|
-
_oldRenderer: Function
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
static get observers() {
|
|
105
|
-
return ['_editModeRendererChanged(editModeRenderer, __initialized)', '_cellsChanged(_cells.*)'];
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
constructor() {
|
|
109
|
-
super();
|
|
110
|
-
|
|
111
|
-
this.__editModeRenderer = function (root, column) {
|
|
112
|
-
const cell = root.assignedSlot.parentNode;
|
|
113
|
-
|
|
114
|
-
const tagName = column._getEditorTagName(cell);
|
|
115
|
-
if (!root.firstElementChild || root.firstElementChild.localName.toLowerCase() !== tagName) {
|
|
116
|
-
root.innerHTML = `
|
|
117
|
-
<${tagName}></${tagName}>
|
|
118
|
-
`;
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/** @private */
|
|
124
|
-
_pathChanged(path) {
|
|
125
|
-
if (!path || path.length == 0) {
|
|
126
|
-
throw new Error('You should specify the path for the edit column');
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** @private */
|
|
131
|
-
_cellsChanged() {
|
|
132
|
-
this._cells.forEach((cell) => {
|
|
133
|
-
const part = cell.getAttribute('part');
|
|
134
|
-
if (part.indexOf('editable-cell') < 0) {
|
|
135
|
-
cell.setAttribute('part', part + ' editable-cell');
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** @private */
|
|
141
|
-
_editModeRendererChanged(renderer) {
|
|
142
|
-
if (renderer) {
|
|
143
|
-
this.editorType = 'custom';
|
|
144
|
-
} else if (this._oldRenderer) {
|
|
145
|
-
this.editorType = 'text';
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
this._oldRenderer = renderer;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @param {!HTMLElement} cell
|
|
153
|
-
* @return {string}
|
|
154
|
-
* @protected
|
|
155
|
-
*/
|
|
156
|
-
_getEditorTagName(cell) {
|
|
157
|
-
return this.editorType === 'custom' ? this._getEditorComponent(cell).localName : this._getTagNameByType();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @param {!HTMLElement} cell
|
|
162
|
-
* @return {HTMLElement | null}
|
|
163
|
-
* @protected
|
|
164
|
-
*/
|
|
165
|
-
_getEditorComponent(cell) {
|
|
166
|
-
return this.editorType === 'custom'
|
|
167
|
-
? cell._content.firstElementChild
|
|
168
|
-
: cell._content.querySelector(this._getEditorTagName(cell));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/** @private */
|
|
172
|
-
_getTagNameByType() {
|
|
173
|
-
let type;
|
|
174
|
-
switch (this.editorType) {
|
|
175
|
-
case 'checkbox':
|
|
176
|
-
type = 'checkbox';
|
|
177
|
-
break;
|
|
178
|
-
case 'select':
|
|
179
|
-
type = 'select';
|
|
180
|
-
break;
|
|
181
|
-
case 'text':
|
|
182
|
-
default:
|
|
183
|
-
type = 'text-field';
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
return this.constructor.is.replace('column', type);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** @private */
|
|
190
|
-
_focusEditor(editor) {
|
|
191
|
-
editor.focus();
|
|
192
|
-
if (this.editorType === 'checkbox') {
|
|
193
|
-
editor.setAttribute('focus-ring', '');
|
|
194
|
-
} else if (editor instanceof HTMLInputElement) {
|
|
195
|
-
editor.select();
|
|
196
|
-
} else if (editor.focusElement && editor.focusElement instanceof HTMLInputElement) {
|
|
197
|
-
editor.focusElement.select();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @param {!HTMLElement} editor
|
|
203
|
-
* @return {unknown}
|
|
204
|
-
* @protected
|
|
205
|
-
*/
|
|
206
|
-
_getEditorValue(editor) {
|
|
207
|
-
const path = this.editorType === 'checkbox' ? 'checked' : this.editorValuePath;
|
|
208
|
-
return get(editor, path);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/** @private */
|
|
212
|
-
_renderEditor(cell, model) {
|
|
213
|
-
cell.__savedRenderer = this._renderer || cell._renderer;
|
|
214
|
-
cell._renderer = this.editModeRenderer || this.__editModeRenderer;
|
|
215
|
-
|
|
216
|
-
this._clearCellContent(cell);
|
|
217
|
-
this._runRenderer(cell._renderer, cell, model);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/** @private */
|
|
221
|
-
_removeEditor(cell, _model) {
|
|
222
|
-
if (!cell.__savedRenderer) return;
|
|
223
|
-
|
|
224
|
-
cell._renderer = cell.__savedRenderer;
|
|
225
|
-
cell.__savedRenderer = undefined;
|
|
226
|
-
|
|
227
|
-
this._clearCellContent(cell);
|
|
228
|
-
|
|
229
|
-
const row = cell.parentElement;
|
|
230
|
-
this._grid._updateItem(row, row._item);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/** @private */
|
|
234
|
-
_setEditorOptions(editor) {
|
|
235
|
-
if (this.editorOptions && this.editorOptions.length) {
|
|
236
|
-
editor.options = this.editorOptions;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/** @private */
|
|
241
|
-
_setEditorValue(editor, value) {
|
|
242
|
-
const path = this.editorType === 'checkbox' ? 'checked' : this.editorValuePath;
|
|
243
|
-
// FIXME(yuriy): Required for the flow counterpart as it is passing the string value to webcomponent
|
|
244
|
-
value = this.editorType === 'checkbox' && typeof value === 'string' ? value == 'true' : value;
|
|
245
|
-
set(editor, path, value);
|
|
246
|
-
editor.notifyPath && editor.notifyPath(path, value);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* @param {!HTMLElement} cell
|
|
251
|
-
* @param {!GridItemModel} model
|
|
252
|
-
* @protected
|
|
253
|
-
*/
|
|
254
|
-
_startCellEdit(cell, model) {
|
|
255
|
-
this._renderEditor(cell, model);
|
|
256
|
-
|
|
257
|
-
const editor = this._getEditorComponent(cell);
|
|
258
|
-
editor.addEventListener('focusout', this._grid.__boundEditorFocusOut);
|
|
259
|
-
editor.addEventListener('focusin', this._grid.__boundEditorFocusIn);
|
|
260
|
-
editor.addEventListener('internal-tab', this._grid.__boundCancelCellSwitch);
|
|
261
|
-
document.body.addEventListener('focusin', this._grid.__boundGlobalFocusIn);
|
|
262
|
-
this._setEditorOptions(editor);
|
|
263
|
-
this._setEditorValue(editor, get(model.item, this.path));
|
|
264
|
-
editor._grid = this._grid;
|
|
265
|
-
this._focusEditor(editor);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @param {!HTMLElement} cell
|
|
270
|
-
* @param {!GridItemModel} model
|
|
271
|
-
* @protected
|
|
272
|
-
*/
|
|
273
|
-
_stopCellEdit(cell, model) {
|
|
274
|
-
document.body.removeEventListener('focusin', this._grid.__boundGlobalFocusIn);
|
|
275
|
-
|
|
276
|
-
this._removeEditor(cell, model);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
customElements.define(GridProEditColumnElement.is, GridProEditColumnElement);
|
|
281
|
-
|
|
282
|
-
export { GridProEditColumnElement };
|
|
14
|
+
export * from '@vaadin/grid-pro/src/vaadin-grid-pro-edit-column.js';
|
|
@@ -4,125 +4,4 @@
|
|
|
4
4
|
* This program is available under Commercial Vaadin Developer License 4.0 (CVDLv4).
|
|
5
5
|
* See <a href="https://vaadin.com/license/cvdl-4.0">the website</a> for the complete license.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
import '@vaadin/vaadin-list-box/src/vaadin-list-box.js';
|
|
9
|
-
import '@vaadin/vaadin-item/src/vaadin-item.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* An element used internally by `<vaadin-grid-pro>`. Not intended to be used separately.
|
|
13
|
-
*
|
|
14
|
-
* @extends Select
|
|
15
|
-
* @private
|
|
16
|
-
*/
|
|
17
|
-
class GridProEditSelectElement extends Select {
|
|
18
|
-
static get is() {
|
|
19
|
-
return 'vaadin-grid-pro-edit-select';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static get properties() {
|
|
23
|
-
return {
|
|
24
|
-
options: {
|
|
25
|
-
type: Array,
|
|
26
|
-
value: () => []
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
_grid: {
|
|
30
|
-
type: Object
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
_initialized: {
|
|
34
|
-
type: Boolean
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static get observers() {
|
|
40
|
-
return ['_optionsChanged(options)'];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
ready() {
|
|
44
|
-
super.ready();
|
|
45
|
-
|
|
46
|
-
this.setAttribute('theme', 'grid-pro-editor');
|
|
47
|
-
|
|
48
|
-
this.__boundOnKeyDown = this.__onOverlayKeyDown.bind(this);
|
|
49
|
-
this._overlayElement.addEventListener('keydown', this.__boundOnKeyDown);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
_onKeyDown(e) {
|
|
53
|
-
super._onKeyDown(e);
|
|
54
|
-
|
|
55
|
-
if (this.options.length === 0 && /^(ArrowDown|Down|ArrowUp|Up|Enter|SpaceBar| )$/.test(e.key)) {
|
|
56
|
-
console.warn('Missing "editorOptions" for <vaadin-grid-pro-edit-column> select editor!');
|
|
57
|
-
}
|
|
58
|
-
// Event handled in select, stop here
|
|
59
|
-
if (e.defaultPrevented) {
|
|
60
|
-
e.stopPropagation();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
__onOverlayKeyDown(e) {
|
|
65
|
-
if (e.keyCode === 9) {
|
|
66
|
-
!this._grid.singleCellEdit && this._grid._switchEditCell(e);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
_valueChanged(value, oldValue) {
|
|
71
|
-
super._valueChanged(value, oldValue);
|
|
72
|
-
|
|
73
|
-
// select is first created without a value
|
|
74
|
-
if (value === '' && oldValue === undefined) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (this._initialized) {
|
|
78
|
-
const enter = this._enterKeydown;
|
|
79
|
-
if (enter && this._grid.enterNextRow) {
|
|
80
|
-
this._grid._switchEditCell(enter);
|
|
81
|
-
} else if (this._grid.singleCellEdit) {
|
|
82
|
-
this._grid._stopEdit(false, true);
|
|
83
|
-
} else {
|
|
84
|
-
this.focus();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
_optionsChanged(options) {
|
|
90
|
-
if (options && options.length) {
|
|
91
|
-
this.renderer = (root) => {
|
|
92
|
-
if (root.firstChild) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const listBox = document.createElement('vaadin-list-box');
|
|
96
|
-
listBox.selected = options.indexOf(this.value);
|
|
97
|
-
options.forEach((option) => {
|
|
98
|
-
const item = document.createElement('vaadin-item');
|
|
99
|
-
item.textContent = option;
|
|
100
|
-
listBox.appendChild(item);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// save the "keydown" event for Enter
|
|
104
|
-
listBox.addEventListener('keydown', (e) => {
|
|
105
|
-
if (e.keyCode === 13) {
|
|
106
|
-
this._enterKeydown = e;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
root.appendChild(listBox);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
this._overlayElement.addEventListener('vaadin-overlay-outside-click', () => {
|
|
114
|
-
this._grid._stopEdit();
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// FIXME(web-padawan): _updateValueSlot() in `vaadin-select` resets opened to false
|
|
118
|
-
// see https://github.com/vaadin/vaadin-list-mixin/issues/49
|
|
119
|
-
setTimeout(() => {
|
|
120
|
-
this.opened = true;
|
|
121
|
-
// any value change after first open will stop edit
|
|
122
|
-
this._initialized = true;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
customElements.define(GridProEditSelectElement.is, GridProEditSelectElement);
|
|
7
|
+
export * from '@vaadin/grid-pro/src/vaadin-grid-pro-edit-select.js';
|
|
@@ -4,23 +4,4 @@
|
|
|
4
4
|
* This program is available under Commercial Vaadin Developer License 4.0 (CVDLv4).
|
|
5
5
|
* See <a href="https://vaadin.com/license/cvdl-4.0">the website</a> for the complete license.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* An element used internally by `<vaadin-grid-pro>`. Not intended to be used separately.
|
|
11
|
-
*
|
|
12
|
-
* @extends TextFieldElement
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
class GridProEditTextFieldElement extends TextFieldElement {
|
|
16
|
-
static get is() {
|
|
17
|
-
return 'vaadin-grid-pro-edit-text-field';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
ready() {
|
|
21
|
-
super.ready();
|
|
22
|
-
this.setAttribute('theme', 'grid-pro-editor');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
customElements.define(GridProEditTextFieldElement.is, GridProEditTextFieldElement);
|
|
7
|
+
export * from '@vaadin/grid-pro/src/vaadin-grid-pro-edit-text-field.js';
|