@ysgroup/ui 0.1.19 → 0.1.21
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
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ysgroup/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@element-plus/icons-vue": "^2.3.1",
|
|
9
|
-
"@ysgroup/
|
|
10
|
-
"@ysgroup/
|
|
9
|
+
"@ysgroup/contracts": "workspace:^",
|
|
10
|
+
"@ysgroup/theme": "^0.1.0"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"element-plus": ">=2.9",
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|
|
23
23
|
}
|
|
24
|
-
}
|
|
24
|
+
}
|
|
@@ -160,7 +160,7 @@ function onSubmit(payload: Record<string, unknown>) {
|
|
|
160
160
|
>
|
|
161
161
|
</YsTableToolbar>
|
|
162
162
|
|
|
163
|
-
<el-table :data="paged" v-loading="loading" stripe border size="small" table-layout="fixed" row-key="_id">
|
|
163
|
+
<el-table :fit="false" :data="paged" v-loading="loading" stripe border size="small" table-layout="fixed" row-key="_id">
|
|
164
164
|
<el-table-column v-for="c in displayColumns" :key="c.key" :label="c.title" :width="columnWidth(c)" show-overflow-tooltip>
|
|
165
165
|
<template #default="{ row }">{{ display(row, c) }}</template>
|
|
166
166
|
</el-table-column>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
|
|
4
|
+
import { enumLabel } from "../tokens-runtime";
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
role?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
size?: "small" | "default" | "large";
|
|
11
|
+
}>(),
|
|
12
|
+
{
|
|
13
|
+
role: "Initiate",
|
|
14
|
+
label: "",
|
|
15
|
+
size: "default",
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const roleCode = computed(() => props.role.trim() || "Initiate");
|
|
20
|
+
const roleClass = computed(() => {
|
|
21
|
+
const builtin = ["Root", "Admin", "Manager", "Editor", "Viewer", "Initiate"];
|
|
22
|
+
return builtin.includes(roleCode.value) ? roleCode.value.toLowerCase() : "custom";
|
|
23
|
+
});
|
|
24
|
+
const displayLabel = computed(
|
|
25
|
+
() => props.label || enumLabel("UserRole" as never, roleCode.value) || roleCode.value,
|
|
26
|
+
);
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<el-tag :size="size" class="ys-role-tag" :class="`ys-role-tag--${roleClass}`" effect="plain">
|
|
31
|
+
{{ displayLabel }}
|
|
32
|
+
</el-tag>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<style scoped>
|
|
36
|
+
.ys-role-tag {
|
|
37
|
+
--ys-role-bg: #f8fafc;
|
|
38
|
+
--ys-role-text: #475569;
|
|
39
|
+
--ys-role-border: #cbd5e1;
|
|
40
|
+
|
|
41
|
+
border-color: var(--ys-role-border);
|
|
42
|
+
background-color: var(--ys-role-bg);
|
|
43
|
+
color: var(--ys-role-text);
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.ys-role-tag--root {
|
|
48
|
+
--ys-role-bg: #ede9fe;
|
|
49
|
+
--ys-role-text: #4c1d95;
|
|
50
|
+
--ys-role-border: #8b5cf6;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ys-role-tag--admin {
|
|
54
|
+
--ys-role-bg: #fee2e2;
|
|
55
|
+
--ys-role-text: #991b1b;
|
|
56
|
+
--ys-role-border: #f87171;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ys-role-tag--manager {
|
|
60
|
+
--ys-role-bg: #ffedd5;
|
|
61
|
+
--ys-role-text: #9a3412;
|
|
62
|
+
--ys-role-border: #fb923c;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ys-role-tag--editor {
|
|
66
|
+
--ys-role-bg: #dbeafe;
|
|
67
|
+
--ys-role-text: #1d4ed8;
|
|
68
|
+
--ys-role-border: #60a5fa;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ys-role-tag--viewer {
|
|
72
|
+
--ys-role-bg: #eff6ff;
|
|
73
|
+
--ys-role-text: #2563eb;
|
|
74
|
+
--ys-role-border: #93c5fd;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ys-role-tag--initiate {
|
|
78
|
+
--ys-role-bg: #f1f5f9;
|
|
79
|
+
--ys-role-text: #64748b;
|
|
80
|
+
--ys-role-border: #cbd5e1;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -24,10 +24,12 @@ function select(action: YsRowAction) {
|
|
|
24
24
|
<template>
|
|
25
25
|
<el-popover
|
|
26
26
|
:visible="visible"
|
|
27
|
-
placement="
|
|
28
|
-
:fallback-placements="['
|
|
27
|
+
placement="left-start"
|
|
28
|
+
:fallback-placements="['left', 'left-end', 'top-end', 'bottom-end']"
|
|
29
29
|
:width="150"
|
|
30
|
-
:offset="
|
|
30
|
+
:offset="8"
|
|
31
|
+
:hide-after="0"
|
|
32
|
+
:teleported="true"
|
|
31
33
|
trigger="click"
|
|
32
34
|
popper-class="ys-action-popover"
|
|
33
35
|
@update:visible="visible = $event"
|
package/src/index.ts
CHANGED
|
@@ -11,4 +11,5 @@ export { default as YsPageHeader } from "./components/YsPageHeader.vue";
|
|
|
11
11
|
export { default as YsLoginPage } from "./components/YsLoginPage.vue";
|
|
12
12
|
export { default as YsSettingsCenterDialog } from "./components/YsSettingsCenterDialog.vue";
|
|
13
13
|
export { default as YsPortalGrid } from "./components/YsPortalGrid.vue";
|
|
14
|
+
export { default as YsRoleTag } from "./components/YsRoleTag.vue";
|
|
14
15
|
export { enumOptions, enumLabel, type EnumOption } from "./tokens-runtime";
|
package/src/tokens-runtime.ts
CHANGED
|
@@ -14,7 +14,7 @@ export function enumOptions(enumName: keyof typeof ENUM_META): EnumOption[] {
|
|
|
14
14
|
return Object.entries(meta)
|
|
15
15
|
.map(([value, m]) => ({ value, label: m.label ?? m.name ?? value, sort: m.sort ?? 0 }))
|
|
16
16
|
.sort((a, b) =>
|
|
17
|
-
enumName === "
|
|
17
|
+
enumName === "UserRole"
|
|
18
18
|
? b.sort - a.sort
|
|
19
19
|
: a.sort - b.sort,
|
|
20
20
|
);
|