@stsdti/funky-ui-kit 1.4.0 → 1.4.2
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/funky-ui-kit.css +1 -1
- package/dist/funky-ui-kit.es.js +151 -139
- package/dist/funky-ui-kit.es.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
package/dist/funky-ui-kit.es.js
CHANGED
|
@@ -20732,6 +20732,96 @@ __publicField(ResponseUtils, "STATUS_CODES", {
|
|
|
20732
20732
|
STATUS_CODE_UNPROCESSABLE_ENTITY: 422,
|
|
20733
20733
|
STATUS_CODE_SERVER_ERROR: 500
|
|
20734
20734
|
});
|
|
20735
|
+
const isMediaInstance = (file) => !!(file == null ? void 0 : file.id);
|
|
20736
|
+
const isFileInstance = (file) => file instanceof File || file instanceof Blob;
|
|
20737
|
+
const getFilesFromEvent = (event) => {
|
|
20738
|
+
var _a3, _b2;
|
|
20739
|
+
return [...((_a3 = event == null ? void 0 : event.dataTransfer) == null ? void 0 : _a3.files) || ((_b2 = event == null ? void 0 : event.target) == null ? void 0 : _b2.files)];
|
|
20740
|
+
};
|
|
20741
|
+
const normalizeToFileLike = (item) => {
|
|
20742
|
+
var _a3;
|
|
20743
|
+
return isFileInstance(item) ? item : {
|
|
20744
|
+
name: (item == null ? void 0 : item.name) || (item == null ? void 0 : item.filename) || ((_a3 = item == null ? void 0 : item.files) == null ? void 0 : _a3.filename),
|
|
20745
|
+
size: item == null ? void 0 : item.size,
|
|
20746
|
+
lastModified: item == null ? void 0 : item.lastModified
|
|
20747
|
+
};
|
|
20748
|
+
};
|
|
20749
|
+
const fileExists = (item, list = []) => {
|
|
20750
|
+
if (!item) return false;
|
|
20751
|
+
const c2 = normalizeToFileLike(item);
|
|
20752
|
+
return (list || []).some((i2) => {
|
|
20753
|
+
const f = normalizeToFileLike(i2);
|
|
20754
|
+
return (f == null ? void 0 : f.name) === (c2 == null ? void 0 : c2.name) && (f == null ? void 0 : f.size) === (c2 == null ? void 0 : c2.size) && (f == null ? void 0 : f.lastModified) === (c2 == null ? void 0 : c2.lastModified);
|
|
20755
|
+
});
|
|
20756
|
+
};
|
|
20757
|
+
const getFilename = (file) => (file == null ? void 0 : file.name) || (file == null ? void 0 : file.filename) || "Fișier";
|
|
20758
|
+
const getMimeType = (file) => (file == null ? void 0 : file.mime_type) || (file == null ? void 0 : file.type) || "";
|
|
20759
|
+
const getExtension = (file) => {
|
|
20760
|
+
const name = getFilename(file);
|
|
20761
|
+
const parts = String(name).split(".");
|
|
20762
|
+
return parts.length > 1 ? parts.pop().toLowerCase() : "";
|
|
20763
|
+
};
|
|
20764
|
+
const getFileTypeClass = (file) => {
|
|
20765
|
+
const type = getMimeType(file);
|
|
20766
|
+
switch (type) {
|
|
20767
|
+
case mimeType.image:
|
|
20768
|
+
case mimeType.imagePng:
|
|
20769
|
+
case mimeType.imageJpeg:
|
|
20770
|
+
return fileType.image;
|
|
20771
|
+
case mimeType.pdf:
|
|
20772
|
+
return fileType.pdf;
|
|
20773
|
+
default:
|
|
20774
|
+
return fileType.default;
|
|
20775
|
+
}
|
|
20776
|
+
};
|
|
20777
|
+
const getStatus = (file) => isFileInstance(file) ? fileStatus.pending : fileStatus.uploaded;
|
|
20778
|
+
const getResponseContentType = (response) => {
|
|
20779
|
+
if (!(response == null ? void 0 : response.headers)) {
|
|
20780
|
+
return;
|
|
20781
|
+
}
|
|
20782
|
+
return response.headers["content-type"] || response.headers["Content-Type"] || "";
|
|
20783
|
+
};
|
|
20784
|
+
const blobToBase64$1 = (blob) => new Promise((resolve, reject) => {
|
|
20785
|
+
const reader = new FileReader();
|
|
20786
|
+
reader.onloadend = () => resolve(reader.result);
|
|
20787
|
+
reader.onerror = reject;
|
|
20788
|
+
reader.readAsDataURL(blob);
|
|
20789
|
+
});
|
|
20790
|
+
const downloadFileByteArray = ({ data, name, contentType }) => {
|
|
20791
|
+
const blob = new Blob([data], { type: contentType });
|
|
20792
|
+
const link = document.createElement("a");
|
|
20793
|
+
link.href = window.URL.createObjectURL(blob);
|
|
20794
|
+
link.download = name;
|
|
20795
|
+
link.click();
|
|
20796
|
+
window.URL.revokeObjectURL(link.href);
|
|
20797
|
+
};
|
|
20798
|
+
const AppFileNewUtils = {
|
|
20799
|
+
isMediaInstance,
|
|
20800
|
+
isFileInstance,
|
|
20801
|
+
getFilesFromEvent,
|
|
20802
|
+
normalizeToFileLike,
|
|
20803
|
+
fileExists,
|
|
20804
|
+
getFilename,
|
|
20805
|
+
getExtension,
|
|
20806
|
+
getMimeType,
|
|
20807
|
+
getFileTypeClass,
|
|
20808
|
+
getStatus,
|
|
20809
|
+
getResponseContentType,
|
|
20810
|
+
blobToBase64: blobToBase64$1,
|
|
20811
|
+
downloadFileByteArray
|
|
20812
|
+
};
|
|
20813
|
+
class Media {
|
|
20814
|
+
static get type() {
|
|
20815
|
+
return {
|
|
20816
|
+
mediable: "mediable",
|
|
20817
|
+
spatieMediable: "spatie"
|
|
20818
|
+
};
|
|
20819
|
+
}
|
|
20820
|
+
static getTag(media, type = mediaType) {
|
|
20821
|
+
let path = type === this.type.mediable ? "pivot.tag" : "custom_properties.tag";
|
|
20822
|
+
return lodashExports.get(media, path);
|
|
20823
|
+
}
|
|
20824
|
+
}
|
|
20735
20825
|
function bind(fn7, thisArg) {
|
|
20736
20826
|
return function wrap() {
|
|
20737
20827
|
return fn7.apply(thisArg, arguments);
|
|
@@ -23065,26 +23155,26 @@ function createInstance(defaultConfig) {
|
|
|
23065
23155
|
};
|
|
23066
23156
|
return instance;
|
|
23067
23157
|
}
|
|
23068
|
-
const axios = createInstance(defaults);
|
|
23069
|
-
axios.Axios = Axios$1;
|
|
23070
|
-
axios.CanceledError = CanceledError$1;
|
|
23071
|
-
axios.CancelToken = CancelToken$1;
|
|
23072
|
-
axios.isCancel = isCancel$1;
|
|
23073
|
-
axios.VERSION = VERSION$1;
|
|
23074
|
-
axios.toFormData = toFormData$1;
|
|
23075
|
-
axios.AxiosError = AxiosError$1;
|
|
23076
|
-
axios.Cancel = axios.CanceledError;
|
|
23077
|
-
axios.all = function all(promises) {
|
|
23158
|
+
const axios$1 = createInstance(defaults);
|
|
23159
|
+
axios$1.Axios = Axios$1;
|
|
23160
|
+
axios$1.CanceledError = CanceledError$1;
|
|
23161
|
+
axios$1.CancelToken = CancelToken$1;
|
|
23162
|
+
axios$1.isCancel = isCancel$1;
|
|
23163
|
+
axios$1.VERSION = VERSION$1;
|
|
23164
|
+
axios$1.toFormData = toFormData$1;
|
|
23165
|
+
axios$1.AxiosError = AxiosError$1;
|
|
23166
|
+
axios$1.Cancel = axios$1.CanceledError;
|
|
23167
|
+
axios$1.all = function all(promises) {
|
|
23078
23168
|
return Promise.all(promises);
|
|
23079
23169
|
};
|
|
23080
|
-
axios.spread = spread$1;
|
|
23081
|
-
axios.isAxiosError = isAxiosError$1;
|
|
23082
|
-
axios.mergeConfig = mergeConfig$1;
|
|
23083
|
-
axios.AxiosHeaders = AxiosHeaders$1;
|
|
23084
|
-
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
23085
|
-
axios.getAdapter = adapters.getAdapter;
|
|
23086
|
-
axios.HttpStatusCode = HttpStatusCode$1;
|
|
23087
|
-
axios.default = axios;
|
|
23170
|
+
axios$1.spread = spread$1;
|
|
23171
|
+
axios$1.isAxiosError = isAxiosError$1;
|
|
23172
|
+
axios$1.mergeConfig = mergeConfig$1;
|
|
23173
|
+
axios$1.AxiosHeaders = AxiosHeaders$1;
|
|
23174
|
+
axios$1.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
23175
|
+
axios$1.getAdapter = adapters.getAdapter;
|
|
23176
|
+
axios$1.HttpStatusCode = HttpStatusCode$1;
|
|
23177
|
+
axios$1.default = axios$1;
|
|
23088
23178
|
const {
|
|
23089
23179
|
Axios: Axios2,
|
|
23090
23180
|
AxiosError,
|
|
@@ -23102,85 +23192,16 @@ const {
|
|
|
23102
23192
|
formToJSON,
|
|
23103
23193
|
getAdapter,
|
|
23104
23194
|
mergeConfig
|
|
23105
|
-
} = axios;
|
|
23106
|
-
|
|
23107
|
-
const
|
|
23108
|
-
const
|
|
23109
|
-
|
|
23110
|
-
|
|
23111
|
-
|
|
23112
|
-
const
|
|
23113
|
-
|
|
23114
|
-
|
|
23115
|
-
name: (item == null ? void 0 : item.name) || (item == null ? void 0 : item.filename) || ((_a3 = item == null ? void 0 : item.files) == null ? void 0 : _a3.filename),
|
|
23116
|
-
size: item == null ? void 0 : item.size,
|
|
23117
|
-
lastModified: item == null ? void 0 : item.lastModified
|
|
23118
|
-
};
|
|
23119
|
-
};
|
|
23120
|
-
const fileExists = (item, list = []) => {
|
|
23121
|
-
if (!item) return false;
|
|
23122
|
-
const c2 = normalizeToFileLike(item);
|
|
23123
|
-
return (list || []).some((i2) => {
|
|
23124
|
-
const f = normalizeToFileLike(i2);
|
|
23125
|
-
return (f == null ? void 0 : f.name) === (c2 == null ? void 0 : c2.name) && (f == null ? void 0 : f.size) === (c2 == null ? void 0 : c2.size) && (f == null ? void 0 : f.lastModified) === (c2 == null ? void 0 : c2.lastModified);
|
|
23126
|
-
});
|
|
23127
|
-
};
|
|
23128
|
-
const getFilename = (file) => (file == null ? void 0 : file.name) || (file == null ? void 0 : file.filename) || "Fișier";
|
|
23129
|
-
const getMimeType = (file) => (file == null ? void 0 : file.mime_type) || (file == null ? void 0 : file.type) || "";
|
|
23130
|
-
const getExtension = (file) => {
|
|
23131
|
-
const name = getFilename(file);
|
|
23132
|
-
const parts = String(name).split(".");
|
|
23133
|
-
return parts.length > 1 ? parts.pop().toLowerCase() : "";
|
|
23134
|
-
};
|
|
23135
|
-
const getFileTypeClass = (file) => {
|
|
23136
|
-
const type = getMimeType(file);
|
|
23137
|
-
switch (type) {
|
|
23138
|
-
case mimeType.image:
|
|
23139
|
-
case mimeType.imagePng:
|
|
23140
|
-
case mimeType.imageJpeg:
|
|
23141
|
-
return fileType.image;
|
|
23142
|
-
case mimeType.pdf:
|
|
23143
|
-
return fileType.pdf;
|
|
23144
|
-
default:
|
|
23145
|
-
return fileType.default;
|
|
23146
|
-
}
|
|
23147
|
-
};
|
|
23148
|
-
const getStatus = (file) => isFileInstance(file) ? fileStatus.pending : fileStatus.uploaded;
|
|
23149
|
-
const getResponseContentType = (response) => {
|
|
23150
|
-
if (!(response == null ? void 0 : response.headers)) {
|
|
23151
|
-
return;
|
|
23152
|
-
}
|
|
23153
|
-
return response.headers["content-type"] || response.headers["Content-Type"] || "";
|
|
23154
|
-
};
|
|
23155
|
-
const blobToBase64$1 = (blob) => new Promise((resolve, reject) => {
|
|
23156
|
-
const reader = new FileReader();
|
|
23157
|
-
reader.onloadend = () => resolve(reader.result);
|
|
23158
|
-
reader.onerror = reject;
|
|
23159
|
-
reader.readAsDataURL(blob);
|
|
23160
|
-
});
|
|
23161
|
-
const downloadFileByteArray = ({ data, name, contentType }) => {
|
|
23162
|
-
const blob = new Blob([data], { type: contentType });
|
|
23163
|
-
const link = document.createElement("a");
|
|
23164
|
-
link.href = window.URL.createObjectURL(blob);
|
|
23165
|
-
link.download = name;
|
|
23166
|
-
link.click();
|
|
23167
|
-
window.URL.revokeObjectURL(link.href);
|
|
23168
|
-
};
|
|
23169
|
-
const AppFileNewUtils = {
|
|
23170
|
-
isMediaInstance,
|
|
23171
|
-
isFileInstance,
|
|
23172
|
-
getFilesFromEvent,
|
|
23173
|
-
normalizeToFileLike,
|
|
23174
|
-
fileExists,
|
|
23175
|
-
getFilename,
|
|
23176
|
-
getExtension,
|
|
23177
|
-
getMimeType,
|
|
23178
|
-
getFileTypeClass,
|
|
23179
|
-
getStatus,
|
|
23180
|
-
getResponseContentType,
|
|
23181
|
-
blobToBase64: blobToBase64$1,
|
|
23182
|
-
downloadFileByteArray
|
|
23183
|
-
};
|
|
23195
|
+
} = axios$1;
|
|
23196
|
+
let router = null;
|
|
23197
|
+
const getRouter = () => router;
|
|
23198
|
+
const getRoute = () => lodashExports.get(router, "currentRoute.value");
|
|
23199
|
+
const setRouter = (value) => router = value;
|
|
23200
|
+
let axios = null;
|
|
23201
|
+
const getAxios = () => axios ?? axios$1;
|
|
23202
|
+
const setAxios = (value) => axios = value;
|
|
23203
|
+
let mediaType = Media.type.spatieMediable;
|
|
23204
|
+
const setMediaType = (value) => mediaType = value;
|
|
23184
23205
|
const AppFileNewRepository = (props2) => {
|
|
23185
23206
|
const uploadMedia = async (files) => {
|
|
23186
23207
|
const base = getBaseUrlFromProps();
|
|
@@ -23211,7 +23232,7 @@ const AppFileNewRepository = (props2) => {
|
|
|
23211
23232
|
};
|
|
23212
23233
|
const submitFileRequest = async (method, url, data = null, config = {}) => {
|
|
23213
23234
|
try {
|
|
23214
|
-
return await
|
|
23235
|
+
return await getAxios()({ method, url, data, ...config });
|
|
23215
23236
|
} catch (e2) {
|
|
23216
23237
|
return e2 == null ? void 0 : e2.response;
|
|
23217
23238
|
}
|
|
@@ -23281,6 +23302,7 @@ function useFileUpload(modelValue, props2, emit) {
|
|
|
23281
23302
|
}
|
|
23282
23303
|
};
|
|
23283
23304
|
const submitFiles = async (filesList = null) => {
|
|
23305
|
+
var _a3;
|
|
23284
23306
|
const list = filesList ?? modelValue.value;
|
|
23285
23307
|
const files = list.filter((f) => appFileNewUtils.isFileInstance(f));
|
|
23286
23308
|
let shouldReplaceMedia = appFileNewUtils.isMediaInstance(lodashExports.head(localModelValue)) && !props2.isMultiple && files.length === 1;
|
|
@@ -23292,7 +23314,8 @@ function useFileUpload(modelValue, props2, emit) {
|
|
|
23292
23314
|
response = shouldReplaceMedia ? await appFileNewRepository.updateMedia(lodashExports.head(files), lodashExports.head(localModelValue)) : await appFileNewRepository.uploadMedia(files);
|
|
23293
23315
|
}
|
|
23294
23316
|
if (!ResponseUtils.isSuccess(response)) {
|
|
23295
|
-
|
|
23317
|
+
const errorMessage = ((_a3 = response == null ? void 0 : response.data) == null ? void 0 : _a3.message) || (shouldReplaceMedia ? "Fișierul nu a putut fi înlocuit." : "Fișierul nu a putut fi încărcat.");
|
|
23318
|
+
UIUtils.showToastError(errorMessage);
|
|
23296
23319
|
modelValue.value = localModelValue;
|
|
23297
23320
|
isLoading.value = false;
|
|
23298
23321
|
return;
|
|
@@ -29171,24 +29194,6 @@ const urlToBooleanOption = (value) => {
|
|
|
29171
29194
|
}
|
|
29172
29195
|
return null;
|
|
29173
29196
|
};
|
|
29174
|
-
class Media {
|
|
29175
|
-
static get type() {
|
|
29176
|
-
return {
|
|
29177
|
-
mediable: "mediable",
|
|
29178
|
-
spatieMediable: "spatie"
|
|
29179
|
-
};
|
|
29180
|
-
}
|
|
29181
|
-
static getTag(media, type = mediaType) {
|
|
29182
|
-
let path = type === this.type.mediable ? "pivot.tag" : "custom_properties.tag";
|
|
29183
|
-
return lodashExports.get(media, path);
|
|
29184
|
-
}
|
|
29185
|
-
}
|
|
29186
|
-
let router = null;
|
|
29187
|
-
const getRouter = () => router;
|
|
29188
|
-
const getRoute = () => lodashExports.get(router, "currentRoute.value");
|
|
29189
|
-
const setRouter = (value) => router = value;
|
|
29190
|
-
let mediaType = Media.type.spatieMediable;
|
|
29191
|
-
const setMediaType = (value) => mediaType = value;
|
|
29192
29197
|
function useTableFilters(tableFilters, emits) {
|
|
29193
29198
|
const migrateFilterDefinition = (filterDefinition) => {
|
|
29194
29199
|
if ("computed" in filterDefinition) {
|
|
@@ -81489,7 +81494,13 @@ const _sfc_main$7 = {
|
|
|
81489
81494
|
class: "status-icon"
|
|
81490
81495
|
}, null, 8, ["value"]),
|
|
81491
81496
|
createTextVNode(" " + toDisplayString(getFileStatusLabel(file)), 1)
|
|
81492
|
-
], 2)
|
|
81497
|
+
], 2),
|
|
81498
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(_ctx.$slots), (slotName) => {
|
|
81499
|
+
return renderSlot(_ctx.$slots, slotName, {
|
|
81500
|
+
key: slotName,
|
|
81501
|
+
file
|
|
81502
|
+
});
|
|
81503
|
+
}), 128))
|
|
81493
81504
|
])
|
|
81494
81505
|
]),
|
|
81495
81506
|
unref(getStatus2)(file) === unref(fileStatus).uploaded ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
@@ -81710,7 +81721,7 @@ const _sfc_main$5 = {
|
|
|
81710
81721
|
size: 20,
|
|
81711
81722
|
"stroke-width": 2
|
|
81712
81723
|
}),
|
|
81713
|
-
_cache2[2] || (_cache2[2] = createElementVNode("p", { class: "dropzone__title" }, "
|
|
81724
|
+
_cache2[2] || (_cache2[2] = createElementVNode("p", { class: "dropzone__title" }, "Trage aici sau alege fișiere", -1))
|
|
81714
81725
|
]),
|
|
81715
81726
|
createElementVNode("div", _hoisted_5, [
|
|
81716
81727
|
createVNode(_component_app_button, {
|
|
@@ -81758,29 +81769,29 @@ const _sfc_main$5 = {
|
|
|
81758
81769
|
_: 3
|
|
81759
81770
|
}, 8, ["disabled", "onClick"])) : createCommentVNode("", true)
|
|
81760
81771
|
])
|
|
81761
|
-
])
|
|
81772
|
+
]),
|
|
81773
|
+
unref(fileUpload).hasFiles.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
81774
|
+
createVNode(_sfc_main$7, {
|
|
81775
|
+
files: modelValue.value,
|
|
81776
|
+
disabled: _ctx.disabled,
|
|
81777
|
+
onRemoved: unref(fileUpload).removeFile,
|
|
81778
|
+
onPreview,
|
|
81779
|
+
onDownload
|
|
81780
|
+
}, createSlots({ _: 2 }, [
|
|
81781
|
+
renderList(Object.keys(_ctx.$slots), (slot) => {
|
|
81782
|
+
return {
|
|
81783
|
+
name: slot,
|
|
81784
|
+
fn: withCtx((scope) => [
|
|
81785
|
+
renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(scope)))
|
|
81786
|
+
])
|
|
81787
|
+
};
|
|
81788
|
+
})
|
|
81789
|
+
]), 1032, ["files", "disabled", "onRemoved"])
|
|
81790
|
+
], 512)) : createCommentVNode("", true)
|
|
81762
81791
|
], 2)
|
|
81763
81792
|
]),
|
|
81764
81793
|
_: 3
|
|
81765
|
-
}, 8, ["disabled", "onFilesDropped"])
|
|
81766
|
-
unref(fileUpload).hasFiles.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
81767
|
-
createVNode(_sfc_main$7, {
|
|
81768
|
-
files: modelValue.value,
|
|
81769
|
-
disabled: _ctx.disabled,
|
|
81770
|
-
onRemoved: unref(fileUpload).removeFile,
|
|
81771
|
-
onPreview,
|
|
81772
|
-
onDownload
|
|
81773
|
-
}, createSlots({ _: 2 }, [
|
|
81774
|
-
renderList(Object.keys(_ctx.$slots), (slot) => {
|
|
81775
|
-
return {
|
|
81776
|
-
name: slot,
|
|
81777
|
-
fn: withCtx((scope) => [
|
|
81778
|
-
renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(scope)))
|
|
81779
|
-
])
|
|
81780
|
-
};
|
|
81781
|
-
})
|
|
81782
|
-
]), 1032, ["files", "disabled", "onRemoved"])
|
|
81783
|
-
], 512)) : createCommentVNode("", true)
|
|
81794
|
+
}, 8, ["disabled", "onFilesDropped"])
|
|
81784
81795
|
])
|
|
81785
81796
|
]),
|
|
81786
81797
|
_: 3
|
|
@@ -83075,6 +83086,7 @@ const plugin = {
|
|
|
83075
83086
|
Vue.use(ToastPlugin);
|
|
83076
83087
|
Vue.directive("horizontal-scroll", vHorizontalScroll);
|
|
83077
83088
|
setRouter(config == null ? void 0 : config.router);
|
|
83089
|
+
setAxios(config == null ? void 0 : config.axios);
|
|
83078
83090
|
(config == null ? void 0 : config.mediaType) ? setMediaType(config.mediaType) : null;
|
|
83079
83091
|
}
|
|
83080
83092
|
};
|