@stsdti/funky-ui-kit 1.4.0 → 1.4.1
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.es.js +120 -116
- 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
|
}
|
|
@@ -29171,24 +29192,6 @@ const urlToBooleanOption = (value) => {
|
|
|
29171
29192
|
}
|
|
29172
29193
|
return null;
|
|
29173
29194
|
};
|
|
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
29195
|
function useTableFilters(tableFilters, emits) {
|
|
29193
29196
|
const migrateFilterDefinition = (filterDefinition) => {
|
|
29194
29197
|
if ("computed" in filterDefinition) {
|
|
@@ -83075,6 +83078,7 @@ const plugin = {
|
|
|
83075
83078
|
Vue.use(ToastPlugin);
|
|
83076
83079
|
Vue.directive("horizontal-scroll", vHorizontalScroll);
|
|
83077
83080
|
setRouter(config == null ? void 0 : config.router);
|
|
83081
|
+
setAxios(config == null ? void 0 : config.axios);
|
|
83078
83082
|
(config == null ? void 0 : config.mediaType) ? setMediaType(config.mediaType) : null;
|
|
83079
83083
|
}
|
|
83080
83084
|
};
|