pimelon-ui 0.0.98
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/license.md +0 -0
- package/package.json +75 -0
- package/readme.md +0 -0
- package/src/components/Alert.vue +57 -0
- package/src/components/Autocomplete.vue +176 -0
- package/src/components/Avatar.vue +62 -0
- package/src/components/Badge.vue +42 -0
- package/src/components/Button.vue +155 -0
- package/src/components/Card.vue +37 -0
- package/src/components/DatePicker.vue +252 -0
- package/src/components/Dialog.vue +216 -0
- package/src/components/Dropdown.vue +145 -0
- package/src/components/ErrorMessage.vue +24 -0
- package/src/components/FeatherIcon.vue +59 -0
- package/src/components/FileUploader.vue +220 -0
- package/src/components/GreenCheckIcon.vue +16 -0
- package/src/components/Input.vue +214 -0
- package/src/components/Link.vue +28 -0
- package/src/components/ListItem.vue +28 -0
- package/src/components/LoadingIndicator.vue +27 -0
- package/src/components/LoadingText.vue +21 -0
- package/src/components/Popover.vue +253 -0
- package/src/components/Resource.vue +21 -0
- package/src/components/TextEditor/FontColor.vue +108 -0
- package/src/components/TextEditor/InsertImage.vue +74 -0
- package/src/components/TextEditor/InsertLink.vue +67 -0
- package/src/components/TextEditor/InsertVideo.vue +94 -0
- package/src/components/TextEditor/MentionList.vue +95 -0
- package/src/components/TextEditor/Menu.vue +99 -0
- package/src/components/TextEditor/TextEditor.vue +275 -0
- package/src/components/TextEditor/TextEditorBubbleMenu.vue +69 -0
- package/src/components/TextEditor/TextEditorFixedMenu.vue +72 -0
- package/src/components/TextEditor/TextEditorFloatingMenu.vue +55 -0
- package/src/components/TextEditor/commands.js +272 -0
- package/src/components/TextEditor/icons/align-center.vue +14 -0
- package/src/components/TextEditor/icons/align-justify.vue +14 -0
- package/src/components/TextEditor/icons/align-left.vue +14 -0
- package/src/components/TextEditor/icons/align-right.vue +14 -0
- package/src/components/TextEditor/icons/arrow-go-back-line.vue +14 -0
- package/src/components/TextEditor/icons/arrow-go-forward-line.vue +14 -0
- package/src/components/TextEditor/icons/bold.vue +14 -0
- package/src/components/TextEditor/icons/code-view.vue +14 -0
- package/src/components/TextEditor/icons/double-quotes-r.vue +14 -0
- package/src/components/TextEditor/icons/font-color.vue +14 -0
- package/src/components/TextEditor/icons/format-clear.vue +14 -0
- package/src/components/TextEditor/icons/h-1.vue +14 -0
- package/src/components/TextEditor/icons/h-2.vue +14 -0
- package/src/components/TextEditor/icons/h-3.vue +14 -0
- package/src/components/TextEditor/icons/h-4.vue +14 -0
- package/src/components/TextEditor/icons/h-5.vue +14 -0
- package/src/components/TextEditor/icons/h-6.vue +14 -0
- package/src/components/TextEditor/icons/image-add-line.vue +14 -0
- package/src/components/TextEditor/icons/italic.vue +14 -0
- package/src/components/TextEditor/icons/link.vue +14 -0
- package/src/components/TextEditor/icons/list-ordered.vue +14 -0
- package/src/components/TextEditor/icons/list-unordered.vue +14 -0
- package/src/components/TextEditor/icons/readme.md +1 -0
- package/src/components/TextEditor/icons/separator.vue +14 -0
- package/src/components/TextEditor/icons/strikethrough.vue +14 -0
- package/src/components/TextEditor/icons/table-2.vue +14 -0
- package/src/components/TextEditor/icons/text.vue +11 -0
- package/src/components/TextEditor/icons/underline.vue +14 -0
- package/src/components/TextEditor/icons/video-add-line.vue +14 -0
- package/src/components/TextEditor/image-extension.js +152 -0
- package/src/components/TextEditor/index.js +6 -0
- package/src/components/TextEditor/mention.js +72 -0
- package/src/components/TextEditor/utils.js +11 -0
- package/src/components/TextEditor/video-extension.js +60 -0
- package/src/components/Toast.vue +83 -0
- package/src/components/Tooltip.vue +36 -0
- package/src/components/toast.js +98 -0
- package/src/directives/onOutsideClick.js +34 -0
- package/src/directives/visibility.js +24 -0
- package/src/index.js +56 -0
- package/src/resources/documentResource.js +194 -0
- package/src/resources/index.js +4 -0
- package/src/resources/listResource.js +312 -0
- package/src/resources/local.js +16 -0
- package/src/resources/plugin.js +105 -0
- package/src/resources/resources.js +215 -0
- package/src/style.css +15 -0
- package/src/utils/call.js +98 -0
- package/src/utils/config.js +9 -0
- package/src/utils/debounce.js +15 -0
- package/src/utils/file-to-base64.js +9 -0
- package/src/utils/markdown.js +29 -0
- package/src/utils/melonRequest.js +105 -0
- package/src/utils/pageMeta.js +52 -0
- package/src/utils/plugin.js +24 -0
- package/src/utils/request.js +49 -0
- package/src/utils/socketio.js +11 -0
- package/src/utils/tailwind.config.js +117 -0
- package/src/utils/vite-dev-server.js +14 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<input
|
|
4
|
+
ref="input"
|
|
5
|
+
type="file"
|
|
6
|
+
:accept="fileTypes"
|
|
7
|
+
class="hidden"
|
|
8
|
+
@change="onFileAdd"
|
|
9
|
+
/>
|
|
10
|
+
<slot
|
|
11
|
+
v-bind="{
|
|
12
|
+
file,
|
|
13
|
+
uploading,
|
|
14
|
+
progress,
|
|
15
|
+
uploaded,
|
|
16
|
+
message,
|
|
17
|
+
error,
|
|
18
|
+
total,
|
|
19
|
+
success,
|
|
20
|
+
openFileSelector,
|
|
21
|
+
}"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
class FileUploader {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.listeners = {}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
on(event, handler) {
|
|
33
|
+
this.listeners[event] = this.listeners[event] || []
|
|
34
|
+
this.listeners[event].push(handler)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
trigger(event, data) {
|
|
38
|
+
let handlers = this.listeners[event] || []
|
|
39
|
+
handlers.forEach((handler) => {
|
|
40
|
+
handler.call(this, data)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
upload(file, options) {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
let xhr = new XMLHttpRequest()
|
|
47
|
+
xhr.upload.addEventListener('loadstart', () => {
|
|
48
|
+
this.trigger('start')
|
|
49
|
+
})
|
|
50
|
+
xhr.upload.addEventListener('progress', (e) => {
|
|
51
|
+
if (e.lengthComputable) {
|
|
52
|
+
this.trigger('progress', {
|
|
53
|
+
uploaded: e.loaded,
|
|
54
|
+
total: e.total,
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
xhr.upload.addEventListener('load', () => {
|
|
59
|
+
this.trigger('finish')
|
|
60
|
+
})
|
|
61
|
+
xhr.addEventListener('error', () => {
|
|
62
|
+
this.trigger('error')
|
|
63
|
+
reject()
|
|
64
|
+
})
|
|
65
|
+
xhr.onreadystatechange = () => {
|
|
66
|
+
if (xhr.readyState == XMLHttpRequest.DONE) {
|
|
67
|
+
let error
|
|
68
|
+
if (xhr.status === 200) {
|
|
69
|
+
let r = null
|
|
70
|
+
try {
|
|
71
|
+
r = JSON.parse(xhr.responseText)
|
|
72
|
+
} catch (e) {
|
|
73
|
+
r = xhr.responseText
|
|
74
|
+
}
|
|
75
|
+
let out = r.message || r
|
|
76
|
+
resolve(out)
|
|
77
|
+
} else if (xhr.status === 403) {
|
|
78
|
+
error = JSON.parse(xhr.responseText)
|
|
79
|
+
} else {
|
|
80
|
+
this.failed = true
|
|
81
|
+
try {
|
|
82
|
+
error = JSON.parse(xhr.responseText)
|
|
83
|
+
} catch (e) {
|
|
84
|
+
// pass
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (error && error.exc) {
|
|
88
|
+
console.error(JSON.parse(error.exc)[0])
|
|
89
|
+
}
|
|
90
|
+
reject(error)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
xhr.open('POST', '/api/method/upload_file', true)
|
|
94
|
+
xhr.setRequestHeader('Accept', 'application/json')
|
|
95
|
+
if (window.csrf_token && window.csrf_token !== '{{ csrf_token }}') {
|
|
96
|
+
xhr.setRequestHeader('X-Melon-CSRF-Token', window.csrf_token)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let form_data = new FormData()
|
|
100
|
+
if (file) {
|
|
101
|
+
form_data.append('file', file, file.name)
|
|
102
|
+
}
|
|
103
|
+
form_data.append('is_private', +(options.private || 0))
|
|
104
|
+
form_data.append('folder', options.folder || 'Home')
|
|
105
|
+
|
|
106
|
+
if (options.file_url) {
|
|
107
|
+
form_data.append('file_url', options.file_url)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (options.doctype && options.docname) {
|
|
111
|
+
form_data.append('doctype', options.doctype)
|
|
112
|
+
form_data.append('docname', options.docname)
|
|
113
|
+
if (options.fieldname) {
|
|
114
|
+
form_data.append('fieldname', options.fieldname)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (options.method) {
|
|
119
|
+
form_data.append('method', options.method)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (options.type) {
|
|
123
|
+
form_data.append('type', options.type)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
xhr.send(form_data)
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default {
|
|
132
|
+
name: 'FileUploader',
|
|
133
|
+
props: ['fileTypes', 'uploadArgs', 'validateFile'],
|
|
134
|
+
data() {
|
|
135
|
+
return {
|
|
136
|
+
uploader: null,
|
|
137
|
+
uploading: false,
|
|
138
|
+
uploaded: 0,
|
|
139
|
+
error: null,
|
|
140
|
+
message: '',
|
|
141
|
+
total: 0,
|
|
142
|
+
file: null,
|
|
143
|
+
finishedUploading: false,
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
computed: {
|
|
147
|
+
progress() {
|
|
148
|
+
let value = Math.floor((this.uploaded / this.total) * 100)
|
|
149
|
+
return isNaN(value) ? 0 : value
|
|
150
|
+
},
|
|
151
|
+
success() {
|
|
152
|
+
return this.finishedUploading && !this.error
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
methods: {
|
|
156
|
+
openFileSelector() {
|
|
157
|
+
this.$refs['input'].click()
|
|
158
|
+
},
|
|
159
|
+
async onFileAdd(e) {
|
|
160
|
+
this.error = null
|
|
161
|
+
this.file = e.target.files[0]
|
|
162
|
+
|
|
163
|
+
if (this.file && this.validateFile) {
|
|
164
|
+
try {
|
|
165
|
+
let message = await this.validateFile(this.file)
|
|
166
|
+
if (message) {
|
|
167
|
+
this.error = message
|
|
168
|
+
}
|
|
169
|
+
} catch (error) {
|
|
170
|
+
this.error = error
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (!this.error) {
|
|
175
|
+
this.uploadFile(this.file)
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
async uploadFile(file) {
|
|
179
|
+
this.error = null
|
|
180
|
+
this.uploaded = 0
|
|
181
|
+
this.total = 0
|
|
182
|
+
|
|
183
|
+
this.uploader = new FileUploader()
|
|
184
|
+
this.uploader.on('start', () => {
|
|
185
|
+
this.uploading = true
|
|
186
|
+
})
|
|
187
|
+
this.uploader.on('progress', (data) => {
|
|
188
|
+
this.uploaded = data.uploaded
|
|
189
|
+
this.total = data.total
|
|
190
|
+
})
|
|
191
|
+
this.uploader.on('error', () => {
|
|
192
|
+
this.uploading = false
|
|
193
|
+
this.error = 'Error Uploading File'
|
|
194
|
+
})
|
|
195
|
+
this.uploader.on('finish', () => {
|
|
196
|
+
this.uploading = false
|
|
197
|
+
this.finishedUploading = true
|
|
198
|
+
})
|
|
199
|
+
this.uploader
|
|
200
|
+
.upload(file, this.uploadArgs || {})
|
|
201
|
+
.then((data) => {
|
|
202
|
+
this.$emit('success', data)
|
|
203
|
+
})
|
|
204
|
+
.catch((error) => {
|
|
205
|
+
this.uploading = false
|
|
206
|
+
let errorMessage = 'Error Uploading File'
|
|
207
|
+
if (error?._server_messages) {
|
|
208
|
+
errorMessage = JSON.parse(
|
|
209
|
+
JSON.parse(error._server_messages)[0]
|
|
210
|
+
).message
|
|
211
|
+
} else if (error?.exc) {
|
|
212
|
+
errorMessage = JSON.parse(error.exc)[0].split('\n').slice(-2, -1)[0]
|
|
213
|
+
}
|
|
214
|
+
this.error = errorMessage
|
|
215
|
+
this.$emit('failure', error)
|
|
216
|
+
})
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
}
|
|
220
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path
|
|
4
|
+
d="M16 32c8.837 0 16-7.163 16-16S24.837 0 16 0 0 7.163 0 16s7.163 16 16 16z"
|
|
5
|
+
fill="#59B179"
|
|
6
|
+
/>
|
|
7
|
+
<path
|
|
8
|
+
d="M9.333 17.227l1.333 1.333 2.667 2.667 5.333-5.333 2.667-2.667 1.333-1.333"
|
|
9
|
+
stroke="#fff"
|
|
10
|
+
stroke-width="2"
|
|
11
|
+
stroke-miterlimit="10"
|
|
12
|
+
stroke-linecap="round"
|
|
13
|
+
stroke-linejoin="round"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label :class="[type == 'checkbox' ? 'flex' : 'block', $attrs.class]">
|
|
3
|
+
<span
|
|
4
|
+
v-if="label && type != 'checkbox'"
|
|
5
|
+
class="mb-2 block text-sm leading-4 text-gray-700"
|
|
6
|
+
>
|
|
7
|
+
{{ label }}
|
|
8
|
+
</span>
|
|
9
|
+
<div
|
|
10
|
+
class="relative flex"
|
|
11
|
+
:class="{ 'items-center': isNormalInput || type == 'select' }"
|
|
12
|
+
>
|
|
13
|
+
<FeatherIcon
|
|
14
|
+
v-if="iconLeft && type != 'checkbox'"
|
|
15
|
+
:name="iconLeft"
|
|
16
|
+
class="absolute mx-2 h-4 w-4 text-gray-600"
|
|
17
|
+
:class="{ 'mt-2': type == 'textarea' }"
|
|
18
|
+
/>
|
|
19
|
+
<input
|
|
20
|
+
v-if="isNormalInput"
|
|
21
|
+
v-bind="inputAttributes"
|
|
22
|
+
class="border-gray-400 placeholder-gray-500"
|
|
23
|
+
ref="input"
|
|
24
|
+
:class="[
|
|
25
|
+
{
|
|
26
|
+
'form-input block w-full': type != 'checkbox',
|
|
27
|
+
'form-checkbox': type == 'checkbox',
|
|
28
|
+
'pl-8': iconLeft && type != 'checkbox',
|
|
29
|
+
},
|
|
30
|
+
inputClass,
|
|
31
|
+
]"
|
|
32
|
+
:type="type || 'text'"
|
|
33
|
+
:disabled="disabled"
|
|
34
|
+
:placeholder="placeholder"
|
|
35
|
+
:value="passedInputValue"
|
|
36
|
+
/>
|
|
37
|
+
<textarea
|
|
38
|
+
v-if="type === 'textarea'"
|
|
39
|
+
v-bind="inputAttributes"
|
|
40
|
+
:placeholder="placeholder"
|
|
41
|
+
class="placeholder-gray-500"
|
|
42
|
+
:class="[
|
|
43
|
+
'form-textarea block w-full resize-none',
|
|
44
|
+
inputClass,
|
|
45
|
+
{
|
|
46
|
+
'pl-8': iconLeft,
|
|
47
|
+
},
|
|
48
|
+
]"
|
|
49
|
+
ref="input"
|
|
50
|
+
:value="passedInputValue"
|
|
51
|
+
:disabled="disabled"
|
|
52
|
+
:rows="rows"
|
|
53
|
+
></textarea>
|
|
54
|
+
<select
|
|
55
|
+
v-if="type === 'select'"
|
|
56
|
+
v-bind="inputAttributes"
|
|
57
|
+
class="form-select block w-full"
|
|
58
|
+
:class="{ 'pl-8': iconLeft }"
|
|
59
|
+
ref="input"
|
|
60
|
+
:disabled="disabled"
|
|
61
|
+
>
|
|
62
|
+
<option
|
|
63
|
+
v-for="option in selectOptions"
|
|
64
|
+
:key="option.value"
|
|
65
|
+
:value="option.value"
|
|
66
|
+
:disabled="option.disabled || false"
|
|
67
|
+
:selected="passedInputValue === option.value"
|
|
68
|
+
>
|
|
69
|
+
{{ option.label }}
|
|
70
|
+
</option>
|
|
71
|
+
</select>
|
|
72
|
+
</div>
|
|
73
|
+
<span
|
|
74
|
+
v-if="label && type == 'checkbox'"
|
|
75
|
+
class="ml-2 inline-block text-base leading-4"
|
|
76
|
+
>
|
|
77
|
+
{{ label }}
|
|
78
|
+
</span>
|
|
79
|
+
</label>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script>
|
|
83
|
+
import { debounce } from '../index'
|
|
84
|
+
import FeatherIcon from './FeatherIcon.vue'
|
|
85
|
+
|
|
86
|
+
export default {
|
|
87
|
+
name: 'Input',
|
|
88
|
+
inheritAttrs: false,
|
|
89
|
+
expose: ['getInputValue'],
|
|
90
|
+
components: { FeatherIcon },
|
|
91
|
+
props: {
|
|
92
|
+
label: {
|
|
93
|
+
type: String,
|
|
94
|
+
},
|
|
95
|
+
type: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: 'text',
|
|
98
|
+
validator(value) {
|
|
99
|
+
let isValid = [
|
|
100
|
+
'text',
|
|
101
|
+
'number',
|
|
102
|
+
'checkbox',
|
|
103
|
+
'textarea',
|
|
104
|
+
'select',
|
|
105
|
+
'email',
|
|
106
|
+
'password',
|
|
107
|
+
'date',
|
|
108
|
+
].includes(value)
|
|
109
|
+
if (!isValid) {
|
|
110
|
+
console.warn(`Invalid value "${value}" for "type" prop for Input`)
|
|
111
|
+
}
|
|
112
|
+
return isValid
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
modelValue: {
|
|
116
|
+
type: [String, Number, Boolean, Object, Array],
|
|
117
|
+
},
|
|
118
|
+
inputClass: {
|
|
119
|
+
type: [String, Array, Object],
|
|
120
|
+
},
|
|
121
|
+
debounce: {
|
|
122
|
+
type: Number,
|
|
123
|
+
},
|
|
124
|
+
options: {
|
|
125
|
+
type: Array,
|
|
126
|
+
},
|
|
127
|
+
disabled: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
},
|
|
130
|
+
rows: {
|
|
131
|
+
type: Number,
|
|
132
|
+
default: 3,
|
|
133
|
+
},
|
|
134
|
+
placeholder: {
|
|
135
|
+
type: String,
|
|
136
|
+
},
|
|
137
|
+
iconLeft: {
|
|
138
|
+
type: String,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
emits: ['input', 'change', 'update:modelValue'],
|
|
142
|
+
methods: {
|
|
143
|
+
focus() {
|
|
144
|
+
this.$refs.input.focus()
|
|
145
|
+
},
|
|
146
|
+
blur() {
|
|
147
|
+
this.$refs.input.blur()
|
|
148
|
+
},
|
|
149
|
+
getInputValue(e) {
|
|
150
|
+
let $input = e ? e.target : this.$refs.input
|
|
151
|
+
let value = $input.value
|
|
152
|
+
if (this.type == 'checkbox') {
|
|
153
|
+
value = $input.checked
|
|
154
|
+
}
|
|
155
|
+
return value
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
computed: {
|
|
159
|
+
passedInputValue() {
|
|
160
|
+
if ('value' in this.$attrs) {
|
|
161
|
+
return this.$attrs.value
|
|
162
|
+
}
|
|
163
|
+
return this.modelValue || null
|
|
164
|
+
},
|
|
165
|
+
inputAttributes() {
|
|
166
|
+
let attrs = {}
|
|
167
|
+
let onInput = (e) => {
|
|
168
|
+
this.$emit('input', this.getInputValue(e))
|
|
169
|
+
}
|
|
170
|
+
if (this.debounce) {
|
|
171
|
+
onInput = debounce(onInput, this.debounce)
|
|
172
|
+
}
|
|
173
|
+
if (this.type == 'checkbox') {
|
|
174
|
+
attrs.checked = this.passedInputValue
|
|
175
|
+
}
|
|
176
|
+
return Object.assign(attrs, this.$attrs, {
|
|
177
|
+
onInput,
|
|
178
|
+
onChange: (e) => {
|
|
179
|
+
this.$emit('change', this.getInputValue(e))
|
|
180
|
+
this.$emit('update:modelValue', this.getInputValue(e))
|
|
181
|
+
},
|
|
182
|
+
})
|
|
183
|
+
},
|
|
184
|
+
selectOptions() {
|
|
185
|
+
return this.options
|
|
186
|
+
.map((option) => {
|
|
187
|
+
if (typeof option === 'string') {
|
|
188
|
+
return {
|
|
189
|
+
label: option,
|
|
190
|
+
value: option,
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return option
|
|
194
|
+
})
|
|
195
|
+
.filter(Boolean)
|
|
196
|
+
},
|
|
197
|
+
isNormalInput() {
|
|
198
|
+
return [
|
|
199
|
+
'text',
|
|
200
|
+
'number',
|
|
201
|
+
'checkbox',
|
|
202
|
+
'email',
|
|
203
|
+
'password',
|
|
204
|
+
'date',
|
|
205
|
+
].includes(this.type)
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
}
|
|
209
|
+
</script>
|
|
210
|
+
<style>
|
|
211
|
+
.form-select {
|
|
212
|
+
background-image: url("data:image/svg+xml;utf8,<svg fill='none' width='8' xmlns='http://www.w3.org/2000/svg' viewBox='-4 -2 16 16'><path d='M4.5 3.636 6.136 2l1.637 1.636M4.5 8.364 6.136 10l1.637-1.636' stroke='%23333C44' stroke-linecap='round' stroke-linejoin='round'/></svg>");
|
|
213
|
+
}
|
|
214
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="isExternal ? 'a' : 'router-link'"
|
|
4
|
+
v-bind="attributes"
|
|
5
|
+
class="cursor-pointer text-blue-500 hover:text-blue-600"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</component>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
props: ['to'],
|
|
14
|
+
computed: {
|
|
15
|
+
attributes() {
|
|
16
|
+
return {
|
|
17
|
+
...this.$attrs,
|
|
18
|
+
target: this.isExternal ? '_blank' : null,
|
|
19
|
+
to: !this.isExternal ? this.to : undefined,
|
|
20
|
+
href: this.isExternal ? this.to : undefined,
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
isExternal() {
|
|
24
|
+
return this.to.startsWith('http')
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex items-center justify-between py-3">
|
|
3
|
+
<div>
|
|
4
|
+
<h3 class="text-base font-medium text-gray-900">
|
|
5
|
+
{{ title }}
|
|
6
|
+
</h3>
|
|
7
|
+
<div class="mt-1" v-if="secondaryText || $slots.subtitle">
|
|
8
|
+
<template v-if="secondaryText">
|
|
9
|
+
<span class="text-base text-gray-600" v-html="secondaryText" />
|
|
10
|
+
</template>
|
|
11
|
+
<slot v-if="$slots.subtitle" name="subtitle" />
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<slot name="actions"></slot>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: 'ListItem',
|
|
20
|
+
props: ['title', 'subtitle'],
|
|
21
|
+
computed: {
|
|
22
|
+
secondaryText() {
|
|
23
|
+
let text = this.subtitle || ''
|
|
24
|
+
return text.replace('\n', '<br>')
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
class="max-w-xs animate-spin"
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
fill="none"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
>
|
|
8
|
+
<circle
|
|
9
|
+
class="opacity-25"
|
|
10
|
+
cx="12"
|
|
11
|
+
cy="12"
|
|
12
|
+
r="10"
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
stroke-width="4"
|
|
15
|
+
></circle>
|
|
16
|
+
<path
|
|
17
|
+
class="opacity-75"
|
|
18
|
+
fill="currentColor"
|
|
19
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
20
|
+
></path>
|
|
21
|
+
</svg>
|
|
22
|
+
</template>
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
name: 'LoadingIndicator',
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex items-center text-base text-gray-500">
|
|
3
|
+
<LoadingIndicator class="mr-2 -ml-1 h-3 w-3" /> {{ text }}
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
import LoadingIndicator from './LoadingIndicator.vue'
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
name: 'Loading',
|
|
11
|
+
props: {
|
|
12
|
+
text: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'Loading...',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
components: {
|
|
18
|
+
LoadingIndicator,
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
</script>
|