@progress/kendo-vue-buttons 3.5.0 → 3.5.1-dev.202208150613
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/cdn/js/kendo-vue-buttons.js +1 -1
- package/dist/es/Button.js +1 -1
- package/dist/es/ButtonGroupInterface.js +1 -0
- package/dist/es/ButtonInterface.js +1 -0
- package/dist/es/Chip/Chip.js +1 -1
- package/dist/es/Chip/ChipList.js +1 -1
- package/dist/es/Chip/selection-reducer.js +8 -12
- package/dist/es/FloatingActionButton/FloatingActionButton.js +8 -8
- package/dist/es/FloatingActionButton/FloatingActionButtonItem.js +3 -3
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +1 -0
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +1 -0
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.js +1 -0
- package/dist/es/FloatingActionButton/models/align-offset.js +1 -0
- package/dist/es/FloatingActionButton/models/align.js +1 -0
- package/dist/es/FloatingActionButton/models/events.js +1 -0
- package/dist/es/FloatingActionButton/models/position-mode.js +1 -0
- package/dist/es/FloatingActionButton/models/shape.js +1 -0
- package/dist/es/FloatingActionButton/models/size.js +1 -0
- package/dist/es/FloatingActionButton/models/theme-color.js +1 -0
- package/dist/es/FloatingActionButton/utils.js +2 -2
- package/dist/es/ListButton/ButtonItem.js +1 -1
- package/dist/es/ListButton/DropDownButton.js +8 -8
- package/dist/es/ListButton/SplitButton.js +8 -8
- package/dist/es/ListButton/models/ButtonItemInterface.js +1 -0
- package/dist/es/ListButton/models/ListButtonProps.js +1 -0
- package/dist/es/ListButton/models/PopupSettings.js +1 -0
- package/dist/es/ListButton/models/events.js +1 -0
- package/dist/es/buttonLook.js +1 -0
- package/dist/es/models/index.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/util.d.ts +3 -3
- package/dist/esm/Button.d.ts +123 -0
- package/dist/esm/Button.js +280 -0
- package/dist/esm/ButtonGroup.d.ts +49 -0
- package/dist/esm/ButtonGroup.js +106 -0
- package/dist/esm/ButtonGroupInterface.d.ts +30 -0
- package/dist/esm/ButtonGroupInterface.js +2 -0
- package/dist/esm/ButtonInterface.d.ts +56 -0
- package/dist/esm/ButtonInterface.js +2 -0
- package/dist/esm/ButtonWrap.d.ts +19 -0
- package/dist/esm/ButtonWrap.js +33 -0
- package/dist/esm/Chip/Chip.d.ts +199 -0
- package/dist/esm/Chip/Chip.js +339 -0
- package/dist/esm/Chip/ChipList.d.ts +174 -0
- package/dist/esm/Chip/ChipList.js +263 -0
- package/dist/esm/Chip/data-reducer.d.ts +21 -0
- package/dist/esm/Chip/data-reducer.js +34 -0
- package/dist/esm/Chip/focus-reducer.d.ts +24 -0
- package/dist/esm/Chip/focus-reducer.js +38 -0
- package/dist/esm/Chip/selection-reducer.d.ts +29 -0
- package/dist/esm/Chip/selection-reducer.js +102 -0
- package/dist/esm/FloatingActionButton/FloatingActionButton.d.ts +49 -0
- package/dist/esm/FloatingActionButton/FloatingActionButton.js +494 -0
- package/dist/esm/FloatingActionButton/FloatingActionButtonItem.d.ts +118 -0
- package/dist/esm/FloatingActionButton/FloatingActionButtonItem.js +121 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +13 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +1 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +24 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +1 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +243 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonProps.js +1 -0
- package/dist/esm/FloatingActionButton/models/align-offset.d.ts +20 -0
- package/dist/esm/FloatingActionButton/models/align-offset.js +1 -0
- package/dist/esm/FloatingActionButton/models/align.d.ts +27 -0
- package/dist/esm/FloatingActionButton/models/align.js +1 -0
- package/dist/esm/FloatingActionButton/models/events.d.ts +18 -0
- package/dist/esm/FloatingActionButton/models/events.js +2 -0
- package/dist/esm/FloatingActionButton/models/position-mode.d.ts +9 -0
- package/dist/esm/FloatingActionButton/models/position-mode.js +1 -0
- package/dist/esm/FloatingActionButton/models/shape.d.ts +13 -0
- package/dist/esm/FloatingActionButton/models/shape.js +1 -0
- package/dist/esm/FloatingActionButton/models/size.d.ts +10 -0
- package/dist/esm/FloatingActionButton/models/size.js +1 -0
- package/dist/esm/FloatingActionButton/models/theme-color.d.ts +17 -0
- package/dist/esm/FloatingActionButton/models/theme-color.js +1 -0
- package/dist/esm/FloatingActionButton/utils.d.ts +27 -0
- package/dist/esm/FloatingActionButton/utils.js +93 -0
- package/dist/esm/ListButton/ButtonItem.d.ts +58 -0
- package/dist/esm/ListButton/ButtonItem.js +138 -0
- package/dist/esm/ListButton/DropDownButton.d.ts +66 -0
- package/dist/esm/ListButton/DropDownButton.js +453 -0
- package/dist/esm/ListButton/SplitButton.d.ts +67 -0
- package/dist/esm/ListButton/SplitButton.js +515 -0
- package/dist/esm/ListButton/models/ButtonItemInterface.d.ts +29 -0
- package/dist/esm/ListButton/models/ButtonItemInterface.js +2 -0
- package/dist/esm/ListButton/models/ListButtonProps.d.ts +328 -0
- package/dist/esm/ListButton/models/ListButtonProps.js +2 -0
- package/dist/esm/ListButton/models/PopupSettings.d.ts +24 -0
- package/dist/esm/ListButton/models/PopupSettings.js +1 -0
- package/dist/esm/ListButton/models/events.d.ts +48 -0
- package/dist/esm/ListButton/models/events.js +1 -0
- package/dist/esm/ListButton/utils/navigation.d.ts +5 -0
- package/dist/esm/ListButton/utils/navigation.js +24 -0
- package/dist/esm/ListButton/utils/popup.d.ts +9 -0
- package/dist/esm/ListButton/utils/popup.js +20 -0
- package/dist/esm/additionalTypes.ts +21 -0
- package/dist/esm/buttonLook.d.ts +13 -0
- package/dist/esm/buttonLook.js +1 -0
- package/dist/esm/main.d.ts +30 -0
- package/dist/esm/main.js +15 -0
- package/dist/esm/models/index.d.ts +87 -0
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/package-metadata.d.ts +5 -0
- package/dist/esm/package-metadata.js +11 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/toolbar/Toolbar.d.ts +112 -0
- package/dist/esm/toolbar/Toolbar.js +208 -0
- package/dist/esm/toolbar/tools/ToolbarItem.d.ts +64 -0
- package/dist/esm/toolbar/tools/ToolbarItem.js +58 -0
- package/dist/esm/toolbar/tools/ToolbarSeparator.d.ts +36 -0
- package/dist/esm/toolbar/tools/ToolbarSeparator.js +56 -0
- package/dist/esm/toolbar/tools/ToolbarSpacer.d.ts +36 -0
- package/dist/esm/toolbar/tools/ToolbarSpacer.js +53 -0
- package/dist/esm/util.d.ts +31 -0
- package/dist/esm/util.js +40 -0
- package/dist/npm/Button.js +5 -5
- package/dist/npm/ButtonGroup.js +4 -4
- package/dist/npm/ButtonWrap.js +1 -1
- package/dist/npm/Chip/Chip.js +10 -10
- package/dist/npm/Chip/ChipList.js +8 -8
- package/dist/npm/Chip/data-reducer.js +4 -2
- package/dist/npm/Chip/focus-reducer.js +4 -2
- package/dist/npm/Chip/selection-reducer.js +12 -14
- package/dist/npm/FloatingActionButton/FloatingActionButton.js +31 -31
- package/dist/npm/FloatingActionButton/FloatingActionButtonItem.js +8 -8
- package/dist/npm/FloatingActionButton/utils.js +14 -9
- package/dist/npm/ListButton/ButtonItem.js +1 -1
- package/dist/npm/ListButton/DropDownButton.js +19 -19
- package/dist/npm/ListButton/SplitButton.js +19 -19
- package/dist/npm/main.js +6 -2
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/toolbar/Toolbar.js +2 -2
- package/dist/npm/toolbar/tools/ToolbarItem.js +1 -1
- package/dist/npm/util.d.ts +3 -3
- package/package.json +11 -5
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { ChipRemoveEvent, ChipMouseEvent, ChipFocusEvent, ChipKeyboardEvent } from './../models/index';
|
|
7
|
+
/**
|
|
8
|
+
* Represents the properties of [Chip]({% slug api_buttons_chip %}) component.
|
|
9
|
+
*/
|
|
10
|
+
export interface ChipProps {
|
|
11
|
+
/**
|
|
12
|
+
* Sets the `id` property of the top div element of the Chip.
|
|
13
|
+
*/
|
|
14
|
+
id?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Sets the `tabIndex` attribute.
|
|
17
|
+
*/
|
|
18
|
+
tabIndex?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the label text of the Chip.
|
|
21
|
+
*/
|
|
22
|
+
text?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Sets the `id` value of the Chip.
|
|
25
|
+
*/
|
|
26
|
+
value?: any;
|
|
27
|
+
/**
|
|
28
|
+
* Sets the `type` of the Chip element - 'warning', 'error', 'success', 'info', by default - 'none'.
|
|
29
|
+
*/
|
|
30
|
+
type?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The Chip direction 'ltr' as default or 'rtl'.
|
|
33
|
+
*/
|
|
34
|
+
dir?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Determines if the Chip could be removed.
|
|
37
|
+
*/
|
|
38
|
+
removable?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Determines if the Chip has custom `removeIcon`.
|
|
41
|
+
*/
|
|
42
|
+
removeIcon?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Determines if the Chip is disabled.
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Determines if the Chip has an `icon`.
|
|
49
|
+
*/
|
|
50
|
+
icon?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Determines if the Chip has custom selection `icon`.
|
|
53
|
+
*/
|
|
54
|
+
selectedIcon?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Determines if the Chip style is `filled` or `outlined`.
|
|
57
|
+
*/
|
|
58
|
+
look?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Configures the `size` of the Chip.
|
|
61
|
+
*
|
|
62
|
+
* The available options are:
|
|
63
|
+
* - small
|
|
64
|
+
* - medium
|
|
65
|
+
* - large
|
|
66
|
+
* - null—Does not set a size `class`.
|
|
67
|
+
*
|
|
68
|
+
* @default `medium`
|
|
69
|
+
*/
|
|
70
|
+
size?: null | 'small' | 'medium' | 'large' | string;
|
|
71
|
+
/**
|
|
72
|
+
* Configures the `roundness` of the Chip.
|
|
73
|
+
*
|
|
74
|
+
* The available options are:
|
|
75
|
+
* - small
|
|
76
|
+
* - medium
|
|
77
|
+
* - large
|
|
78
|
+
* - full
|
|
79
|
+
* - null—Does not set a rounded `class`.
|
|
80
|
+
*
|
|
81
|
+
* @default `medium`
|
|
82
|
+
*/
|
|
83
|
+
rounded?: null | 'small' | 'medium' | 'large' | 'full' | string;
|
|
84
|
+
/**
|
|
85
|
+
* Configures the `fillMode` of the Chip.
|
|
86
|
+
*
|
|
87
|
+
* The available options are:
|
|
88
|
+
* - solid
|
|
89
|
+
* - outline
|
|
90
|
+
* - flat
|
|
91
|
+
* - null—Does not set a fillMode `class`.
|
|
92
|
+
*
|
|
93
|
+
* @default `solid`
|
|
94
|
+
*/
|
|
95
|
+
fillMode?: null | 'solid' | 'outline' | 'flat' | string;
|
|
96
|
+
/**
|
|
97
|
+
* Configures the `themeColor` of the Chip.
|
|
98
|
+
*
|
|
99
|
+
* The available options are:
|
|
100
|
+
* - base
|
|
101
|
+
* - info
|
|
102
|
+
* - success
|
|
103
|
+
* - warning
|
|
104
|
+
* - error
|
|
105
|
+
* - null—Does not set a themeColor `class`.
|
|
106
|
+
*
|
|
107
|
+
* @default `base`
|
|
108
|
+
*/
|
|
109
|
+
themeColor?: null | 'base' | 'info' | 'success' | 'warning' | 'error' | string;
|
|
110
|
+
/**
|
|
111
|
+
* Triggered on Chip removing.
|
|
112
|
+
*/
|
|
113
|
+
onRemove?: (event: ChipRemoveEvent) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Triggered on onClick event.
|
|
116
|
+
*/
|
|
117
|
+
onClick?: (event: ChipMouseEvent) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Triggered on onKeyDown event.
|
|
120
|
+
*/
|
|
121
|
+
onKeydown?: (event: ChipKeyboardEvent) => void;
|
|
122
|
+
/**
|
|
123
|
+
* Triggered on onFocus event.
|
|
124
|
+
*/
|
|
125
|
+
onFocus?: (event: ChipFocusEvent) => void;
|
|
126
|
+
/**
|
|
127
|
+
* Triggered on onBlur event.
|
|
128
|
+
*/
|
|
129
|
+
onBlur?: (event: ChipFocusEvent) => void;
|
|
130
|
+
/**
|
|
131
|
+
* Represents the item data, coming from the `ChipList` component.
|
|
132
|
+
*/
|
|
133
|
+
dataItem?: any;
|
|
134
|
+
/**
|
|
135
|
+
* Determines if the Chip is selected.
|
|
136
|
+
*/
|
|
137
|
+
selected?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Identifies the element(s) which will describe the component, similar to HTML aria-describedby attribute.
|
|
140
|
+
* For example these elements could contain error or hint message.
|
|
141
|
+
*/
|
|
142
|
+
ariaDescribedBy?: string;
|
|
143
|
+
/**
|
|
144
|
+
* @hidden
|
|
145
|
+
*/
|
|
146
|
+
role?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Represents the target(element and props) of the ChipRemoveEvent.
|
|
150
|
+
*/
|
|
151
|
+
export interface ChipHandle {
|
|
152
|
+
/**
|
|
153
|
+
* The current element or `null` if there is no one.
|
|
154
|
+
*/
|
|
155
|
+
element: HTMLDivElement | null;
|
|
156
|
+
/**
|
|
157
|
+
* The props values of the Chip.
|
|
158
|
+
*/
|
|
159
|
+
props: ChipProps;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @hidden
|
|
163
|
+
*/
|
|
164
|
+
export interface ChipMethods {
|
|
165
|
+
[key: string]: any;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* @hidden
|
|
169
|
+
*/
|
|
170
|
+
export interface ChipState {
|
|
171
|
+
v3: boolean;
|
|
172
|
+
target: any;
|
|
173
|
+
currentRtl: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* @hidden
|
|
177
|
+
*/
|
|
178
|
+
export interface ChipData {
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @hidden
|
|
182
|
+
*/
|
|
183
|
+
export interface ChipComputed {
|
|
184
|
+
[key: string]: any;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* @hidden
|
|
188
|
+
*/
|
|
189
|
+
export interface ChipAll extends ChipMethods, ChipState, ChipData, ChipComputed, Vue2type {
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @hidden
|
|
193
|
+
*/
|
|
194
|
+
declare let ChipVue2: ComponentOptions<Vue2type, DefaultData<ChipData>, DefaultMethods<ChipAll>, ChipComputed, RecordPropsDefinition<ChipProps>>;
|
|
195
|
+
/**
|
|
196
|
+
* @hidden
|
|
197
|
+
*/
|
|
198
|
+
declare const Chip: DefineComponent<ChipProps, any, ChipData, ChipComputed, ChipMethods, {}, {}, {}, string, ChipProps, ChipProps, {}>;
|
|
199
|
+
export { Chip, ChipVue2 };
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
+
var ref = allVue.ref; // import { ChipListSelectionContext, ChipListFocusContext, ChipListDataContext } from './ChipList.js';
|
|
7
|
+
|
|
8
|
+
import { classNames, getTabIndex, Keys, noop, validatePackage, kendoThemeMaps, setRef, getRef } from '@progress/kendo-vue-common';
|
|
9
|
+
import { FOCUS_ACTION } from './focus-reducer.js';
|
|
10
|
+
import { DATA_ACTION } from './data-reducer.js';
|
|
11
|
+
import { SELECTION_ACTION } from './selection-reducer.js';
|
|
12
|
+
import { packageMetadata } from '../package-metadata.js';
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var ChipVue2 = {
|
|
18
|
+
name: 'KendoVueChip',
|
|
19
|
+
props: {
|
|
20
|
+
id: String,
|
|
21
|
+
text: String,
|
|
22
|
+
value: [String, Object],
|
|
23
|
+
type: String,
|
|
24
|
+
dir: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: function _default() {
|
|
27
|
+
return 'ltr';
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
removable: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
removeIcon: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: function _default() {
|
|
37
|
+
return 'k-i-close-circle';
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
icon: String,
|
|
45
|
+
selectedIcon: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: function _default() {
|
|
48
|
+
return 'k-i-check';
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
look: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: function _default() {
|
|
54
|
+
return 'solid';
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
size: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: 'medium'
|
|
60
|
+
},
|
|
61
|
+
rounded: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: 'medium'
|
|
64
|
+
},
|
|
65
|
+
fillMode: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'solid',
|
|
68
|
+
validator: function validator(value) {
|
|
69
|
+
return [null, 'flat', 'outline', 'solid'].includes(value);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
// eslint-disable-next-line max-len
|
|
73
|
+
themeColor: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: 'base',
|
|
76
|
+
validator: function validator(value) {
|
|
77
|
+
return [null, 'base', 'error', 'info', 'success', 'warning'].includes(value);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
dataItem: Object,
|
|
81
|
+
selected: Boolean,
|
|
82
|
+
ariaDescribedBy: String
|
|
83
|
+
},
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
emits: {
|
|
86
|
+
'click': null,
|
|
87
|
+
'keydown': null,
|
|
88
|
+
'blur': null,
|
|
89
|
+
'focus': null,
|
|
90
|
+
'remove': null
|
|
91
|
+
},
|
|
92
|
+
inject: {
|
|
93
|
+
kendoSelection: {
|
|
94
|
+
default: {
|
|
95
|
+
value: null
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
kendoFocused: {
|
|
99
|
+
default: {
|
|
100
|
+
value: null
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
kendoDataItems: {
|
|
104
|
+
default: null
|
|
105
|
+
},
|
|
106
|
+
handleDispatchDataItems: {
|
|
107
|
+
default: noop
|
|
108
|
+
},
|
|
109
|
+
handleDispatchSelection: {
|
|
110
|
+
default: noop
|
|
111
|
+
},
|
|
112
|
+
handleDispatchFocus: {
|
|
113
|
+
default: noop
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
created: function created() {
|
|
117
|
+
this.currentDir = undefined;
|
|
118
|
+
validatePackage(packageMetadata);
|
|
119
|
+
},
|
|
120
|
+
mounted: function mounted() {
|
|
121
|
+
this.chip = getRef(this, 'chip');
|
|
122
|
+
this.currentDir = this.$props.dir !== undefined ? this.$props.dir === 'rtl' : this.$el && getComputedStyle(this.$el).direction === 'rtl' || false;
|
|
123
|
+
},
|
|
124
|
+
updated: function updated() {
|
|
125
|
+
if (this.kendoFocused.value === this.$props.value && this.$el) {
|
|
126
|
+
this.$el.focus();
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
computed: {
|
|
130
|
+
currentSelected: function currentSelected() {
|
|
131
|
+
var _this = this;
|
|
132
|
+
|
|
133
|
+
return this.$props.selected || (Array.isArray(this.kendoSelection.value) ? this.kendoSelection.value.some(function (i) {
|
|
134
|
+
return i === _this.$props.value;
|
|
135
|
+
}) : this.kendoSelection.value === this.$props.value);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
methods: {
|
|
139
|
+
computedFocused: function computedFocused() {
|
|
140
|
+
return this.kendoFocused.value === this.$props.value;
|
|
141
|
+
},
|
|
142
|
+
handleClick: function handleClick(event) {
|
|
143
|
+
if (this.handleDispatchSelection) {
|
|
144
|
+
this.handleDispatchSelection({
|
|
145
|
+
type: SELECTION_ACTION.toggle,
|
|
146
|
+
payload: this.$props.value,
|
|
147
|
+
event: event
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
this.$emit('click', {
|
|
152
|
+
target: this.target,
|
|
153
|
+
event: event
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
handleRemove: function handleRemove(event) {
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
|
|
159
|
+
if (!this.$props.removable) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (this.handleDispatchFocus) {
|
|
164
|
+
this.handleDispatchDataItems({
|
|
165
|
+
type: DATA_ACTION.remove,
|
|
166
|
+
payload: this.$props.value,
|
|
167
|
+
event: event
|
|
168
|
+
});
|
|
169
|
+
this.handleDispatchFocus({
|
|
170
|
+
type: FOCUS_ACTION.reset,
|
|
171
|
+
payload: this.$props.value,
|
|
172
|
+
event: event
|
|
173
|
+
});
|
|
174
|
+
this.handleDispatchSelection({
|
|
175
|
+
type: SELECTION_ACTION.remove,
|
|
176
|
+
payload: this.$props.value,
|
|
177
|
+
event: event
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
this.$emit('remove', {
|
|
182
|
+
target: this.target,
|
|
183
|
+
event: event
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
handleKeyDown: function handleKeyDown(event) {
|
|
187
|
+
switch (event.keyCode) {
|
|
188
|
+
case Keys.left:
|
|
189
|
+
if (this.handleDispatchFocus) {
|
|
190
|
+
this.handleDispatchFocus({
|
|
191
|
+
type: FOCUS_ACTION.prev,
|
|
192
|
+
payload: this.$props.value,
|
|
193
|
+
event: event
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
break;
|
|
198
|
+
|
|
199
|
+
case Keys.right:
|
|
200
|
+
if (this.handleDispatchFocus) {
|
|
201
|
+
this.handleDispatchFocus({
|
|
202
|
+
type: FOCUS_ACTION.next,
|
|
203
|
+
payload: this.$props.value,
|
|
204
|
+
event: event
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
break;
|
|
209
|
+
|
|
210
|
+
case Keys.enter:
|
|
211
|
+
if (this.handleDispatchFocus) {
|
|
212
|
+
this.handleDispatchSelection({
|
|
213
|
+
type: SELECTION_ACTION.toggle,
|
|
214
|
+
payload: this.$props.value,
|
|
215
|
+
event: event
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
break;
|
|
220
|
+
|
|
221
|
+
case Keys.delete:
|
|
222
|
+
this.handleRemove(event);
|
|
223
|
+
break;
|
|
224
|
+
|
|
225
|
+
default:
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
this.$emit('keydown', {
|
|
230
|
+
target: this.target,
|
|
231
|
+
event: event
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
handleFocus: function handleFocus(event) {
|
|
235
|
+
if (this.handleDispatchFocus) {
|
|
236
|
+
this.handleDispatchFocus({
|
|
237
|
+
payload: this.$props.value,
|
|
238
|
+
type: FOCUS_ACTION.current,
|
|
239
|
+
event: event
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
this.$emit('focus', {
|
|
244
|
+
target: this.target,
|
|
245
|
+
event: event
|
|
246
|
+
});
|
|
247
|
+
},
|
|
248
|
+
handleBlur: function handleBlur(event) {
|
|
249
|
+
this.$emit('blur', {
|
|
250
|
+
target: this.target,
|
|
251
|
+
event: event
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
// @ts-ignore
|
|
256
|
+
setup: !isV3 ? undefined : function () {
|
|
257
|
+
var v3 = !!isV3;
|
|
258
|
+
var chipRef = ref(null);
|
|
259
|
+
return {
|
|
260
|
+
v3: v3,
|
|
261
|
+
chipRef: chipRef
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
render: function render(createElement) {
|
|
265
|
+
var _a;
|
|
266
|
+
|
|
267
|
+
var h = gh || createElement;
|
|
268
|
+
var _b = this.$props,
|
|
269
|
+
size = _b.size,
|
|
270
|
+
rounded = _b.rounded,
|
|
271
|
+
themeColor = _b.themeColor,
|
|
272
|
+
fillMode = _b.fillMode,
|
|
273
|
+
look = _b.look,
|
|
274
|
+
type = _b.type;
|
|
275
|
+
return h("div", {
|
|
276
|
+
role: this.$props.role,
|
|
277
|
+
attrs: this.v3 ? undefined : {
|
|
278
|
+
role: this.$props.role,
|
|
279
|
+
id: this.$props.value,
|
|
280
|
+
dir: this.currentDir,
|
|
281
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled, undefined),
|
|
282
|
+
"aria-checked": this.currentSelected,
|
|
283
|
+
"aria-disabled": this.$props.disabled,
|
|
284
|
+
"aria-describedby": this.$props.ariaDescribedBy
|
|
285
|
+
},
|
|
286
|
+
id: this.$props.value,
|
|
287
|
+
ref: setRef(this, 'chip'),
|
|
288
|
+
dir: this.currentDir,
|
|
289
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled, undefined),
|
|
290
|
+
"class": classNames('k-chip', (_a = {
|
|
291
|
+
'k-rtl': this.currentDir === 'rtl',
|
|
292
|
+
'k-disabled': this.$props.disabled,
|
|
293
|
+
'k-selected': this.currentSelected,
|
|
294
|
+
'k-focus': this.computedFocused()
|
|
295
|
+
}, _a["k-chip-".concat(kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a["k-chip-".concat(fillMode)] = fillMode, _a["k-chip-".concat(fillMode, "-").concat(themeColor)] = Boolean(fillMode && themeColor), _a['k-chip-success'] = type === 'success', _a['k-chip-warning'] = type === 'warning', _a['k-chip-error'] = type === 'error', _a['k-chip-info'] = type === 'info', _a['k-chip-outline'] = look === 'outline' || look === 'outlined', _a['k-chip-solid'] = look === 'solid' || look === 'filled', _a)),
|
|
296
|
+
"aria-checked": this.currentSelected,
|
|
297
|
+
"aria-disabled": this.$props.disabled,
|
|
298
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
299
|
+
onFocus: this.handleFocus,
|
|
300
|
+
on: this.v3 ? undefined : {
|
|
301
|
+
"focus": this.handleFocus,
|
|
302
|
+
"blur": this.handleBlur,
|
|
303
|
+
"click": this.handleClick,
|
|
304
|
+
"keydown": this.handleKeyDown
|
|
305
|
+
},
|
|
306
|
+
onBlur: this.handleBlur,
|
|
307
|
+
onClick: this.handleClick,
|
|
308
|
+
onKeydown: this.handleKeyDown
|
|
309
|
+
}, [this.currentSelected && this.$props.selectedIcon && h("span", {
|
|
310
|
+
"class": classNames('k-chip-icon', 'k-icon', this.$props.selectedIcon)
|
|
311
|
+
}), this.$props.icon && h("span", {
|
|
312
|
+
"class": classNames('k-chip-icon', 'k-icon', this.$props.icon)
|
|
313
|
+
}), h("span", {
|
|
314
|
+
"class": 'k-chip-content'
|
|
315
|
+
}, [this.$props.text && h("span", {
|
|
316
|
+
"aria-label": this.$props.text,
|
|
317
|
+
attrs: this.v3 ? undefined : {
|
|
318
|
+
"aria-label": this.$props.text
|
|
319
|
+
},
|
|
320
|
+
"class": 'k-chip-label'
|
|
321
|
+
}, [this.$props.text])]), this.$props.removable && h("span", {
|
|
322
|
+
"class": "k-chip-actions"
|
|
323
|
+
}, [h("span", {
|
|
324
|
+
"class": "k-chip-action k-chip-remove-action"
|
|
325
|
+
}, [h("span", {
|
|
326
|
+
"class": classNames('k-chip-icon', 'k-icon', this.$props.removeIcon),
|
|
327
|
+
onClick: this.handleRemove,
|
|
328
|
+
on: this.v3 ? undefined : {
|
|
329
|
+
"click": this.handleRemove
|
|
330
|
+
}
|
|
331
|
+
})])])]);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* @hidden
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
var Chip = ChipVue2;
|
|
339
|
+
export { Chip, ChipVue2 };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { FormComponentProps } from '@progress/kendo-vue-common';
|
|
7
|
+
import { ChipListChangeEvent, ChipListDataChangeEvent } from './../models/index';
|
|
8
|
+
/**
|
|
9
|
+
* Represents the properties of [ChipList]({% slug api_buttons_chiplist %}) component.
|
|
10
|
+
*/
|
|
11
|
+
export interface ChipListProps extends FormComponentProps {
|
|
12
|
+
/**
|
|
13
|
+
* Sets the `id` property of the top div element of the ChipList.
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Sets additional classes to the ChipList.
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the `tabIndex` attribute.
|
|
22
|
+
*/
|
|
23
|
+
tabIndex?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Represents Chip component.
|
|
26
|
+
*/
|
|
27
|
+
chip?: any;
|
|
28
|
+
/**
|
|
29
|
+
* Represents the data about the child Chips.
|
|
30
|
+
*/
|
|
31
|
+
dataItems?: any;
|
|
32
|
+
/**
|
|
33
|
+
* Represents the default data about the child Chips.
|
|
34
|
+
*/
|
|
35
|
+
defaultDataItems?: any[];
|
|
36
|
+
/**
|
|
37
|
+
* Triggered after Chip data change.
|
|
38
|
+
*/
|
|
39
|
+
onDatachange?: (event: ChipListDataChangeEvent) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Represents the selection state of Chip component.
|
|
42
|
+
*/
|
|
43
|
+
value?: any | any[];
|
|
44
|
+
/**
|
|
45
|
+
* Represents the default value of the selection state of Chip component.
|
|
46
|
+
*/
|
|
47
|
+
defaultValue?: any | any[];
|
|
48
|
+
/**
|
|
49
|
+
* Triggered after value change.
|
|
50
|
+
*/
|
|
51
|
+
onChange?: (event: ChipListChangeEvent) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Configures the `size` of the Chip.
|
|
54
|
+
*
|
|
55
|
+
* The available options are:
|
|
56
|
+
* - small
|
|
57
|
+
* - medium
|
|
58
|
+
* - large
|
|
59
|
+
* - null—Does not set a size `class`.
|
|
60
|
+
*
|
|
61
|
+
* @default `medium`
|
|
62
|
+
*/
|
|
63
|
+
size?: null | 'small' | 'medium' | 'large' | string;
|
|
64
|
+
/**
|
|
65
|
+
* Configures the `roundness` of the Chip.
|
|
66
|
+
*
|
|
67
|
+
* The available options are:
|
|
68
|
+
* - small
|
|
69
|
+
* - medium
|
|
70
|
+
* - large
|
|
71
|
+
* - full
|
|
72
|
+
* - null—Does not set a rounded `class`.
|
|
73
|
+
*
|
|
74
|
+
* @default `medium`
|
|
75
|
+
*/
|
|
76
|
+
rounded?: null | 'small' | 'medium' | 'large' | 'full' | string;
|
|
77
|
+
/**
|
|
78
|
+
* Configures the `fillMode` of the Chip.
|
|
79
|
+
*
|
|
80
|
+
* The available options are:
|
|
81
|
+
* - solid
|
|
82
|
+
* - outline
|
|
83
|
+
* - flat
|
|
84
|
+
* - null—Does not set a fillMode `class`.
|
|
85
|
+
*
|
|
86
|
+
* @default `solid`
|
|
87
|
+
*/
|
|
88
|
+
fillMode?: null | 'solid' | 'outline' | 'flat' | string;
|
|
89
|
+
/**
|
|
90
|
+
* Represents the selection state of Chip component.
|
|
91
|
+
*/
|
|
92
|
+
selection?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Represents the `text` field of Chip, used for the `label`.
|
|
95
|
+
*/
|
|
96
|
+
textField?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Represents the `value` field of Chip, used for setting the Chip `id`.
|
|
99
|
+
*/
|
|
100
|
+
valueField?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Determines of ChipList is disabled.
|
|
103
|
+
*/
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The ChipList direction 'ltr' as default or 'rtl'.
|
|
107
|
+
*/
|
|
108
|
+
dir?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Identifies the element(s) which will describe the component, similar to HTML aria-describedby attribute.
|
|
111
|
+
* For example these elements could contain error or hint message.
|
|
112
|
+
*/
|
|
113
|
+
ariaDescribedBy?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Identifies the element(s) which will label the component.
|
|
116
|
+
*/
|
|
117
|
+
ariaLabelledBy?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Represents the target(element and props) of the ChipListChangeEvent.
|
|
121
|
+
*/
|
|
122
|
+
export interface ChipListHandle {
|
|
123
|
+
/**
|
|
124
|
+
* The current element or `null` if there is no one.
|
|
125
|
+
*/
|
|
126
|
+
element: HTMLDivElement | null;
|
|
127
|
+
/**
|
|
128
|
+
* The props values of the ChipList.
|
|
129
|
+
*/
|
|
130
|
+
props: ChipListProps;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @hidden
|
|
134
|
+
*/
|
|
135
|
+
export interface ChipListMethods {
|
|
136
|
+
[key: string]: any;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @hidden
|
|
140
|
+
*/
|
|
141
|
+
export interface ChipListState {
|
|
142
|
+
v3: boolean;
|
|
143
|
+
target: any;
|
|
144
|
+
currentRtl: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* @hidden
|
|
148
|
+
*/
|
|
149
|
+
export interface ChipListData {
|
|
150
|
+
currentDataItems: Array<any>;
|
|
151
|
+
currentDir: string;
|
|
152
|
+
isRtl: boolean;
|
|
153
|
+
currentFocused: any;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @hidden
|
|
157
|
+
*/
|
|
158
|
+
export interface ChipListComputed {
|
|
159
|
+
[key: string]: any;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @hidden
|
|
163
|
+
*/
|
|
164
|
+
export interface ChipListAll extends ChipListMethods, ChipListState, ChipListData, ChipListComputed, Vue2type {
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @hidden
|
|
168
|
+
*/
|
|
169
|
+
declare let ChipListVue2: ComponentOptions<Vue2type, DefaultData<ChipListData>, DefaultMethods<ChipListAll>, ChipListComputed, RecordPropsDefinition<ChipListProps>>;
|
|
170
|
+
/**
|
|
171
|
+
* @hidden
|
|
172
|
+
*/
|
|
173
|
+
declare const ChipList: DefineComponent<ChipListProps, any, ChipListData, ChipListComputed, ChipListMethods, {}, {}, {}, string, ChipListProps, ChipListProps, {}>;
|
|
174
|
+
export { ChipList, ChipListVue2 };
|