@globalbrain/sefirot 2.9.0 → 2.11.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/lib/components/SAvatar.vue +15 -8
- package/lib/components/SButton.vue +363 -576
- package/lib/components/SInputBase.vue +4 -4
- package/lib/components/SInputCheckboxes.vue +0 -1
- package/lib/components/SInputDate.vue +1 -1
- package/lib/components/SInputDropdown.vue +2 -2
- package/lib/components/SInputSelect.vue +92 -106
- package/lib/components/SPill.vue +199 -0
- package/lib/components/SSnackbar.vue +0 -1
- package/lib/components/STable.vue +5 -2
- package/lib/components/STableCell.vue +40 -26
- package/lib/components/STableCellDay.vue +2 -2
- package/lib/components/STableCellPill.vue +13 -45
- package/lib/components/STableCellPills.vue +42 -0
- package/lib/components/STableCellText.vue +2 -2
- package/lib/composables/Table.ts +14 -3
- package/lib/composables/Tooltip.ts +1 -2
- package/lib/composables/Utils.ts +9 -0
- package/lib/styles/variables.css +433 -160
- package/lib/support/Day/plugins/RelativeTime.ts +1 -2
- package/lib/support/Time.ts +3 -1
- package/package.json +26 -27
|
@@ -1,70 +1,84 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
2
3
|
import { TableCell } from '../composables/Table'
|
|
3
4
|
import STableCellAvatar from './STableCellAvatar.vue'
|
|
4
5
|
import STableCellAvatars from './STableCellAvatars.vue'
|
|
5
6
|
import STableCellDay from './STableCellDay.vue'
|
|
6
7
|
import STableCellPill from './STableCellPill.vue'
|
|
8
|
+
import STableCellPills from './STableCellPills.vue'
|
|
7
9
|
import STableCellText from './STableCellText.vue'
|
|
8
10
|
|
|
9
|
-
defineProps<{
|
|
11
|
+
const props = defineProps<{
|
|
10
12
|
name: string
|
|
11
13
|
className?: string
|
|
12
|
-
cell?:
|
|
14
|
+
cell?: any
|
|
13
15
|
value: any
|
|
14
16
|
record: any
|
|
15
17
|
records: Record<string, any>
|
|
16
18
|
}>()
|
|
19
|
+
|
|
20
|
+
const computedCell = computed<TableCell | undefined>(() =>
|
|
21
|
+
typeof props.cell === 'function'
|
|
22
|
+
? props.cell(props.value, props.record)
|
|
23
|
+
: props.cell
|
|
24
|
+
)
|
|
17
25
|
</script>
|
|
18
26
|
|
|
19
27
|
<template>
|
|
20
28
|
<div class="STableCell" :class="[className, `col-${name}`]">
|
|
21
29
|
<STableCellText
|
|
22
|
-
v-if="!
|
|
30
|
+
v-if="!computedCell || computedCell.type === 'text'"
|
|
23
31
|
:value="value"
|
|
24
32
|
:record="record"
|
|
25
|
-
:icon="
|
|
26
|
-
:getter="
|
|
27
|
-
:link="
|
|
28
|
-
:color="
|
|
29
|
-
:icon-color="
|
|
30
|
-
:on-click="
|
|
33
|
+
:icon="computedCell?.icon"
|
|
34
|
+
:getter="computedCell?.value"
|
|
35
|
+
:link="computedCell?.link"
|
|
36
|
+
:color="computedCell?.color"
|
|
37
|
+
:icon-color="computedCell?.iconColor"
|
|
38
|
+
:on-click="computedCell?.onClick"
|
|
31
39
|
/>
|
|
32
40
|
<STableCellDay
|
|
33
|
-
v-else-if="
|
|
41
|
+
v-else-if="computedCell.type === 'day'"
|
|
34
42
|
:value="value"
|
|
35
43
|
:record="record"
|
|
36
|
-
:format="
|
|
37
|
-
:color="
|
|
44
|
+
:format="computedCell.format"
|
|
45
|
+
:color="computedCell.color"
|
|
38
46
|
/>
|
|
39
47
|
<STableCellPill
|
|
40
|
-
v-else-if="
|
|
48
|
+
v-else-if="computedCell.type === 'pill'"
|
|
49
|
+
:value="value"
|
|
50
|
+
:record="record"
|
|
51
|
+
:getter="computedCell.value"
|
|
52
|
+
:color="computedCell.color"
|
|
53
|
+
/>
|
|
54
|
+
<STableCellPills
|
|
55
|
+
v-else-if="computedCell.type === 'pills'"
|
|
41
56
|
:value="value"
|
|
42
57
|
:record="record"
|
|
43
|
-
:
|
|
44
|
-
:color="cell.color"
|
|
58
|
+
:pills="computedCell.pills"
|
|
45
59
|
/>
|
|
46
60
|
<STableCellAvatar
|
|
47
|
-
v-else-if="
|
|
61
|
+
v-else-if="computedCell.type === 'avatar'"
|
|
48
62
|
:value="value"
|
|
49
63
|
:record="record"
|
|
50
|
-
:image="
|
|
51
|
-
:name="
|
|
52
|
-
:link="
|
|
53
|
-
:color="
|
|
64
|
+
:image="computedCell.image"
|
|
65
|
+
:name="computedCell.name"
|
|
66
|
+
:link="computedCell.link"
|
|
67
|
+
:color="computedCell.color"
|
|
54
68
|
/>
|
|
55
69
|
<STableCellAvatars
|
|
56
|
-
v-else-if="
|
|
70
|
+
v-else-if="computedCell.type === 'avatars'"
|
|
57
71
|
:value="value"
|
|
58
72
|
:record="record"
|
|
59
|
-
:avatars="
|
|
60
|
-
:color="
|
|
73
|
+
:avatars="computedCell.avatars"
|
|
74
|
+
:color="computedCell.color"
|
|
61
75
|
/>
|
|
62
76
|
<component
|
|
63
|
-
v-else-if="
|
|
64
|
-
:is="
|
|
77
|
+
v-else-if="computedCell.type === 'component'"
|
|
78
|
+
:is="computedCell.component"
|
|
65
79
|
:value="value"
|
|
66
80
|
:record="record"
|
|
67
|
-
v-bind="
|
|
81
|
+
v-bind="computedCell.props"
|
|
68
82
|
/>
|
|
69
83
|
</div>
|
|
70
84
|
</template>
|
|
@@ -26,8 +26,8 @@ defineProps<{
|
|
|
26
26
|
.value {
|
|
27
27
|
line-height: 24px;
|
|
28
28
|
font-family: var(--font-family-number);
|
|
29
|
-
font-size:
|
|
30
|
-
font-weight:
|
|
29
|
+
font-size: var(--table-cell-font-size);
|
|
30
|
+
font-weight: var(--table-cell-font-weight);
|
|
31
31
|
white-space: nowrap;
|
|
32
32
|
overflow: hidden;
|
|
33
33
|
text-overflow: ellipsis;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
+
import SPill from './SPill.vue'
|
|
3
4
|
|
|
4
|
-
export type Color = '
|
|
5
|
+
export type Color = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
5
6
|
|
|
6
7
|
const props = defineProps<{
|
|
7
8
|
value?: any
|
|
@@ -22,7 +23,7 @@ const _value = computed(() => {
|
|
|
22
23
|
|
|
23
24
|
const _color = computed(() => {
|
|
24
25
|
if (props.color === undefined) {
|
|
25
|
-
return
|
|
26
|
+
return props.color
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
return typeof props.color === 'string'
|
|
@@ -32,54 +33,21 @@ const _color = computed(() => {
|
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
35
|
<template>
|
|
35
|
-
<div class="STableCellPill" :class="[_color ?? '
|
|
36
|
-
<
|
|
36
|
+
<div class="STableCellPill" :class="[_color ?? 'neutral']">
|
|
37
|
+
<SPill
|
|
38
|
+
v-if="_value"
|
|
39
|
+
size="mini"
|
|
40
|
+
:mode="_color"
|
|
41
|
+
:label="value"
|
|
42
|
+
/>
|
|
37
43
|
</div>
|
|
38
44
|
</template>
|
|
39
45
|
|
|
40
46
|
<style scoped lang="postcss">
|
|
41
47
|
.STableCellPill {
|
|
42
|
-
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
padding: 8px 16px;
|
|
43
51
|
min-height: 40px;
|
|
44
52
|
}
|
|
45
|
-
|
|
46
|
-
.value {
|
|
47
|
-
display: inline-block;
|
|
48
|
-
border: 1px solid transparent;
|
|
49
|
-
border-radius: 14px;
|
|
50
|
-
padding: 0 8px;
|
|
51
|
-
line-height: 18px;
|
|
52
|
-
font-size: 12px;
|
|
53
|
-
font-weight: 500;
|
|
54
|
-
|
|
55
|
-
.STableCellPill.info & {
|
|
56
|
-
border-color: var(--c-info);
|
|
57
|
-
color: var(--c-info);
|
|
58
|
-
background-color: var(--c-info-bg);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.STableCellPill.success & {
|
|
62
|
-
border-color: var(--c-success);
|
|
63
|
-
color: var(--c-success);
|
|
64
|
-
background-color: var(--c-success-bg);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.STableCellPill.warning & {
|
|
68
|
-
border-color: var(--c-warning);
|
|
69
|
-
color: var(--c-warning);
|
|
70
|
-
background-color: var(--c-warning-bg);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.STableCellPill.danger & {
|
|
74
|
-
border-color: var(--c-danger);
|
|
75
|
-
color: var(--c-danger);
|
|
76
|
-
background-color: var(--c-danger-bg);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.STableCellPill.mute & {
|
|
80
|
-
border-color: var(--c-divider);
|
|
81
|
-
color: var(--c-text-2);
|
|
82
|
-
background-color: var(--c-bg-elv);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
53
|
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { TableCellPillColor } from '../composables/Table'
|
|
4
|
+
import STableCellPill from './STableCellPill.vue'
|
|
5
|
+
|
|
6
|
+
export interface Pill {
|
|
7
|
+
label: string
|
|
8
|
+
color: TableCellPillColor
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
value: string[]
|
|
13
|
+
record: any
|
|
14
|
+
pills(value: string[], record: any): Pill[]
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const items = computed(() => props.pills(props.value, props.record))
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div class="STableCellPills">
|
|
22
|
+
<STableCellPill
|
|
23
|
+
v-for="item in items"
|
|
24
|
+
:key="item.label"
|
|
25
|
+
:value="item.label"
|
|
26
|
+
:record="record"
|
|
27
|
+
:color="item.color"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style scoped lang="postcss">
|
|
33
|
+
.STableCellPills {
|
|
34
|
+
display: flex;
|
|
35
|
+
padding: 0 14px;
|
|
36
|
+
|
|
37
|
+
:deep(.STableCellPill) {
|
|
38
|
+
padding-right: 2px;
|
|
39
|
+
padding-left: 2px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
@@ -78,8 +78,8 @@ const _iconColor = computed(() => {
|
|
|
78
78
|
|
|
79
79
|
.text {
|
|
80
80
|
line-height: 24px;
|
|
81
|
-
font-size:
|
|
82
|
-
font-weight:
|
|
81
|
+
font-size: var(--table-cell-font-size);
|
|
82
|
+
font-weight: var(--table-cell-font-weight);
|
|
83
83
|
white-space: nowrap;
|
|
84
84
|
overflow: hidden;
|
|
85
85
|
text-overflow: ellipsis;
|
package/lib/composables/Table.ts
CHANGED
|
@@ -25,18 +25,19 @@ export interface TableColumn {
|
|
|
25
25
|
label: string
|
|
26
26
|
className?: string
|
|
27
27
|
dropdown?: DropdownSection[]
|
|
28
|
-
cell?: TableCell
|
|
28
|
+
cell?: TableCell | ((value: any, record: any) => TableCell)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export type TableCell =
|
|
32
32
|
| TableCellText
|
|
33
33
|
| TableCellDay
|
|
34
34
|
| TableCellPill
|
|
35
|
+
| TableCellPills
|
|
35
36
|
| TableCellAvatar
|
|
36
37
|
| TableCellAvatars
|
|
37
38
|
| TableCellComponent
|
|
38
39
|
|
|
39
|
-
export type TableCellType = 'text' | 'day' | 'pill' | 'avatar' | 'avatars' | 'component'
|
|
40
|
+
export type TableCellType = 'text' | 'day' | 'pill' | 'pills' | 'avatar' | 'avatars' | 'component'
|
|
40
41
|
|
|
41
42
|
export interface TableCellBase {
|
|
42
43
|
type: TableCellType
|
|
@@ -73,7 +74,17 @@ export interface TableCellPill extends TableCellBase {
|
|
|
73
74
|
color?: TableCellPillColor | ((value: any) => TableCellPillColor)
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
export type TableCellPillColor = '
|
|
77
|
+
export type TableCellPillColor = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
78
|
+
|
|
79
|
+
export interface TableCellPills extends TableCellBase {
|
|
80
|
+
type: 'pills'
|
|
81
|
+
pills(value: any, record: any): TableCellPillItem[]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface TableCellPillItem {
|
|
85
|
+
label: string
|
|
86
|
+
color: TableCellPillColor
|
|
87
|
+
}
|
|
77
88
|
|
|
78
89
|
export interface TableCellAvatar extends TableCellBase {
|
|
79
90
|
type: 'avatar'
|