@ulu/frontend-vue 0.1.0-beta.3 → 0.1.0-beta.5
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 +97 -1
- package/dist/{breakpoints-Cq2oSdYS.js → breakpoints-DVO2G7-7.js} +1 -1
- package/dist/frontend-vue.js +56 -62
- package/dist/index-BPVCOXRL.js +6459 -0
- package/lib/components/elements/UluIcon.vue +6 -6
- package/lib/components/index.js +0 -1
- package/lib/components/systems/table-sticky/UluTableSticky.vue +1 -1
- package/lib/index.js +0 -1
- package/lib/plugins/core/index.js +87 -0
- package/lib/plugins/index.js +1 -0
- package/package.json +16 -5
- package/dist/index-CMGxe_M1.js +0 -6466
- package/lib/components/forms/UluFormDropzone.vue +0 -62
- package/lib/settings.js +0 -119
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<!-- Based on https://react-dropzone.js.org/#section-basic-example -->
|
|
2
|
-
<template>
|
|
3
|
-
<div
|
|
4
|
-
class="site-dropzone site-form__item site-form__item--file"
|
|
5
|
-
:class="{ 'is-danger' : fileErrors.length }"
|
|
6
|
-
>
|
|
7
|
-
<div
|
|
8
|
-
class="site-dropzone__target"
|
|
9
|
-
:class="{
|
|
10
|
-
'site-dropzone__target--dropping' : isDragActive
|
|
11
|
-
}"
|
|
12
|
-
v-bind="getRootProps()"
|
|
13
|
-
>
|
|
14
|
-
<input v-bind="getInputProps()" />
|
|
15
|
-
<div class="site-dropzone__instructions">
|
|
16
|
-
<strong class="type-normal">
|
|
17
|
-
Drag 'n' drop files here, or click to select
|
|
18
|
-
</strong>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
<p class="site-form__description">
|
|
22
|
-
<em>Only images allowed (.jpg, .png)</em>
|
|
23
|
-
</p>
|
|
24
|
-
<div v-if="fileErrors.length" class="site-dropzone__errors site-form__description site-form__error">
|
|
25
|
-
<ul class="list-unordered">
|
|
26
|
-
<li v-for="(fileErr, index) in fileErrors" :key="index">
|
|
27
|
-
<strong>{{ fileErr.file.name }}</strong>:
|
|
28
|
-
<span>{{ fileErr.errors.map(e => e.message).join() }}</span>
|
|
29
|
-
</li>
|
|
30
|
-
</ul>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="site-dropzone__display margin-top" v-if="files.length">
|
|
33
|
-
<strong>Files</strong>
|
|
34
|
-
<FilesDisplay class="site-dropzone__list" :files="files"/>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
|
|
39
|
-
<script setup>
|
|
40
|
-
import { ref } from "vue";
|
|
41
|
-
import { useDropzone } from "vue3-dropzone";
|
|
42
|
-
|
|
43
|
-
const files = ref([]);
|
|
44
|
-
const fileErrors = ref([]);
|
|
45
|
-
|
|
46
|
-
const $emit = defineEmits(["filesChange"]);
|
|
47
|
-
|
|
48
|
-
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
49
|
-
onDrop: (acceptFiles, rejectReasons) => {
|
|
50
|
-
if (rejectReasons) {
|
|
51
|
-
fileErrors.value = rejectReasons.map(err => err);
|
|
52
|
-
} else {
|
|
53
|
-
fileErrors.value = [];
|
|
54
|
-
}
|
|
55
|
-
if (acceptFiles.length) {
|
|
56
|
-
files.value = acceptFiles.map(file => file);
|
|
57
|
-
$emit("filesChange", files.value);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
accept: [".png", ".jpg", ".jpeg"]
|
|
61
|
-
});
|
|
62
|
-
</script>
|
package/lib/settings.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module settings
|
|
3
|
-
* @description Manages shared configuration for the library.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { reactive } from 'vue';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Default settings
|
|
10
|
-
* @typedef {object} Defaults
|
|
11
|
-
* @property {string} fontAwesomeStatic - Whether the default UluIcon should use fontawesome vue or fontawesome CSS classes (static)
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @type {Defaults}
|
|
16
|
-
*/
|
|
17
|
-
const defaults = {
|
|
18
|
-
/**
|
|
19
|
-
* If set UluIcon will use global css classes instead of Font Awesome vue component
|
|
20
|
-
*/
|
|
21
|
-
fontAwesomeStatic: false,
|
|
22
|
-
/**
|
|
23
|
-
* Use a different icon component (if using a library other than Font Awesome)
|
|
24
|
-
* - Need to have this component map (iconsByType) to it's implementation
|
|
25
|
-
* - All components internally use type, so only user defined components change definitions
|
|
26
|
-
* - So you should only need to create definitions for the default types to replace this for the library
|
|
27
|
-
*/
|
|
28
|
-
iconComponent: null,
|
|
29
|
-
/**
|
|
30
|
-
* Which prop in iconComponent should receive the resolved definition
|
|
31
|
-
*/
|
|
32
|
-
iconPropResolver: (definition) => ({ icon: definition }),
|
|
33
|
-
/**
|
|
34
|
-
* Default icons by type
|
|
35
|
-
*/
|
|
36
|
-
iconsByType: {
|
|
37
|
-
danger: "fas fa-triangle-exclamation",
|
|
38
|
-
warning: "fas fa-circle-exclamation",
|
|
39
|
-
info: "fas fa-circle-info",
|
|
40
|
-
success: "fas fa-circle-check",
|
|
41
|
-
externalLink: "fas fa-arrow-up-right-from-square",
|
|
42
|
-
close: "fas fa-xmark",
|
|
43
|
-
expand: "fas fa-plus",
|
|
44
|
-
collapse: "fas fa-minus",
|
|
45
|
-
resizeHorizontal: "fas fa-grip-lines-vertical",
|
|
46
|
-
resizeVertical: "fas fa-grip-lines",
|
|
47
|
-
resizeBoth: "fas fa-grip",
|
|
48
|
-
ellipsis: "fas fa-ellipsis",
|
|
49
|
-
pathSeparator: "fas fa-chevron-right"
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Current configuration, initialized with defaults and made reactive
|
|
54
|
-
// We wrap `defaults` in `reactive` so `currentSettings` becomes a reactive object.
|
|
55
|
-
let currentSettings = reactive({ ...defaults });
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Retrieves a copy of the default settings.
|
|
59
|
-
* @returns {object} A copy of the default settings object.
|
|
60
|
-
*/
|
|
61
|
-
export function getDefaultSettings() {
|
|
62
|
-
// Return a non-reactive copy of defaults
|
|
63
|
-
return { ...defaults };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Updates multiple configuration settings.
|
|
68
|
-
* @param {object} changes An object containing the settings to update.
|
|
69
|
-
*/
|
|
70
|
-
export function updateSettings(changes) {
|
|
71
|
-
Object.assign(currentSettings, changes);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Retrieves a copy of the current configuration settings.
|
|
76
|
-
* @returns {object} A copy of the current settings object (vue reactive object)
|
|
77
|
-
*/
|
|
78
|
-
export function getSettings() {
|
|
79
|
-
return currentSettings;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Retrieves a specific configuration setting by key.
|
|
84
|
-
* @param {string} key The key of the setting to retrieve.
|
|
85
|
-
* @returns {*} The value of the setting, or undefined if not found.
|
|
86
|
-
*/
|
|
87
|
-
export function getSetting(key) {
|
|
88
|
-
if (!currentSettings.hasOwnProperty(key)) {
|
|
89
|
-
console.warn(`Attempted to access non-existent setting: ${key}`);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
return currentSettings[key];
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Updates a specific configuration setting.
|
|
97
|
-
* @param {string} key The key of the setting to update.
|
|
98
|
-
* @param {*} value The new value for the setting.
|
|
99
|
-
*/
|
|
100
|
-
export function updateSetting(key, value) {
|
|
101
|
-
if (typeof key !== "string") {
|
|
102
|
-
throw new Error("Expected key to be string");
|
|
103
|
-
}
|
|
104
|
-
currentSettings[key] = value;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Retrieves the icon definition by type
|
|
109
|
-
* @param {string} type - The type of icon to retrieve (e.g., 'error', 'info').
|
|
110
|
-
* @returns {string} The icon definition
|
|
111
|
-
* @throws {Error} If the specified icon type is not found
|
|
112
|
-
*/
|
|
113
|
-
export function getIconByType(type) {
|
|
114
|
-
const icons = currentSettings.iconsByType;
|
|
115
|
-
if (!icons[type]) {
|
|
116
|
-
throw new Error(`Icon type "${ type }" not found!`);
|
|
117
|
-
}
|
|
118
|
-
return icons[type];
|
|
119
|
-
}
|