@v1nt1248/3nclient-lib 0.0.8 → 0.0.11
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/dist/components/index.d.ts +20 -1
- package/dist/components/ui3n-dialog.vue.d.ts +73 -0
- package/dist/components/ui3n-drop-files.vue.d.ts +41 -0
- package/dist/components/ui3n-emoji.vue.d.ts +36 -0
- package/dist/components/ui3n-input.vue.d.ts +96 -0
- package/dist/components/ui3n-list.vue.d.ts +45 -0
- package/dist/components/ui3n-menu.vue.d.ts +85 -0
- package/dist/components/ui3n-notification.vue.d.ts +4 -4
- package/dist/components/ui3n-table-sort-icon.vue.d.ts +29 -0
- package/dist/components/ui3n-table.vue.d.ts +42 -0
- package/dist/components/ui3n-text.vue.d.ts +79 -0
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/ui3n-click-outside.d.ts +10 -0
- package/dist/index.d.ts +31 -0
- package/dist/plugins/dialogs.d.ts +17 -0
- package/dist/plugins/i18n.d.ts +2 -0
- package/dist/plugins/index.d.ts +8 -4
- package/dist/plugins/notifications.d.ts +2 -0
- package/dist/plugins/store-dialogs.d.ts +4 -0
- package/dist/plugins/store-notifications.d.ts +4 -0
- package/dist/plugins/vue-bus.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/ui-3n-lib.js +6931 -6186
- package/package.json +8 -3
- package/src/components/index.ts +50 -0
- package/src/components/ui3n-button.vue +4 -5
- package/src/components/ui3n-dialog.vue +311 -0
- package/src/components/ui3n-drop-files.vue +8 -4
- package/src/components/ui3n-emoji.vue +8 -4
- package/src/components/ui3n-list.vue +135 -0
- package/src/components/ui3n-menu.vue +134 -0
- package/src/components/ui3n-notification.vue +2 -13
- package/src/components/ui3n-table-sort-icon.vue +4 -2
- package/src/components/ui3n-table.vue +9 -4
- package/src/components/ui3n-text.vue +9 -5
- package/dist/types.d.ts +0 -23
package/package.json
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"author": "v1nt1248",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.11",
|
|
7
7
|
"description": "Library for 3NWeb clients",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"src/components/"
|
|
12
|
+
],
|
|
10
13
|
"module": "./dist/ui-3n-lib.js",
|
|
11
14
|
"types": "./dist/index.d.ts",
|
|
12
15
|
"exports": {
|
|
@@ -19,7 +22,7 @@
|
|
|
19
22
|
"dev": "vite",
|
|
20
23
|
"generate:types": "vue-tsc --declaration --emitDeclarationOnly --outdir ./dist",
|
|
21
24
|
"copy:dts": "cp ./src/types.d.ts ./dist",
|
|
22
|
-
"build": "vite build
|
|
25
|
+
"build": "vite build",
|
|
23
26
|
"preview": "vite preview",
|
|
24
27
|
"stylelint": "stylelint --config .stylelint.config.cjs 'src/**/*.{vue,scss}'",
|
|
25
28
|
"stylelint:fix": "stylelint --config .stylelint.config.cjs --fix 'src/**/*.{vue,scss}'",
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
"sanitize-html": "^2.11.0"
|
|
38
41
|
},
|
|
39
42
|
"peerDependencies": {
|
|
43
|
+
"pinia": "^2.1.6",
|
|
40
44
|
"vue": "^3.3.4"
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
@@ -66,6 +70,7 @@
|
|
|
66
70
|
"vite": "^4.4.5",
|
|
67
71
|
"vite-plugin-css-injected-by-js": "^3.3.0",
|
|
68
72
|
"vite-plugin-dts": "^3.5.3",
|
|
73
|
+
"vue": "^3.3.4",
|
|
69
74
|
"vue-tsc": "^1.8.5"
|
|
70
75
|
}
|
|
71
76
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -2,6 +2,25 @@ import Ui3nIcon from './ui3n-icon.vue'
|
|
|
2
2
|
import type { Ui3nIconProps, Ui3nIconEmits } from './ui3n-icon.vue'
|
|
3
3
|
import Ui3nButton from './ui3n-button.vue'
|
|
4
4
|
import type { Ui3nButtonProps, Ui3nButtonEmits } from './ui3n-button.vue'
|
|
5
|
+
import Ui3nDropFiles from './ui3n-drop-files.vue'
|
|
6
|
+
import type { Ui3nDropFilesProps, Ui3nDropFilesEmits } from './ui3n-drop-files.vue'
|
|
7
|
+
import Ui3nEmoji from './ui3n-emoji.vue'
|
|
8
|
+
import type { Ui3nEmojiProps, Ui3nEmojiEmits } from './ui3n-emoji.vue'
|
|
9
|
+
import Ui3nInput from './ui3n-input.vue'
|
|
10
|
+
import type { Ui3nInputProps, Ui3nInputEmits } from './ui3n-input.vue'
|
|
11
|
+
import Ui3nText from './ui3n-text.vue'
|
|
12
|
+
import type { Ui3nTextProps, Ui3nTextEmits } from './ui3n-text.vue'
|
|
13
|
+
import Ui3nNotification from './ui3n-notification.vue'
|
|
14
|
+
import Ui3nTableSortIcon from './ui3n-table-sort-icon.vue'
|
|
15
|
+
import type { Ui3nTableSortIconProps } from './ui3n-table-sort-icon.vue'
|
|
16
|
+
import Ui3nTable from './ui3n-table.vue'
|
|
17
|
+
import type { Ui3nTableProps, Ui3nTableEmits } from './ui3n-table.vue'
|
|
18
|
+
import Ui3nDialog from './ui3n-dialog.vue'
|
|
19
|
+
import type { Ui3nDialogComponentProps, Ui3nDialogComponentEmits, Ui3nDialogProps, Ui3nDialogEvent } from './ui3n-dialog.vue'
|
|
20
|
+
import Ui3nMenu from './ui3n-menu.vue'
|
|
21
|
+
import type { Ui3nMenuProps, Ui3nMenuEmits, Ui3nMenuSlots } from './ui3n-menu.vue'
|
|
22
|
+
import Ui3nList from './ui3n-list.vue'
|
|
23
|
+
import type { Ui3nListProps, Ui3nListEmits, Ui3nListSlots } from './ui3n-list.vue'
|
|
5
24
|
|
|
6
25
|
export {
|
|
7
26
|
Ui3nIcon,
|
|
@@ -10,4 +29,35 @@ export {
|
|
|
10
29
|
Ui3nButton,
|
|
11
30
|
Ui3nButtonProps,
|
|
12
31
|
Ui3nButtonEmits,
|
|
32
|
+
Ui3nDropFiles,
|
|
33
|
+
Ui3nDropFilesProps,
|
|
34
|
+
Ui3nDropFilesEmits,
|
|
35
|
+
Ui3nEmoji,
|
|
36
|
+
Ui3nEmojiProps,
|
|
37
|
+
Ui3nEmojiEmits,
|
|
38
|
+
Ui3nInput,
|
|
39
|
+
Ui3nInputProps,
|
|
40
|
+
Ui3nInputEmits,
|
|
41
|
+
Ui3nText,
|
|
42
|
+
Ui3nTextProps,
|
|
43
|
+
Ui3nTextEmits,
|
|
44
|
+
Ui3nNotification,
|
|
45
|
+
Ui3nTableSortIcon,
|
|
46
|
+
Ui3nTableSortIconProps,
|
|
47
|
+
Ui3nTable,
|
|
48
|
+
Ui3nTableProps,
|
|
49
|
+
Ui3nTableEmits,
|
|
50
|
+
Ui3nDialog,
|
|
51
|
+
Ui3nDialogComponentProps,
|
|
52
|
+
Ui3nDialogComponentEmits,
|
|
53
|
+
Ui3nDialogProps,
|
|
54
|
+
Ui3nDialogEvent,
|
|
55
|
+
Ui3nMenu,
|
|
56
|
+
Ui3nMenuProps,
|
|
57
|
+
Ui3nMenuEmits,
|
|
58
|
+
Ui3nMenuSlots,
|
|
59
|
+
Ui3nList,
|
|
60
|
+
Ui3nListProps,
|
|
61
|
+
Ui3nListEmits,
|
|
62
|
+
Ui3nListSlots,
|
|
13
63
|
}
|
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
</template>
|
|
73
73
|
|
|
74
74
|
<style lang="scss" scoped>
|
|
75
|
+
@import "../assets/styles/mixins";
|
|
76
|
+
|
|
75
77
|
.ui3n-button {
|
|
76
78
|
--ui3n-button-text-size: 12px;
|
|
77
79
|
--ui3n-button-text-height: 16px;
|
|
@@ -102,10 +104,7 @@
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
&--elevation {
|
|
105
|
-
|
|
106
|
-
rgba(0, 0, 0, 0.2) 0px 3px 1px -2px
|
|
107
|
-
rgba(0, 0, 0, 0.14) 0px 2px 2px 0px
|
|
108
|
-
rgba(0, 0, 0, 0.12) 0px 1px 5px 0px;
|
|
107
|
+
@include elevation();
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
&:not([disabled]) {
|
|
@@ -127,7 +126,7 @@
|
|
|
127
126
|
|
|
128
127
|
&:active {
|
|
129
128
|
opacity: 1;
|
|
130
|
-
background-color: var(--
|
|
129
|
+
background-color: var(--black-30, #b3b3b3);
|
|
131
130
|
background-size: 100%;
|
|
132
131
|
transition: background 0s;
|
|
133
132
|
}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
import { computed, onMounted, ref } from 'vue'
|
|
4
|
+
import type { Component } from 'vue'
|
|
5
|
+
import { getRandomId } from '../tools'
|
|
6
|
+
import Ui3nButton from './ui3n-button.vue'
|
|
7
|
+
|
|
8
|
+
export type Ui3nDialogEvent = 'open' | 'before-close' | 'close' | 'confirm' | 'cancel' | 'click-overlay'
|
|
9
|
+
|
|
10
|
+
export interface Ui3nDialogProps {
|
|
11
|
+
teleport?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
width?: string | number;
|
|
14
|
+
cssClass?: string;
|
|
15
|
+
cssStyle?: Record<string, string>;
|
|
16
|
+
contentCssClass?: string;
|
|
17
|
+
contentCssStyle?: Record<string, string>;
|
|
18
|
+
confirmButton?: boolean;
|
|
19
|
+
cancelButton?: boolean;
|
|
20
|
+
onConfirm?: (data: any) => void;
|
|
21
|
+
onCancel?: (data: any) => void;
|
|
22
|
+
confirmButtonText?: string;
|
|
23
|
+
cancelButtonText?: string;
|
|
24
|
+
confirmButtonColor?: string;
|
|
25
|
+
cancelButtonColor?: string;
|
|
26
|
+
confirmButtonBackground?: string;
|
|
27
|
+
cancelButtonBackground?: string;
|
|
28
|
+
closeOnClickOverlay?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface Ui3nDialogComponentProps {
|
|
32
|
+
component: Component;
|
|
33
|
+
componentProps?: Record<string, any>;
|
|
34
|
+
dialogProps?: Ui3nDialogProps;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface Ui3nDialogComponentEmits {
|
|
38
|
+
(ev: 'open', value?: any): void;
|
|
39
|
+
(ev: 'before-close', value?: any): void;
|
|
40
|
+
(ev: 'close', value?: any): void;
|
|
41
|
+
(ev: 'confirm', value?: any): void;
|
|
42
|
+
(ev: 'cancel', value?: any): void;
|
|
43
|
+
(ev: 'click-overlay', value?: any): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const props = defineProps<Ui3nDialogComponentProps>()
|
|
47
|
+
|
|
48
|
+
const emit = defineEmits<Ui3nDialogComponentEmits>()
|
|
49
|
+
|
|
50
|
+
const dialogProps = computed(() => {
|
|
51
|
+
const {
|
|
52
|
+
teleport = 'body',
|
|
53
|
+
title = '',
|
|
54
|
+
width = 380,
|
|
55
|
+
cssClass = '',
|
|
56
|
+
cssStyle = {},
|
|
57
|
+
contentCssClass = '',
|
|
58
|
+
contentCssStyle = {},
|
|
59
|
+
confirmButton = true,
|
|
60
|
+
cancelButton = true,
|
|
61
|
+
confirmButtonText = 'Done',
|
|
62
|
+
cancelButtonText = 'Cancel',
|
|
63
|
+
confirmButtonColor = 'var(--system-white, #fff)',
|
|
64
|
+
cancelButtonColor = 'var(--blue-main, #0090ec)',
|
|
65
|
+
confirmButtonBackground = 'var(--blue-main, #0090ec)',
|
|
66
|
+
cancelButtonBackground = 'var(--system-white, #fff)',
|
|
67
|
+
closeOnClickOverlay = true,
|
|
68
|
+
} = props.dialogProps || {}
|
|
69
|
+
return {
|
|
70
|
+
teleport,
|
|
71
|
+
title,
|
|
72
|
+
cssClass: cssClass ? `ui3n-dialog ${cssClass}` : 'ui3n-dialog',
|
|
73
|
+
cssStyle: { width: `${width}px`, ...cssStyle },
|
|
74
|
+
contentCssClass: contentCssClass ? `ui3n-dialog__content ${contentCssClass}` : 'ui3n-dialog__content',
|
|
75
|
+
contentCssStyle,
|
|
76
|
+
confirmButton,
|
|
77
|
+
cancelButton,
|
|
78
|
+
confirmButtonText,
|
|
79
|
+
cancelButtonText,
|
|
80
|
+
confirmButtonColor,
|
|
81
|
+
cancelButtonColor,
|
|
82
|
+
confirmButtonBackground,
|
|
83
|
+
cancelButtonBackground,
|
|
84
|
+
closeOnClickOverlay,
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
const show = ref(true)
|
|
89
|
+
const data = ref(null)
|
|
90
|
+
const isValid = ref(true)
|
|
91
|
+
const dialogId = `dialog-${getRandomId(4)}`
|
|
92
|
+
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
const dialogElement = document.getElementById(dialogId)
|
|
95
|
+
if (dialogElement) {
|
|
96
|
+
dialogElement.style.setProperty('--dialog-confirm-button-color', dialogProps.value.confirmButtonColor)
|
|
97
|
+
dialogElement.style.setProperty('--dialog-cancel-button-color', dialogProps.value.cancelButtonColor)
|
|
98
|
+
dialogElement.style.setProperty('--dialog-confirm-background-color', dialogProps.value.confirmButtonBackground)
|
|
99
|
+
dialogElement.style.setProperty('--dialog-cancel-background-color', dialogProps.value.cancelButtonBackground)
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
|
+
const selectData = (value: any) => {
|
|
105
|
+
data.value = value
|
|
106
|
+
if (
|
|
107
|
+
!dialogProps.value.confirmButton
|
|
108
|
+
&& !dialogProps.value.cancelButton
|
|
109
|
+
&& props.dialogProps?.onConfirm
|
|
110
|
+
) {
|
|
111
|
+
props.dialogProps.onConfirm(data.value)
|
|
112
|
+
closeDialog()
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const validate = (value: boolean) => {
|
|
117
|
+
isValid.value = value
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const closeDialog = (arg?: { ev?: Event, withAction?: boolean }) => {
|
|
121
|
+
const { ev, withAction = false } = arg || {}
|
|
122
|
+
if (ev) {
|
|
123
|
+
ev.stopImmediatePropagation()
|
|
124
|
+
ev.preventDefault()
|
|
125
|
+
}
|
|
126
|
+
show.value = false
|
|
127
|
+
if (withAction) {
|
|
128
|
+
emit('close')
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const startEmit = (event: Ui3nDialogEvent) => {
|
|
133
|
+
if (event === 'click-overlay') {
|
|
134
|
+
emit(event)
|
|
135
|
+
closeDialog()
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (event === 'confirm' && props.dialogProps?.onConfirm) {
|
|
139
|
+
props.dialogProps.onConfirm(data.value)
|
|
140
|
+
closeDialog()
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (event === 'cancel' && props.dialogProps?.onCancel) {
|
|
144
|
+
props.dialogProps.onCancel(data.value)
|
|
145
|
+
closeDialog()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (data.value) {
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
emit(event, data.value)
|
|
151
|
+
} else {
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
emit(event)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const handleEvent = (event: Event, eventName: Ui3nDialogEvent) => {
|
|
158
|
+
event.stopImmediatePropagation()
|
|
159
|
+
event.preventDefault()
|
|
160
|
+
startEmit(eventName)
|
|
161
|
+
}
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<template>
|
|
165
|
+
<teleport :to="dialogProps.teleport">
|
|
166
|
+
<div
|
|
167
|
+
v-if="show"
|
|
168
|
+
class="ui3n-dialog__overlay"
|
|
169
|
+
@click="dialogProps.closeOnClickOverlay
|
|
170
|
+
? closeDialog({ ev: $event, withAction: true })
|
|
171
|
+
: startEmit('click-overlay')
|
|
172
|
+
"
|
|
173
|
+
>
|
|
174
|
+
<div
|
|
175
|
+
:id="dialogId"
|
|
176
|
+
:class="dialogProps.cssClass"
|
|
177
|
+
:style="dialogProps.cssStyle"
|
|
178
|
+
>
|
|
179
|
+
<div
|
|
180
|
+
v-if="dialogProps.title"
|
|
181
|
+
class="ui3n-dialog__title"
|
|
182
|
+
@click.stop
|
|
183
|
+
>
|
|
184
|
+
<span>{{ dialogProps.title }}</span>
|
|
185
|
+
<ui3n-button
|
|
186
|
+
round
|
|
187
|
+
color="transparent"
|
|
188
|
+
icon="close"
|
|
189
|
+
icon-size="12"
|
|
190
|
+
icon-color="var(--gray-90, #444)"
|
|
191
|
+
class="ui3n-dialog__close"
|
|
192
|
+
@click="closeDialog({ ev: $event, withAction: true })"
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div
|
|
197
|
+
v-if="props.component"
|
|
198
|
+
:class="dialogProps.contentCssClass"
|
|
199
|
+
:style="dialogProps.contentCssStyle"
|
|
200
|
+
@click.stop
|
|
201
|
+
>
|
|
202
|
+
<component
|
|
203
|
+
:is="props.component"
|
|
204
|
+
v-bind="props.componentProps"
|
|
205
|
+
@select="selectData"
|
|
206
|
+
@validate="validate"
|
|
207
|
+
@close="closeDialog({ ev: $event, withAction: true })"
|
|
208
|
+
@confirm="startEmit('confirm')"
|
|
209
|
+
@cancel="startEmit('cancel')"
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
<div
|
|
214
|
+
v-if="dialogProps.confirmButton || dialogProps.cancelButton"
|
|
215
|
+
:class="[
|
|
216
|
+
'ui3n-dialog__actions',
|
|
217
|
+
{ 'ui3n-dialog__actions--both': dialogProps.confirmButton && dialogProps.cancelButton },
|
|
218
|
+
]"
|
|
219
|
+
@click.stop
|
|
220
|
+
>
|
|
221
|
+
<ui3n-button
|
|
222
|
+
v-if="dialogProps.cancelButton"
|
|
223
|
+
:color="dialogProps.cancelButtonBackground"
|
|
224
|
+
:text-color="dialogProps.cancelButtonColor"
|
|
225
|
+
@click="handleEvent($event, 'cancel')"
|
|
226
|
+
>
|
|
227
|
+
{{ dialogProps.cancelButtonText }}
|
|
228
|
+
</ui3n-button>
|
|
229
|
+
|
|
230
|
+
<ui3n-button
|
|
231
|
+
v-if="dialogProps.confirmButton"
|
|
232
|
+
:color="dialogProps.confirmButtonBackground"
|
|
233
|
+
:text-color="dialogProps.confirmButtonColor"
|
|
234
|
+
:disabled="!isValid"
|
|
235
|
+
@click="handleEvent($event, 'confirm')"
|
|
236
|
+
>
|
|
237
|
+
{{ dialogProps.confirmButtonText }}
|
|
238
|
+
</ui3n-button>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
242
|
+
</teleport>
|
|
243
|
+
</template>
|
|
244
|
+
|
|
245
|
+
<style lang="scss">
|
|
246
|
+
@import "../assets/styles/mixins";
|
|
247
|
+
|
|
248
|
+
.ui3n-dialog__overlay {
|
|
249
|
+
position: fixed;
|
|
250
|
+
z-index: 1000;
|
|
251
|
+
inset: 0;
|
|
252
|
+
display: flex;
|
|
253
|
+
justify-content: center;
|
|
254
|
+
align-items: center;
|
|
255
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.ui3n-dialog {
|
|
259
|
+
--dialog-border-radius: 8px;
|
|
260
|
+
--dialog-title-padding: 16px 24px 16px;
|
|
261
|
+
--dialog-title-font-size: 14px;
|
|
262
|
+
--dialog-actions-padding: 16px;
|
|
263
|
+
--dialog-confirm-button-color: var(--system-white, #fff);
|
|
264
|
+
--dialog-cancel-button-color: var(--blue-main, #0090ec);
|
|
265
|
+
--dialog-confirm-background-color: var(--blue-main, #0090ec);
|
|
266
|
+
--dialog-cancel-background-color: var(--system-white, #fff);
|
|
267
|
+
|
|
268
|
+
position: relative;
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-direction: column;
|
|
271
|
+
height: auto;
|
|
272
|
+
max-height: 95%;
|
|
273
|
+
background-color: var(--system-white, #fff);
|
|
274
|
+
border-radius: var(--dialog-border-radius);
|
|
275
|
+
@include elevation();
|
|
276
|
+
|
|
277
|
+
&__title {
|
|
278
|
+
padding: var(--dialog-title-padding);
|
|
279
|
+
font-size: var(--dialog-title-font-size);
|
|
280
|
+
font-weight: 600;
|
|
281
|
+
line-height: 1.3;
|
|
282
|
+
color: var(--black-90, #212121);
|
|
283
|
+
border-bottom: 1px solid var(--grey-50, #f2f2f2);
|
|
284
|
+
@include text-overflow-ellipsis();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&__close {
|
|
288
|
+
position: absolute;
|
|
289
|
+
right: 4px;
|
|
290
|
+
top: 4px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
&__content {
|
|
294
|
+
flex-grow: 2;
|
|
295
|
+
overflow-y: auto;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&__actions {
|
|
299
|
+
padding: var(--dialog-actions-padding);
|
|
300
|
+
display: flex;
|
|
301
|
+
justify-content: flex-end;
|
|
302
|
+
align-items: center;
|
|
303
|
+
|
|
304
|
+
&--both {
|
|
305
|
+
.ui3n-button {
|
|
306
|
+
margin-left: 8px;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
</style>
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export interface Ui3nDropFilesProps {
|
|
5
5
|
title?: string;
|
|
6
6
|
text?: string;
|
|
7
7
|
additionalText?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Ui3nDropFilesEmits {
|
|
10
11
|
(e: 'select', fileList: FileList): void;
|
|
11
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = defineProps<Ui3nDropFilesProps>()
|
|
15
|
+
const emit = defineEmits<Ui3nDropFilesEmits>()
|
|
12
16
|
|
|
13
17
|
const isOverDropPlace = ref(false)
|
|
14
18
|
const isOverDropZone = ref(false)
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, onMounted, ref } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export interface Ui3nEmojiProps {
|
|
5
5
|
emoji: string;
|
|
6
6
|
size?: string | number;
|
|
7
7
|
readonly?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Ui3nEmojiEmits {
|
|
10
11
|
(ev: 'click', value: Event): void;
|
|
11
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = defineProps<Ui3nEmojiProps>()
|
|
15
|
+
const emit = defineEmits<Ui3nEmojiEmits>()
|
|
12
16
|
|
|
13
17
|
const emojiElement = ref<HTMLDivElement | null>(null)
|
|
14
18
|
const params = computed(() => {
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<script lang="ts" setup generic="T extends { id?: string }">
|
|
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
|
+
|
|
26
|
+
const emits = defineEmits<Ui3nListEmits<T>>()
|
|
27
|
+
defineSlots<Ui3nListSlots<T>>()
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<div
|
|
32
|
+
ref="listElement"
|
|
33
|
+
class="ui3n-list"
|
|
34
|
+
>
|
|
35
|
+
<div
|
|
36
|
+
:class="[
|
|
37
|
+
'ui3n-list__title',
|
|
38
|
+
{ 'ui3n-list__title--sticky': props.sticky },
|
|
39
|
+
]"
|
|
40
|
+
>
|
|
41
|
+
<slot name="title">
|
|
42
|
+
<div
|
|
43
|
+
v-if="props.title"
|
|
44
|
+
class="ui3n-list__title-content"
|
|
45
|
+
>
|
|
46
|
+
{{ props.title }}
|
|
47
|
+
</div>
|
|
48
|
+
</slot>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="ui3n-list__content">
|
|
52
|
+
<div
|
|
53
|
+
v-for="(item, index) in props.items"
|
|
54
|
+
:key="item.id ?? index"
|
|
55
|
+
class="ui3n-list__item"
|
|
56
|
+
>
|
|
57
|
+
<slot
|
|
58
|
+
name="item"
|
|
59
|
+
:item="item"
|
|
60
|
+
:index="index"
|
|
61
|
+
>
|
|
62
|
+
<div
|
|
63
|
+
:class="[
|
|
64
|
+
'ui3n-list__item-content',
|
|
65
|
+
{ 'ui3n-list__item-content--disables': props.disabled },
|
|
66
|
+
]"
|
|
67
|
+
@click.stop="emits('select', { value: item, index })"
|
|
68
|
+
>
|
|
69
|
+
{{ item }}
|
|
70
|
+
</div>
|
|
71
|
+
</slot>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<style lang="scss" scoped>
|
|
78
|
+
.ui3n-list {
|
|
79
|
+
--ui3n-list-item-height: 28px;
|
|
80
|
+
--ui3n-list-bg-color: var(--system-white, #fff);
|
|
81
|
+
|
|
82
|
+
position: relative;
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: 100%;
|
|
85
|
+
background-color: var(--ui3n-list-bg-color);
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
justify-content: flex-start;
|
|
89
|
+
align-items: stretch;
|
|
90
|
+
|
|
91
|
+
&__title {
|
|
92
|
+
position: relative;
|
|
93
|
+
top: 0;
|
|
94
|
+
z-index: 1;
|
|
95
|
+
|
|
96
|
+
&--sticky {
|
|
97
|
+
position: sticky;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__content {
|
|
102
|
+
position: relative;
|
|
103
|
+
flex-grow: 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__title-content,
|
|
107
|
+
&__item {
|
|
108
|
+
position: relative;
|
|
109
|
+
width: 100%;
|
|
110
|
+
min-height: var(--ui3n-list-item-height);
|
|
111
|
+
padding: 4px 0;
|
|
112
|
+
display: flex;
|
|
113
|
+
justify-content: flex-start;
|
|
114
|
+
align-items: center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&__title-content {
|
|
118
|
+
z-index: 1;
|
|
119
|
+
font-size: 16px;
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
background-color: var(--ui3n-list-bg-color);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&__item-content {
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
font-weight: 400;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
|
|
129
|
+
&--disabled {
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
cursor: default;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
</style>
|