@globalbrain/sefirot 2.0.0-draft.7 → 2.0.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.
- package/LICENSE.md +1 -1
- package/README.md +6 -6
- package/lib/components/SAvatar.vue +17 -17
- package/lib/components/SButton.vue +512 -267
- package/lib/components/SButtonGroup.vue +149 -0
- package/lib/components/SDropdown.vue +26 -150
- package/lib/components/SDropdownSection.vue +48 -0
- package/lib/components/SDropdownSectionFilter.vue +189 -0
- package/lib/components/SDropdownSectionFilterItem.vue +21 -0
- package/lib/components/SDropdownSectionFilterItemAvatar.vue +31 -0
- package/lib/components/SDropdownSectionFilterItemText.vue +20 -0
- package/lib/components/SDropdownSectionMenu.vue +39 -0
- package/lib/components/SIcon.vue +13 -0
- package/lib/components/SInputBase.vue +31 -31
- package/lib/components/SInputCheckbox.vue +1 -1
- package/lib/components/SInputCheckboxes.vue +74 -0
- package/lib/components/SInputDate.vue +182 -0
- package/lib/components/SInputDropdown.vue +158 -157
- package/lib/components/SInputDropdownItem.vue +46 -48
- package/lib/components/{SInputDropdownItemUserTag.vue → SInputDropdownItemAvatar.vue} +43 -44
- package/lib/components/SInputDropdownItemText.vue +79 -16
- package/lib/components/SInputFile.vue +55 -60
- package/lib/components/SInputHMS.vue +120 -110
- package/lib/components/SInputNumber.vue +38 -9
- package/lib/components/SInputRadio.vue +39 -36
- package/lib/components/SInputRadios.vue +40 -53
- package/lib/components/SInputSelect.vue +3 -3
- package/lib/components/SInputSwitch.vue +193 -0
- package/lib/components/SInputSwitches.vue +88 -0
- package/lib/components/SInputText.vue +206 -62
- package/lib/components/SInputTextarea.vue +46 -32
- package/lib/components/SInputYMD.vue +123 -126
- package/lib/components/SMarkdown.vue +52 -0
- package/lib/components/SModal.vue +25 -63
- package/lib/components/SMount.vue +19 -0
- package/lib/components/SSheet.vue +49 -55
- package/lib/components/SSheetFooter.vue +1 -1
- package/lib/components/SSheetFooterAction.vue +24 -17
- package/lib/components/SSheetFooterActions.vue +1 -4
- package/lib/components/SSheetForm.vue +15 -0
- package/lib/components/SSheetMedium.vue +8 -10
- package/lib/components/SSheetTitle.vue +7 -14
- package/lib/components/SSnackbar.vue +55 -45
- package/lib/components/{SPortalSnackbars.vue → SSnackbars.vue} +17 -20
- package/lib/components/SStep.vue +106 -0
- package/lib/components/SSteps.vue +59 -0
- package/lib/components/STable.vue +241 -0
- package/lib/components/STableCell.vue +82 -0
- package/lib/components/STableCellAvatar.vue +69 -0
- package/lib/components/STableCellAvatars.vue +93 -0
- package/lib/components/STableCellDay.vue +40 -0
- package/lib/components/STableCellPill.vue +84 -0
- package/lib/components/STableCellText.vue +102 -0
- package/lib/components/STableColumn.vue +255 -0
- package/lib/components/STableFooter.vue +115 -0
- package/lib/components/STableHeader.vue +74 -0
- package/lib/components/STableItem.vue +38 -0
- package/lib/components/STooltip.vue +112 -0
- package/lib/composables/Dropdown.ts +40 -99
- package/lib/composables/Form.ts +21 -18
- package/lib/composables/Grid.ts +117 -0
- package/lib/composables/Markdown.ts +138 -0
- package/lib/composables/Step.ts +7 -0
- package/lib/composables/Table.ts +103 -0
- package/lib/composables/Tooltip.ts +91 -0
- package/lib/composables/Validation.ts +6 -7
- package/lib/composables/markdown/LinkPlugin.ts +45 -0
- package/lib/mixins/Sheet.ts +5 -3
- package/lib/stores/Snackbars.ts +48 -0
- package/lib/{assets/styles → styles}/base.css +0 -0
- package/lib/{assets/styles → styles}/bootstrap.css +1 -0
- package/lib/{assets/styles → styles}/variables.css +55 -48
- package/lib/support/Day.ts +8 -0
- package/lib/support/Num.ts +3 -0
- package/lib/support/Time.ts +5 -2
- package/lib/support/Utils.ts +4 -3
- package/lib/types/shims.d.ts +3 -0
- package/lib/validation/validators/requiredYmd.ts +1 -1
- package/lib/validation/validators/ymd.ts +4 -4
- package/package.json +62 -43
- package/CHANGELOG.md +0 -41
- package/lib/components/SDialog.vue +0 -140
- package/lib/components/SDropdownItem.vue +0 -78
- package/lib/components/SDropdownItemText.vue +0 -22
- package/lib/components/SDropdownItemUser.vue +0 -40
- package/lib/components/SInputDropdownItemTextTag.vue +0 -94
- package/lib/components/SInputDropdownItemUser.vue +0 -41
- package/lib/components/SPortalModals.vue +0 -74
- package/lib/composables/Dialog.ts +0 -38
- package/lib/composables/Modal.ts +0 -34
- package/lib/composables/Snackbar.ts +0 -18
- package/lib/store/Sefirot.ts +0 -17
- package/lib/store/dialog/index.ts +0 -42
- package/lib/store/modal/index.ts +0 -61
- package/lib/store/snackbars/index.ts +0 -70
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, computed, unref, watch, nextTick } from 'vue'
|
|
3
|
+
import { DropdownSection } from '../composables/Dropdown'
|
|
4
|
+
import { useFlyout } from '../composables/Flyout'
|
|
5
|
+
import { isArray } from '../support/Utils'
|
|
6
|
+
import SDropdown from './SDropdown.vue'
|
|
7
|
+
import SIconMoreHorizontal from './icons/SIconMoreHorizontal.vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
name: string
|
|
11
|
+
label: string
|
|
12
|
+
className?: string
|
|
13
|
+
dropdown?: DropdownSection[]
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
(e: 'resize', value: string): void
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const { container, isOpen, toggle } = useFlyout()
|
|
21
|
+
|
|
22
|
+
let startWidth = 0
|
|
23
|
+
let startPoint = 0
|
|
24
|
+
|
|
25
|
+
const column = ref<HTMLElement | null>(null)
|
|
26
|
+
const dialog = ref<HTMLElement | null>(null)
|
|
27
|
+
const top = ref('')
|
|
28
|
+
const left = ref('')
|
|
29
|
+
|
|
30
|
+
const active = computed(() => {
|
|
31
|
+
return props.dropdown?.some((item) => {
|
|
32
|
+
if (item.type !== 'filter') {
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const selected = unref(item.selected)
|
|
37
|
+
|
|
38
|
+
if (!isArray(selected)) {
|
|
39
|
+
return selected !== null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!selected.length) {
|
|
43
|
+
return false
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return item.options.some((option) => {
|
|
47
|
+
return selected.includes(option.value)
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const buttonActive = computed(() => {
|
|
53
|
+
return isOpen.value || active.value
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
watch(isOpen, (value) => {
|
|
57
|
+
value ? adjustDialogPosition() : stopDialogPositionListener()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
function grip(e: any) {
|
|
61
|
+
startWidth = column.value?.offsetWidth ?? 0
|
|
62
|
+
startPoint = e.pageX
|
|
63
|
+
|
|
64
|
+
document.addEventListener('mousemove', resize)
|
|
65
|
+
document.addEventListener('mouseup', stopResizeListener)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function resize(e: MouseEvent) {
|
|
69
|
+
const movedWidth = e.pageX - startPoint
|
|
70
|
+
const resized = startWidth + movedWidth
|
|
71
|
+
|
|
72
|
+
emit('resize', resized > -1 ? `${resized}px` : 'var(--table-col-width)')
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function stopResizeListener() {
|
|
76
|
+
document.removeEventListener('mousemove', resize)
|
|
77
|
+
document.removeEventListener('mouseup', stopResizeListener)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function adjustDialogPosition() {
|
|
81
|
+
if (!props.dropdown || !isOpen.value) {
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
startDialogPositionListener()
|
|
86
|
+
|
|
87
|
+
const rect = container.value.getBoundingClientRect()
|
|
88
|
+
|
|
89
|
+
await nextTick()
|
|
90
|
+
|
|
91
|
+
const dialogWidth = dialog.value?.offsetWidth ?? 0
|
|
92
|
+
const position = (window.innerWidth - rect.right) > dialogWidth ? 'right' : 'left'
|
|
93
|
+
|
|
94
|
+
top.value = `${rect.top + rect.height - 8}px`
|
|
95
|
+
left.value = position === 'right' ? `${rect.left - 4}px` : `${rect.right - dialogWidth - 4}px`
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function startDialogPositionListener() {
|
|
99
|
+
window.addEventListener('scroll', adjustDialogPosition)
|
|
100
|
+
window.addEventListener('resize', adjustDialogPosition)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function stopDialogPositionListener() {
|
|
104
|
+
window.removeEventListener('scroll', adjustDialogPosition)
|
|
105
|
+
window.removeEventListener('resize', adjustDialogPosition)
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<template>
|
|
110
|
+
<div class="STableColumn STableCell" :class="[{ active }, className ?? `col-${name}`]" ref="column">
|
|
111
|
+
<div class="container">
|
|
112
|
+
<p class="label">{{ label }}</p>
|
|
113
|
+
|
|
114
|
+
<div v-if="dropdown" class="action" ref="container">
|
|
115
|
+
<button class="button" :class="{ active: buttonActive }" @click="toggle">
|
|
116
|
+
<SIconMoreHorizontal class="icon" />
|
|
117
|
+
</button>
|
|
118
|
+
|
|
119
|
+
<transition name="fade">
|
|
120
|
+
<div v-if="isOpen" class="dialog" :style="{ top, left }" ref="dialog">
|
|
121
|
+
<SDropdown :sections="dropdown" />
|
|
122
|
+
</div>
|
|
123
|
+
</transition>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div class="grip" @mousedown="grip" />
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</template>
|
|
130
|
+
|
|
131
|
+
<style scoped lang="postcss">
|
|
132
|
+
.STableColumn {
|
|
133
|
+
border-top: 1px solid var(--c-divider-light);
|
|
134
|
+
background-color: var(--c-bg-soft);
|
|
135
|
+
|
|
136
|
+
.STableItem:first-child & {
|
|
137
|
+
padding-left: var(--table-padding-left);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.STableItem:last-child & {
|
|
141
|
+
border-right: 0;
|
|
142
|
+
padding-right: var(--table-padding-right);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.container {
|
|
147
|
+
display: flex;
|
|
148
|
+
justify-content: space-between;
|
|
149
|
+
padding-left: 16px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.label {
|
|
153
|
+
flex-grow: 1;
|
|
154
|
+
line-height: 40px;
|
|
155
|
+
text-align: left;
|
|
156
|
+
font-size: 12px;
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
color: var(--c-text-2);
|
|
159
|
+
white-space: nowrap;
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
text-overflow: ellipsis;
|
|
162
|
+
transition: color 0.25s;
|
|
163
|
+
|
|
164
|
+
.STableColumn.active & {
|
|
165
|
+
color: var(--c-info);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.action {
|
|
170
|
+
position: relative;
|
|
171
|
+
padding-right: 6px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.button {
|
|
175
|
+
display: flex;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
align-items: center;
|
|
178
|
+
flex-shrink: 0;
|
|
179
|
+
margin: 6px 0;
|
|
180
|
+
border-radius: 8px;
|
|
181
|
+
width: 28px;
|
|
182
|
+
height: 28px;
|
|
183
|
+
color: var(--c-text-2);
|
|
184
|
+
transition: background-color 0.25s, color 0.25s;
|
|
185
|
+
|
|
186
|
+
&:hover {
|
|
187
|
+
color: var(--c-text-1);
|
|
188
|
+
background-color: var(--c-bg-mute);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&.active {
|
|
192
|
+
color: var(--c-info);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.dark &:hover {
|
|
196
|
+
background-color: var(--c-bg);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.icon {
|
|
201
|
+
width: 16px;
|
|
202
|
+
height: 16px;
|
|
203
|
+
fill: currentColor;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.dialog {
|
|
207
|
+
position: fixed;
|
|
208
|
+
z-index: var(--z-index-dropdown);
|
|
209
|
+
border-radius: 12px;
|
|
210
|
+
width: 256px;
|
|
211
|
+
box-shadow: var(--shadow-depth-3);
|
|
212
|
+
transition: opacity 0.25s, transform 0.25s;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.dialog.fade-enter-from,
|
|
216
|
+
.dialog.fade-leave-to {
|
|
217
|
+
opacity: 0;
|
|
218
|
+
transform: translateY(-4px);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.grip {
|
|
222
|
+
position: relative;
|
|
223
|
+
right: -8px;
|
|
224
|
+
top: 0px;
|
|
225
|
+
bottom: 0px;
|
|
226
|
+
width: 16px;
|
|
227
|
+
z-index: 1;
|
|
228
|
+
position: absolute;
|
|
229
|
+
cursor: col-resize;
|
|
230
|
+
|
|
231
|
+
&::before {
|
|
232
|
+
position: absolute;
|
|
233
|
+
top: 0;
|
|
234
|
+
bottom: 0;
|
|
235
|
+
left: 7px;
|
|
236
|
+
width: 3px;
|
|
237
|
+
content: "";
|
|
238
|
+
transition: background-color 0.25s;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&:hover::before {
|
|
242
|
+
background-color: var(--c-info);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.STableItem:last-child .STableColumn & {
|
|
246
|
+
right: 0;
|
|
247
|
+
width: 8px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.STableItem:last-child .STableColumn &::before {
|
|
251
|
+
left: 6px;
|
|
252
|
+
width: 2px;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
</style>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { format } from '../support/Num'
|
|
4
|
+
import SIconChevronLeft from './icons/SIconChevronLeft.vue'
|
|
5
|
+
import SIconChevronRight from './icons/SIconChevronRight.vue'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
total?: number
|
|
9
|
+
page?: number
|
|
10
|
+
perPage?: number
|
|
11
|
+
borderless?: boolean
|
|
12
|
+
onPrev?(): void
|
|
13
|
+
onNext?(): void
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const _total = computed(() => props.total ?? 0)
|
|
17
|
+
const _page = computed(() => props.page ?? 0)
|
|
18
|
+
const _perPage = computed(() => props.perPage ?? 0)
|
|
19
|
+
|
|
20
|
+
const from = computed(() => {
|
|
21
|
+
return _page.value === 1 ? 1 : (_page.value - 1) * _perPage.value + 1
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const to = computed(() => {
|
|
25
|
+
const value = _page.value * _perPage.value
|
|
26
|
+
|
|
27
|
+
return value > _total.value ? _total.value : value
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const hasPrev = computed(() => {
|
|
31
|
+
return _page.value > 1
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const hasNext = computed(() => {
|
|
35
|
+
return to.value < _total.value
|
|
36
|
+
})
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<div class="STableFooter" :class="{ borderless }">
|
|
41
|
+
<div class="container">
|
|
42
|
+
<p class="info">{{ format(from) }}–{{ format(to) }} of {{ format(_total) }}</p>
|
|
43
|
+
|
|
44
|
+
<div class="actions">
|
|
45
|
+
<button class="button prev" :class="{ active: hasPrev }" @click="onPrev">
|
|
46
|
+
<SIconChevronLeft class="icon" />
|
|
47
|
+
</button>
|
|
48
|
+
<button class="button next" :class="{ active: hasNext }" @click="onNext">
|
|
49
|
+
<SIconChevronRight class="icon" />
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<style scoped lang="postcss">
|
|
57
|
+
.STableFooter {
|
|
58
|
+
border-radius: 0 0 6px 6px;
|
|
59
|
+
padding-top: 8px;
|
|
60
|
+
padding-right: var(--table-padding-right);
|
|
61
|
+
padding-bottom: 8px;
|
|
62
|
+
padding-left: var(--table-padding-left);
|
|
63
|
+
background-color: var(--c-bg-elv-up);
|
|
64
|
+
|
|
65
|
+
&.borderless {
|
|
66
|
+
border-radius: 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.container {
|
|
71
|
+
display: flex;
|
|
72
|
+
justify-content: flex-end;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.info {
|
|
76
|
+
padding-right: 8px;
|
|
77
|
+
padding-top: 4px;
|
|
78
|
+
line-height: 24px;
|
|
79
|
+
font-size: 12px;
|
|
80
|
+
font-weight: 500;
|
|
81
|
+
color: var(--c-text-2);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.actions {
|
|
85
|
+
display: flex;
|
|
86
|
+
padding-right: 8px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.button {
|
|
90
|
+
display: flex;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
align-items: center;
|
|
93
|
+
border-radius: 6px;
|
|
94
|
+
width: 32px;
|
|
95
|
+
height: 32px;
|
|
96
|
+
color: var(--c-text-3);
|
|
97
|
+
cursor: not-allowed;
|
|
98
|
+
transition: color 0.25s, background-color 0.25s;
|
|
99
|
+
|
|
100
|
+
&.active {
|
|
101
|
+
color: var(--c-text-2);
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.active:hover {
|
|
106
|
+
background-color: var(--c-bg-elv-down);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.icon {
|
|
111
|
+
width: 16px;
|
|
112
|
+
height: 16px;
|
|
113
|
+
fill: currentColor;
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { format } from '../support/Num'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
total?: number
|
|
6
|
+
reset?: boolean
|
|
7
|
+
borderless?: boolean
|
|
8
|
+
onReset?(): void
|
|
9
|
+
}>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div class="STableHeader" :class="{ borderless }">
|
|
14
|
+
<div class="container">
|
|
15
|
+
<p class="total">
|
|
16
|
+
{{ format(total ?? 0) }} {{ (total ?? 0) > 1 ? 'records' : 'record' }}
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<div v-if="reset" class="reset">
|
|
20
|
+
<button class="button" @click="onReset">
|
|
21
|
+
Reset filters
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<style scoped lang="postcss">
|
|
29
|
+
.STableHeader {
|
|
30
|
+
padding-right: var(--table-padding-right);
|
|
31
|
+
padding-left: var(--table-padding-left);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.container {
|
|
35
|
+
display: flex;
|
|
36
|
+
padding: 0 16px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.total {
|
|
40
|
+
padding: 13px 0 11px;
|
|
41
|
+
line-height: 24px;
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
color: var(--c-text-2);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.reset {
|
|
48
|
+
position: relative;
|
|
49
|
+
margin-left: 16px;
|
|
50
|
+
|
|
51
|
+
&::before {
|
|
52
|
+
display: inline-block;
|
|
53
|
+
margin-right: 16px;
|
|
54
|
+
width: 1px;
|
|
55
|
+
height: 16px;
|
|
56
|
+
background-color: var(--c-divider-light);
|
|
57
|
+
content: "";
|
|
58
|
+
transform: translateY(4px);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.button {
|
|
63
|
+
padding: 13px 0 11px;
|
|
64
|
+
line-height: 24px;
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
font-weight: 500;
|
|
67
|
+
color: var(--c-info);
|
|
68
|
+
transition: color 0.25s;
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
color: var(--c-info-dark);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
name: string
|
|
4
|
+
width?: string
|
|
5
|
+
}>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div
|
|
10
|
+
class="STableItem"
|
|
11
|
+
:class="[`col-${name}`, { adjusted: width }]"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<style scoped lang="postcss">
|
|
18
|
+
.STableItem {
|
|
19
|
+
position: var(--table-col-position, relative);
|
|
20
|
+
left: 0;
|
|
21
|
+
z-index: var(--table-col-z-index, auto);
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
flex-grow: 1;
|
|
24
|
+
border-right: 1px solid var(--c-divider-light);
|
|
25
|
+
min-width: var(--table-col-width);
|
|
26
|
+
max-width: var(--table-col-max-width, var(--table-col-width));
|
|
27
|
+
|
|
28
|
+
&:last-child {
|
|
29
|
+
border-right: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.adjusted {
|
|
33
|
+
width: v-bind(width) !important;
|
|
34
|
+
min-width: v-bind(width) !important;
|
|
35
|
+
max-width: v-bind(width) !important;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" class="STooltip" @mouseenter="show" @mouseleave="hide">
|
|
3
|
+
<template v-if="text">
|
|
4
|
+
<span ref="content" class="STooltip-content">
|
|
5
|
+
<slot />
|
|
6
|
+
</span>
|
|
7
|
+
|
|
8
|
+
<transition name="fade">
|
|
9
|
+
<span v-show="on" ref="tip" class="STooltip-container" :class="classes">
|
|
10
|
+
<SMarkdown class="STooltip-tip" :content="text" inline />
|
|
11
|
+
</span>
|
|
12
|
+
</transition>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<template v-else>
|
|
16
|
+
<span class="STooltip-content">
|
|
17
|
+
<slot />
|
|
18
|
+
</span>
|
|
19
|
+
</template>
|
|
20
|
+
</component>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { computed, PropType, ref } from 'vue'
|
|
25
|
+
import { Position, useTooltip } from '../composables/Tooltip'
|
|
26
|
+
import SMarkdown from './SMarkdown.vue'
|
|
27
|
+
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
tag: { type: String, default: 'span' },
|
|
30
|
+
text: { type: String, default: null },
|
|
31
|
+
position: { type: String as PropType<Position>, default: 'top' }
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const tip = ref<HTMLElement | null>(null)
|
|
35
|
+
const content = ref<HTMLElement | null>(null)
|
|
36
|
+
const classes = computed(() => [props.position])
|
|
37
|
+
const { on, show, hide } = useTooltip(content, tip, props.position)
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<style lang="postcss" scoped>
|
|
41
|
+
.STooltip {
|
|
42
|
+
position: relative;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.STooltip-container {
|
|
46
|
+
position: absolute;
|
|
47
|
+
display: block;
|
|
48
|
+
transition: opacity .25s;
|
|
49
|
+
z-index: var(--z-index-tooltip);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.STooltip-container.fade-enter,
|
|
53
|
+
.STooltip-container.fade-leave-to {
|
|
54
|
+
opacity: 0;
|
|
55
|
+
&.top .STooltip-tip { transform: translateY(8px); }
|
|
56
|
+
&.right .STooltip-tip { transform: translateX(-8px); }
|
|
57
|
+
&.bottom .STooltip-tip { transform: translateY(-8px); }
|
|
58
|
+
&.left .STooltip-tip { transform: translateX(8px); }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.STooltip-container.top {
|
|
62
|
+
top: 0;
|
|
63
|
+
left: 50%;
|
|
64
|
+
padding-bottom: 8px;
|
|
65
|
+
transform: translate(-50%, -100%);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.STooltip-container.right {
|
|
69
|
+
top: 50%;
|
|
70
|
+
left: 100%;
|
|
71
|
+
transform: translate(8px, -50%);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.STooltip-container.bottom {
|
|
75
|
+
bottom: 0;
|
|
76
|
+
left: 50%;
|
|
77
|
+
padding-top: 8px;
|
|
78
|
+
transform: translate(-50%, 100%);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.STooltip-container.left {
|
|
82
|
+
top: 50%;
|
|
83
|
+
right: 100%;
|
|
84
|
+
transform: translate(-8px, -50%);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.STooltip-tip {
|
|
88
|
+
display: block;
|
|
89
|
+
border-radius: 4px;
|
|
90
|
+
padding: 12px;
|
|
91
|
+
width: max-content;
|
|
92
|
+
max-width: 288px;
|
|
93
|
+
line-height: 18px;
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
font-weight: 500;
|
|
96
|
+
color: var(--c-text-dark-1);
|
|
97
|
+
background-color: rgba(0, 0, 0, .9);
|
|
98
|
+
transition: transform .25s;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.STooltip-tip :deep(a) {
|
|
102
|
+
color: var(--c-info);
|
|
103
|
+
|
|
104
|
+
&:hover {
|
|
105
|
+
color: var(--c-info-dark);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.STooltip-content {
|
|
110
|
+
white-space: nowrap;
|
|
111
|
+
}
|
|
112
|
+
</style>
|