@coreui/vue-pro 4.5.0 → 4.7.0-alpha.0

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 (60) hide show
  1. package/dist/components/Types.d.ts +5 -5
  2. package/dist/components/calendar/CCalendar.d.ts +41 -3
  3. package/dist/components/date-picker/CDatePicker.d.ts +43 -4
  4. package/dist/components/date-range-picker/CDateRangePicker.d.ts +191 -4
  5. package/dist/components/form/CFormInput.d.ts +166 -1
  6. package/dist/components/form/CFormSelect.d.ts +1 -1
  7. package/dist/components/grid/CCol.d.ts +3 -3
  8. package/dist/components/grid/CRow.d.ts +1 -1
  9. package/dist/components/index.d.ts +1 -0
  10. package/dist/components/multi-select/CMultiSelect.d.ts +143 -4
  11. package/dist/components/multi-select/CMultiSelectOptions.d.ts +11 -0
  12. package/dist/components/multi-select/CMultiSelectSelection.d.ts +3 -3
  13. package/dist/components/pagination/index.d.ts +1 -2
  14. package/dist/components/picker/CPicker.d.ts +1 -1
  15. package/dist/components/popover/CPopover.d.ts +1 -1
  16. package/dist/components/smart-pagination/CSmartPagination.d.ts +257 -0
  17. package/dist/components/smart-pagination/index.d.ts +6 -0
  18. package/dist/components/smart-table/CSmartTable.d.ts +6 -4
  19. package/dist/components/smart-table/CSmartTableFilter.d.ts +2 -2
  20. package/dist/components/smart-table/CSmartTableHead.d.ts +2 -2
  21. package/dist/components/smart-table/CSmartTableInterface.d.ts +4 -1
  22. package/dist/components/table/CTable.d.ts +1 -1
  23. package/dist/components/table/CTableCaption.d.ts +2 -8
  24. package/dist/components/time-picker/CTimePicker.d.ts +2 -1
  25. package/dist/components/tooltip/CTooltip.d.ts +1 -1
  26. package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
  27. package/dist/index.es.js +1560 -1017
  28. package/dist/index.es.js.map +1 -1
  29. package/dist/index.js +1559 -1015
  30. package/dist/index.js.map +1 -1
  31. package/dist/utils/getNextSibling.d.ts +2 -0
  32. package/dist/utils/getPreviousSibling.d.ts +2 -0
  33. package/dist/utils/index.d.ts +4 -0
  34. package/dist/utils/isVisible.d.ts +2 -0
  35. package/dist/utils/time.d.ts +2 -2
  36. package/package.json +2 -2
  37. package/src/components/calendar/CCalendar.ts +46 -4
  38. package/src/components/carousel/CCarousel.ts +1 -9
  39. package/src/components/date-picker/CDatePicker.ts +44 -3
  40. package/src/components/date-range-picker/CDateRangePicker.ts +340 -170
  41. package/src/components/form/CFormInput.ts +2 -0
  42. package/src/components/index.ts +1 -0
  43. package/src/components/loading-button/CLoadingButton.ts +1 -2
  44. package/src/components/multi-select/CMultiSelect.ts +295 -173
  45. package/src/components/multi-select/CMultiSelectOptions.ts +48 -10
  46. package/src/components/multi-select/CMultiSelectSelection.ts +1 -1
  47. package/src/components/pagination/index.ts +1 -3
  48. package/src/components/sidebar/CSidebar.ts +2 -10
  49. package/src/components/{pagination → smart-pagination}/CSmartPagination.ts +1 -2
  50. package/src/components/smart-pagination/index.ts +10 -0
  51. package/src/components/smart-table/CSmartTable.ts +10 -5
  52. package/src/components/smart-table/CSmartTableInterface.ts +4 -0
  53. package/src/components/table/CTableCaption.ts +0 -1
  54. package/src/components/time-picker/CTimePicker.ts +198 -64
  55. package/src/components/time-picker/CTimePickerRollCol.ts +9 -0
  56. package/src/utils/getNextSibling.ts +18 -0
  57. package/src/utils/getPreviousSibling.ts +18 -0
  58. package/src/utils/index.ts +5 -0
  59. package/src/utils/isVisible.ts +11 -0
  60. package/src/utils/time.ts +14 -6
@@ -0,0 +1,2 @@
1
+ declare const getNextSibling: (elem: HTMLElement, selector?: string) => Element | null | undefined;
2
+ export default getNextSibling;
@@ -0,0 +1,2 @@
1
+ declare const getPreviousSibling: (elem: HTMLElement, selector?: string) => Element | null | undefined;
2
+ export default getPreviousSibling;
@@ -0,0 +1,4 @@
1
+ import getNextSibling from './getNextSibling';
2
+ import getPreviousSibling from './getPreviousSibling';
3
+ import isVisible from './isVisible';
4
+ export { getNextSibling, getPreviousSibling, isVisible };
@@ -0,0 +1,2 @@
1
+ declare const isVisible: (element: HTMLElement) => boolean;
2
+ export default isVisible;
@@ -2,7 +2,7 @@ export declare const convert12hTo24h: (abbr: 'am' | 'pm', hour: number) => numbe
2
2
  export declare const convert24hTo12h: (hour: number) => number;
