@datametria/vue-components 2.1.1 → 2.3.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 +34 -8
- package/dist/index.es.js +3520 -2211
- package/dist/index.umd.js +10 -10
- package/dist/src/components/DatametriaAutocomplete.vue.d.ts +14 -17
- package/dist/src/components/DatametriaBreadcrumb.vue.d.ts +39 -7
- package/dist/src/components/DatametriaCheckbox.vue.d.ts +35 -6
- package/dist/src/components/DatametriaCheckboxGroup.vue.d.ts +30 -0
- package/dist/src/components/DatametriaDataTable.vue.d.ts +64 -0
- package/dist/src/components/DatametriaDatePicker.vue.d.ts +15 -37
- package/dist/src/components/DatametriaDialog.vue.d.ts +71 -0
- package/dist/src/components/DatametriaEmpty.vue.d.ts +30 -0
- package/dist/src/components/DatametriaFloatingBar.vue.d.ts +2 -2
- package/dist/src/components/DatametriaForm.vue.d.ts +40 -0
- package/dist/src/components/DatametriaFormItem.vue.d.ts +28 -0
- package/dist/src/components/DatametriaGrid.vue.d.ts +1 -1
- package/dist/src/components/DatametriaInput.vue.d.ts +69 -10
- package/dist/src/components/DatametriaMenu.vue.d.ts +3 -3
- package/dist/src/components/DatametriaNavbar.vue.d.ts +2 -2
- package/dist/src/components/DatametriaPagination.vue.d.ts +29 -0
- package/dist/src/components/DatametriaPopconfirm.vue.d.ts +43 -0
- package/dist/src/components/DatametriaProgress.vue.d.ts +33 -8
- package/dist/src/components/DatametriaRadio.vue.d.ts +25 -6
- package/dist/src/components/DatametriaRadioGroup.vue.d.ts +29 -0
- package/dist/src/components/DatametriaResult.vue.d.ts +30 -0
- package/dist/src/components/DatametriaSelect.vue.d.ts +16 -11
- package/dist/src/components/DatametriaSidebar.vue.d.ts +3 -3
- package/dist/src/components/DatametriaSlider.vue.d.ts +3 -3
- package/dist/src/components/DatametriaSortableTable.vue.d.ts +1 -1
- package/dist/src/components/DatametriaSteps.vue.d.ts +45 -0
- package/dist/src/components/DatametriaSwitch.vue.d.ts +9 -4
- package/dist/src/components/DatametriaTabPane.vue.d.ts +28 -0
- package/dist/src/components/DatametriaTextarea.vue.d.ts +27 -8
- package/dist/src/components/DatametriaTimePicker.vue.d.ts +17 -25
- package/dist/src/components/DatametriaToast.vue.d.ts +1 -1
- package/dist/src/components/DatametriaTooltip.vue.d.ts +1 -1
- package/dist/src/components/DatametriaTree.vue.d.ts +31 -0
- package/dist/src/components/DatametriaTreeNode.vue.d.ts +17 -0
- package/dist/src/components/DatametriaUpload.vue.d.ts +64 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/types/index.d.ts +5 -0
- package/dist/vue-components.css +1 -1
- package/package.json +4 -3
- package/src/components/DatametriaAutocomplete.vue +155 -260
- package/src/components/DatametriaBreadcrumb.vue +66 -80
- package/src/components/DatametriaCheckbox.vue +150 -37
- package/src/components/DatametriaCheckboxGroup.vue +43 -0
- package/src/components/DatametriaDataTable.vue +304 -0
- package/src/components/DatametriaDatePicker.vue +238 -614
- package/src/components/DatametriaDialog.vue +295 -0
- package/src/components/DatametriaDropdown.vue +352 -0
- package/src/components/DatametriaEmpty.vue +153 -0
- package/src/components/DatametriaForm.vue +160 -0
- package/src/components/DatametriaFormItem.vue +181 -0
- package/src/components/DatametriaInput.vue +226 -63
- package/src/components/DatametriaPagination.vue +373 -0
- package/src/components/DatametriaPopconfirm.vue +236 -0
- package/src/components/DatametriaProgress.vue +176 -63
- package/src/components/DatametriaRadio.vue +83 -72
- package/src/components/DatametriaRadioGroup.vue +42 -0
- package/src/components/DatametriaResult.vue +133 -0
- package/src/components/DatametriaSelect.vue +172 -67
- package/src/components/DatametriaSortableTable.vue +241 -20
- package/src/components/DatametriaSteps.vue +314 -0
- package/src/components/DatametriaSwitch.vue +86 -80
- package/src/components/DatametriaTabPane.vue +82 -0
- package/src/components/DatametriaTextarea.vue +140 -100
- package/src/components/DatametriaTimePicker.vue +231 -214
- package/src/components/DatametriaTree.vue +124 -0
- package/src/components/DatametriaTreeNode.vue +174 -0
- package/src/components/DatametriaUpload.vue +365 -0
- package/src/index.ts +25 -11
- package/src/types/index.ts +2 -0
- package/src/components/__tests__/DatametriaAutocomplete.test.ts +0 -180
- package/src/components/__tests__/DatametriaBreadcrumb.test.ts +0 -75
- package/src/components/__tests__/DatametriaCheckbox.test.ts +0 -47
- package/src/components/__tests__/DatametriaDatePicker.test.ts +0 -234
- package/src/components/__tests__/DatametriaProgress.test.ts +0 -90
- package/src/components/__tests__/DatametriaRadio.test.ts +0 -77
- package/src/components/__tests__/DatametriaSwitch.test.ts +0 -64
- package/src/components/__tests__/DatametriaTextarea.test.ts +0 -66
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="datametria-tree-node" role="treeitem" :aria-expanded="isExpanded">
|
|
3
|
+
<div
|
|
4
|
+
class="datametria-tree-node__content"
|
|
5
|
+
:class="{ 'is-leaf': isLeaf }"
|
|
6
|
+
@click="handleClick"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
v-if="!isLeaf"
|
|
10
|
+
class="datametria-tree-node__expand"
|
|
11
|
+
@click.stop="handleToggle"
|
|
12
|
+
>
|
|
13
|
+
<span class="datametria-tree-node__icon">{{ isExpanded ? '▼' : '▶' }}</span>
|
|
14
|
+
</span>
|
|
15
|
+
<span v-else class="datametria-tree-node__expand datametria-tree-node__expand--leaf"></span>
|
|
16
|
+
|
|
17
|
+
<input
|
|
18
|
+
v-if="checkable"
|
|
19
|
+
type="checkbox"
|
|
20
|
+
class="datametria-tree-node__checkbox"
|
|
21
|
+
:checked="isChecked"
|
|
22
|
+
@change="handleCheckChange"
|
|
23
|
+
@click.stop
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<span class="datametria-tree-node__label">
|
|
27
|
+
{{ node.label || node.name || node[nodeKey] }}
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div v-if="hasChildren && isExpanded" class="datametria-tree-node__children">
|
|
32
|
+
<DatametriaTreeNode
|
|
33
|
+
v-for="child in node.children"
|
|
34
|
+
:key="getChildKey(child)"
|
|
35
|
+
:node="child"
|
|
36
|
+
:node-key="nodeKey"
|
|
37
|
+
:checkable="checkable"
|
|
38
|
+
:default-expand-all="defaultExpandAll"
|
|
39
|
+
:expanded-keys="expandedKeys"
|
|
40
|
+
:checked-keys="checkedKeys"
|
|
41
|
+
@toggle="$emit('toggle', $event)"
|
|
42
|
+
@check="(node, checked) => $emit('check', node, checked)"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { computed } from 'vue'
|
|
50
|
+
import type { TreeNode } from './DatametriaTree.vue'
|
|
51
|
+
|
|
52
|
+
interface Props {
|
|
53
|
+
node: TreeNode
|
|
54
|
+
nodeKey: string
|
|
55
|
+
checkable: boolean
|
|
56
|
+
defaultExpandAll: boolean
|
|
57
|
+
expandedKeys: Set<string | number>
|
|
58
|
+
checkedKeys: Set<string | number>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const props = defineProps<Props>()
|
|
62
|
+
|
|
63
|
+
const emit = defineEmits<{
|
|
64
|
+
toggle: [node: TreeNode]
|
|
65
|
+
check: [node: TreeNode, checked: boolean]
|
|
66
|
+
}>()
|
|
67
|
+
|
|
68
|
+
const nodeKeyValue = computed(() => props.node[props.nodeKey])
|
|
69
|
+
|
|
70
|
+
const hasChildren = computed(() => {
|
|
71
|
+
return props.node.children && props.node.children.length > 0
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const isLeaf = computed(() => !hasChildren.value)
|
|
75
|
+
|
|
76
|
+
const isExpanded = computed(() => {
|
|
77
|
+
return props.expandedKeys.has(nodeKeyValue.value)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const isChecked = computed(() => {
|
|
81
|
+
return props.checkedKeys.has(nodeKeyValue.value)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const getChildKey = (child: TreeNode): string | number => {
|
|
85
|
+
return child[props.nodeKey]
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const handleToggle = () => {
|
|
89
|
+
emit('toggle', props.node)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const handleClick = () => {
|
|
93
|
+
if (!isLeaf.value) {
|
|
94
|
+
handleToggle()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const handleCheckChange = (event: Event) => {
|
|
99
|
+
const target = event.target as HTMLInputElement
|
|
100
|
+
emit('check', props.node, target.checked)
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<style scoped>
|
|
105
|
+
.datametria-tree-node {
|
|
106
|
+
user-select: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.datametria-tree-node__content {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
padding: 4px 8px;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
transition: background-color 0.2s;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.datametria-tree-node__content:hover {
|
|
119
|
+
background-color: var(--dm-color-background-hover, #f5f5f5);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.datametria-tree-node__content.is-leaf {
|
|
123
|
+
padding-left: 24px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.datametria-tree-node__expand {
|
|
127
|
+
display: inline-flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
width: 20px;
|
|
131
|
+
height: 20px;
|
|
132
|
+
margin-right: 4px;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.datametria-tree-node__expand--leaf {
|
|
137
|
+
cursor: default;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.datametria-tree-node__icon {
|
|
141
|
+
font-size: 10px;
|
|
142
|
+
color: var(--dm-color-text-secondary, #666);
|
|
143
|
+
transition: transform 0.2s;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.datametria-tree-node__checkbox {
|
|
147
|
+
margin-right: 8px;
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.datametria-tree-node__label {
|
|
152
|
+
flex: 1;
|
|
153
|
+
font-size: var(--dm-font-size-base, 14px);
|
|
154
|
+
color: var(--dm-color-text, #333);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.datametria-tree-node__children {
|
|
158
|
+
padding-left: 20px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@media (prefers-color-scheme: dark) {
|
|
162
|
+
.datametria-tree-node__content:hover {
|
|
163
|
+
background-color: var(--dm-color-background-hover-dark, #2a2a2a);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.datametria-tree-node__icon {
|
|
167
|
+
color: var(--dm-color-text-secondary-dark, #999);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.datametria-tree-node__label {
|
|
171
|
+
color: var(--dm-color-text-dark, #e0e0e0);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="datametria-upload" :class="{ 'datametria-upload--disabled': disabled }">
|
|
3
|
+
<div
|
|
4
|
+
v-if="drag"
|
|
5
|
+
class="datametria-upload__drag"
|
|
6
|
+
:class="{ 'datametria-upload__drag--over': isDragOver }"
|
|
7
|
+
@drop.prevent="handleDrop"
|
|
8
|
+
@dragover.prevent="isDragOver = true"
|
|
9
|
+
@dragleave.prevent="isDragOver = false"
|
|
10
|
+
>
|
|
11
|
+
<slot name="trigger">
|
|
12
|
+
<div class="datametria-upload__drag-content">
|
|
13
|
+
<span>Arraste arquivos aqui ou clique para selecionar</span>
|
|
14
|
+
</div>
|
|
15
|
+
</slot>
|
|
16
|
+
<input
|
|
17
|
+
ref="inputRef"
|
|
18
|
+
type="file"
|
|
19
|
+
class="datametria-upload__input"
|
|
20
|
+
:accept="accept"
|
|
21
|
+
:multiple="multiple"
|
|
22
|
+
:disabled="disabled"
|
|
23
|
+
@change="handleChange"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
<div v-else class="datametria-upload__button">
|
|
27
|
+
<slot name="trigger">
|
|
28
|
+
<button type="button" :disabled="disabled" @click="triggerUpload">
|
|
29
|
+
Selecionar arquivo
|
|
30
|
+
</button>
|
|
31
|
+
</slot>
|
|
32
|
+
<input
|
|
33
|
+
ref="inputRef"
|
|
34
|
+
type="file"
|
|
35
|
+
class="datametria-upload__input"
|
|
36
|
+
:accept="accept"
|
|
37
|
+
:multiple="multiple"
|
|
38
|
+
:disabled="disabled"
|
|
39
|
+
@change="handleChange"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
<div v-if="fileList.length" class="datametria-upload__list">
|
|
43
|
+
<div
|
|
44
|
+
v-for="file in fileList"
|
|
45
|
+
:key="file.uid"
|
|
46
|
+
class="datametria-upload__item"
|
|
47
|
+
>
|
|
48
|
+
<img
|
|
49
|
+
v-if="file.preview"
|
|
50
|
+
:src="file.preview"
|
|
51
|
+
class="datametria-upload__preview"
|
|
52
|
+
alt="preview"
|
|
53
|
+
/>
|
|
54
|
+
<div class="datametria-upload__info">
|
|
55
|
+
<span class="datametria-upload__name">{{ file.name }}</span>
|
|
56
|
+
<span class="datametria-upload__size">{{ formatSize(file.size) }}</span>
|
|
57
|
+
</div>
|
|
58
|
+
<div v-if="file.status === 'uploading'" class="datametria-upload__progress">
|
|
59
|
+
<div
|
|
60
|
+
class="datametria-upload__progress-bar"
|
|
61
|
+
:style="{ width: `${file.progress}%` }"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
class="datametria-upload__remove"
|
|
67
|
+
@click="removeFile(file)"
|
|
68
|
+
>
|
|
69
|
+
×
|
|
70
|
+
</button>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<script setup lang="ts">
|
|
77
|
+
import { ref, computed } from 'vue'
|
|
78
|
+
|
|
79
|
+
interface UploadFile {
|
|
80
|
+
uid: string
|
|
81
|
+
name: string
|
|
82
|
+
size: number
|
|
83
|
+
status: 'ready' | 'uploading' | 'success' | 'error'
|
|
84
|
+
progress: number
|
|
85
|
+
preview?: string
|
|
86
|
+
raw: File
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface Props {
|
|
90
|
+
modelValue?: UploadFile[]
|
|
91
|
+
action?: string
|
|
92
|
+
accept?: string
|
|
93
|
+
multiple?: boolean
|
|
94
|
+
limit?: number
|
|
95
|
+
maxSize?: number
|
|
96
|
+
drag?: boolean
|
|
97
|
+
disabled?: boolean
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
101
|
+
modelValue: () => [],
|
|
102
|
+
action: '',
|
|
103
|
+
accept: '',
|
|
104
|
+
multiple: false,
|
|
105
|
+
limit: 0,
|
|
106
|
+
maxSize: 0,
|
|
107
|
+
drag: false,
|
|
108
|
+
disabled: false
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const emit = defineEmits<{
|
|
112
|
+
'update:modelValue': [files: UploadFile[]]
|
|
113
|
+
change: [files: UploadFile[]]
|
|
114
|
+
exceed: [files: File[]]
|
|
115
|
+
error: [error: Error, file: File]
|
|
116
|
+
success: [response: any, file: UploadFile]
|
|
117
|
+
}>()
|
|
118
|
+
|
|
119
|
+
const inputRef = ref<HTMLInputElement>()
|
|
120
|
+
const isDragOver = ref(false)
|
|
121
|
+
const fileList = ref<UploadFile[]>(props.modelValue)
|
|
122
|
+
let uidCounter = 0
|
|
123
|
+
|
|
124
|
+
const triggerUpload = () => {
|
|
125
|
+
inputRef.value?.click()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const handleChange = (event: Event) => {
|
|
129
|
+
const target = event.target as HTMLInputElement
|
|
130
|
+
const files = Array.from(target.files || [])
|
|
131
|
+
handleFiles(files)
|
|
132
|
+
target.value = ''
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const handleDrop = (event: DragEvent) => {
|
|
136
|
+
isDragOver.value = false
|
|
137
|
+
const files = Array.from(event.dataTransfer?.files || [])
|
|
138
|
+
handleFiles(files)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const handleFiles = (files: File[]) => {
|
|
142
|
+
if (props.disabled) return
|
|
143
|
+
|
|
144
|
+
if (props.limit && fileList.value.length + files.length > props.limit) {
|
|
145
|
+
emit('exceed', files)
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
files.forEach(file => {
|
|
150
|
+
if (props.maxSize && file.size > props.maxSize) {
|
|
151
|
+
emit('error', new Error('File size exceeds limit'), file)
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (props.accept && !validateFileType(file)) {
|
|
156
|
+
emit('error', new Error('Invalid file type'), file)
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const uploadFile: UploadFile = {
|
|
161
|
+
uid: `upload-${Date.now()}-${uidCounter++}`,
|
|
162
|
+
name: file.name,
|
|
163
|
+
size: file.size,
|
|
164
|
+
status: 'ready',
|
|
165
|
+
progress: 0,
|
|
166
|
+
raw: file
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (file.type.startsWith('image/')) {
|
|
170
|
+
const reader = new FileReader()
|
|
171
|
+
reader.onload = (e) => {
|
|
172
|
+
uploadFile.preview = e.target?.result as string
|
|
173
|
+
}
|
|
174
|
+
reader.readAsDataURL(file)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
fileList.value.push(uploadFile)
|
|
178
|
+
|
|
179
|
+
if (props.action) {
|
|
180
|
+
uploadFile.status = 'uploading'
|
|
181
|
+
simulateUpload(uploadFile)
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
emit('update:modelValue', fileList.value)
|
|
186
|
+
emit('change', fileList.value)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const validateFileType = (file: File): boolean => {
|
|
190
|
+
const acceptTypes = props.accept.split(',').map(t => t.trim())
|
|
191
|
+
return acceptTypes.some(type => {
|
|
192
|
+
if (type.startsWith('.')) {
|
|
193
|
+
return file.name.toLowerCase().endsWith(type.toLowerCase())
|
|
194
|
+
}
|
|
195
|
+
if (type.endsWith('/*')) {
|
|
196
|
+
return file.type.startsWith(type.replace('/*', ''))
|
|
197
|
+
}
|
|
198
|
+
return file.type === type
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const simulateUpload = (file: UploadFile) => {
|
|
203
|
+
const interval = setInterval(() => {
|
|
204
|
+
file.progress += 10
|
|
205
|
+
if (file.progress >= 100) {
|
|
206
|
+
clearInterval(interval)
|
|
207
|
+
file.status = 'success'
|
|
208
|
+
emit('success', { status: 'success' }, file)
|
|
209
|
+
}
|
|
210
|
+
}, 100)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const removeFile = (file: UploadFile) => {
|
|
214
|
+
const index = fileList.value.indexOf(file)
|
|
215
|
+
if (index > -1) {
|
|
216
|
+
fileList.value.splice(index, 1)
|
|
217
|
+
emit('update:modelValue', fileList.value)
|
|
218
|
+
emit('change', fileList.value)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const formatSize = (bytes: number): string => {
|
|
223
|
+
if (bytes === 0) return '0 B'
|
|
224
|
+
const k = 1024
|
|
225
|
+
const sizes = ['B', 'KB', 'MB', 'GB']
|
|
226
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
227
|
+
return `${(bytes / Math.pow(k, i)).toFixed(2)} ${sizes[i]}`
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
defineExpose({
|
|
231
|
+
clearFiles: () => {
|
|
232
|
+
fileList.value = []
|
|
233
|
+
emit('update:modelValue', [])
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
</script>
|
|
237
|
+
|
|
238
|
+
<style scoped>
|
|
239
|
+
.datametria-upload {
|
|
240
|
+
width: 100%;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.datametria-upload__drag {
|
|
244
|
+
position: relative;
|
|
245
|
+
border: 2px dashed var(--datametria-border-color, #dcdfe6);
|
|
246
|
+
border-radius: 4px;
|
|
247
|
+
padding: 40px;
|
|
248
|
+
text-align: center;
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
transition: border-color 0.2s;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.datametria-upload__drag:hover {
|
|
254
|
+
border-color: var(--datametria-primary-color, #0072ce);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.datametria-upload__drag--over {
|
|
258
|
+
border-color: var(--datametria-primary-color, #0072ce);
|
|
259
|
+
background-color: var(--datametria-primary-light-color, #ecf5ff);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.datametria-upload__drag-content {
|
|
263
|
+
color: var(--datametria-text-color, #303133);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.datametria-upload__button {
|
|
267
|
+
position: relative;
|
|
268
|
+
display: inline-block;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.datametria-upload__button button {
|
|
272
|
+
padding: 8px 16px;
|
|
273
|
+
border: 1px solid var(--datametria-border-color, #dcdfe6);
|
|
274
|
+
border-radius: 4px;
|
|
275
|
+
background-color: var(--datametria-bg-color, #ffffff);
|
|
276
|
+
color: var(--datametria-text-color, #303133);
|
|
277
|
+
cursor: pointer;
|
|
278
|
+
transition: all 0.2s;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.datametria-upload__button button:hover {
|
|
282
|
+
border-color: var(--datametria-primary-color, #0072ce);
|
|
283
|
+
color: var(--datametria-primary-color, #0072ce);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.datametria-upload__input {
|
|
287
|
+
position: absolute;
|
|
288
|
+
top: 0;
|
|
289
|
+
left: 0;
|
|
290
|
+
width: 100%;
|
|
291
|
+
height: 100%;
|
|
292
|
+
opacity: 0;
|
|
293
|
+
cursor: pointer;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.datametria-upload--disabled .datametria-upload__input {
|
|
297
|
+
cursor: not-allowed;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.datametria-upload__list {
|
|
301
|
+
margin-top: 12px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.datametria-upload__item {
|
|
305
|
+
display: flex;
|
|
306
|
+
align-items: center;
|
|
307
|
+
gap: 12px;
|
|
308
|
+
padding: 8px;
|
|
309
|
+
border: 1px solid var(--datametria-border-color, #dcdfe6);
|
|
310
|
+
border-radius: 4px;
|
|
311
|
+
margin-bottom: 8px;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.datametria-upload__preview {
|
|
315
|
+
width: 60px;
|
|
316
|
+
height: 60px;
|
|
317
|
+
object-fit: cover;
|
|
318
|
+
border-radius: 4px;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.datametria-upload__info {
|
|
322
|
+
flex: 1;
|
|
323
|
+
display: flex;
|
|
324
|
+
flex-direction: column;
|
|
325
|
+
gap: 4px;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.datametria-upload__name {
|
|
329
|
+
font-size: 14px;
|
|
330
|
+
color: var(--datametria-text-color, #303133);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.datametria-upload__size {
|
|
334
|
+
font-size: 12px;
|
|
335
|
+
color: var(--datametria-info-color, #909399);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.datametria-upload__progress {
|
|
339
|
+
width: 100%;
|
|
340
|
+
height: 4px;
|
|
341
|
+
background-color: var(--datametria-border-color, #dcdfe6);
|
|
342
|
+
border-radius: 2px;
|
|
343
|
+
overflow: hidden;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.datametria-upload__progress-bar {
|
|
347
|
+
height: 100%;
|
|
348
|
+
background-color: var(--datametria-primary-color, #0072ce);
|
|
349
|
+
transition: width 0.3s;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.datametria-upload__remove {
|
|
353
|
+
padding: 4px 8px;
|
|
354
|
+
border: none;
|
|
355
|
+
background: none;
|
|
356
|
+
color: var(--datametria-danger-color, #f56c6c);
|
|
357
|
+
font-size: 20px;
|
|
358
|
+
cursor: pointer;
|
|
359
|
+
transition: color 0.2s;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.datametria-upload__remove:hover {
|
|
363
|
+
color: var(--datametria-danger-hover-color, #f78989);
|
|
364
|
+
}
|
|
365
|
+
</style>
|
package/src/index.ts
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
// Components - Form
|
|
2
2
|
export { default as DatametriaButton } from './components/DatametriaButton.vue'
|
|
3
|
-
export { default as DatametriaInput } from './components/DatametriaInput.vue'
|
|
3
|
+
export { default as DatametriaInput } from './components/DatametriaInput.vue' // v2.3.0
|
|
4
4
|
export { default as DatametriaPasswordInput } from './components/DatametriaPasswordInput.vue'
|
|
5
|
-
export { default as DatametriaSelect } from './components/DatametriaSelect.vue'
|
|
6
|
-
export { default as DatametriaCheckbox } from './components/DatametriaCheckbox.vue'
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
5
|
+
export { default as DatametriaSelect } from './components/DatametriaSelect.vue' // v2.3.0
|
|
6
|
+
export { default as DatametriaCheckbox } from './components/DatametriaCheckbox.vue' // v2.3.0
|
|
7
|
+
export { default as DatametriaCheckboxGroup } from './components/DatametriaCheckboxGroup.vue' // v2.3.0
|
|
8
|
+
export { default as DatametriaRadio } from './components/DatametriaRadio.vue' // v2.3.0
|
|
9
|
+
export { default as DatametriaRadioGroup } from './components/DatametriaRadioGroup.vue' // v2.3.0
|
|
10
|
+
export { default as DatametriaSwitch } from './components/DatametriaSwitch.vue' // v2.3.0
|
|
11
|
+
export { default as DatametriaTextarea } from './components/DatametriaTextarea.vue' // v2.3.0
|
|
12
|
+
export { default as DatametriaDatePicker } from './components/DatametriaDatePicker.vue' // v2.3.0
|
|
13
|
+
export { default as DatametriaTimePicker } from './components/DatametriaTimePicker.vue' // v2.3.0
|
|
12
14
|
export { default as DatametriaSlider } from './components/DatametriaSlider.vue'
|
|
13
15
|
export { default as DatametriaFileUpload } from './components/DatametriaFileUpload.vue'
|
|
14
|
-
export { default as
|
|
16
|
+
export { default as DatametriaUpload } from './components/DatametriaUpload.vue' // v2.3.0
|
|
17
|
+
export { default as DatametriaAutocomplete } from './components/DatametriaAutocomplete.vue' // v2.3.0
|
|
18
|
+
export { default as DatametriaForm } from './components/DatametriaForm.vue' // v2.3.0
|
|
19
|
+
export { default as DatametriaFormItem } from './components/DatametriaFormItem.vue' // v2.3.0
|
|
15
20
|
|
|
16
21
|
// Components - Layout
|
|
17
22
|
export { default as DatametriaCard } from './components/DatametriaCard.vue'
|
|
23
|
+
export { default as DatametriaDialog } from './components/DatametriaDialog.vue'
|
|
18
24
|
export { default as DatametriaModal } from './components/DatametriaModal.vue'
|
|
19
25
|
export { default as DatametriaContainer } from './components/DatametriaContainer.vue'
|
|
20
26
|
export { default as DatametriaGrid } from './components/DatametriaGrid.vue'
|
|
@@ -24,13 +30,19 @@ export { default as DatametriaDivider } from './components/DatametriaDivider.vue
|
|
|
24
30
|
export { default as DatametriaAlert } from './components/DatametriaAlert.vue'
|
|
25
31
|
export { default as DatametriaToast } from './components/DatametriaToast.vue'
|
|
26
32
|
export { default as DatametriaTooltip } from './components/DatametriaTooltip.vue'
|
|
27
|
-
export { default as DatametriaSkeleton } from './components/DatametriaSkeleton.vue'
|
|
28
|
-
export { default as DatametriaProgress } from './components/DatametriaProgress.vue'
|
|
33
|
+
export { default as DatametriaSkeleton } from './components/DatametriaSkeleton.vue' // v2.3.0
|
|
34
|
+
export { default as DatametriaProgress } from './components/DatametriaProgress.vue' // v2.3.0
|
|
35
|
+
export { default as DatametriaResult } from './components/DatametriaResult.vue' // v2.3.0
|
|
36
|
+
export { default as DatametriaPopconfirm } from './components/DatametriaPopconfirm.vue' // v2.3.0
|
|
29
37
|
export { default as DatametriaSpinner } from './components/DatametriaSpinner.vue'
|
|
30
38
|
|
|
31
39
|
// Components - Data Display
|
|
32
40
|
export { default as DatametriaTable } from './components/DatametriaTable.vue'
|
|
33
41
|
export { default as DatametriaSortableTable } from './components/DatametriaSortableTable.vue'
|
|
42
|
+
export { default as DatametriaDataTable } from './components/DatametriaDataTable.vue' // v2.3.0
|
|
43
|
+
export { default as DatametriaPagination } from './components/DatametriaPagination.vue' // v2.3.0
|
|
44
|
+
export { default as DatametriaTree } from './components/DatametriaTree.vue' // v2.3.0
|
|
45
|
+
export { default as DatametriaEmpty } from './components/DatametriaEmpty.vue' // v2.3.0
|
|
34
46
|
export { default as DatametriaAvatar } from './components/DatametriaAvatar.vue'
|
|
35
47
|
export { default as DatametriaBadge } from './components/DatametriaBadge.vue'
|
|
36
48
|
export { default as DatametriaChip } from './components/DatametriaChip.vue'
|
|
@@ -41,7 +53,9 @@ export { default as DatametriaSidebar } from './components/DatametriaSidebar.vue
|
|
|
41
53
|
export { default as DatametriaFloatingBar } from './components/DatametriaFloatingBar.vue'
|
|
42
54
|
export { default as DatametriaMenu } from './components/DatametriaMenu.vue'
|
|
43
55
|
export { default as DatametriaBreadcrumb } from './components/DatametriaBreadcrumb.vue'
|
|
56
|
+
export { default as DatametriaSteps } from './components/DatametriaSteps.vue' // v2.3.0
|
|
44
57
|
export { default as DatametriaTabs } from './components/DatametriaTabs.vue'
|
|
58
|
+
export { default as DatametriaTabPane } from './components/DatametriaTabPane.vue' // v2.3.0
|
|
45
59
|
|
|
46
60
|
// Composables - Core
|
|
47
61
|
export { useValidation, required, email, minLength, maxLength, pattern, custom } from './composables/useValidation'
|
package/src/types/index.ts
CHANGED
|
@@ -39,6 +39,8 @@ export interface TableColumn {
|
|
|
39
39
|
width?: string
|
|
40
40
|
sortable?: boolean
|
|
41
41
|
filterable?: boolean
|
|
42
|
+
filterType?: 'text' | 'date' | 'select' | 'multiselect'
|
|
43
|
+
filterOptions?: Array<{ value: string; label: string }> | 'auto'
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export interface SortableTableProps {
|