@stsdti/funky-ui-kit 1.4.8 → 1.4.9
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 +30 -25
- package/dist/funky-ui-kit.es.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +6 -6
package/dist/funky-ui-kit.es.js
CHANGED
|
@@ -20314,6 +20314,12 @@ function hasValue(value) {
|
|
|
20314
20314
|
}
|
|
20315
20315
|
return value || value === false || value === 0;
|
|
20316
20316
|
}
|
|
20317
|
+
const resolveValue = async (value) => {
|
|
20318
|
+
let result = value;
|
|
20319
|
+
result = result instanceof Function ? result() : result;
|
|
20320
|
+
result = result instanceof Promise ? await result : result;
|
|
20321
|
+
return result;
|
|
20322
|
+
};
|
|
20317
20323
|
function joinList(list, path, separator = ",") {
|
|
20318
20324
|
let localList = list || [];
|
|
20319
20325
|
if (!lodashExports.isArray(localList)) {
|
|
@@ -20832,6 +20838,9 @@ class Media {
|
|
|
20832
20838
|
let path = type === this.type.mediable ? "pivot.tag" : "custom_properties.tag";
|
|
20833
20839
|
return lodashExports.get(media, path);
|
|
20834
20840
|
}
|
|
20841
|
+
static getCollection(media) {
|
|
20842
|
+
return lodashExports.get(media, "collection_name");
|
|
20843
|
+
}
|
|
20835
20844
|
}
|
|
20836
20845
|
function bind(fn7, thisArg) {
|
|
20837
20846
|
return function wrap() {
|
|
@@ -23217,7 +23226,7 @@ const AppFileNewRepository = (props2) => {
|
|
|
23217
23226
|
const uploadMedia = async (files) => {
|
|
23218
23227
|
const base = getBaseUrlFromProps();
|
|
23219
23228
|
const url = `${base}/media`;
|
|
23220
|
-
const formData = buildUploadFormData(files);
|
|
23229
|
+
const formData = await buildUploadFormData(files);
|
|
23221
23230
|
return await submitFileRequest("post", url, formData);
|
|
23222
23231
|
};
|
|
23223
23232
|
const deleteMedia = async (media) => {
|
|
@@ -23228,7 +23237,7 @@ const AppFileNewRepository = (props2) => {
|
|
|
23228
23237
|
const updateMedia = async (file, media) => {
|
|
23229
23238
|
const base = getBaseUrlFromProps();
|
|
23230
23239
|
const url = `${base}/media/${media.id}`;
|
|
23231
|
-
const formData = buildUploadFormData([file]);
|
|
23240
|
+
const formData = await buildUploadFormData([file]);
|
|
23232
23241
|
return await submitFileRequest("post", url, formData);
|
|
23233
23242
|
};
|
|
23234
23243
|
const getMedia = async (media) => {
|
|
@@ -23248,11 +23257,16 @@ const AppFileNewRepository = (props2) => {
|
|
|
23248
23257
|
return e2 == null ? void 0 : e2.response;
|
|
23249
23258
|
}
|
|
23250
23259
|
};
|
|
23251
|
-
const buildUploadFormData = (filesList) => {
|
|
23260
|
+
const buildUploadFormData = async (filesList) => {
|
|
23252
23261
|
const formData = new FormData();
|
|
23253
|
-
const { itemId
|
|
23262
|
+
const { itemId } = props2;
|
|
23254
23263
|
if (itemId) formData.append("resourceId", itemId);
|
|
23255
|
-
|
|
23264
|
+
const extra = await resolveValue(props2.getExtra);
|
|
23265
|
+
Object.entries(extra).forEach(([key, value]) => {
|
|
23266
|
+
if (value != null) {
|
|
23267
|
+
formData.append(key, value);
|
|
23268
|
+
}
|
|
23269
|
+
});
|
|
23256
23270
|
const files = filesList.filter((f) => AppFileNewUtils.isFileInstance(f));
|
|
23257
23271
|
for (const file of files) {
|
|
23258
23272
|
formData.append("upload[]", file, file.name);
|
|
@@ -23290,7 +23304,6 @@ function useFileUpload(modelValue, props2, emit) {
|
|
|
23290
23304
|
if (appFileNewUtils.fileExists(file)) {
|
|
23291
23305
|
continue;
|
|
23292
23306
|
}
|
|
23293
|
-
file.tag = props2.tag;
|
|
23294
23307
|
newFiles.push(file);
|
|
23295
23308
|
}
|
|
23296
23309
|
newFiles = props2.isMultiple ? newFiles : [lodashExports.last(newFiles)];
|
|
@@ -81658,8 +81671,9 @@ const _sfc_main$5 = {
|
|
|
81658
81671
|
isMultiple: { type: Boolean, default: false },
|
|
81659
81672
|
autoUpload: { type: Boolean, default: true },
|
|
81660
81673
|
model: { type: Object, default: null },
|
|
81661
|
-
tag: { type: String, default: "" },
|
|
81662
81674
|
itemId: { Number },
|
|
81675
|
+
// Extra prop for things like tag, collection
|
|
81676
|
+
getExtra: { type: [Object, Function], default: () => ({}) },
|
|
81663
81677
|
customUpload: { type: Function },
|
|
81664
81678
|
customDelete: { type: Function },
|
|
81665
81679
|
...appFormElementProps
|
|
@@ -82046,16 +82060,10 @@ function useForm(config, emits) {
|
|
|
82046
82060
|
const setPayload = (value) => {
|
|
82047
82061
|
payload.value = value;
|
|
82048
82062
|
};
|
|
82049
|
-
const getItemEmptyValue = async () => {
|
|
82050
|
-
let result = itemEmpty;
|
|
82051
|
-
result = result instanceof Function ? result() : result;
|
|
82052
|
-
result = result instanceof Promise ? await result : result;
|
|
82053
|
-
return result;
|
|
82054
|
-
};
|
|
82055
82063
|
async function initItem({ id = null, value = null, external: external2 = null, payload: payload2 = null } = {}) {
|
|
82056
82064
|
external2 ? setExternal(external2) : null;
|
|
82057
82065
|
payload2 ? setPayload(payload2) : null;
|
|
82058
|
-
let itemValue = value ? lodashExports.cloneDeep(value) : lodashExports.cloneDeep(await
|
|
82066
|
+
let itemValue = value ? lodashExports.cloneDeep(value) : lodashExports.cloneDeep(await resolveValue(itemEmpty));
|
|
82059
82067
|
setItem(itemValue);
|
|
82060
82068
|
id ? await fetchItem(id) : null;
|
|
82061
82069
|
announce(useFormEvent.inited, externalContext);
|
|
@@ -82197,22 +82205,18 @@ function useForm(config, emits) {
|
|
|
82197
82205
|
return result;
|
|
82198
82206
|
}, {});
|
|
82199
82207
|
};
|
|
82200
|
-
const getBindingMedia = (fieldPath, tag = null,
|
|
82208
|
+
const getBindingMedia = (fieldPath, { tag = null, collection = null, validationPath = null } = {}) => {
|
|
82209
|
+
const isRelevant = (m3) => {
|
|
82210
|
+
return (!tag || Media.getTag(m3) === tag) && (!collection || Media.getCollection(m3) === collection);
|
|
82211
|
+
};
|
|
82201
82212
|
let field = computed({
|
|
82202
82213
|
get() {
|
|
82203
82214
|
const list = lodashExports.get(item.value, fieldPath, []);
|
|
82204
|
-
return list.filter(
|
|
82205
|
-
if (!(m3 == null ? void 0 : m3.id)) return (m3 == null ? void 0 : m3.tag) === tag;
|
|
82206
|
-
return !tag || tag === Media.getTag(m3);
|
|
82207
|
-
});
|
|
82215
|
+
return list.filter(isRelevant);
|
|
82208
82216
|
},
|
|
82209
82217
|
set(value) {
|
|
82210
82218
|
const list = lodashExports.get(item.value, fieldPath, []);
|
|
82211
|
-
|
|
82212
|
-
if (!(m3 == null ? void 0 : m3.id)) return (m3 == null ? void 0 : m3.tag) !== tag;
|
|
82213
|
-
return tag && tag !== Media.getTag(m3);
|
|
82214
|
-
});
|
|
82215
|
-
lodashExports.set(item.value, fieldPath, [...otherMedia, ...value]);
|
|
82219
|
+
lodashExports.set(item.value, fieldPath, [...list.filter((m3) => !isRelevant(m3)), ...value]);
|
|
82216
82220
|
}
|
|
82217
82221
|
});
|
|
82218
82222
|
const isDisabled = getPayloadIsDisabled(fieldPath);
|
|
@@ -82227,7 +82231,7 @@ function useForm(config, emits) {
|
|
|
82227
82231
|
[`onUpdate:modelValue`]: (value) => {
|
|
82228
82232
|
field.value = value;
|
|
82229
82233
|
},
|
|
82230
|
-
tag,
|
|
82234
|
+
getExtra: { tag, collection },
|
|
82231
82235
|
itemId: itemId.value,
|
|
82232
82236
|
...isDisabled ? { disabled: true } : {},
|
|
82233
82237
|
...isHidden ? { hidden: true } : {},
|
|
@@ -83143,6 +83147,7 @@ export {
|
|
|
83143
83147
|
joinList,
|
|
83144
83148
|
makeArray,
|
|
83145
83149
|
mergeObjectWithoutOverwrite,
|
|
83150
|
+
resolveValue,
|
|
83146
83151
|
useAppSelectCore as sharedProps,
|
|
83147
83152
|
sleep,
|
|
83148
83153
|
toPathString,
|