@progress/kendo-react-dropdowns 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.
Files changed (177) hide show
  1. package/{dist/es/AutoComplete → AutoComplete}/AutoComplete.d.ts +12 -8
  2. package/{dist/npm/AutoComplete → AutoComplete}/AutoCompleteProps.d.ts +4 -1
  3. package/{dist/es/ComboBox → ComboBox}/ComboBox.d.ts +12 -8
  4. package/{dist/es/ComboBox → ComboBox}/ComboBoxProps.d.ts +4 -1
  5. package/{dist/es/DropDownList → DropDownList}/DropDownList.d.ts +9 -5
  6. package/{dist/es/DropDownList → DropDownList}/DropDownListProps.d.ts +4 -1
  7. package/{dist/es/DropDownTree → DropDownTree}/DropDownTree.d.ts +4 -0
  8. package/{dist/npm/DropDownTree → DropDownTree}/DropDownTreeProps.d.ts +4 -1
  9. package/DropDownTree/ListNoData.d.ts +10 -0
  10. package/DropDownTree/useDropdownWidth.d.ts +9 -0
  11. package/LICENSE.md +1 -1
  12. package/{dist/es/MultiColumnComboBox → MultiColumnComboBox}/MultiColumnComboBox.d.ts +4 -0
  13. package/{dist/npm/MultiSelect → MultiSelect}/MultiSelect.d.ts +9 -5
  14. package/{dist/es/MultiSelect → MultiSelect}/MultiSelectProps.d.ts +4 -1
  15. package/{dist/npm/MultiSelect → MultiSelect}/TagList.d.ts +5 -1
  16. package/{dist/es/MultiSelectTree → MultiSelectTree}/MultiSelectTree.d.ts +4 -0
  17. package/{dist/es/MultiSelectTree → MultiSelectTree}/MultiSelectTreeProps.d.ts +5 -1
  18. package/{dist/npm/MultiSelectTree → MultiSelectTree}/utils.d.ts +5 -1
  19. package/{dist/npm/common → common}/AdaptiveMode.d.ts +5 -1
  20. package/common/ClearButton.d.ts +18 -0
  21. package/{dist/npm/common → common}/DropDownBase.d.ts +5 -1
  22. package/{dist/es/common → common}/GroupStickyHeader.d.ts +5 -1
  23. package/{dist/es/common → common}/List.d.ts +8 -3
  24. package/common/ListContainer.d.ts +22 -0
  25. package/common/ListDefaultItem.d.ts +20 -0
  26. package/{dist/npm/common → common}/ListFilter.d.ts +4 -0
  27. package/{dist/npm/common → common}/ListGroupItem.d.ts +5 -1
  28. package/{dist/npm/common → common}/ListItem.d.ts +5 -1
  29. package/common/MultiColumnList.d.ts +9 -0
  30. package/common/Navigation.d.ts +17 -0
  31. package/{dist/es/common → common}/SearchBar.d.ts +5 -1
  32. package/{dist/npm/common → common}/VirtualScroll.d.ts +4 -1
  33. package/common/constants.d.ts +8 -0
  34. package/{dist/es/common → common}/events.d.ts +4 -1
  35. package/{dist/npm/common → common}/filterDescriptor.d.ts +4 -0
  36. package/{dist/es/common → common}/settings.d.ts +5 -2
  37. package/{dist/npm/common → common}/utils.d.ts +4 -0
  38. package/dist/cdn/js/kendo-react-dropdowns.js +5 -1
  39. package/index.d.ts +29 -0
  40. package/index.js +5 -0
  41. package/index.mjs +4397 -0
  42. package/{dist/npm/messages → messages}/index.d.ts +4 -0
  43. package/package-metadata.d.ts +9 -0
  44. package/package.json +34 -62
  45. package/about.md +0 -3
  46. package/dist/es/AutoComplete/AutoComplete.js +0 -652
  47. package/dist/es/AutoComplete/AutoCompleteProps.d.ts +0 -243
  48. package/dist/es/AutoComplete/AutoCompleteProps.js +0 -2
  49. package/dist/es/ComboBox/ComboBox.js +0 -915
  50. package/dist/es/ComboBox/ComboBoxProps.js +0 -2
  51. package/dist/es/DropDownList/DropDownList.js +0 -887
  52. package/dist/es/DropDownList/DropDownListProps.js +0 -2
  53. package/dist/es/DropDownTree/DropDownTree.js +0 -540
  54. package/dist/es/DropDownTree/DropDownTreeProps.d.ts +0 -294
  55. package/dist/es/DropDownTree/DropDownTreeProps.js +0 -2
  56. package/dist/es/DropDownTree/ListNoData.d.ts +0 -6
  57. package/dist/es/DropDownTree/ListNoData.js +0 -8
  58. package/dist/es/DropDownTree/useDropdownWidth.d.ts +0 -5
  59. package/dist/es/DropDownTree/useDropdownWidth.js +0 -13
  60. package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +0 -213
  61. package/dist/es/MultiSelect/MultiSelect.d.ts +0 -256
  62. package/dist/es/MultiSelect/MultiSelect.js +0 -1110
  63. package/dist/es/MultiSelect/MultiSelectProps.js +0 -2
  64. package/dist/es/MultiSelect/TagList.d.ts +0 -38
  65. package/dist/es/MultiSelect/TagList.js +0 -39
  66. package/dist/es/MultiSelectTree/MultiSelectTree.js +0 -619
  67. package/dist/es/MultiSelectTree/MultiSelectTreeProps.js +0 -2
  68. package/dist/es/MultiSelectTree/utils.d.ts +0 -17
  69. package/dist/es/MultiSelectTree/utils.js +0 -191
  70. package/dist/es/common/AdaptiveMode.d.ts +0 -21
  71. package/dist/es/common/AdaptiveMode.js +0 -45
  72. package/dist/es/common/ClearButton.d.ts +0 -14
  73. package/dist/es/common/ClearButton.js +0 -39
  74. package/dist/es/common/DropDownBase.d.ts +0 -175
  75. package/dist/es/common/DropDownBase.js +0 -297
  76. package/dist/es/common/GroupStickyHeader.js +0 -34
  77. package/dist/es/common/List.js +0 -75
  78. package/dist/es/common/ListContainer.d.ts +0 -18
  79. package/dist/es/common/ListContainer.js +0 -43
  80. package/dist/es/common/ListDefaultItem.d.ts +0 -16
  81. package/dist/es/common/ListDefaultItem.js +0 -36
  82. package/dist/es/common/ListFilter.d.ts +0 -19
  83. package/dist/es/common/ListFilter.js +0 -37
  84. package/dist/es/common/ListGroupItem.d.ts +0 -33
  85. package/dist/es/common/ListGroupItem.js +0 -33
  86. package/dist/es/common/ListItem.d.ts +0 -61
  87. package/dist/es/common/ListItem.js +0 -44
  88. package/dist/es/common/MultiColumnList.d.ts +0 -6
  89. package/dist/es/common/MultiColumnList.js +0 -22
  90. package/dist/es/common/Navigation.d.ts +0 -13
  91. package/dist/es/common/Navigation.js +0 -34
  92. package/dist/es/common/SearchBar.js +0 -62
  93. package/dist/es/common/VirtualScroll.d.ts +0 -42
  94. package/dist/es/common/VirtualScroll.js +0 -161
  95. package/dist/es/common/constants.d.ts +0 -4
  96. package/dist/es/common/constants.js +0 -4
  97. package/dist/es/common/events.js +0 -1
  98. package/dist/es/common/filterDescriptor.d.ts +0 -41
  99. package/dist/es/common/filterDescriptor.js +0 -2
  100. package/dist/es/common/settings.js +0 -8
  101. package/dist/es/common/utils.d.ts +0 -62
  102. package/dist/es/common/utils.js +0 -194
  103. package/dist/es/main.d.ts +0 -25
  104. package/dist/es/main.js +0 -19
  105. package/dist/es/messages/index.d.ts +0 -40
  106. package/dist/es/messages/index.js +0 -41
  107. package/dist/es/package-metadata.d.ts +0 -5
  108. package/dist/es/package-metadata.js +0 -11
  109. package/dist/npm/AutoComplete/AutoComplete.d.ts +0 -230
  110. package/dist/npm/AutoComplete/AutoComplete.js +0 -655
  111. package/dist/npm/AutoComplete/AutoCompleteProps.js +0 -3
  112. package/dist/npm/ComboBox/ComboBox.d.ts +0 -248
  113. package/dist/npm/ComboBox/ComboBox.js +0 -918
  114. package/dist/npm/ComboBox/ComboBoxProps.d.ts +0 -313
  115. package/dist/npm/ComboBox/ComboBoxProps.js +0 -3
  116. package/dist/npm/DropDownList/DropDownList.d.ts +0 -258
  117. package/dist/npm/DropDownList/DropDownList.js +0 -890
  118. package/dist/npm/DropDownList/DropDownListProps.d.ts +0 -326
  119. package/dist/npm/DropDownList/DropDownListProps.js +0 -3
  120. package/dist/npm/DropDownTree/DropDownTree.d.ts +0 -70
  121. package/dist/npm/DropDownTree/DropDownTree.js +0 -543
  122. package/dist/npm/DropDownTree/DropDownTreeProps.js +0 -3
  123. package/dist/npm/DropDownTree/ListNoData.d.ts +0 -6
  124. package/dist/npm/DropDownTree/ListNoData.js +0 -12
  125. package/dist/npm/DropDownTree/useDropdownWidth.d.ts +0 -5
  126. package/dist/npm/DropDownTree/useDropdownWidth.js +0 -17
  127. package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.d.ts +0 -287
  128. package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +0 -216
  129. package/dist/npm/MultiSelect/MultiSelect.js +0 -1113
  130. package/dist/npm/MultiSelect/MultiSelectProps.d.ts +0 -314
  131. package/dist/npm/MultiSelect/MultiSelectProps.js +0 -3
  132. package/dist/npm/MultiSelect/TagList.js +0 -41
  133. package/dist/npm/MultiSelectTree/MultiSelectTree.d.ts +0 -81
  134. package/dist/npm/MultiSelectTree/MultiSelectTree.js +0 -622
  135. package/dist/npm/MultiSelectTree/MultiSelectTreeProps.d.ts +0 -320
  136. package/dist/npm/MultiSelectTree/MultiSelectTreeProps.js +0 -3
  137. package/dist/npm/MultiSelectTree/utils.js +0 -196
  138. package/dist/npm/common/AdaptiveMode.js +0 -49
  139. package/dist/npm/common/ClearButton.d.ts +0 -14
  140. package/dist/npm/common/ClearButton.js +0 -41
  141. package/dist/npm/common/DropDownBase.js +0 -299
  142. package/dist/npm/common/GroupStickyHeader.d.ts +0 -24
  143. package/dist/npm/common/GroupStickyHeader.js +0 -36
  144. package/dist/npm/common/List.d.ts +0 -45
  145. package/dist/npm/common/List.js +0 -77
  146. package/dist/npm/common/ListContainer.d.ts +0 -18
  147. package/dist/npm/common/ListContainer.js +0 -45
  148. package/dist/npm/common/ListDefaultItem.d.ts +0 -16
  149. package/dist/npm/common/ListDefaultItem.js +0 -38
  150. package/dist/npm/common/ListFilter.js +0 -39
  151. package/dist/npm/common/ListGroupItem.js +0 -35
  152. package/dist/npm/common/ListItem.js +0 -46
  153. package/dist/npm/common/MultiColumnList.d.ts +0 -6
  154. package/dist/npm/common/MultiColumnList.js +0 -26
  155. package/dist/npm/common/Navigation.d.ts +0 -13
  156. package/dist/npm/common/Navigation.js +0 -37
  157. package/dist/npm/common/SearchBar.d.ts +0 -43
  158. package/dist/npm/common/SearchBar.js +0 -64
  159. package/dist/npm/common/VirtualScroll.js +0 -163
  160. package/dist/npm/common/constants.d.ts +0 -4
  161. package/dist/npm/common/constants.js +0 -7
  162. package/dist/npm/common/events.d.ts +0 -73
  163. package/dist/npm/common/events.js +0 -2
  164. package/dist/npm/common/filterDescriptor.js +0 -3
  165. package/dist/npm/common/settings.d.ts +0 -114
  166. package/dist/npm/common/settings.js +0 -11
  167. package/dist/npm/common/utils.js +0 -211
  168. package/dist/npm/main.d.ts +0 -25
  169. package/dist/npm/main.js +0 -62
  170. package/dist/npm/messages/index.js +0 -44
  171. package/dist/npm/package-metadata.d.ts +0 -5
  172. package/dist/npm/package-metadata.js +0 -14
  173. package/dist/systemjs/kendo-react-dropdowns.js +0 -1
  174. package/e2e-next/combobox.basic.ts +0 -24
  175. package/e2e-next/dropdownlist.basic.tests.ts +0 -24
  176. package/e2e-next/dropdowntree.basic.tests.ts +0 -24
  177. package/e2e-next/multicolumncombobox.basic.tests.ts +0 -24
