|
149 | 149 | }, false)
|
150 | 150 | })
|
151 | 151 | }
|
| 152 | + |
| 153 | + // ------------------------------- |
| 154 | + // Loading Buttons |
| 155 | + // ------------------------------- |
| 156 | + // 'Loading Buttons components' example in docs only |
| 157 | + const myLoadingButton = document.querySelectorAll('.docs-example .btn-loading') |
| 158 | + if (myLoadingButton) { |
| 159 | + myLoadingButton.forEach(button => { |
| 160 | + new coreui.LoadingButton(button) |
| 161 | + button.addEventListener('click', event => { |
| 162 | + const myBtn = coreui.LoadingButton.getInstance(event.target) |
| 163 | + myBtn.start() |
| 164 | + }) |
| 165 | + }) |
| 166 | + } |
| 167 | + |
| 168 | + // ------------------------------- |
| 169 | + // Multi Selects |
| 170 | + // ------------------------------- |
| 171 | + // 'Multi Selects components' example in docs only |
| 172 | + const myMultiSelect = document.getElementById('multiSelect') |
| 173 | + |
| 174 | + if (myMultiSelect) { |
| 175 | + const cuiMultiSelect = new coreui.MultiSelect(myMultiSelect, { |
| 176 | + name: 'multiSelect', |
| 177 | + options: [ |
| 178 | + { |
| 179 | + value: 0, |
| 180 | + text: 'Angular' |
| 181 | + }, |
| 182 | + { |
| 183 | + value: 1, |
| 184 | + text: 'Bootstrap', |
| 185 | + selected: true |
| 186 | + }, |
| 187 | + { |
| 188 | + value: 2, |
| 189 | + text: 'React.js', |
| 190 | + selected: true |
| 191 | + }, |
| 192 | + { |
| 193 | + value: 3, |
| 194 | + text: 'Vue.js' |
| 195 | + }, |
| 196 | + { |
| 197 | + label: 'backend', |
| 198 | + options: [ |
| 199 | + { |
| 200 | + value: 4, |
| 201 | + text: 'Django' |
| 202 | + }, |
| 203 | + { |
| 204 | + value: 5, |
| 205 | + text: 'Laravel' |
| 206 | + }, |
| 207 | + { |
| 208 | + value: 6, |
| 209 | + text: 'Node.js', |
| 210 | + selected: true |
| 211 | + } |
| 212 | + ] |
| 213 | + } |
| 214 | + ], |
| 215 | + search: true |
| 216 | + }) |
| 217 | + cuiMultiSelect.update({ |
| 218 | + options: [ |
| 219 | + { |
| 220 | + value: 0, |
| 221 | + text: 'Angular2' |
| 222 | + }, |
| 223 | + { |
| 224 | + value: 1, |
| 225 | + text: 'Bootstrap2', |
| 226 | + selected: true |
| 227 | + }, |
| 228 | + { |
| 229 | + value: 2, |
| 230 | + text: 'React.js', |
| 231 | + selected: true |
| 232 | + }, |
| 233 | + { |
| 234 | + value: 3, |
| 235 | + text: 'Vue.js' |
| 236 | + }, |
| 237 | + { |
| 238 | + label: 'backend', |
| 239 | + options: [ |
| 240 | + { |
| 241 | + value: 4, |
| 242 | + text: 'Django' |
| 243 | + }, |
| 244 | + { |
| 245 | + value: 5, |
| 246 | + text: 'Laravel' |
| 247 | + }, |
| 248 | + { |
| 249 | + value: 6, |
| 250 | + text: 'Node.js', |
| 251 | + selected: true |
| 252 | + } |
| 253 | + ] |
| 254 | + } |
| 255 | + ] |
| 256 | + }) |
| 257 | + } |
| 258 | + |
| 259 | + // ------------------------------- |
| 260 | + // Date Pickers |
| 261 | + // ------------------------------- |
| 262 | + // 'Date Pickers components' example in docs only |
| 263 | + |
| 264 | + if (document.getElementById('myDatePickerDisabledDates')) { |
| 265 | + const optionsDatePickerDisabledDates = { |
| 266 | + locale: 'en-US', |
| 267 | + calendarDate: new Date(2022, 2, 1), |
| 268 | + disabledDates: [ |
| 269 | + [new Date(2022, 2, 4), new Date(2022, 2, 7)], |
| 270 | + new Date(2022, 2, 16), |
| 271 | + new Date(2022, 3, 16), |
| 272 | + [new Date(2022, 4, 2), new Date(2022, 4, 8)] |
| 273 | + ], |
| 274 | + maxDate: new Date(2022, 5, 0), |
| 275 | + minDate: new Date(2022, 1, 1) |
| 276 | + } |
| 277 | + // eslint-disable-next-line no-unused-vars |
| 278 | + const myDatePickerDisabledDates = new coreui.DatePicker(document.getElementById('myDatePickerDisabledDates'), optionsDatePickerDisabledDates) |
| 279 | + } |
| 280 | + |
| 281 | + // ------------------------------- |
| 282 | + // Date Range Pickers |
| 283 | + // ------------------------------- |
| 284 | + // 'Date Range Pickers components' example in docs only |
| 285 | + |
| 286 | + if (document.getElementById('myDateRangePickerDisabledDates')) { |
| 287 | + const optionsDateRangePickerDisabledDates = { |
| 288 | + locale: 'en-US', |
| 289 | + calendarDate: new Date(2022, 2, 1), |
| 290 | + disabledDates: [ |
| 291 | + [new Date(2022, 2, 4), new Date(2022, 2, 7)], |
| 292 | + new Date(2022, 2, 16), |
| 293 | + new Date(2022, 3, 16), |
| 294 | + [new Date(2022, 4, 2), new Date(2022, 4, 8)] |
| 295 | + ], |
| 296 | + maxDate: new Date(2022, 5, 0), |
| 297 | + minDate: new Date(2022, 1, 1) |
| 298 | + } |
| 299 | + // eslint-disable-next-line no-unused-vars |
| 300 | + const myDateRangePickerDisabledDates = new coreui.DateRangePicker(document.getElementById('myDateRangePickerDisabledDates'), optionsDateRangePickerDisabledDates) |
| 301 | + } |
| 302 | + |
| 303 | + if (document.getElementById('myDateRangePickerCustomRanges')) { |
| 304 | + const optionsCustomRanges = { |
| 305 | + locale: 'en-US', |
| 306 | + ranges: { |
| 307 | + Today: [new Date(), new Date()], |
| 308 | + Yesterday: [ |
| 309 | + new Date(new Date().setDate(new Date().getDate() - 1)), |
| 310 | + new Date(new Date().setDate(new Date().getDate() - 1)) |
| 311 | + ], |
| 312 | + 'Last 7 Days': [ |
| 313 | + new Date(new Date().setDate(new Date().getDate() - 6)), |
| 314 | + new Date(new Date()) |
| 315 | + ], |
| 316 | + 'Last 30 Days': [ |
| 317 | + new Date(new Date().setDate(new Date().getDate() - 29)), |
| 318 | + new Date(new Date()) |
| 319 | + ], |
| 320 | + 'This Month': [ |
| 321 | + new Date(new Date().setDate(1)), |
| 322 | + new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0) |
| 323 | + ], |
| 324 | + 'Last Month': [ |
| 325 | + new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1), |
| 326 | + new Date(new Date().getFullYear(), new Date().getMonth(), 0) |
| 327 | + ] |
| 328 | + } |
| 329 | + } |
| 330 | + // eslint-disable-next-line no-unused-vars |
| 331 | + const myDateRangePickerCustomRanges = new coreui.DateRangePicker(document.getElementById('myDateRangePickerCustomRanges'), optionsCustomRanges) |
| 332 | + } |
152 | 333 | })()
|
0 commit comments