webcake-ui-kit 1.1.28 → 1.1.30
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/package.json +7 -2
- package/src/components/alert/Alert.vue +3 -2
- package/src/components/alert/alert.css +29 -3
- package/src/components/date-picker/CalendarPanel.vue +154 -0
- package/src/components/date-picker/CalendarView.vue +104 -0
- package/src/components/date-picker/DatePicker.vue +587 -0
- package/src/components/date-picker/PanelFooter.vue +45 -0
- package/src/components/date-picker/PanelHeader.vue +102 -0
- package/src/components/date-picker/TimePanel.vue +98 -0
- package/src/components/date-picker/calendar-panel.css +36 -0
- package/src/components/date-picker/calendar-view.css +134 -0
- package/src/components/date-picker/calendar.js +116 -0
- package/src/components/date-picker/date-picker.css +95 -0
- package/src/components/date-picker/dayjs.js +34 -0
- package/src/components/date-picker/panel-footer.css +42 -0
- package/src/components/date-picker/panel-header.css +71 -0
- package/src/components/date-picker/time-panel.css +63 -0
- package/src/components/dropdown/Dropdown.vue +14 -2
- package/src/components/dropdown/DropdownMenuItems.vue +7 -3
- package/src/components/dropdown/dropdown-menu-items.css +4 -11
- package/src/components/input/input.css +7 -2
- package/src/components/menu/Menu.vue +7 -2
- package/src/components/menu/menu.css +0 -1
- package/src/components/message/Message.vue +72 -0
- package/src/components/message/MessageContainer.vue +200 -0
- package/src/components/message/message-container.css +108 -0
- package/src/components/message/message.css +69 -0
- package/src/components/message/message.js +133 -0
- package/src/components/progress/Progress.vue +42 -0
- package/src/components/progress/progress.css +15 -0
- package/src/components/radio/Radio.vue +1 -1
- package/src/components/radio-group/RadioGroup.vue +2 -2
- package/src/components/select/Select.vue +5 -1
- package/src/components/select/select.css +13 -7
- package/src/components/select-option/SelectOption.vue +6 -0
- package/src/components/select-option/select_option.css +20 -0
- package/src/components/table/Table.vue +434 -92
- package/src/components/table/table.css +178 -5
- package/src/components/tooltip/Tooltip.vue +6 -3
- package/src/floating/click-outside-mixin.js +21 -1
- package/src/index.js +5 -0
- package/src/styles/color_general.css +20 -12
- package/src/styles/raw_colors.css +4 -4
- package/src/styles/shadow.css +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webcake-ui-kit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.30",
|
|
4
4
|
"description": "UI Kit for Vue 2 && 3 - Pure Options API",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"./WkButtonGroup": "./src/components/button-group/ButtonGroup.vue",
|
|
28
28
|
"./WkCheckbox": "./src/components/checkbox/Checkbox.vue",
|
|
29
29
|
"./WkCheckboxGroup": "./src/components/checkbox-group/CheckboxGroup.vue",
|
|
30
|
+
"./WkDatePicker": "./src/components/date-picker/DatePicker.vue",
|
|
30
31
|
"./WkDialog": "./src/components/dialog/Dialog.vue",
|
|
31
32
|
"./WkDivider": "./src/components/divider/Divider.vue",
|
|
32
33
|
"./WkDropdown": "./src/components/dropdown/Dropdown.vue",
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"./WkInputNumber": "./src/components/input-number/InputNumber.vue",
|
|
38
39
|
"./WkMenu": "./src/components/menu/Menu.vue",
|
|
39
40
|
"./WkPagination": "./src/components/pagination/Pagination.vue",
|
|
41
|
+
"./WkProgress": "./src/components/progress/Progress.vue",
|
|
40
42
|
"./WkRadio": "./src/components/radio/Radio.vue",
|
|
41
43
|
"./WkRadioGroup": "./src/components/radio-group/RadioGroup.vue",
|
|
42
44
|
"./WkRichCheckboxGroup": "./src/components/rich-checkbox-group/RichCheckboxGroup.vue",
|
|
@@ -135,5 +137,8 @@
|
|
|
135
137
|
"bugs": {
|
|
136
138
|
"url": "https://github.com/pancake-vn/webcake-ui-kit/issues"
|
|
137
139
|
},
|
|
138
|
-
"homepage": "https://ui.webcake.io"
|
|
140
|
+
"homepage": "https://ui.webcake.io",
|
|
141
|
+
"dependencies": {
|
|
142
|
+
"dayjs": "^1.11.21"
|
|
143
|
+
}
|
|
139
144
|
}
|
|
@@ -29,7 +29,8 @@ const ICON_BY_TYPE = {
|
|
|
29
29
|
neutral: 'WkiCircleCheck',
|
|
30
30
|
error: 'WkiCircleAlert',
|
|
31
31
|
warning: 'WkiTriangleAlert',
|
|
32
|
-
info: 'WkiInfo'
|
|
32
|
+
info: 'WkiInfo',
|
|
33
|
+
success: 'WkiCircleCheck'
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export default {
|
|
@@ -40,7 +41,7 @@ export default {
|
|
|
40
41
|
type: String,
|
|
41
42
|
default: 'neutral',
|
|
42
43
|
validator: function (v) {
|
|
43
|
-
return ['neutral', 'error', 'warning', 'info'].includes(v)
|
|
44
|
+
return ['neutral', 'error', 'warning', 'info', 'success'].includes(v)
|
|
44
45
|
}
|
|
45
46
|
},
|
|
46
47
|
title: {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
letter-spacing: var(--paragraph-small-letter-spacing);
|
|
43
43
|
font-weight: var(--paragraph-medium-font-weight);
|
|
44
44
|
word-break: break-word;
|
|
45
|
+
color: var(--primary-fg);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
.ui-alert__description {
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
padding: 0;
|
|
70
71
|
border: none;
|
|
71
72
|
background: none;
|
|
72
|
-
color:
|
|
73
|
+
color: var(--primary-fg);
|
|
73
74
|
cursor: pointer;
|
|
74
75
|
border-radius: var(--rounded-md);
|
|
75
76
|
outline: none;
|
|
@@ -95,6 +96,9 @@
|
|
|
95
96
|
.ui-alert--neutral {
|
|
96
97
|
background: var(--card);
|
|
97
98
|
border-color: var(--border-primary);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.ui-alert--neutral .ui-alert__icon {
|
|
98
102
|
color: var(--primary-fg);
|
|
99
103
|
}
|
|
100
104
|
|
|
@@ -104,14 +108,36 @@
|
|
|
104
108
|
color: var(--destructive-text);
|
|
105
109
|
}
|
|
106
110
|
|
|
111
|
+
.ui-alert--error .ui-alert__icon {
|
|
112
|
+
color: var(--destructive);
|
|
113
|
+
}
|
|
114
|
+
|
|
107
115
|
.ui-alert--warning {
|
|
108
116
|
background: var(--warning-subtle);
|
|
109
117
|
border-color: var(--warning-border-subtle);
|
|
110
|
-
color: var(--warning
|
|
118
|
+
color: var(--warning);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.ui-alert--warning .ui-alert__icon {
|
|
122
|
+
color: var(--warning);
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
.ui-alert--info {
|
|
114
126
|
background: var(--infor-subtle);
|
|
115
127
|
border-color: var(--infor-border-subtle);
|
|
116
|
-
color: var(--infor
|
|
128
|
+
color: var(--infor);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ui-alert--info .ui-alert__icon {
|
|
132
|
+
color: var(--infor);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.ui-alert--success {
|
|
136
|
+
background: var(--positive-subtle);
|
|
137
|
+
border-color: var(--positive-border-subtle);
|
|
138
|
+
color: var(--positive);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ui-alert--success .ui-alert__icon {
|
|
142
|
+
color: var(--positive);
|
|
117
143
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-cal-panel" :class="{ 'ui-cal-panel--with-time': showTime }">
|
|
3
|
+
<div class="ui-cal-panel__main">
|
|
4
|
+
<slot name="header">
|
|
5
|
+
<PanelHeader
|
|
6
|
+
:panels="panels"
|
|
7
|
+
:month-options="monthOptions"
|
|
8
|
+
:year-options="yearOptions"
|
|
9
|
+
:show-select-month="showSelectMonth"
|
|
10
|
+
:show-select-year="showSelectYear"
|
|
11
|
+
:can-prev="canPrev"
|
|
12
|
+
:can-next="canNext"
|
|
13
|
+
:show-year-jump="showYearJump"
|
|
14
|
+
@prev="$emit('prev')"
|
|
15
|
+
@next="$emit('next')"
|
|
16
|
+
@prev-year="$emit('prev-year')"
|
|
17
|
+
@next-year="$emit('next-year')"
|
|
18
|
+
@set-month="p => $emit('set-month', p)"
|
|
19
|
+
@set-year="p => $emit('set-year', p)"
|
|
20
|
+
@label-click="p => $emit('label-click', p)"
|
|
21
|
+
/>
|
|
22
|
+
</slot>
|
|
23
|
+
|
|
24
|
+
<div class="ui-cal-panel__body">
|
|
25
|
+
<div class="ui-cal-panel__months" @keydown="$emit('grid-keydown', $event)">
|
|
26
|
+
<CalendarView
|
|
27
|
+
v-for="(view, i) in views"
|
|
28
|
+
:key="i"
|
|
29
|
+
class="ui-cal-panel__month"
|
|
30
|
+
:matrix="view.matrix"
|
|
31
|
+
:weekdays="weekdays"
|
|
32
|
+
:mode="mode"
|
|
33
|
+
:selected="selected"
|
|
34
|
+
:range-start="rangeStart"
|
|
35
|
+
:range-end="rangeEnd"
|
|
36
|
+
:focus-iso="focusIso"
|
|
37
|
+
:clip-outside="views.length > 1"
|
|
38
|
+
@select="iso => $emit('select', iso)"
|
|
39
|
+
@hover="iso => $emit('hover', iso)"
|
|
40
|
+
>
|
|
41
|
+
<!-- Always forward; the fallback renders the day number when the
|
|
42
|
+
consumer hasn't supplied a custom #cell slot (dual-compat: no
|
|
43
|
+
$scopedSlots sniffing needed). -->
|
|
44
|
+
<template #cell="slotProps">
|
|
45
|
+
<slot name="cell" v-bind="slotProps">{{ slotProps.cell.day }}</slot>
|
|
46
|
+
</template>
|
|
47
|
+
</CalendarView>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div v-if="showTime" class="ui-cal-panel__time">
|
|
51
|
+
<slot name="time">
|
|
52
|
+
<TimePanel
|
|
53
|
+
:value="timeValue"
|
|
54
|
+
:show-seconds="showSeconds"
|
|
55
|
+
:hour-step="hourStep"
|
|
56
|
+
:minute-step="minuteStep"
|
|
57
|
+
:second-step="secondStep"
|
|
58
|
+
:disabled-time="disabledTime"
|
|
59
|
+
@change="t => $emit('time-change', t)"
|
|
60
|
+
/>
|
|
61
|
+
</slot>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<slot name="footer">
|
|
67
|
+
<PanelFooter
|
|
68
|
+
v-if="showFooter"
|
|
69
|
+
:show-today="showToday"
|
|
70
|
+
:show-clear="showClear"
|
|
71
|
+
:show-confirm="showConfirm"
|
|
72
|
+
:today-disabled="todayDisabled"
|
|
73
|
+
:confirm-disabled="confirmDisabled"
|
|
74
|
+
:today-text="todayText"
|
|
75
|
+
:clear-text="clearText"
|
|
76
|
+
:confirm-text="confirmText"
|
|
77
|
+
@today="$emit('today')"
|
|
78
|
+
@clear="$emit('clear')"
|
|
79
|
+
@confirm="$emit('confirm')"
|
|
80
|
+
/>
|
|
81
|
+
</slot>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script>
|
|
86
|
+
import CalendarView from './CalendarView.vue'
|
|
87
|
+
import PanelHeader from './PanelHeader.vue'
|
|
88
|
+
import PanelFooter from './PanelFooter.vue'
|
|
89
|
+
import TimePanel from './TimePanel.vue'
|
|
90
|
+
|
|
91
|
+
export default {
|
|
92
|
+
name: 'CalendarPanel',
|
|
93
|
+
components: { CalendarView, PanelHeader, PanelFooter, TimePanel },
|
|
94
|
+
props: {
|
|
95
|
+
// [{ matrix, monthLabel, month, year }] — one per visible month.
|
|
96
|
+
views: { type: Array, default: () => [] },
|
|
97
|
+
// Localized month names + selectable years for the header dropdowns.
|
|
98
|
+
monthOptions: { type: Array, default: () => [] },
|
|
99
|
+
yearOptions: { type: Array, default: () => [] },
|
|
100
|
+
showSelectMonth: { type: Boolean, default: false },
|
|
101
|
+
showSelectYear: { type: Boolean, default: false },
|
|
102
|
+
weekdays: { type: Array, default: () => [] },
|
|
103
|
+
mode: { type: String, default: 'single' },
|
|
104
|
+
selected: { type: Array, default: () => [] },
|
|
105
|
+
rangeStart: { type: String, default: null },
|
|
106
|
+
rangeEnd: { type: String, default: null },
|
|
107
|
+
focusIso: { type: String, default: null },
|
|
108
|
+
canPrev: { type: Boolean, default: true },
|
|
109
|
+
canNext: { type: Boolean, default: true },
|
|
110
|
+
showYearJump: { type: Boolean, default: false },
|
|
111
|
+
// Time
|
|
112
|
+
showTime: { type: Boolean, default: false },
|
|
113
|
+
timeValue: { type: Object, default: () => ({ hour: 0, minute: 0, second: 0 }) },
|
|
114
|
+
showSeconds: { type: Boolean, default: false },
|
|
115
|
+
hourStep: { type: Number, default: 1 },
|
|
116
|
+
minuteStep: { type: Number, default: 1 },
|
|
117
|
+
secondStep: { type: Number, default: 1 },
|
|
118
|
+
disabledTime: { type: Function, default: null },
|
|
119
|
+
// Footer
|
|
120
|
+
showFooter: { type: Boolean, default: true },
|
|
121
|
+
showToday: { type: Boolean, default: true },
|
|
122
|
+
showClear: { type: Boolean, default: true },
|
|
123
|
+
showConfirm: { type: Boolean, default: false },
|
|
124
|
+
todayDisabled: { type: Boolean, default: false },
|
|
125
|
+
confirmDisabled: { type: Boolean, default: false },
|
|
126
|
+
todayText: { type: String, default: 'Today' },
|
|
127
|
+
clearText: { type: String, default: 'Clear' },
|
|
128
|
+
confirmText: { type: String, default: 'OK' }
|
|
129
|
+
},
|
|
130
|
+
emits: [
|
|
131
|
+
'prev',
|
|
132
|
+
'next',
|
|
133
|
+
'prev-year',
|
|
134
|
+
'next-year',
|
|
135
|
+
'set-month',
|
|
136
|
+
'set-year',
|
|
137
|
+
'label-click',
|
|
138
|
+
'select',
|
|
139
|
+
'hover',
|
|
140
|
+
'grid-keydown',
|
|
141
|
+
'time-change',
|
|
142
|
+
'today',
|
|
143
|
+
'clear',
|
|
144
|
+
'confirm'
|
|
145
|
+
],
|
|
146
|
+
computed: {
|
|
147
|
+
panels() {
|
|
148
|
+
return this.views.map(v => ({ month: v.month, year: v.year }))
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<style src="./calendar-panel.css" scoped></style>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-cal-view">
|
|
3
|
+
<div class="ui-cal-view__weekdays" aria-hidden="true">
|
|
4
|
+
<span v-for="(w, i) in weekdays" :key="i" class="ui-cal-view__weekday">{{ w }}</span>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="ui-cal-view__grid" role="grid" @mouseleave="$emit('hover', null)">
|
|
7
|
+
<button
|
|
8
|
+
v-for="cell in matrix"
|
|
9
|
+
:key="cell.iso"
|
|
10
|
+
type="button"
|
|
11
|
+
role="gridcell"
|
|
12
|
+
class="ui-cal-cell"
|
|
13
|
+
:class="cellClass(cell)"
|
|
14
|
+
:disabled="cell.disabled"
|
|
15
|
+
:tabindex="cell.iso === focusIso ? 0 : -1"
|
|
16
|
+
:aria-selected="isSelected(cell) ? 'true' : 'false'"
|
|
17
|
+
:aria-current="cell.today ? 'date' : null"
|
|
18
|
+
@click="onSelect(cell)"
|
|
19
|
+
@mouseenter="onHover(cell)"
|
|
20
|
+
@focus="onHover(cell)"
|
|
21
|
+
>
|
|
22
|
+
<span class="ui-cal-cell__inner">
|
|
23
|
+
<slot name="cell" :cell="cell">{{ cell.day }}</slot>
|
|
24
|
+
</span>
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import { rangePosition, isWithinRange } from './calendar.js'
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
name: 'CalendarView',
|
|
35
|
+
props: {
|
|
36
|
+
// 42-cell array from buildDayMatrix().
|
|
37
|
+
matrix: { type: Array, default: () => [] },
|
|
38
|
+
// 7 weekday header labels, already rotated to weekStart.
|
|
39
|
+
weekdays: { type: Array, default: () => [] },
|
|
40
|
+
mode: { type: String, default: 'single' },
|
|
41
|
+
// Selected ISO keys (single => [iso], multiple => [...isos], range => []).
|
|
42
|
+
selected: { type: Array, default: () => [] },
|
|
43
|
+
// Resolved range endpoints (include live hover preview) for the band.
|
|
44
|
+
rangeStart: { type: String, default: null },
|
|
45
|
+
rangeEnd: { type: String, default: null },
|
|
46
|
+
// Roving keyboard focus target.
|
|
47
|
+
focusIso: { type: String, default: null },
|
|
48
|
+
// When true (multi-month view), suppress selection/range styling on days
|
|
49
|
+
// that belong to an adjacent month so each panel only paints its own days.
|
|
50
|
+
clipOutside: { type: Boolean, default: false }
|
|
51
|
+
},
|
|
52
|
+
emits: ['select', 'hover'],
|
|
53
|
+
methods: {
|
|
54
|
+
isSelected(cell) {
|
|
55
|
+
if (this.clipOutside && cell.outside) return false
|
|
56
|
+
if (this.mode === 'range') {
|
|
57
|
+
return cell.iso === this.rangeStart || cell.iso === this.rangeEnd
|
|
58
|
+
}
|
|
59
|
+
return this.selected.indexOf(cell.iso) !== -1
|
|
60
|
+
},
|
|
61
|
+
cellClass(cell) {
|
|
62
|
+
const cls = {
|
|
63
|
+
'is-outside': cell.outside,
|
|
64
|
+
'is-today': cell.today,
|
|
65
|
+
'is-weekend': cell.weekend,
|
|
66
|
+
'is-disabled': cell.disabled,
|
|
67
|
+
// The filled endpoint chip is clipped on outside days (via isSelected)
|
|
68
|
+
// so a shared date isn't drawn "active" in two panels at once...
|
|
69
|
+
'is-selected': this.isSelected(cell),
|
|
70
|
+
'is-focus': cell.iso === this.focusIso
|
|
71
|
+
}
|
|
72
|
+
if (this.mode === 'range') {
|
|
73
|
+
// ...but the connecting band (::before) DOES extend onto outside days so
|
|
74
|
+
// the range reads continuously to each panel's edge.
|
|
75
|
+
const pos = rangePosition(cell.iso, this.rangeStart, this.rangeEnd)
|
|
76
|
+
const clippedOutside = this.clipOutside && cell.outside
|
|
77
|
+
if (pos === 'middle') {
|
|
78
|
+
cls['is-in-range'] = true
|
|
79
|
+
} else if (pos === 'left' || pos === 'right') {
|
|
80
|
+
// A true endpoint (with chip) gets the rounded half end-cap; an outside
|
|
81
|
+
// endpoint has no chip, so give it a FULL band segment instead of a
|
|
82
|
+
// bare half-cell — otherwise the panel edge shows a broken 50% band.
|
|
83
|
+
if (clippedOutside) cls['is-in-range'] = true
|
|
84
|
+
else cls['is-range-' + pos] = true
|
|
85
|
+
} else if (pos === 'single' && !clippedOutside) {
|
|
86
|
+
cls['is-range-single'] = true
|
|
87
|
+
}
|
|
88
|
+
if (isWithinRange(cell.iso, this.rangeStart, this.rangeEnd)) cls['is-in-range'] = true
|
|
89
|
+
}
|
|
90
|
+
return cls
|
|
91
|
+
},
|
|
92
|
+
onSelect(cell) {
|
|
93
|
+
if (cell.disabled) return
|
|
94
|
+
this.$emit('select', cell.iso)
|
|
95
|
+
},
|
|
96
|
+
onHover(cell) {
|
|
97
|
+
if (cell.disabled) return
|
|
98
|
+
this.$emit('hover', cell.iso)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<style src="./calendar-view.css" scoped></style>
|