3
3
  export declare const convertTimeToDate: (time: Date | string | null | undefined) => Date | null;
4
4
  export declare const getAmPm: (date: Date, locale: string) => "am" | "pm";
5
- export declare const getListOfHours: (locale: string) => {
5
+ export declare const getListOfHours: (locale: string, ampm?: 'auto' | boolean) => {
6
6
  value: number;
7
7
  label: string;
8
8
  }[];
@@ -14,7 +14,7 @@ export declare const getListOfSeconds: (locale: string, valueAsString?: boolean)
14
14
  value: string | number;
15
15
  label: string;
16
16
  }[];
17
- export declare const getSelectedHour: (date: Date | null, locale: string) => number | "";
17
+ export declare const getSelectedHour: (date: Date | null, locale: string, ampm?: 'auto' | boolean) => number | "";
18
18
  export declare const getSelectedMinutes: (date: Date | null) => number | "";
19
19
  export declare const getSelectedSeconds: (date: Date | null) => number | "";
20
20
  export declare const isAmPm: (locale: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreui/vue-pro",
3
- "version": "4.5.0",
3
+ "version": "4.7.0-alpha.0",
4
4
  "description": "UI Components Library for Vue.js",
5
5
  "keywords": [
6
6
  "vue",
@@ -35,7 +35,7 @@
35
35
  "watch": "rollup -c -w"
36
36
  },
37
37
  "config": {
38
- "version_short": "4.5"
38
+ "version_short": "4.6"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@popperjs/core": "^2.11.6",
@@ -34,6 +34,29 @@ const CCalendar = defineComponent({
34
34
  type: Number,
35
35
  default: 1,
36
36
  },
37
+ /**
38
+ * Set the format of day name.
39
+ *
40
+ * @default 'numeric'
41
+ * @since 4.6.0
42
+ */
43
+ dayFormat: {
44
+ type: [Function, String],
45
+ default: 'numeric',
46
+ required: false,
47
+ validator: (value: string) => {
48
+ if (typeof value === 'string') {
49
+ return ['numeric', '2-digit'].includes(value)
50
+ }
51
+ if (typeof value === 'function') {
52
+ return true
53
+ }
54
+ if (typeof value === 'function') {
55
+ return true
56
+ }
57
+ return false
58
+ },
59
+ },
37
60
  /**
38
61
  * Specify the list of dates that cannot be selected.
39
62
  */
@@ -86,6 +109,12 @@ const CCalendar = defineComponent({
86
109
  type: Boolean,
87
110
  default: true,
88
111
  },
112
+ /**
113
+ * Reorder year-month navigation, and render year first.
114
+ *
115
+ * @since 4.6.0
116
+ */
117
+ navYearFirst: Boolean,
89
118
  /**
90
119
  * Allow range selection.
91
120
  */
@@ -106,7 +135,7 @@ const CCalendar = defineComponent({
106
135
  * @type number | 'long' | 'narrow' | 'short'
107
136
  */
108
137
  weekdayFormat: {
109
- type: [Number, String],
138
+ type: [Function, Number, String],
110
139
  default: 2,
111
140
  validator: (value: string | number) => {
112
141
  if (typeof value === 'string') {
@@ -115,6 +144,9 @@ const CCalendar = defineComponent({
115
144
  if (typeof value === 'number') {
116
145
  return true
117
146
  }
147
+ if (typeof value === 'function') {
148
+ return true
149
+ }
118
150
  return false
119
151
  },
120
152
  },
@@ -359,8 +391,12 @@ const CCalendar = defineComponent({
359
391
  {
360
392
  class: 'calendar-header-cell-inner',
361
393
  },
362
- props.weekdayFormat === 'string'
363
- ? date.toLocaleDateString(props.locale, { weekday: props.weekdayFormat })
394
+ typeof props.weekdayFormat === 'function'
395
+ ? props.weekdayFormat(date)
396
+ : typeof props.weekdayFormat === 'string'
397
+ ? date.toLocaleDateString(props.locale, {
398
+ weekday: <'long' | 'narrow' | 'short'>props.weekdayFormat,
399
+ })
364
400
  : date
365
401
  .toLocaleDateString(props.locale, { weekday: 'long' })
366
402
  .slice(0, props.weekdayFormat),
@@ -416,7 +452,11 @@ const CCalendar = defineComponent({
416
452
  {
417
453
  class: 'calendar-cell-inner',
418
454
  },
419
- date.toLocaleDateString(props.locale, { day: 'numeric' }),
455
+ typeof props.dayFormat === 'function'
456
+ ? props.dayFormat(date)
457
+ : date.toLocaleDateString(props.locale, {
458
+ day: <'numeric' | '2-digit'>props.dayFormat,
459
+ }),
420
460
  ),
421
461
  )
422
462
  }),
@@ -530,6 +570,7 @@ const CCalendar = defineComponent({
530
570
  'div',
531
571
  {
532
572
  class: 'calendar-nav-date',
573
+ ...(props.navYearFirst && { style: { display: 'flex', justifyContent: 'center' } }),
533
574
  },
534
575
  [
535
576
  view.value === 'days' &&
@@ -552,6 +593,7 @@ const CCalendar = defineComponent({
552
593
  onClick: () => {
553
594
  if (props.navigation) view.value = 'years'
554
595
  },
596
+ ...(props.navYearFirst && { style: { order: '-1' } }),
555
597
  },
556
598
  () => date.toLocaleDateString(props.locale, { year: 'numeric' }),
557
599
  ),
@@ -11,15 +11,7 @@ import {
11
11
  watch,
12
12
  } from 'vue'
13
13
 
14
- const isVisible = (element: HTMLDivElement) => {
15
- const rect = element.getBoundingClientRect()
16
- return (
17
- rect.top >= 0 &&
18
- rect.left >= 0 &&
19
- rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
20
- rect.right <= (window.innerWidth || document.documentElement.clientWidth)
21
- )
22
- }
14
+ import { isVisible } from './../../utils'
23
15
 
24
16
  const CCarousel = defineComponent({
25
17
  name: 'CCarousel',
@@ -99,6 +99,29 @@ const CDatePicker = defineComponent({
99
99
  return ['ghost', 'outline'].includes(value)
100
100
  },
101
101
  },
102
+ /**
103
+ * Set the format of day name.
104
+ *
105
+ * @default 'numeric'
106
+ * @since 4.6.0
107
+ */
108
+ dayFormat: {
109
+ type: [Function, String],
110
+ default: 'numeric',
111
+ required: false,
112
+ validator: (value: string) => {
113
+ if (typeof value === 'string') {
114
+ return ['numeric', '2-digit'].includes(value)
115
+ }
116
+ if (typeof value === 'function') {
117
+ return true
118
+ }
119
+ if (typeof value === 'function') {
120
+ return true
121
+ }
122
+ return false
123
+ },
124
+ },
102
125
  /**
103
126
  * Toggle the disabled state for the component.
104
127
  */
@@ -183,6 +206,12 @@ const CDatePicker = defineComponent({
183
206
  type: Boolean,
184
207
  default: true,
185
208
  },
209
+ /**
210
+ * Reorder year-month navigation, and render year first.
211
+ *
212
+ * @since 4.6.0
213
+ */
214
+ navYearFirst: Boolean,
186
215
  /**
187
216
  * Specifies a short hint that is visible in the input.
188
217
  */
@@ -212,7 +241,7 @@ const CDatePicker = defineComponent({
212
241
  * @type number | 'long' | 'narrow' | 'short'
213
242
  */
214
243
  weekdayFormat: {
215
- type: [Number, String],
244
+ type: [Function, Number, String],
216
245
  default: 2,
217
246
  validator: (value: string | number) => {
218
247
  if (typeof value === 'string') {
@@ -221,6 +250,9 @@ const CDatePicker = defineComponent({
221
250
  if (typeof value === 'number') {
222
251
  return true
223
252
  }
253
+ if (typeof value === 'function') {
254
+ return true
255
+ }
224
256
  return false
225
257
  },
226
258
  },
@@ -233,13 +265,22 @@ const CDatePicker = defineComponent({
233
265
  * @property {string} formatedDate - formated date
234
266
  */
235
267
  'date-change',
268
+ /**
269
+ * Callback fired when the date changed.
270
+ *
271
+ * @property {Date | null} date - date object
272
+ * @since 4.7.0
273
+ */
274
+ 'update:date',
236
275
  ],
237
276
  setup(props, { emit }) {
238
277
  return () =>
239
278
  h(CDateRangePicker, {
240
279
  calendars: 1,
241
- onStartDateChange: (date: Date, formatedDate: String) =>
242
- emit('date-change', date, formatedDate),
280
+ onStartDateChange: (date: Date, formatedDate: String) => {
281
+ emit('date-change', date, formatedDate)
282
+ emit('update:date', date)
283
+ },
243
284
  range: false,
244
285
  startDate: props.date,
245
286
  ...props,