UNPKG

1.84 kBJavaScriptView Raw
1const VERSION = '1.4.0'
2
3const DEFAULTS = {
4 name: '',
5 placeholder: '',
6 data: undefined,
7 locale: undefined,
8
9 selectAll: true,
10 single: false,
11 singleRadio: false,
12 multiple: false,
13 hideOptgroupCheckboxes: false,
14 multipleWidth: 80,
15 width: undefined,
16 dropWidth: undefined,
17 maxHeight: 250,
18 position: 'bottom',
19
20 displayValues: false,
21 displayTitle: false,
22 displayDelimiter: ', ',
23 minimumCountSelected: 3,
24 ellipsis: false,
25
26 isOpen: false,
27 keepOpen: false,
28 openOnHover: false,
29 container: null,
30
31 filter: false,
32 filterGroup: false,
33 filterPlaceholder: '',
34 filterAcceptOnEnter: false,
35
36 animate: undefined,
37
38 styler () {
39 return false
40 },
41 textTemplate ($elm) {
42 return $elm[0].innerHTML
43 },
44 labelTemplate ($elm) {
45 return $elm[0].getAttribute('label')
46 },
47
48 onOpen () {
49 return false
50 },
51 onClose () {
52 return false
53 },
54 onCheckAll () {
55 return false
56 },
57 onUncheckAll () {
58 return false
59 },
60 onFocus () {
61 return false
62 },
63 onBlur () {
64 return false
65 },
66 onOptgroupClick () {
67 return false
68 },
69 onClick () {
70 return false
71 },
72 onFilter () {
73 return false
74 },
75 onAfterCreate () {
76 return false
77 }
78}
79
80const EN = {
81 formatSelectAll () {
82 return '[Select all]'
83 },
84 formatAllSelected () {
85 return 'All selected'
86 },
87 formatCountSelected (count, total) {
88 return count + ' of ' + total + ' selected'
89 },
90 formatNoMatchesFound () {
91 return 'No matches found'
92 }
93}
94
95const METHODS = [
96 'getOptions', 'refreshOptions',
97 'getSelects', 'setSelects',
98 'enable', 'disable',
99 'open', 'close',
100 'checkAll', 'uncheckAll',
101 'focus', 'blur',
102 'refresh', 'destroy'
103]
104
105Object.assign(DEFAULTS, EN)
106
107const Constants = {
108 VERSION,
109
110 DEFAULTS,
111
112 METHODS,
113
114 LOCALES: {
115 en: EN,
116 'en-US': EN
117 }
118}
119
120export default Constants