@v1nt1248/3nclient-lib 0.0.41 → 0.1.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/README.md +4 -4
- package/dist/components/index.d.ts +22 -38
- package/dist/components/ui3n-badge-simple.vue.d.ts +3 -3
- package/dist/components/ui3n-badge.vue.d.ts +2 -2
- package/dist/components/ui3n-breadcrumb.vue.d.ts +7 -7
- package/dist/components/ui3n-breadcrumbs.vue.d.ts +3 -3
- package/dist/components/ui3n-button.vue.d.ts +29 -4
- package/dist/components/ui3n-checkbox.vue.d.ts +3 -3
- package/dist/components/ui3n-chip.vue.d.ts +3 -3
- package/dist/components/ui3n-dialog.vue.d.ts +6 -5
- package/dist/components/ui3n-drop-files.vue.d.ts +23 -3
- package/dist/components/ui3n-emoji.vue.d.ts +3 -3
- package/dist/components/ui3n-icon.vue.d.ts +29 -3
- package/dist/components/ui3n-input.vue.d.ts +9 -9
- package/dist/components/ui3n-list.vue.d.ts +4 -4
- package/dist/components/ui3n-menu.vue.d.ts +3 -3
- package/dist/components/ui3n-notification.vue.d.ts +32 -2
- package/dist/components/ui3n-switch.vue.d.ts +55 -0
- package/dist/components/ui3n-table-sort-icon.vue.d.ts +1 -1
- package/dist/components/ui3n-table.vue.d.ts +4 -3
- package/dist/components/ui3n-tabs.vue.d.ts +3 -3
- package/dist/components/ui3n-text.vue.d.ts +29 -3
- package/dist/components/ui3n-virtual-scroll.vue.d.ts +12 -9
- package/dist/constants/types.d.ts +2 -4
- package/dist/directives/index.d.ts +3 -2
- package/dist/directives/ui3n-click-outside.d.ts +2 -1
- package/dist/directives/ui3n-html.d.ts +1 -0
- package/dist/index.d.ts +27 -29
- package/dist/plugins/dialogs.d.ts +3 -3
- package/dist/plugins/i18n.d.ts +2 -2
- package/dist/plugins/icons.d.ts +1 -0
- package/dist/plugins/index.d.ts +5 -8
- package/dist/plugins/notifications.d.ts +2 -2
- package/dist/plugins/store-dialogs.d.ts +2 -1
- package/dist/plugins/store-notifications.d.ts +2 -1
- package/dist/plugins/store-vue-bus.d.ts +2 -1
- package/dist/plugins/vue-bus.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/tools/sqlite-on-3nstorage/index.d.ts +3 -2
- package/dist/tools/ui.helpers.d.ts +1 -0
- package/dist/ui-3n-lib.js +6953 -6615
- package/package.json +57 -58
- package/src/components/index.ts +47 -41
- package/src/components/ui3n-badge-simple.vue +35 -38
- package/src/components/ui3n-badge.vue +25 -25
- package/src/components/ui3n-breadcrumb.vue +44 -44
- package/src/components/ui3n-breadcrumbs.vue +19 -19
- package/src/components/ui3n-button.vue +240 -150
- package/src/components/ui3n-checkbox.vue +199 -158
- package/src/components/ui3n-chip.vue +96 -98
- package/src/components/ui3n-dialog.vue +225 -235
- package/src/components/ui3n-drop-files.vue +146 -154
- package/src/components/ui3n-emoji.vue +62 -64
- package/src/components/ui3n-icon.vue +32 -13
- package/src/components/ui3n-input.vue +239 -221
- package/src/components/ui3n-list.vue +92 -111
- package/src/components/ui3n-menu.vue +101 -100
- package/src/components/ui3n-notification.vue +182 -113
- package/src/components/ui3n-switch.vue +146 -0
- package/src/components/ui3n-table-sort-icon.vue +1 -2
- package/src/components/ui3n-table.vue +229 -223
- package/src/components/ui3n-tabs.vue +141 -148
- package/src/components/ui3n-text.vue +235 -146
- package/src/components/ui3n-virtual-scroll.vue +68 -68
- package/dist/stories/Ui3nBadge.stories.d.ts +0 -124
- package/dist/stories/Ui3nBreadcrumbs.stories.d.ts +0 -252
- package/dist/stories/Ui3nButton.stories.d.ts +0 -152
- package/dist/stories/Ui3nCheckbox.stories.d.ts +0 -186
- package/dist/stories/Ui3nChip.stories.d.ts +0 -562
- package/dist/stories/Ui3nDialog.stories.d.ts +0 -41
- package/dist/stories/Ui3nDropFiles.stories.d.ts +0 -73
- package/dist/stories/Ui3nEmoji.stories.d.ts +0 -39
- package/dist/stories/Ui3nIcon.stories.d.ts +0 -80
- package/dist/stories/Ui3nInput.stories.d.ts +0 -456
- package/dist/stories/Ui3nList.stories.d.ts +0 -54
- package/dist/stories/Ui3nTabs.stories.d.ts +0 -177
- package/dist/stories/data/data-to-list.d.ts +0 -8
- package/dist/stories/data/icons.d.ts +0 -1
|
@@ -1,69 +1,50 @@
|
|
|
1
1
|
<script lang="ts" setup generic="T extends { id?: string }">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
defineSlots<Ui3nListSlots<T>>()
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
export interface Ui3nListProps<T> {
|
|
4
|
+
title?: string;
|
|
5
|
+
sticky?: boolean;
|
|
6
|
+
items: T[];
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Ui3nListEmits<T> {
|
|
11
|
+
(ev: 'select', value: { value: T, index: number }): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Ui3nListSlots<T> {
|
|
15
|
+
title?: () => any;
|
|
16
|
+
item?: ({ item, index }: { item: T, index: number }) => any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(defineProps<Ui3nListProps<T>>(), {
|
|
20
|
+
title: '',
|
|
21
|
+
sticky: true,
|
|
22
|
+
disabled: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const emits = defineEmits<Ui3nListEmits<T>>();
|
|
26
|
+
defineSlots<Ui3nListSlots<T>>();
|
|
28
27
|
</script>
|
|
29
28
|
|
|
30
29
|
<template>
|
|
31
|
-
<div
|
|
32
|
-
|
|
33
|
-
class="ui3n-list"
|
|
34
|
-
>
|
|
35
|
-
<div
|
|
36
|
-
:class="[
|
|
37
|
-
'ui3n-list__title',
|
|
38
|
-
{ 'ui3n-list__title--sticky': props.sticky },
|
|
39
|
-
]"
|
|
40
|
-
>
|
|
30
|
+
<div ref="listElement" :class="$style.list">
|
|
31
|
+
<div :class="[$style.title, sticky && $style.stickyTitle]">
|
|
41
32
|
<slot name="title">
|
|
42
|
-
<div
|
|
43
|
-
|
|
44
|
-
class="ui3n-list__title-content"
|
|
45
|
-
>
|
|
46
|
-
{{ props.title }}
|
|
33
|
+
<div v-if="props.title" :class="$style.titleContent">
|
|
34
|
+
{{ title }}
|
|
47
35
|
</div>
|
|
48
36
|
</slot>
|
|
49
37
|
</div>
|
|
50
38
|
|
|
51
|
-
<div class="
|
|
39
|
+
<div :class="$style.content">
|
|
52
40
|
<div
|
|
53
|
-
v-for="(item, index) in
|
|
41
|
+
v-for="(item, index) in items"
|
|
54
42
|
:key="item.id ?? index"
|
|
55
|
-
class="
|
|
43
|
+
:class="$style.item"
|
|
56
44
|
>
|
|
57
|
-
<slot
|
|
58
|
-
name="item"
|
|
59
|
-
:item="item"
|
|
60
|
-
:index="index"
|
|
61
|
-
>
|
|
45
|
+
<slot name="item" :item="item" :index="index">
|
|
62
46
|
<div
|
|
63
|
-
:class="[
|
|
64
|
-
'ui3n-list__item-content',
|
|
65
|
-
{ 'ui3n-list__item-content--disabled': props.disabled },
|
|
66
|
-
]"
|
|
47
|
+
:class="[$style.itemContent, disabled && $style.itemContentDisabled]"
|
|
67
48
|
@click.stop="emits('select', { value: item, index })"
|
|
68
49
|
>
|
|
69
50
|
{{ item }}
|
|
@@ -74,62 +55,62 @@
|
|
|
74
55
|
</div>
|
|
75
56
|
</template>
|
|
76
57
|
|
|
77
|
-
<style lang="scss"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
58
|
+
<style lang="scss" module>
|
|
59
|
+
.list {
|
|
60
|
+
--ui3n-list-item-height: 28px;
|
|
61
|
+
--ui3n-list-bg-color: transparent;
|
|
62
|
+
|
|
63
|
+
position: relative;
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 100%;
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
justify-content: flex-start;
|
|
70
|
+
align-items: stretch;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.title {
|
|
74
|
+
position: relative;
|
|
75
|
+
top: 0;
|
|
76
|
+
z-index: 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.stickyTitle {
|
|
80
|
+
position: sticky;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.content {
|
|
84
|
+
position: relative;
|
|
85
|
+
flex-grow: 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.titleContent,
|
|
89
|
+
.item {
|
|
90
|
+
position: relative;
|
|
91
|
+
width: 100%;
|
|
92
|
+
min-height: var(--ui3n-list-item-height);
|
|
93
|
+
padding: 4px 0;
|
|
94
|
+
display: flex;
|
|
95
|
+
justify-content: flex-start;
|
|
96
|
+
align-items: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.titleContent {
|
|
100
|
+
z-index: 1;
|
|
101
|
+
font-size: 16px;
|
|
102
|
+
font-weight: 600;
|
|
103
|
+
background-color: var(--ui3n-list-bg-color);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.itemContent {
|
|
107
|
+
font-size: 14px;
|
|
108
|
+
font-weight: 400;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.itemContentDisabled {
|
|
113
|
+
pointer-events: none;
|
|
114
|
+
cursor: default;
|
|
115
|
+
}
|
|
135
116
|
</style>
|
|
@@ -1,80 +1,78 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
import { computed, onMounted, ref } from 'vue';
|
|
4
|
+
import { default as vClickOutside } from '../directives/ui3n-click-outside';
|
|
5
|
+
|
|
6
|
+
export interface Ui3nMenuProps {
|
|
7
|
+
offsetX?: number;
|
|
8
|
+
offsetY?: number;
|
|
9
|
+
closeOnClick?: boolean;
|
|
10
|
+
closeOnClickOutside?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Ui3nMenuEmits {
|
|
15
|
+
(ev: 'open'): void;
|
|
16
|
+
(ev: 'opened'): void;
|
|
17
|
+
(ev: 'close'): void;
|
|
18
|
+
(ev: 'closed'): void;
|
|
19
|
+
(ev: 'click-outside'): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Ui3nMenuSlots {
|
|
23
|
+
default: () => any;
|
|
24
|
+
menu?: () => any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const props = withDefaults(defineProps<Ui3nMenuProps>(), {
|
|
28
|
+
offsetX: 0,
|
|
29
|
+
offsetY: 0,
|
|
30
|
+
closeOnClick: true,
|
|
31
|
+
closeOnClickOutside: true,
|
|
32
|
+
disabled: false,
|
|
33
|
+
});
|
|
34
|
+
const emits = defineEmits<Ui3nMenuEmits>();
|
|
35
|
+
defineSlots<Ui3nMenuSlots>();
|
|
36
|
+
|
|
37
|
+
const menuElement = ref<HTMLDivElement | null>(null);
|
|
38
|
+
const menuTriggerElement = ref<HTMLDivElement | null>(null);
|
|
39
|
+
const isShow = ref(false);
|
|
40
|
+
const defaultAnimationDuration = 400;
|
|
41
|
+
const menuContentStyle = computed(() => {
|
|
42
|
+
if (!props.offsetX && !props.offsetY) {
|
|
43
|
+
return {};
|
|
12
44
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
defineSlots<Ui3nMenuSlots>()
|
|
36
|
-
|
|
37
|
-
const menuElement = ref<HTMLDivElement | null>(null)
|
|
38
|
-
const menuTriggerElement = ref<HTMLDivElement | null>(null)
|
|
39
|
-
const isShow = ref(false)
|
|
40
|
-
const defaultAnimationDuration = 400
|
|
41
|
-
const menuContentStyle = computed(() => {
|
|
42
|
-
if (!props.offsetX && !props.offsetY) {
|
|
43
|
-
return {}
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
...(props.offsetX && { left: `${props.offsetX}px` }),
|
|
47
|
-
...(props.offsetY && { top: `${menuTriggerElement.value!.clientHeight + props.offsetY}px` }),
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
onMounted(() => {
|
|
52
|
-
menuElement.value!.style.setProperty('--menu-animation-duration', `${defaultAnimationDuration}ms`)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const toggleMenu = () => {
|
|
56
|
-
isShow.value = !isShow.value
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const onContentClick = () => {
|
|
60
|
-
isShow.value = false
|
|
61
|
-
}
|
|
62
|
-
const onClickOutside = () => {
|
|
63
|
-
emits('click-outside')
|
|
64
|
-
if (props.closeOnClickOutside) {
|
|
65
|
-
isShow.value = false
|
|
66
|
-
}
|
|
45
|
+
return {
|
|
46
|
+
...(props.offsetX && { left: `${props.offsetX}px` }),
|
|
47
|
+
...(props.offsetY && { top: `${menuTriggerElement.value!.clientHeight + props.offsetY}px` }),
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
onMounted(() => {
|
|
52
|
+
menuElement.value!.style.setProperty('--ui3n-menu-animation-duration', `${defaultAnimationDuration}ms`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
function toggleMenu() {
|
|
56
|
+
isShow.value = !isShow.value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function onContentClick() {
|
|
60
|
+
isShow.value = false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function onClickOutside() {
|
|
64
|
+
emits('click-outside');
|
|
65
|
+
if (props.closeOnClickOutside) {
|
|
66
|
+
isShow.value = false;
|
|
67
67
|
}
|
|
68
|
+
}
|
|
68
69
|
</script>
|
|
69
70
|
|
|
70
71
|
<template>
|
|
71
|
-
<div
|
|
72
|
-
ref="menuElement"
|
|
73
|
-
class="ui3n-menu"
|
|
74
|
-
>
|
|
72
|
+
<div ref="menuElement" :class="$style.menu">
|
|
75
73
|
<div
|
|
76
74
|
ref="menuTriggerElement"
|
|
77
|
-
class="
|
|
75
|
+
:class="$style.trigger"
|
|
78
76
|
@click.stop="toggleMenu"
|
|
79
77
|
>
|
|
80
78
|
<slot />
|
|
@@ -92,7 +90,7 @@
|
|
|
92
90
|
v-if="isShow"
|
|
93
91
|
v-click-outside="onClickOutside"
|
|
94
92
|
:style="menuContentStyle"
|
|
95
|
-
class="
|
|
93
|
+
:class="$style.content"
|
|
96
94
|
v-on="props.closeOnClick ? { click: onContentClick } : {}"
|
|
97
95
|
>
|
|
98
96
|
<slot name="menu" />
|
|
@@ -101,35 +99,38 @@
|
|
|
101
99
|
</div>
|
|
102
100
|
</template>
|
|
103
101
|
|
|
102
|
+
<style lang="scss" module>
|
|
103
|
+
@import "../assets/styles/mixins";
|
|
104
|
+
|
|
105
|
+
.menu {
|
|
106
|
+
--ui3n-menu-animation-duration: 400ms;
|
|
107
|
+
--ui3n-menu-content-bg: var(--color-bg-control-secondary-default);
|
|
108
|
+
|
|
109
|
+
position: relative;
|
|
110
|
+
overflow: visible;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.trigger {
|
|
114
|
+
position: relative;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.content {
|
|
118
|
+
position: absolute;
|
|
119
|
+
border-radius: 4px;
|
|
120
|
+
background-color: var(--ui3n-menu-content-bg);
|
|
121
|
+
z-index: 1000;
|
|
122
|
+
@include elevation(3);
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
125
|
+
|
|
104
126
|
<style lang="scss" scoped>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
.menu-leave-active {
|
|
115
|
-
transition: opacity var(--menu-animation-duration);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.menu-enter-from,
|
|
119
|
-
.menu-leave-to {
|
|
120
|
-
opacity: 0;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
&__trigger {
|
|
124
|
-
position: relative;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&__content {
|
|
128
|
-
position: absolute;
|
|
129
|
-
border-radius: 4px;
|
|
130
|
-
background-color: var(--system-white, #fff);
|
|
131
|
-
z-index: 1000;
|
|
132
|
-
@include elevation(3);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
127
|
+
.menu-enter-active,
|
|
128
|
+
.menu-leave-active {
|
|
129
|
+
transition: opacity var(--ui3n-menu-animation-duration);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.menu-enter-from,
|
|
133
|
+
.menu-leave-to {
|
|
134
|
+
opacity: 0;
|
|
135
|
+
}
|
|
135
136
|
</style>
|