@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,263 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
}; // @ts-ignore
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import * as Vue from 'vue';
|
|
19
|
+
var allVue = Vue;
|
|
20
|
+
var gh = allVue.h;
|
|
21
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
22
|
+
var ref = allVue.ref;
|
|
23
|
+
import { getTabIndex, classNames, getListeners, templateRendering, getTemplate, validatePackage, kendoThemeMaps, setRef } from '@progress/kendo-vue-common';
|
|
24
|
+
import { selectionReducer } from './selection-reducer.js';
|
|
25
|
+
import { focusReducer } from './focus-reducer.js';
|
|
26
|
+
import { dataReducer } from './data-reducer.js';
|
|
27
|
+
import { Chip } from './Chip.js';
|
|
28
|
+
import { packageMetadata } from '../package-metadata.js';
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
var ChipListVue2 = {
|
|
34
|
+
name: 'KendoVueChipList',
|
|
35
|
+
props: {
|
|
36
|
+
id: String,
|
|
37
|
+
tabIndex: Number,
|
|
38
|
+
dataItems: Array,
|
|
39
|
+
defaultDataItems: {
|
|
40
|
+
type: Array,
|
|
41
|
+
default: function _default() {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
value: [Object, Array, String, Number],
|
|
46
|
+
defaultValue: {
|
|
47
|
+
type: [Object, Array, String, Number],
|
|
48
|
+
default: function _default() {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
size: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'medium'
|
|
55
|
+
},
|
|
56
|
+
rounded: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'medium'
|
|
59
|
+
},
|
|
60
|
+
fillMode: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'solid',
|
|
63
|
+
validator: function validator(value) {
|
|
64
|
+
return [null, 'flat', 'outline', 'solid'].includes(value);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
selection: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: function _default() {
|
|
70
|
+
return 'none';
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
textField: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: function _default() {
|
|
76
|
+
return 'text';
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
valueField: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: function _default() {
|
|
82
|
+
return 'value';
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
disabled: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
dir: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: function _default() {
|
|
92
|
+
return 'ltr';
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
chip: [String, Function, Object],
|
|
96
|
+
ariaLabelledBy: String,
|
|
97
|
+
ariaDescribedBy: String
|
|
98
|
+
},
|
|
99
|
+
provide: function provide() {
|
|
100
|
+
return {
|
|
101
|
+
kendoSelection: this.currentValue,
|
|
102
|
+
kendoFocused: this.currentFocused,
|
|
103
|
+
kendoDataItems: this.computedDataItems,
|
|
104
|
+
handleDispatchDataItems: this.handleDispatchDataItems,
|
|
105
|
+
handleDispatchSelection: this.handleDispatchSelection,
|
|
106
|
+
handleDispatchFocus: this.handleDispatchFocus
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
created: function created() {
|
|
110
|
+
validatePackage(packageMetadata);
|
|
111
|
+
this.currentDataItems = this.$props.dataItems || this.$props.defaultDataItems;
|
|
112
|
+
this.currentValue.value = this.$props.value || this.$props.defaultValue;
|
|
113
|
+
},
|
|
114
|
+
data: function data() {
|
|
115
|
+
return {
|
|
116
|
+
currentDataItems: [],
|
|
117
|
+
currentDir: 'ltr',
|
|
118
|
+
isRtl: false,
|
|
119
|
+
currentFocused: {
|
|
120
|
+
value: false
|
|
121
|
+
},
|
|
122
|
+
currentValue: {
|
|
123
|
+
value: null
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
mounted: function mounted() {
|
|
128
|
+
this.chipList = this.v3 ? this.chipListRef : this.$refs.chipList;
|
|
129
|
+
this.currentDir = this.$props.dir !== undefined ? this.$props.dir : this.$el && getComputedStyle(this.$el).direction === 'rtl' || false;
|
|
130
|
+
this.isRtl = this.currentDir === 'rtl';
|
|
131
|
+
},
|
|
132
|
+
computed: {
|
|
133
|
+
computedDataItems: function computedDataItems() {
|
|
134
|
+
return this.$props.dataItems || this.currentDataItems;
|
|
135
|
+
},
|
|
136
|
+
computedValue: function computedValue() {
|
|
137
|
+
return this.$props.value || this.currentValue.value;
|
|
138
|
+
},
|
|
139
|
+
items: function items() {
|
|
140
|
+
return this.computedDataItems.reduce(this.itemsReducer, []);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
methods: {
|
|
144
|
+
handleDispatchSelection: function handleDispatchSelection(action) {
|
|
145
|
+
var newState = selectionReducer(this.computedValue, __assign(__assign({}, action), {
|
|
146
|
+
selection: this.$props.selection,
|
|
147
|
+
state: this.computedValue
|
|
148
|
+
}));
|
|
149
|
+
this.handleChange(newState, action.event);
|
|
150
|
+
this.currentValue.value = newState;
|
|
151
|
+
},
|
|
152
|
+
handleDispatchFocus: function handleDispatchFocus(action) {
|
|
153
|
+
var newState = focusReducer(action.payload, __assign(__assign({}, action), {
|
|
154
|
+
items: this.items
|
|
155
|
+
}));
|
|
156
|
+
this.currentFocused.value = newState;
|
|
157
|
+
},
|
|
158
|
+
handleDispatchDataItems: function handleDispatchDataItems(action) {
|
|
159
|
+
var newState = dataReducer(this.computedDataItems, __assign(__assign({}, action), {
|
|
160
|
+
state: this.computedDataItems,
|
|
161
|
+
valueField: this.$props.valueField
|
|
162
|
+
}));
|
|
163
|
+
this.handleDataChange(newState, action.event);
|
|
164
|
+
this.currentDataItems = newState;
|
|
165
|
+
},
|
|
166
|
+
handleChange: function handleChange(newValue, event) {
|
|
167
|
+
if (this.$el) {
|
|
168
|
+
this.$emit('change', {
|
|
169
|
+
value: newValue,
|
|
170
|
+
target: this.$el,
|
|
171
|
+
event: event
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
handleDataChange: function handleDataChange(newData, event) {
|
|
176
|
+
if (this.$el) {
|
|
177
|
+
this.$emit('datachange', {
|
|
178
|
+
value: newData,
|
|
179
|
+
target: this.$el,
|
|
180
|
+
event: event
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
itemsReducer: function itemsReducer(acc, current) {
|
|
185
|
+
acc.push(current[this.$props.valueField || this.$props.valueField]);
|
|
186
|
+
return acc;
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
// @ts-ignore
|
|
190
|
+
setup: !isV3 ? undefined : function () {
|
|
191
|
+
var v3 = !!isV3;
|
|
192
|
+
var chipListRef = ref(null);
|
|
193
|
+
return {
|
|
194
|
+
v3: v3,
|
|
195
|
+
chipListRef: chipListRef
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
render: function render(createElement) {
|
|
199
|
+
var _a;
|
|
200
|
+
|
|
201
|
+
var h = gh || createElement;
|
|
202
|
+
var size = this.$props.size;
|
|
203
|
+
return h("div", {
|
|
204
|
+
ref: setRef(this, 'chipList'),
|
|
205
|
+
role: 'listbox',
|
|
206
|
+
attrs: this.v3 ? undefined : {
|
|
207
|
+
role: 'listbox',
|
|
208
|
+
id: this.$props.id,
|
|
209
|
+
dir: this.currentDir,
|
|
210
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled, undefined),
|
|
211
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
212
|
+
"aria-describedby": this.$props.ariaDescribedBy
|
|
213
|
+
},
|
|
214
|
+
id: this.$props.id,
|
|
215
|
+
dir: this.currentDir,
|
|
216
|
+
style: this.$props.style,
|
|
217
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled, undefined),
|
|
218
|
+
"class": classNames('k-chip-list', (_a = {}, _a["k-chip-list-".concat(kendoThemeMaps.sizeMap[size] || size)] = size, _a['k-rtl'] = this.currentDir === 'rtl', _a['k-selection-single'] = this.$props.selection === 'single', _a['k-selection-multiple'] = this.$props.selection === 'multiple', _a['k-disabled'] = this.$props.disabled, _a)),
|
|
219
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
220
|
+
"aria-describedby": this.$props.ariaDescribedBy
|
|
221
|
+
}, [this.computedDataItems.map(function (item) {
|
|
222
|
+
var chipTemplate = templateRendering.call(this, this.$props.chip, getListeners.call(this));
|
|
223
|
+
var chipDefaultRendering = // @ts-ignore function children
|
|
224
|
+
h(Chip, {
|
|
225
|
+
role: 'option',
|
|
226
|
+
attrs: this.v3 ? undefined : {
|
|
227
|
+
role: 'option',
|
|
228
|
+
dataItem: item,
|
|
229
|
+
text: item[this.$props.textField],
|
|
230
|
+
value: item[this.$props.valueField],
|
|
231
|
+
size: this.$props.size,
|
|
232
|
+
rounded: this.$props.rounded,
|
|
233
|
+
fillMode: this.$props.fillMode
|
|
234
|
+
},
|
|
235
|
+
dataItem: item,
|
|
236
|
+
key: item[this.$props.valueField],
|
|
237
|
+
text: item[this.$props.textField],
|
|
238
|
+
value: item[this.$props.valueField],
|
|
239
|
+
size: this.$props.size,
|
|
240
|
+
rounded: this.$props.rounded,
|
|
241
|
+
fillMode: this.$props.fillMode
|
|
242
|
+
});
|
|
243
|
+
return getTemplate.call(this, {
|
|
244
|
+
h: h,
|
|
245
|
+
template: chipTemplate,
|
|
246
|
+
defaultRendering: chipDefaultRendering,
|
|
247
|
+
additionalProps: {
|
|
248
|
+
dataItem: item,
|
|
249
|
+
key: item[this.$props.valueField],
|
|
250
|
+
text: item[this.$props.textField],
|
|
251
|
+
value: item[this.$props.valueField],
|
|
252
|
+
size: this.$props.size
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}, this)]);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* @hidden
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
var ChipList = ChipListVue2;
|
|
263
|
+
export { ChipList, ChipListVue2 };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export declare enum DATA_ACTION {
|
|
5
|
+
remove = "remove",
|
|
6
|
+
add = "add",
|
|
7
|
+
reorder = "reorder"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export declare type DataAction = {
|
|
13
|
+
type: DATA_ACTION;
|
|
14
|
+
payload?: any;
|
|
15
|
+
valueField: string;
|
|
16
|
+
event?: any;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export declare const dataReducer: (state: any, action: DataAction) => any;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export var DATA_ACTION;
|
|
5
|
+
|
|
6
|
+
(function (DATA_ACTION) {
|
|
7
|
+
DATA_ACTION["remove"] = "remove";
|
|
8
|
+
DATA_ACTION["add"] = "add";
|
|
9
|
+
DATA_ACTION["reorder"] = "reorder";
|
|
10
|
+
})(DATA_ACTION || (DATA_ACTION = {}));
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export var dataReducer = function dataReducer(state, action) {
|
|
17
|
+
switch (action.type) {
|
|
18
|
+
case DATA_ACTION.add:
|
|
19
|
+
// TODO v2
|
|
20
|
+
break;
|
|
21
|
+
|
|
22
|
+
case DATA_ACTION.remove:
|
|
23
|
+
return state.filter(function (i) {
|
|
24
|
+
return i[action.valueField] !== action.payload;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
case DATA_ACTION.reorder:
|
|
28
|
+
// TODO v2
|
|
29
|
+
break;
|
|
30
|
+
|
|
31
|
+
default:
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export declare enum FOCUS_ACTION {
|
|
5
|
+
next = "next",
|
|
6
|
+
prev = "prev",
|
|
7
|
+
current = "current",
|
|
8
|
+
reset = "reset"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export declare type FocusAction = {
|
|
14
|
+
type: FOCUS_ACTION;
|
|
15
|
+
payload: string;
|
|
16
|
+
items: string[];
|
|
17
|
+
target?: any;
|
|
18
|
+
event?: any;
|
|
19
|
+
state?: any;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export declare const focusReducer: (state: any, action: FocusAction) => any;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export var FOCUS_ACTION;
|
|
5
|
+
|
|
6
|
+
(function (FOCUS_ACTION) {
|
|
7
|
+
FOCUS_ACTION["next"] = "next";
|
|
8
|
+
FOCUS_ACTION["prev"] = "prev";
|
|
9
|
+
FOCUS_ACTION["current"] = "current";
|
|
10
|
+
FOCUS_ACTION["reset"] = "reset";
|
|
11
|
+
})(FOCUS_ACTION || (FOCUS_ACTION = {}));
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export var focusReducer = function focusReducer(state, action) {
|
|
18
|
+
var currentIndex = action.items.findIndex(function (i) {
|
|
19
|
+
return i === state;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
switch (action.type) {
|
|
23
|
+
case FOCUS_ACTION.next:
|
|
24
|
+
return currentIndex === action.items.length - 1 ? state : action.items[currentIndex + 1];
|
|
25
|
+
|
|
26
|
+
case FOCUS_ACTION.prev:
|
|
27
|
+
return currentIndex === 0 ? state : action.items[currentIndex - 1];
|
|
28
|
+
|
|
29
|
+
case FOCUS_ACTION.current:
|
|
30
|
+
return action.payload;
|
|
31
|
+
|
|
32
|
+
case FOCUS_ACTION.reset:
|
|
33
|
+
return null;
|
|
34
|
+
|
|
35
|
+
default:
|
|
36
|
+
return state;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export declare enum SELECTION_TYPE {
|
|
5
|
+
single = "single",
|
|
6
|
+
multiple = "multiple",
|
|
7
|
+
none = "none"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export declare enum SELECTION_ACTION {
|
|
13
|
+
toggle = "toggle",
|
|
14
|
+
remove = "remove"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export declare type SelectionAction = {
|
|
20
|
+
type?: SELECTION_ACTION;
|
|
21
|
+
selection: SELECTION_TYPE;
|
|
22
|
+
payload?: string;
|
|
23
|
+
event?: any;
|
|
24
|
+
state?: any;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
export declare const selectionReducer: (state: any, action: SelectionAction) => any;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export var SELECTION_TYPE;
|
|
16
|
+
|
|
17
|
+
(function (SELECTION_TYPE) {
|
|
18
|
+
SELECTION_TYPE["single"] = "single";
|
|
19
|
+
SELECTION_TYPE["multiple"] = "multiple";
|
|
20
|
+
SELECTION_TYPE["none"] = "none";
|
|
21
|
+
})(SELECTION_TYPE || (SELECTION_TYPE = {}));
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export var SELECTION_ACTION;
|
|
28
|
+
|
|
29
|
+
(function (SELECTION_ACTION) {
|
|
30
|
+
SELECTION_ACTION["toggle"] = "toggle";
|
|
31
|
+
SELECTION_ACTION["remove"] = "remove";
|
|
32
|
+
})(SELECTION_ACTION || (SELECTION_ACTION = {}));
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
export var selectionReducer = function selectionReducer(state, action) {
|
|
39
|
+
switch (action.selection) {
|
|
40
|
+
case SELECTION_TYPE.single:
|
|
41
|
+
switch (action.type) {
|
|
42
|
+
case SELECTION_ACTION.toggle:
|
|
43
|
+
{
|
|
44
|
+
if (!Array.isArray(state) || state === null) {
|
|
45
|
+
return action.payload === state ? null : action.payload;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw new Error('State cannot be an array in single selection');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
case SELECTION_ACTION.remove:
|
|
52
|
+
{
|
|
53
|
+
return action.payload === state ? null : state;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
default:
|
|
57
|
+
return state;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
case SELECTION_TYPE.multiple:
|
|
61
|
+
switch (action.type) {
|
|
62
|
+
case SELECTION_ACTION.toggle:
|
|
63
|
+
{
|
|
64
|
+
if (Array.isArray(state)) {
|
|
65
|
+
return state.some(function (i) {
|
|
66
|
+
return i === action.payload;
|
|
67
|
+
}) ? state.filter(function (i) {
|
|
68
|
+
return i !== action.payload;
|
|
69
|
+
}) : __spreadArray(__spreadArray([], state, true), [action.payload], false);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (state === null) {
|
|
73
|
+
return [action.payload];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
throw new Error('State cannot be non-array in multiple selection');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
case SELECTION_ACTION.remove:
|
|
80
|
+
{
|
|
81
|
+
if (Array.isArray(state)) {
|
|
82
|
+
return state.some(function (i) {
|
|
83
|
+
return i === action.payload;
|
|
84
|
+
}) ? state.filter(function (i) {
|
|
85
|
+
return i !== action.payload;
|
|
86
|
+
}) : __spreadArray(__spreadArray([], state, true), [action.payload], false);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return state;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
default:
|
|
93
|
+
return state;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
case SELECTION_TYPE.none:
|
|
97
|
+
return null;
|
|
98
|
+
|
|
99
|
+
default:
|
|
100
|
+
return state;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { FloatingActionButtonProps } from './interfaces/FloatingActionButtonProps';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface FloatingActionButtonMethods {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export interface FloatingActionButtonState {
|
|
17
|
+
v3: boolean;
|
|
18
|
+
target: any;
|
|
19
|
+
currentRtl: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export interface FloatingActionButtonData {
|
|
25
|
+
currentOpened: boolean;
|
|
26
|
+
currentFocused: boolean;
|
|
27
|
+
focusedIndex: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
export interface FloatingActionButtonComputed {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
computedOpened: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
export interface FloatingActionButtonAll extends FloatingActionButtonMethods, FloatingActionButtonState, FloatingActionButtonData, FloatingActionButtonComputed, Vue2type {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @hidden
|
|
43
|
+
*/
|
|
44
|
+
declare let FloatingActionButtonVue2: ComponentOptions<Vue2type, DefaultData<FloatingActionButtonData>, DefaultMethods<FloatingActionButtonAll>, FloatingActionButtonComputed, RecordPropsDefinition<FloatingActionButtonProps>>;
|
|
45
|
+
/**
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
declare const FloatingActionButton: DefineComponent<FloatingActionButtonProps, any, FloatingActionButtonData, FloatingActionButtonComputed, FloatingActionButtonMethods, {}, {}, {}, string, FloatingActionButtonProps, FloatingActionButtonProps, {}>;
|
|
49
|
+
export { FloatingActionButton, FloatingActionButtonVue2 };
|