@mythpe/quasar-ui-qui 0.4.72 → 0.4.74
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/package.json
CHANGED
|
@@ -110,6 +110,7 @@ type Props = {
|
|
|
110
110
|
wrapCells?: MDatatableProps['wrapCells'];
|
|
111
111
|
tooSmall?: MDatatableProps['tooSmall'];
|
|
112
112
|
color?: MDatatableProps['color'];
|
|
113
|
+
transformer?: MDatatableProps['transformer'];
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -195,7 +196,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
195
196
|
noExampleBtn: undefined,
|
|
196
197
|
wrapCells: undefined,
|
|
197
198
|
tooSmall: undefined,
|
|
198
|
-
color: 'primary'
|
|
199
|
+
color: 'primary',
|
|
200
|
+
transformer: undefined
|
|
199
201
|
})
|
|
200
202
|
|
|
201
203
|
interface Emits {
|
|
@@ -401,9 +403,12 @@ const onSuccess: SubmissionHandler = async (form) => {
|
|
|
401
403
|
requestWith: getRequestWith(isUpdateMode.value ? 'withUpdate' : 'withStore') || undefined
|
|
402
404
|
}
|
|
403
405
|
}
|
|
404
|
-
|
|
405
|
-
form
|
|
406
|
-
|
|
406
|
+
if (props.transformer) {
|
|
407
|
+
form = props.transformer(form)
|
|
408
|
+
}
|
|
409
|
+
const method = async () => isUpdateMode.value
|
|
410
|
+
? await apiServices.update(dialogItem.value?.id || '', form, _conf)
|
|
411
|
+
: await apiServices.store(form, _conf)
|
|
407
412
|
try {
|
|
408
413
|
const response: ApiInterface = await method()
|
|
409
414
|
const { _message, _success, _data } = response
|
|
@@ -519,7 +524,6 @@ const showIfContext = (contextBtn: GenericMDtBtn): boolean => {
|
|
|
519
524
|
if (!contextBtn.multiClick) {
|
|
520
525
|
return !1
|
|
521
526
|
}
|
|
522
|
-
// console.log(typeof contextBtn.showIf, contextBtn.name)
|
|
523
527
|
for (let idx = 0; idx < selected.value.length; idx++) {
|
|
524
528
|
const item = toValue(selected.value[idx])
|
|
525
529
|
const per = typeof contextBtn.showIf === 'function' ? contextBtn.showIf(item, idx) : contextBtn.showIf === !0
|
|
@@ -1203,59 +1207,26 @@ defineExpose({
|
|
|
1203
1207
|
<MRow
|
|
1204
1208
|
gutter="sm"
|
|
1205
1209
|
>
|
|
1206
|
-
<!--<MDtBtn-->
|
|
1207
|
-
<!-- v-if="hasUpdateBtn && isSingleSelectedItem"-->
|
|
1208
|
-
<!-- key="update-dt-selection-btn"-->
|
|
1209
|
-
<!-- :disable="loading"-->
|
|
1210
|
-
<!-- icon="ion-ios-create"-->
|
|
1211
|
-
<!-- update-->
|
|
1212
|
-
<!-- v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn as any}"-->
|
|
1213
|
-
<!-- @click="openUpdateDialogNoIndex(selected[0] as any)"-->
|
|
1214
|
-
<!--/>-->
|
|
1215
|
-
<!--<MDtBtn-->
|
|
1216
|
-
<!-- v-if="hasCloneBtn && isSingleSelectedItem"-->
|
|
1217
|
-
<!-- key="clone-dt-selection-btn"-->
|
|
1218
|
-
<!-- :disable="loading"-->
|
|
1219
|
-
<!-- clone-->
|
|
1220
|
-
<!-- tooltip="labels.clone"-->
|
|
1221
|
-
<!-- v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn as any}"-->
|
|
1222
|
-
<!-- @click="onCloneItem(selected[0] as any)"-->
|
|
1223
|
-
<!--/>-->
|
|
1224
|
-
<!--<MDtBtn-->
|
|
1225
|
-
<!-- v-if="hasShowBtn && isSingleSelectedItem"-->
|
|
1226
|
-
<!-- key="show-dt-selection-btn"-->
|
|
1227
|
-
<!-- :disable="loading"-->
|
|
1228
|
-
<!-- icon="ion-ios-eye"-->
|
|
1229
|
-
<!-- show-->
|
|
1230
|
-
<!-- v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn as any}"-->
|
|
1231
|
-
<!-- @click="openShowDialogNoIndex(selected[0] as any)"-->
|
|
1232
|
-
<!--/>-->
|
|
1233
|
-
<!--<MDtBtn-->
|
|
1234
|
-
<!-- v-if="selected.length > 1 ? (hasDestroyBtn && multiDestroy) : hasDestroyBtn"-->
|
|
1235
|
-
<!-- key="destroy-dt-selection-btn"-->
|
|
1236
|
-
<!-- :disable="!hasSelectedItem || loading"-->
|
|
1237
|
-
<!-- color="negative"-->
|
|
1238
|
-
<!-- destroy-->
|
|
1239
|
-
<!-- icon="ion-ios-trash"-->
|
|
1240
|
-
<!-- v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn as any}"-->
|
|
1241
|
-
<!-- @click="deleteSelectionItem()"-->
|
|
1242
|
-
<!--/>-->
|
|
1243
1210
|
<template
|
|
1244
1211
|
v-for="(contextBtn,i) in contextmenuItems as GenericMDtBtn[]"
|
|
1245
1212
|
:key="`top-s-${i}`"
|
|
1246
1213
|
>
|
|
1247
1214
|
<MDtBtn
|
|
1248
1215
|
v-if="showIfContext(contextBtn)"
|
|
1249
|
-
:tooltip="contextBtn.tooltip ? __(contextBtn.tooltip) : (
|
|
1250
|
-
contextBtn.label ? ( te(`labels.${contextBtn.label}`) ? __(`labels.${contextBtn.label}`) : __(contextBtn.label) ) : undefined
|
|
1251
|
-
)"
|
|
1252
1216
|
v-bind="{
|
|
1253
1217
|
...defaultTopBtnProps,
|
|
1254
1218
|
...pluginOptions.dt?.topSelection?.btn as any,
|
|
1255
1219
|
...contextBtn as any,
|
|
1256
1220
|
...contextBtn.attr as any,
|
|
1257
|
-
to: typeof contextBtn.attr?.to === 'function' ? contextBtn.attr.to(selected[0],0) : contextBtn.attr?.to,
|
|
1221
|
+
to: typeof contextBtn.attr?.to === 'function' ? ( selected.length === 1 ? contextBtn.attr.to(selected[0],0) : undefined ) : contextBtn.attr?.to,
|
|
1258
1222
|
[contextBtn.name]: true,
|
|
1223
|
+
tooltip: contextBtn.tooltip ? (typeof contextBtn.tooltip === 'function' ? ( selected.length === 1 ? contextBtn.tooltip(selected[0],0) : undefined ) : (
|
|
1224
|
+
( te(`labels.${contextBtn.tooltip}`) ? __(`labels.${contextBtn.tooltip}`) : (
|
|
1225
|
+
te(contextBtn.tooltip) ? __(contextBtn.tooltip) : undefined
|
|
1226
|
+
) )
|
|
1227
|
+
) ) : (
|
|
1228
|
+
contextBtn.label ? ( te(`labels.${contextBtn.label}`) ? __(`labels.${contextBtn.label}`) : __(contextBtn.label) ) : undefined
|
|
1229
|
+
)
|
|
1259
1230
|
}"
|
|
1260
1231
|
@click="contextBtn.attr?.to ? undefined : onClickTopMenu(contextBtn)"
|
|
1261
1232
|
/>
|
|
@@ -1399,7 +1370,7 @@ defineExpose({
|
|
|
1399
1370
|
<q-td :props="noBodyProps">
|
|
1400
1371
|
<!--Control-->
|
|
1401
1372
|
<q-btn-dropdown
|
|
1402
|
-
v-if="activeContextItems.length > contextItemsLength && !1"
|
|
1373
|
+
v-if="contextItemsLength && activeContextItems.length > contextItemsLength && !1"
|
|
1403
1374
|
v-close-popup
|
|
1404
1375
|
:menu-offset="[0,10]"
|
|
1405
1376
|
color="primary"
|
|
@@ -381,6 +381,10 @@ export type MDatatableProps<I extends GenericFormValues = GenericFormValues> = O
|
|
|
381
381
|
* too small a screen size in px.
|
|
382
382
|
*/
|
|
383
383
|
tooSmall?: number;
|
|
384
|
+
/**
|
|
385
|
+
* transformer for form data
|
|
386
|
+
*/
|
|
387
|
+
transformer?: (formData: any) => any;
|
|
384
388
|
}
|
|
385
389
|
|
|
386
390
|
export interface MDtAvatarProps extends QAvatarProps {
|