@@ -1,287 +0,0 @@
1
- import * as React from 'react';
2
- import { ComboBoxBlurEvent, ComboBoxChangeEvent, ComboBoxCloseEvent, ComboBoxFilterChangeEvent, ComboBoxFocusEvent, ComboBoxOpenEvent, ComboBoxPageChangeEvent, ComboBoxProps } from '../ComboBox/ComboBoxProps';
3
- import { DropDownsPopupSettings, VirtualizationSettings } from '../common/settings';
4
- import { ListItemProps } from '../common/ListItem';
5
- /**
6
- * The represents the interface of the MultiColumnComboBox columns.
7
- */
8
- export interface MultiColumnComboBoxColumn {
9
- /**
10
- * The unique id of the column.
11
- */
12
- uniqueKey?: string;
13
- /**
14
- * The field of the column.
15
- */
16
- field?: string;
17
- /**
18
- * The header of the column.
19
- */
20
- header?: React.ReactNode;
21
- /**
22
- * Represents the width of the column. If the width is not specified it is applied the default width of `200px`.
23
- */
24
- width?: string | number;
25
- }
26
- /**
27
- * Represents the properties of the [MultiColumnComboBox]({% slug api_dropdowns_multicolumncombobox %}) component.
28
- */
29
- export interface MultiColumnComboBoxProps extends ComboBoxProps {
30
- /**
31
- * Determines the columns array of the MultiColumnComboBox.
32
- */
33
- columns: MultiColumnComboBoxColumn[];
34
- /**
35
- * Sets the data of the MultiColumnComboBox.
36
- */
37
- data?: any[];
38
- /**
39
- * Sets the opened and closed state of the MultiColumnComboBox.
40
- */
41
- opened?: boolean;
42
- /**
43
- * The styles that are applied to the MultiColumnComboBox.
44
- */
45
- style?: React.CSSProperties;
46
- /**
47
- * Sets the value of the MultiColumnComboBox. It can either be of the primitive (string, numbers) or of the complex (objects) type.
48
- */
49
- value?: any;
50
- /**
51
- * Sets the default value of the MultiColumnComboBox. Similar to the native `select` HTML element.
52
- */
53
- defaultValue?: any;
54
- /**
55
- * Sets additional classes to the MultiColumnComboBox.
56
- */
57
- className?: string;
58
- /**
59
- * If `clearButton` is set to `true`, the MultiColumnComboBox renders a button on hovering over the component. Clicking this button resets the value of the MultiColumnComboBox to `undefined` and triggers the `change` event.
60
- */
61
- clearButton?: boolean;
62
- /**
63
- * The hint that is displayed when the MultiColumnComboBox is empty.
64
- */
65
- placeholder?: string;
66
- /**
67
- * Specifies whether the MultiColumnComboBox allows user-defined values that are not present in the dataset. Defaults to `false`.
68
- */
69
- allowCustom?: boolean;
70
- /**
71
- * Sets the disabled state of the MultiColumnComboBox.
72
- */
73
- disabled?: boolean;
74
- /**
75
- * Enables the filtering functionality of the MultiColumnComboBox.
76
- */
77
- filterable?: boolean;
78
- /**
79
- * Sets the value of MultiColumnComboBox input. Useful for making the MultiColumnComboBox input a controlled component.
80
- */
81
- filter?: string | null;
82
- /**
83
- * Sets the loading state of the MultiColumnComboBox.
84
- */
85
- loading?: boolean;
86
- /**
87
- * Specifies the `tabIndex` of the MultiColumnComboBox.
88
- */
89
- tabIndex?: number;
90
- /**
91
- * Specifies the `accessKey` of the MultiColumnComboBox.
92
- */
93
- accessKey?: string;
94
- /**
95
- * Sets the key for comparing the data items of the MultiColumnComboBox. If `dataItemKey` is not set, the MultiColumnComboBox compares the items by reference.
96
- */
97
- dataItemKey?: string;
98
- /**
99
- * Renders a floating label for the MultiColumnComboBox.
100
- */
101
- label?: string;
102
- /**
103
- * Configures the popup of the MultiColumnComboBox.
104
- */
105
- popupSettings?: DropDownsPopupSettings;
106
- /**
107
- * Configures the virtual scrolling of the MultiColumnComboBox.
108
- */
109
- virtual?: VirtualizationSettings;
110
- /**
111
- * If set, the MultiColumnComboBox will use it to get the focused item index. Default functionality returns the first item which starts with the input text.
112
- */
113
- focusedItemIndex?: (data: any, inputText: string, textField?: string) => number;
114
- /**
115
- * Fires each time the popup of the MultiColumnComboBox is about to open.
116
- */
117
- onOpen?: (event: ComboBoxOpenEvent) => void;
118
- /**
119
- * Fires each time the popup of the MultiColumnComboBox is about to close.
120
- */
121
- onClose?: (event: ComboBoxCloseEvent) => void;
122
- /**
123
- * Fires each time the user focuses the MultiColumnComboBox.
124
- */
125
- onFocus?: (event: ComboBoxFocusEvent) => void;
126
- /**
127
- * Fires each time the MultiColumnComboBox gets blurred.
128
- */
129
- onBlur?: (event: ComboBoxBlurEvent) => void;
130
- /**
131
- * Fires each time the value of the MultiColumnComboBox is about to change.
132
- */
133
- onChange?: (event: ComboBoxChangeEvent) => void;
134
- /**
135
- * Fires each time the user types in the filter input. You can filter the source based on the passed filtration value.
136
- */
137
- onFilterChange?: (event: ComboBoxFilterChangeEvent) => void;
138
- /**
139
- * Fires when both the virtual scrolling of the MultiColumnComboBox is enabled and the component requires data for another page.
140
- */
141
- onPageChange?: (event: ComboBoxPageChangeEvent) => void;
142
- /**
143
- * @hidden
144
- */
145
- onGroupScroll?: (event: {
146
- group?: string;
147
- }) => void;
148
- /**
149
- * Fires when a MultiColumnComboBox list item is about to be rendered. Used to override the default appearance of the list items.
150
- */
151
- itemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListItemProps) => React.ReactNode;
152
- /**
153
- * Sets the header component of the MultiColumnComboBox.
154
- */
155
- header?: React.ReactNode;
156
- /**
157
- * Sets the footer component of the MultiColumnComboBox.
158
- */
159
- footer?: React.ReactNode;
160
- /**
161
- * Configures the `size` of the MultiColumnComboBox.
162
- *
163
- * The available options are:
164
- * - small
165
- * - medium
166
- * - large
167
- * - null&mdash;Does not set a size `className`.
168
- *
169
- * @default `medium`
170
- */
171
- size?: null | 'small' | 'medium' | 'large';
172
- /**
173
- * Configures the `roundness` of the MultiColumnComboBox.
174
- *
175
- * The available options are:
176
- * - small
177
- * - medium
178
- * - large
179
- * - full
180
- * - null&mdash;Does not set a rounded `className`.
181
- *
182
- * @default `medium`
183
- */
184
- rounded?: null | 'small' | 'medium' | 'large' | 'full';
185
- /**
186
- * Configures the `fillMode` of the MultiColumnComboBox.
187
- *
188
- * The available options are:
189
- * - solid
190
- * - flat
191
- * - outline
192
- * - null&mdash;Does not set a fillMode `className`.
193
- *
194
- * @default `solid`
195
- */
196
- fillMode?: null | 'solid' | 'flat' | 'outline';
197
- }
198
- /**
199
- * Represents the target(element and props) of the MultiColumnComboBoxChangeEvent.
200
- */
201
- export interface MultiColumnComboBoxHandle {
202
- /**
203
- * The current element or `null` of there is no one.
204
- */
205
- element: HTMLSpanElement | null;
206
- /**
207
- * The value of the MultiColumnComboBox.
208
- */
209
- value: any;
210
- /**
211
- * The props values of the MultiColumnComboBox.
212
- */
213
- props: MultiColumnComboBoxProps;
214
- /**
215
- * The focus event callback.
216
- */
217
- focus: () => void;
218
- }
219
- /**
220
- * Represents the type of the MultiColumnComboBoxChangeEvent.
221
- */
222
- export interface MultiColumnComboBoxChangeEvent {
223
- /**
224
- * The value of the MultiColumnComboBoxChangeEvent.
225
- */
226
- value: any;
227
- /**
228
- * The target of the MultiColumnComboBoxChangeEvent from MultiColumnComboBoxHandle.
229
- */
230
- target: MultiColumnComboBoxHandle;
231
- /**
232
- * The event of the MultiColumnComboBoxChangeEvent.
233
- */
234
- syntheticEvent: React.SyntheticEvent<any>;
235
- }
236
- /**
237
- * Represents the PropsContext of the `MultiColumnComboBox` component.
238
- * Used for global configuration of all `MultiColumnComboBox` instances.
239
- *
240
- * For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
241
- */
242
- export declare const MultiColumnComboBoxPropsContext: React.Context<(p: MultiColumnComboBoxProps) => MultiColumnComboBoxProps>;
243
- /**
244
- * Represents the MultiColumnComboBox component.
245
- *
246
- * Accepts properties of type [MultiColumnComboBoxProps]({% slug api_dropdowns_multicolumncomboboxprops %}).
247
- * Obtaining the `ref` returns an object of type [MultiColumnComboBoxHandle]({% slug api_dropdowns_multicolumncomboboxhandle %}).
248
- *
249
- * @example
250
- * ```jsx
251
- * const columns = [
252
- * {
253
- * field: "id",
254
- * header: "ID",
255
- * width: "100px",
256
- * },
257
- * {
258
- * field: "name",
259
- * header: "Name",
260
- * width: "300px",
261
- * },
262
- * {
263
- * field: "position",
264
- * header: "Position",
265
- * width: "300px",
266
- * },
267
- * ];
268
- * const App = () => {
269
- * return (
270
- * <div>
271
- * <div>Employees:</div>
272
- * <MultiColumnComboBox
273
- * data={employees}
274
- * columns={columns}
275
- * textField={"name"}
276
- * style={{
277
- * width: "300px",
278
- * }}
279
- * placeholder="Please select ..."
280
- * />
281
- * </div>
282
- * );
283
- * };
284
- * ReactDOM.render(<App />, document.querySelector("my-app"));
285
- * ```
286
- */
287
- export declare const MultiColumnComboBox: React.ForwardRefExoticComponent<MultiColumnComboBoxProps & React.RefAttributes<MultiColumnComboBoxHandle | null>>;
@@ -1,216 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.MultiColumnComboBox = exports.MultiColumnComboBoxPropsContext = void 0;
26
- var React = require("react");
27
- var PropTypes = require("prop-types");
28
- var kendo_react_popup_1 = require("@progress/kendo-react-popup");
29
- var MultiColumnList_1 = require("./../common/MultiColumnList");
30
- var kendo_react_common_1 = require("@progress/kendo-react-common");
31
- var ComboBox_1 = require("../ComboBox/ComboBox");
32
- var utils_1 = require("../common/utils");
33
- var columnWidth = function (width, defaultWidth) {
34
- if (width) {
35
- return typeof width === 'number' ? width + 'px' : width;
36
- }
37
- return defaultWidth;
38
- };
39
- /**
40
- * Represents the PropsContext of the `MultiColumnComboBox` component.
41
- * Used for global configuration of all `MultiColumnComboBox` instances.
42
- *
43
- * For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
44
- */
45
- exports.MultiColumnComboBoxPropsContext = (0, kendo_react_common_1.createPropsContext)();
46
- /**
47
- * Represents the MultiColumnComboBox component.
48
- *
49
- * Accepts properties of type [MultiColumnComboBoxProps]({% slug api_dropdowns_multicolumncomboboxprops %}).
50
- * Obtaining the `ref` returns an object of type [MultiColumnComboBoxHandle]({% slug api_dropdowns_multicolumncomboboxhandle %}).
51
- *
52
- * @example
53
- * ```jsx
54
- * const columns = [
55
- * {
56
- * field: "id",
57
- * header: "ID",
58
- * width: "100px",
59
- * },
60
- * {
61
- * field: "name",
62
- * header: "Name",
63
- * width: "300px",
64
- * },
65
- * {
66
- * field: "position",
67
- * header: "Position",
68
- * width: "300px",
69
- * },
70
- * ];
71
- * const App = () => {
72
- * return (
73
- * <div>
74
- * <div>Employees:</div>
75
- * <MultiColumnComboBox
76
- * data={employees}
77
- * columns={columns}
78
- * textField={"name"}
79
- * style={{
80
- * width: "300px",
81
- * }}
82
- * placeholder="Please select ..."
83
- * />
84
- * </div>
85
- * );
86
- * };
87
- * ReactDOM.render(<App />, document.querySelector("my-app"));
88
- * ```
89
- */
90
- exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
91
- var props = (0, kendo_react_common_1.usePropsContext)(exports.MultiColumnComboBoxPropsContext, directProps);
92
- var target = React.useRef(null);
93
- var comboBoxRef = React.useRef(null);
94
- var scrollbarWidth = (0, kendo_react_common_1.getScrollbarWidth)();
95
- var _a = props.columns, columns = _a === void 0 ? defaultProps.columns : _a, _b = props.popupSettings, popupSettings = _b === void 0 ? defaultProps.popupSettings : _b, className = props.className, size = props.size, onOpen = props.onOpen, onClose = props.onClose, onFocus = props.onFocus, onBlur = props.onBlur, onChange = props.onChange, onFilterChange = props.onFilterChange, onPageChange = props.onPageChange, other = __rest(props, ["columns", "popupSettings", "className", "size", "onOpen", "onClose", "onFocus", "onBlur", "onChange", "onFilterChange", "onPageChange"]);
96
- React.useImperativeHandle(target, function () {
97
- return ({
98
- element: comboBoxRef.current && comboBoxRef.current.element,
99
- focus: function () {
100
- if (comboBoxRef.current) {
101
- comboBoxRef.current.focus();
102
- }
103
- },
104
- get value() { return comboBoxRef.current && comboBoxRef.current.value; },
105
- get name() { return comboBoxRef.current && comboBoxRef.current.name; },
106
- props: props
107
- });
108
- });
109
- React.useImperativeHandle(ref, function () { return target.current; });
110
- var initialGroupHeader = React.useMemo(function () {
111
- if (props.groupField !== undefined && props.data) {
112
- return (0, utils_1.getItemValue)(props.data[0], props.groupField);
113
- }
114
- }, [props.data, props.groupField]);
115
- var _c = React.useState(initialGroupHeader), groupHeader = _c[0], setGroupHeader = _c[1];
116
- var _d = React.useState(true), showStickyHeader = _d[0], setShowStickyHeader = _d[1];
117
- var header = React.useMemo(function () {
118
- var renderer = (React.createElement("th", { className: 'k-table-th', colSpan: columns.length }, groupHeader));
119
- return (React.createElement(React.Fragment, null,
120
- props.header,
121
- React.createElement("div", { className: "k-table-header-wrap" },
122
- React.createElement("table", { className: "k-table", role: "presentation" },
123
- React.createElement("colgroup", null, columns.map(function (column, i) {
124
- return (React.createElement("col", { key: column.uniqueKey ? column.uniqueKey : i, style: { width: column.width ? column.width : defaultProps.width } }));
125
- })),
126
- React.createElement("thead", { className: 'k-table-thead' },
127
- React.createElement("tr", { className: 'k-table-row' }, columns.map(function (column, i) {
128
- return (React.createElement("th", { className: "k-table-th", key: column.uniqueKey ? column.uniqueKey : i }, column.header || '\u00A0'));
129
- })),
130
- groupHeader && showStickyHeader && React.createElement("tr", { className: 'k-table-group-row' }, props.groupStickyHeaderItemRender ? props.groupStickyHeaderItemRender.call(undefined, renderer, {}) : renderer))))));
131
- }, [props.header, columns, groupHeader, showStickyHeader]);
132
- var popupWidth = React.useMemo(function () {
133
- // These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
134
- return "calc(".concat(columns.map(function (column) { return columnWidth(column.width, defaultProps.width); }).filter(Boolean).join(' + '), " + ").concat(scrollbarWidth, "px + 4px)");
135
- }, [columns, scrollbarWidth]);
136
- var skip = props.virtual ? props.virtual.skip : 0;
137
- var itemRender = React.useCallback(function (li, liProps) {
138
- var children = columns.map(function (column, i) { return (React.createElement("span", { className: !props.itemRender ? 'k-table-td' : undefined, style: !props.itemRender ? { width: column.width ? column.width : defaultProps.width } : undefined, key: column.uniqueKey ? column.uniqueKey : i }, column.field ? String((0, kendo_react_common_1.getter)(column.field)(liProps.dataItem)) : '')); });
139
- var group = undefined;
140
- var curGroup, prevGroup, groupGetter, data = props.data || [];
141
- var index = liProps.index - skip;
142
- if (props.groupField !== undefined) {
143
- groupGetter = (0, kendo_react_common_1.getter)(props.groupField);
144
- curGroup = groupGetter(data[index]);
145
- prevGroup = groupGetter(data[index - 1]);
146
- if (curGroup && prevGroup && curGroup !== prevGroup) {
147
- group = curGroup;
148
- }
149
- }
150
- if (group && props.groupMode === 'classic') {
151
- children.push(React.createElement("div", { key: "group", className: "k-table-td k-table-group-td" },
152
- React.createElement("span", null, group)));
153
- }
154
- var rendering = React.cloneElement(li, __assign(__assign({}, li.props), { className: (0, kendo_react_common_1.classNames)('k-table-row', {
155
- 'k-table-alt-row': liProps.index % 2 !== 0,
156
- 'k-focus': liProps.focused,
157
- 'k-selected': liProps.selected,
158
- 'k-first': Boolean(group),
159
- 'k-disabled': liProps.dataItem.disabled
160
- }) }), children);
161
- return props.itemRender ? props.itemRender.call(undefined, rendering, liProps) : rendering;
162
- }, [columns, props.groupField, props.itemRender, props.data, skip]);
163
- var handleEvent = React.useCallback(function (handler, event) {
164
- if (handler) {
165
- handler.call(undefined, __assign(__assign({}, event), { target: target.current }));
166
- }
167
- }, []);
168
- var onOpenHandler = React.useCallback(function (event) {
169
- // Resets the sticky header group value for scenarios with open/close of component's popup
170
- if (!props.virtual) {
171
- setGroupHeader(initialGroupHeader);
172
- }
173
- ;
174
- return handleEvent(onOpen, event);
175
- }, [handleEvent, onOpen, props.virtual, initialGroupHeader]);
176
- var onCloseHandler = React.useCallback(function (event) { return handleEvent(onClose, event); }, [onClose]);
177
- var onFocusHandler = React.useCallback(function (event) { return handleEvent(onFocus, event); }, [onFocus]);
178
- var onBlurHandler = React.useCallback(function (event) { return handleEvent(onBlur, event); }, [onBlur]);
179
- var onChangeHandler = React.useCallback(function (event) { return handleEvent(onChange, event); }, [onChange]);
180
- var onPageChangeHandler = React.useCallback(function (event) { return handleEvent(onPageChange, event); }, [onPageChange]);
181
- var onFilterChangeHandler = React.useCallback(function (event) {
182
- setGroupHeader(initialGroupHeader);
183
- return handleEvent(onFilterChange, __assign(__assign({}, event), { mobileMode: event.target.mobileMode }));
184
- }, [onFilterChange]);
185
- var onGroupScroll = React.useCallback(function (event) {
186
- setGroupHeader(event.group);
187
- }, []);
188
- React.useEffect(function () { (0, kendo_react_common_1.setScrollbarWidth)(); });
189
- React.useEffect(function () {
190
- var data = props.data;
191
- setGroupHeader(initialGroupHeader);
192
- if (data && data.length !== 0) {
193
- setShowStickyHeader(true);
194
- }
195
- else {
196
- setShowStickyHeader(false);
197
- }
198
- ;
199
- }, [props.data]);
200
- var List = React.useCallback(function (listProps) { return React.createElement(MultiColumnList_1.MultiColumnList, __assign({}, listProps)); }, []);
201
- return (React.createElement(kendo_react_popup_1.PopupPropsContext.Provider, { value: function (PopupProps) { return (__assign(__assign({}, PopupProps), { popupClass: "k-dropdowngrid-popup ".concat(popupSettings.popupClass) })); } },
202
- React.createElement(ComboBox_1.ComboBox, __assign({}, other, { list: List, popupSettings: __assign(__assign({ width: popupWidth }, popupSettings), { className: popupSettings.className }), ref: comboBoxRef, header: header, itemRender: itemRender, groupHeaderItemRender: props.groupHeaderItemRender, size: props.size, rounded: props.rounded, fillMode: props.fillMode, groupMode: props.groupMode, groupField: props.groupField, isMultiColumn: true, onOpen: onOpenHandler, onClose: onCloseHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, onChange: onChangeHandler, onFilterChange: onFilterChangeHandler, onPageChange: onPageChangeHandler, onGroupScroll: onGroupScroll, className: (0, kendo_react_common_1.classNames)('k-dropdowngrid', className), required: props.required, adaptive: props.adaptive, adaptiveFilter: props.adaptiveFilter, adaptiveTitle: props.adaptiveTitle, footer: props.footer, footerClassName: 'k-table-footer' }))));
203
- });
204
- var propTypes = __assign(__assign({}, ComboBox_1.ComboBoxWithoutContext.propTypes), { columns: PropTypes.any.isRequired });
205
- var defaultProps = {
206
- columns: [],
207
- popupSettings: {},
208
- width: '200px',
209
- size: 'medium',
210
- rounded: 'medium',
211
- fillMode: 'solid'
212
- };
213
- exports.MultiColumnComboBox.displayName = 'KendoMultiColumnComboBox';
214
- // TODO: delete casting when @types/react is updated!
215
- exports.MultiColumnComboBox.propTypes = propTypes;
216
- exports.MultiColumnComboBox.defaultProps = defaultProps;