@progress/kendo-react-buttons 6.1.1 → 7.0.0-develop.10
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/es/Button.d.ts → Button.d.ts} +5 -1
- package/{dist/npm/ButtonGroup.d.ts → ButtonGroup.d.ts} +5 -1
- package/{dist/es/ButtonGroupInterface.d.ts → ButtonGroupInterface.d.ts} +4 -1
- package/{dist/npm/ButtonInterface.d.ts → ButtonInterface.d.ts} +4 -0
- package/{dist/npm/Chip → Chip}/Chip.d.ts +4 -0
- package/{dist/npm/Chip → Chip}/ChipList.d.ts +8 -12
- package/Chip/chip-list-contexts.d.ts +17 -0
- package/{dist/npm/Chip → Chip}/data-reducer.d.ts +5 -1
- package/{dist/es/Chip → Chip}/focus-reducer.d.ts +5 -2
- package/{dist/npm/Chip → Chip}/selection-reducer.d.ts +5 -1
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/FloatingActionButton.d.ts +4 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/FloatingActionButtonItem.d.ts +4 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +17 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/interfaces/FloatingActionButtonPopupSettings.d.ts +4 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/interfaces/FloatingActionButtonProps.d.ts +5 -2
- package/{dist/es/FloatingActionButton → FloatingActionButton}/models/align-offset.d.ts +4 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/models/align.d.ts +4 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/models/events.d.ts +5 -1
- package/FloatingActionButton/models/position-mode.d.ts +13 -0
- package/FloatingActionButton/models/rounded.d.ts +16 -0
- package/FloatingActionButton/models/size.d.ts +15 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/models/theme-color.d.ts +5 -1
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/utils.d.ts +4 -0
- package/LICENSE.md +1 -1
- package/{dist/es/ListButton → ListButton}/ButtonItem.d.ts +4 -0
- package/{dist/es/ListButton → ListButton}/DropDownButton.d.ts +5 -1
- package/{dist/npm/ListButton → ListButton}/DropDownButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/SplitButton.d.ts +5 -1
- package/{dist/es/ListButton → ListButton}/SplitButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/ButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/ListButtonProps.d.ts +4 -1
- package/{dist/npm/ListButton → ListButton}/models/PopupSettings.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/events.d.ts +4 -0
- package/ListButton/utils/navigation.d.ts +9 -0
- package/ListButton/utils/popup.d.ts +13 -0
- package/dist/cdn/js/kendo-react-buttons.js +5 -1
- package/index.d.ts +36 -0
- package/index.js +5 -0
- package/index.mjs +1886 -0
- package/{dist/npm/models → models}/index.d.ts +4 -1
- package/package-metadata.d.ts +9 -0
- package/package.json +28 -42
- package/{dist/es/toolbar → toolbar}/Toolbar.d.ts +5 -1
- package/{dist/es/toolbar → toolbar}/tools/ToolbarItem.d.ts +5 -1
- package/toolbar/tools/ToolbarSeparator.d.ts +20 -0
- package/{dist/es/toolbar → toolbar}/tools/ToolbarSpacer.d.ts +4 -0
- package/{dist/npm/util.d.ts → util.d.ts} +4 -0
- package/about.md +0 -3
- package/dist/es/Button.js +0 -171
- package/dist/es/ButtonGroup.d.ts +0 -32
- package/dist/es/ButtonGroup.js +0 -101
- package/dist/es/ButtonGroupInterface.js +0 -2
- package/dist/es/ButtonInterface.d.ts +0 -35
- package/dist/es/ButtonInterface.js +0 -3
- package/dist/es/Chip/Chip.d.ts +0 -234
- package/dist/es/Chip/Chip.js +0 -173
- package/dist/es/Chip/ChipList.d.ts +0 -123
- package/dist/es/Chip/ChipList.js +0 -177
- package/dist/es/Chip/data-reducer.d.ts +0 -22
- package/dist/es/Chip/data-reducer.js +0 -26
- package/dist/es/Chip/focus-reducer.js +0 -32
- package/dist/es/Chip/selection-reducer.d.ts +0 -30
- package/dist/es/Chip/selection-reducer.js +0 -75
- package/dist/es/FloatingActionButton/FloatingActionButton.d.ts +0 -17
- package/dist/es/FloatingActionButton/FloatingActionButton.js +0 -281
- package/dist/es/FloatingActionButton/FloatingActionButtonItem.js +0 -82
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +0 -13
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +0 -1
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +0 -1
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +0 -216
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.js +0 -1
- package/dist/es/FloatingActionButton/models/align-offset.js +0 -1
- package/dist/es/FloatingActionButton/models/align.d.ts +0 -27
- package/dist/es/FloatingActionButton/models/align.js +0 -1
- package/dist/es/FloatingActionButton/models/events.js +0 -1
- package/dist/es/FloatingActionButton/models/position-mode.d.ts +0 -9
- package/dist/es/FloatingActionButton/models/position-mode.js +0 -1
- package/dist/es/FloatingActionButton/models/rounded.d.ts +0 -12
- package/dist/es/FloatingActionButton/models/rounded.js +0 -1
- package/dist/es/FloatingActionButton/models/size.d.ts +0 -11
- package/dist/es/FloatingActionButton/models/size.js +0 -1
- package/dist/es/FloatingActionButton/models/theme-color.d.ts +0 -18
- package/dist/es/FloatingActionButton/models/theme-color.js +0 -1
- package/dist/es/FloatingActionButton/utils.d.ts +0 -27
- package/dist/es/FloatingActionButton/utils.js +0 -93
- package/dist/es/ListButton/ButtonItem.js +0 -24
- package/dist/es/ListButton/DropDownButton.js +0 -325
- package/dist/es/ListButton/DropDownButtonItem.d.ts +0 -30
- package/dist/es/ListButton/DropDownButtonItem.js +0 -43
- package/dist/es/ListButton/SplitButton.d.ts +0 -120
- package/dist/es/ListButton/SplitButton.js +0 -334
- package/dist/es/ListButton/SplitButtonItem.js +0 -42
- package/dist/es/ListButton/models/ButtonItem.d.ts +0 -34
- package/dist/es/ListButton/models/ButtonItem.js +0 -3
- package/dist/es/ListButton/models/ListButtonProps.d.ts +0 -336
- package/dist/es/ListButton/models/ListButtonProps.js +0 -2
- package/dist/es/ListButton/models/PopupSettings.d.ts +0 -24
- package/dist/es/ListButton/models/PopupSettings.js +0 -1
- package/dist/es/ListButton/models/events.d.ts +0 -47
- package/dist/es/ListButton/models/events.js +0 -1
- package/dist/es/ListButton/utils/navigation.d.ts +0 -5
- package/dist/es/ListButton/utils/navigation.js +0 -29
- package/dist/es/ListButton/utils/popup.d.ts +0 -9
- package/dist/es/ListButton/utils/popup.js +0 -20
- package/dist/es/main.d.ts +0 -32
- package/dist/es/main.js +0 -17
- package/dist/es/models/index.d.ts +0 -89
- package/dist/es/models/index.js +0 -1
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/toolbar/Toolbar.js +0 -214
- package/dist/es/toolbar/tools/ToolbarItem.js +0 -56
- package/dist/es/toolbar/tools/ToolbarSeparator.d.ts +0 -16
- package/dist/es/toolbar/tools/ToolbarSeparator.js +0 -31
- package/dist/es/toolbar/tools/ToolbarSpacer.js +0 -20
- package/dist/es/util.d.ts +0 -27
- package/dist/es/util.js +0 -37
- package/dist/npm/Button.d.ts +0 -138
- package/dist/npm/Button.js +0 -174
- package/dist/npm/ButtonGroup.js +0 -104
- package/dist/npm/ButtonGroupInterface.d.ts +0 -33
- package/dist/npm/ButtonGroupInterface.js +0 -3
- package/dist/npm/ButtonInterface.js +0 -4
- package/dist/npm/Chip/Chip.js +0 -176
- package/dist/npm/Chip/ChipList.js +0 -180
- package/dist/npm/Chip/data-reducer.js +0 -30
- package/dist/npm/Chip/focus-reducer.d.ts +0 -25
- package/dist/npm/Chip/focus-reducer.js +0 -36
- package/dist/npm/Chip/selection-reducer.js +0 -79
- package/dist/npm/FloatingActionButton/FloatingActionButton.js +0 -284
- package/dist/npm/FloatingActionButton/FloatingActionButtonItem.d.ts +0 -105
- package/dist/npm/FloatingActionButton/FloatingActionButtonItem.js +0 -85
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +0 -13
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +0 -2
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +0 -24
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +0 -2
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonProps.js +0 -2
- package/dist/npm/FloatingActionButton/models/align-offset.d.ts +0 -20
- package/dist/npm/FloatingActionButton/models/align-offset.js +0 -2
- package/dist/npm/FloatingActionButton/models/align.js +0 -2
- package/dist/npm/FloatingActionButton/models/events.d.ts +0 -21
- package/dist/npm/FloatingActionButton/models/events.js +0 -2
- package/dist/npm/FloatingActionButton/models/position-mode.d.ts +0 -9
- package/dist/npm/FloatingActionButton/models/position-mode.js +0 -2
- package/dist/npm/FloatingActionButton/models/rounded.d.ts +0 -12
- package/dist/npm/FloatingActionButton/models/rounded.js +0 -2
- package/dist/npm/FloatingActionButton/models/size.d.ts +0 -11
- package/dist/npm/FloatingActionButton/models/size.js +0 -2
- package/dist/npm/FloatingActionButton/models/theme-color.js +0 -2
- package/dist/npm/FloatingActionButton/utils.js +0 -101
- package/dist/npm/ListButton/ButtonItem.d.ts +0 -30
- package/dist/npm/ListButton/ButtonItem.js +0 -28
- package/dist/npm/ListButton/DropDownButton.d.ts +0 -118
- package/dist/npm/ListButton/DropDownButton.js +0 -328
- package/dist/npm/ListButton/DropDownButtonItem.js +0 -46
- package/dist/npm/ListButton/SplitButton.js +0 -337
- package/dist/npm/ListButton/SplitButtonItem.d.ts +0 -25
- package/dist/npm/ListButton/SplitButtonItem.js +0 -45
- package/dist/npm/ListButton/models/ButtonItem.js +0 -4
- package/dist/npm/ListButton/models/ListButtonProps.js +0 -3
- package/dist/npm/ListButton/models/PopupSettings.js +0 -2
- package/dist/npm/ListButton/models/events.js +0 -2
- package/dist/npm/ListButton/utils/navigation.d.ts +0 -5
- package/dist/npm/ListButton/utils/navigation.js +0 -32
- package/dist/npm/ListButton/utils/popup.d.ts +0 -9
- package/dist/npm/ListButton/utils/popup.js +0 -25
- package/dist/npm/main.d.ts +0 -32
- package/dist/npm/main.js +0 -48
- package/dist/npm/models/index.js +0 -2
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/toolbar/Toolbar.d.ts +0 -171
- package/dist/npm/toolbar/Toolbar.js +0 -217
- package/dist/npm/toolbar/tools/ToolbarItem.d.ts +0 -38
- package/dist/npm/toolbar/tools/ToolbarItem.js +0 -59
- package/dist/npm/toolbar/tools/ToolbarSeparator.d.ts +0 -16
- package/dist/npm/toolbar/tools/ToolbarSeparator.js +0 -34
- package/dist/npm/toolbar/tools/ToolbarSpacer.d.ts +0 -23
- package/dist/npm/toolbar/tools/ToolbarSpacer.js +0 -23
- package/dist/npm/util.js +0 -40
- package/dist/systemjs/kendo-react-buttons.js +0 -1
- package/e2e-next/button.basic.tests.ts +0 -24
- package/e2e-next/buttongroup.basic.tests.ts +0 -24
- package/e2e-next/chip.basic.tests.ts +0 -24
- package/e2e-next/chiplist.basic.tests.ts +0 -24
- package/e2e-next/dropdownbutton.basic.tests.ts +0 -24
- package/e2e-next/floatingactionbutton.basic.tests.ts +0 -24
- package/e2e-next/splitbutton.basic.tests.ts +0 -24
- package/e2e-next/toolbar.basic.tests.ts +0 -24
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.DropDownButton = void 0;
|
|
30
|
-
var React = require("react");
|
|
31
|
-
var PropTypes = require("prop-types");
|
|
32
|
-
var main_1 = require("./../main");
|
|
33
|
-
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
34
|
-
var kendo_react_common_2 = require("@progress/kendo-react-common");
|
|
35
|
-
var navigation_1 = require("./utils/navigation");
|
|
36
|
-
var DropDownButtonItem_1 = require("./DropDownButtonItem");
|
|
37
|
-
var ButtonItem_1 = require("./ButtonItem");
|
|
38
|
-
var kendo_react_popup_1 = require("@progress/kendo-react-popup");
|
|
39
|
-
var popup_1 = require("./utils/popup");
|
|
40
|
-
var kendo_react_common_3 = require("@progress/kendo-react-common");
|
|
41
|
-
var package_metadata_1 = require("../package-metadata");
|
|
42
|
-
/**
|
|
43
|
-
* Represents the [KendoReact DropDownButton component]({% slug overview_dropdownbutton %}).
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```jsx
|
|
47
|
-
* class App extends React.Component {
|
|
48
|
-
* render() {
|
|
49
|
-
* return (
|
|
50
|
-
* <DropDownButton text="Act">
|
|
51
|
-
* <DropDownButtonItem text="Item1" />
|
|
52
|
-
* <DropDownButtonItem text="Item2" />
|
|
53
|
-
* <DropDownButtonItem text="Item3" />
|
|
54
|
-
* </DropDownButton>
|
|
55
|
-
* );
|
|
56
|
-
* }
|
|
57
|
-
* }
|
|
58
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
var DropDownButton = /** @class */ (function (_super) {
|
|
62
|
-
__extends(DropDownButton, _super);
|
|
63
|
-
function DropDownButton(props) {
|
|
64
|
-
var _this = _super.call(this, props) || this;
|
|
65
|
-
/**
|
|
66
|
-
* @hidden
|
|
67
|
-
*/
|
|
68
|
-
_this.state = {
|
|
69
|
-
opened: false,
|
|
70
|
-
focused: false,
|
|
71
|
-
focusedIndex: -1
|
|
72
|
-
};
|
|
73
|
-
_this.wrapper = null;
|
|
74
|
-
_this.mainButton = null;
|
|
75
|
-
_this.list = null;
|
|
76
|
-
_this.skipFocus = false;
|
|
77
|
-
_this.guid = (0, kendo_react_common_1.guid)();
|
|
78
|
-
_this.buttonsData = [];
|
|
79
|
-
_this.onKeyDown = function (event) {
|
|
80
|
-
var focusedIndex = _this.state.focusedIndex;
|
|
81
|
-
if (event.altKey) {
|
|
82
|
-
if (!_this.opened && event.keyCode === kendo_react_common_1.Keys.down) {
|
|
83
|
-
_this.setOpen(true);
|
|
84
|
-
_this.dispatchPopupEvent(event, true);
|
|
85
|
-
_this.setState({ focusedIndex: 0 });
|
|
86
|
-
}
|
|
87
|
-
else if (_this.opened && event.keyCode === kendo_react_common_1.Keys.up) {
|
|
88
|
-
_this.setState({ focusedIndex: -1 });
|
|
89
|
-
_this.setOpen(false);
|
|
90
|
-
}
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
var newState = __assign({}, _this.state);
|
|
94
|
-
if (event.keyCode === kendo_react_common_1.Keys.enter || event.keyCode === kendo_react_common_1.Keys.space) {
|
|
95
|
-
if (focusedIndex >= 0) {
|
|
96
|
-
_this.dispatchClickEvent(event, focusedIndex);
|
|
97
|
-
}
|
|
98
|
-
// Prevent default because otherwise when an item is selected
|
|
99
|
-
// click on the default button gets emitted which opens the popup again.
|
|
100
|
-
event.preventDefault();
|
|
101
|
-
var notOpened = !_this.opened;
|
|
102
|
-
_this.setOpen(notOpened);
|
|
103
|
-
if (notOpened) {
|
|
104
|
-
_this.dispatchPopupEvent(event, true);
|
|
105
|
-
_this.setState({ focusedIndex: _this.opened ? -1 : 0 });
|
|
106
|
-
}
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
else if (_this.opened && event.keyCode === kendo_react_common_1.Keys.esc) {
|
|
110
|
-
_this.setState({ focusedIndex: -1 });
|
|
111
|
-
_this.setOpen(false);
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (_this.opened) {
|
|
115
|
-
var newFocused = (0, navigation_1.navigate)(focusedIndex, event.keyCode, event.altKey, _this.buttonsData.length);
|
|
116
|
-
newState.focusedIndex = newFocused;
|
|
117
|
-
var arrowKey = event.keyCode === kendo_react_common_1.Keys.up || event.keyCode === kendo_react_common_1.Keys.down ||
|
|
118
|
-
event.keyCode === kendo_react_common_1.Keys.left || event.keyCode === kendo_react_common_1.Keys.right;
|
|
119
|
-
if (!event.altKey && (arrowKey || event.keyCode === kendo_react_common_1.Keys.home || event.keyCode === kendo_react_common_1.Keys.end)) {
|
|
120
|
-
// Needed to notify the parent listeners that event is handled.
|
|
121
|
-
event.preventDefault();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
_this.setState(newState);
|
|
125
|
-
};
|
|
126
|
-
_this.switchFocus = function (focusFn) {
|
|
127
|
-
_this.skipFocus = true;
|
|
128
|
-
focusFn();
|
|
129
|
-
window.setTimeout(function () { return _this.skipFocus = false; }, 0);
|
|
130
|
-
};
|
|
131
|
-
_this.handleFocus = function (event) {
|
|
132
|
-
if (_this.skipFocus) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
_this.setState({ focused: true, focusedIndex: _this.opened ? 0 : -1 });
|
|
136
|
-
(0, kendo_react_common_2.dispatchEvent)(_this.props.onFocus, event, _this, undefined);
|
|
137
|
-
};
|
|
138
|
-
_this.handleBlur = function (event) {
|
|
139
|
-
if (_this.skipFocus) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
_this.setState({ focused: false, focusedIndex: -1 });
|
|
143
|
-
_this.setOpen(false);
|
|
144
|
-
(0, kendo_react_common_2.dispatchEvent)(_this.props.onBlur, event, _this, undefined);
|
|
145
|
-
};
|
|
146
|
-
_this.setOpen = function (value) {
|
|
147
|
-
_this.openedDuringOnChange = value;
|
|
148
|
-
_this.setState({ opened: value });
|
|
149
|
-
};
|
|
150
|
-
_this.onItemClick = function (event, clickedItemIndex) {
|
|
151
|
-
_this.setState({ focusedIndex: -1 });
|
|
152
|
-
_this.setOpen(false);
|
|
153
|
-
_this.dispatchClickEvent(event, clickedItemIndex);
|
|
154
|
-
};
|
|
155
|
-
_this.onItemDown = function (event) {
|
|
156
|
-
var activeElement = (0, kendo_react_common_1.getActiveElement)(document);
|
|
157
|
-
if (activeElement === _this.list) {
|
|
158
|
-
event.preventDefault();
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
_this.mouseDown = function (event) {
|
|
162
|
-
event.preventDefault();
|
|
163
|
-
var activeElement = (0, kendo_react_common_1.getActiveElement)(document);
|
|
164
|
-
if (_this.element && activeElement !== _this.element && activeElement !== _this.list) {
|
|
165
|
-
_this.element.focus();
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
_this.onPopupClose = function () {
|
|
169
|
-
if (_this.state.focused) {
|
|
170
|
-
_this.switchFocus(function () {
|
|
171
|
-
if (_this.element) {
|
|
172
|
-
_this.element.removeAttribute('tabindex');
|
|
173
|
-
_this.element.focus({ preventScroll: true });
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
_this.dispatchPopupEvent({}, false);
|
|
178
|
-
};
|
|
179
|
-
_this.listRef = function (list) {
|
|
180
|
-
_this.list = list;
|
|
181
|
-
if (list && _this.state.focused) {
|
|
182
|
-
_this.switchFocus(function () {
|
|
183
|
-
list.focus({ preventScroll: true });
|
|
184
|
-
if (_this.element) {
|
|
185
|
-
_this.element.tabIndex = -1;
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
_this.onClickMainButton = function (event) {
|
|
191
|
-
if (!_this.buttonsData.length) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
var toOpen = !_this.opened;
|
|
195
|
-
_this.setState({
|
|
196
|
-
focused: true,
|
|
197
|
-
focusedIndex: toOpen ? 0 : -1
|
|
198
|
-
});
|
|
199
|
-
_this.setOpen(toOpen);
|
|
200
|
-
if (toOpen) {
|
|
201
|
-
_this.dispatchPopupEvent(event, toOpen);
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
_this.dispatchPopupEvent = function (dispatchedEvent, open) {
|
|
205
|
-
(0, kendo_react_common_2.dispatchEvent)(open ? _this.props.onOpen : _this.props.onClose, dispatchedEvent, _this, undefined);
|
|
206
|
-
_this.openedDuringOnChange = undefined;
|
|
207
|
-
};
|
|
208
|
-
(0, kendo_react_common_3.validatePackage)(package_metadata_1.packageMetadata);
|
|
209
|
-
return _this;
|
|
210
|
-
}
|
|
211
|
-
Object.defineProperty(DropDownButton.prototype, "opened", {
|
|
212
|
-
get: function () {
|
|
213
|
-
return this.openedDuringOnChange !== undefined
|
|
214
|
-
? this.openedDuringOnChange
|
|
215
|
-
: this.props.opened === undefined
|
|
216
|
-
? this.state.opened
|
|
217
|
-
: this.props.opened;
|
|
218
|
-
},
|
|
219
|
-
enumerable: false,
|
|
220
|
-
configurable: true
|
|
221
|
-
});
|
|
222
|
-
/**
|
|
223
|
-
* @hidden
|
|
224
|
-
*/
|
|
225
|
-
DropDownButton.prototype.render = function () {
|
|
226
|
-
var _this = this;
|
|
227
|
-
var rtl = this.isRtl();
|
|
228
|
-
var dir = rtl ? 'rtl' : undefined;
|
|
229
|
-
var _a = this.props, id = _a.id, style = _a.style, tabIndex = _a.tabIndex, disabled = _a.disabled;
|
|
230
|
-
this.buttonsData = this.props.items ||
|
|
231
|
-
React.Children.toArray(this.props.children)
|
|
232
|
-
.filter(function (child) { return child && child.type === DropDownButtonItem_1.DropDownButtonItem; })
|
|
233
|
-
.map(function (child) { return child.props; });
|
|
234
|
-
return (React.createElement("div", { id: id, style: style, className: (0, kendo_react_common_1.classNames)('k-dropdown-button', {
|
|
235
|
-
'k-focus': this.state.focused
|
|
236
|
-
}, this.props.className), onKeyDown: this.onKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
|
|
237
|
-
React.createElement(main_1.Button, { size: this.props.size, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: this.onClickMainButton, onMouseDown: this.mouseDown, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, icon: this.props.icon, svgIcon: this.props.svgIcon, iconClass: this.props.iconClass, className: this.props.buttonClass, imageUrl: this.props.imageUrl, dir: dir, ref: function (btn) { return _this.mainButton = btn && btn.element; }, type: "button", "aria-haspopup": true, "aria-expanded": this.opened || undefined, "aria-label": this.props.ariaLabel, "aria-controls": this.opened ? this.guid : undefined, id: 'button-' + this.guid, title: this.props.title }, this.props.text),
|
|
238
|
-
this.renderPopup(rtl)));
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* @hidden
|
|
242
|
-
*/
|
|
243
|
-
DropDownButton.prototype.componentDidMount = function () {
|
|
244
|
-
// If this.props.opened is true during the initial render, the popup is not aligned.
|
|
245
|
-
if ((this.props.dir === undefined && this.isRtl()) || this.opened) {
|
|
246
|
-
this.forceUpdate();
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
Object.defineProperty(DropDownButton.prototype, "element", {
|
|
250
|
-
/**
|
|
251
|
-
* The DOM element of main button.
|
|
252
|
-
*/
|
|
253
|
-
get: function () {
|
|
254
|
-
return this.mainButton;
|
|
255
|
-
},
|
|
256
|
-
enumerable: false,
|
|
257
|
-
configurable: true
|
|
258
|
-
});
|
|
259
|
-
DropDownButton.prototype.dispatchClickEvent = function (dispatchedEvent, index) {
|
|
260
|
-
if (!this.isItemDisabled(index)) {
|
|
261
|
-
(0, kendo_react_common_2.dispatchEvent)(this.props.onItemClick, dispatchedEvent, this, {
|
|
262
|
-
item: this.buttonsData[index],
|
|
263
|
-
itemIndex: index
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
DropDownButton.prototype.renderPopup = function (rtl) {
|
|
268
|
-
var _a;
|
|
269
|
-
var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
|
|
270
|
-
var focusedIndex = this.state.focusedIndex;
|
|
271
|
-
return (React.createElement(kendo_react_popup_1.Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: (0, kendo_react_common_1.classNames)('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || (0, popup_1.getAnchorAlign)(rtl), popupAlign: popupSettings.popupAlign || (0, popup_1.getPopupAlign)(rtl), style: rtl ? { direction: 'rtl' } : undefined, onClose: this.onPopupClose },
|
|
272
|
-
React.createElement("ul", { role: "menu", id: this.guid, "aria-labelledby": 'button-' + this.guid, tabIndex: -1, "aria-activedescendant": focusedIndex >= 0 ? "".concat(this.guid, "-").concat(focusedIndex) : undefined, ref: this.listRef, className: (0, kendo_react_common_1.classNames)('k-group k-menu-group k-reset', (_a = {},
|
|
273
|
-
_a["k-menu-group-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
274
|
-
_a)) }, this.renderChildItems())));
|
|
275
|
-
};
|
|
276
|
-
DropDownButton.prototype.renderChildItems = function () {
|
|
277
|
-
var _this = this;
|
|
278
|
-
var _a = this.props, item = _a.item, itemRender = _a.itemRender, textField = _a.textField;
|
|
279
|
-
return this.buttonsData.length > 0 ? (this.buttonsData.map(function (dataItem, index) {
|
|
280
|
-
return (React.createElement(ButtonItem_1.ButtonItem, { className: "k-menu-item", dataItem: dataItem, textField: textField, focused: _this.state.focusedIndex === index, onClick: _this.onItemClick, onDown: _this.onItemDown, render: itemRender, item: item, index: index, key: index, id: "".concat(_this.guid, "-").concat(index) }));
|
|
281
|
-
})) : null;
|
|
282
|
-
};
|
|
283
|
-
DropDownButton.prototype.isItemDisabled = function (index) {
|
|
284
|
-
return this.buttonsData[index] ? this.buttonsData[index].disabled : this.props.disabled;
|
|
285
|
-
};
|
|
286
|
-
DropDownButton.prototype.isRtl = function () {
|
|
287
|
-
return this.props.dir !== undefined ? this.props.dir === 'rtl' :
|
|
288
|
-
!!this.wrapper && getComputedStyle(this.wrapper).direction === 'rtl';
|
|
289
|
-
};
|
|
290
|
-
/**
|
|
291
|
-
* @hidden
|
|
292
|
-
*/
|
|
293
|
-
DropDownButton.propTypes = {
|
|
294
|
-
accessKey: PropTypes.string,
|
|
295
|
-
ariaLabel: PropTypes.string,
|
|
296
|
-
title: PropTypes.string,
|
|
297
|
-
onFocus: PropTypes.func,
|
|
298
|
-
onBlur: PropTypes.func,
|
|
299
|
-
onItemClick: PropTypes.func,
|
|
300
|
-
onOpen: PropTypes.func,
|
|
301
|
-
onClose: PropTypes.func,
|
|
302
|
-
items: PropTypes.arrayOf(PropTypes.any),
|
|
303
|
-
textField: PropTypes.string,
|
|
304
|
-
tabIndex: PropTypes.number,
|
|
305
|
-
disabled: PropTypes.bool,
|
|
306
|
-
icon: PropTypes.string,
|
|
307
|
-
svgIcon: kendo_react_common_1.svgIconPropType,
|
|
308
|
-
iconClass: PropTypes.string,
|
|
309
|
-
imageUrl: PropTypes.string,
|
|
310
|
-
popupSettings: PropTypes.object,
|
|
311
|
-
itemRender: PropTypes.func,
|
|
312
|
-
item: PropTypes.func,
|
|
313
|
-
className: PropTypes.string,
|
|
314
|
-
buttonClass: PropTypes.string,
|
|
315
|
-
dir: PropTypes.string
|
|
316
|
-
};
|
|
317
|
-
/**
|
|
318
|
-
* @hidden
|
|
319
|
-
*/
|
|
320
|
-
DropDownButton.defaultProps = {
|
|
321
|
-
size: 'medium',
|
|
322
|
-
rounded: 'medium',
|
|
323
|
-
fillMode: 'solid',
|
|
324
|
-
themeColor: 'base'
|
|
325
|
-
};
|
|
326
|
-
return DropDownButton;
|
|
327
|
-
}(React.Component));
|
|
328
|
-
exports.DropDownButton = DropDownButton;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.DropDownButtonItem = void 0;
|
|
19
|
-
var React = require("react");
|
|
20
|
-
var PropTypes = require("prop-types");
|
|
21
|
-
var DropDownButtonItem = /** @class */ (function (_super) {
|
|
22
|
-
__extends(DropDownButtonItem, _super);
|
|
23
|
-
function DropDownButtonItem() {
|
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @hidden
|
|
28
|
-
*/
|
|
29
|
-
DropDownButtonItem.prototype.render = function () {
|
|
30
|
-
return null;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* @hidden
|
|
34
|
-
*/
|
|
35
|
-
DropDownButtonItem.propTypes = {
|
|
36
|
-
text: PropTypes.string,
|
|
37
|
-
icon: PropTypes.string,
|
|
38
|
-
iconClass: PropTypes.string,
|
|
39
|
-
imageUrl: PropTypes.string,
|
|
40
|
-
selected: PropTypes.bool,
|
|
41
|
-
disabled: PropTypes.bool,
|
|
42
|
-
render: PropTypes.any
|
|
43
|
-
};
|
|
44
|
-
return DropDownButtonItem;
|
|
45
|
-
}(React.Component));
|
|
46
|
-
exports.DropDownButtonItem = DropDownButtonItem;
|