adminforth 1.3.31 → 1.3.32
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/modules/restApi.js
CHANGED
|
@@ -263,6 +263,9 @@ export default class AdminForthRestAPI {
|
|
|
263
263
|
allowedBulkActions.push(action);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
+
else {
|
|
267
|
+
allowedBulkActions.push(action);
|
|
268
|
+
}
|
|
266
269
|
})));
|
|
267
270
|
// exclude "plugins" key
|
|
268
271
|
return {
|
|
@@ -369,9 +372,10 @@ export default class AdminForthRestAPI {
|
|
|
369
372
|
delete item[key];
|
|
370
373
|
}
|
|
371
374
|
});
|
|
372
|
-
});
|
|
373
|
-
data.data.forEach((item) => {
|
|
374
375
|
item._label = resource.recordLabel(item);
|
|
376
|
+
if (resource.options.listTableClickUrl) {
|
|
377
|
+
item._clickUrl = resource.options.listTableClickUrl(item, adminUser);
|
|
378
|
+
}
|
|
375
379
|
});
|
|
376
380
|
// only after adminforth made all post processing, give user ability to edit it
|
|
377
381
|
for (const hook of listify((_v = (_u = resource.hooks) === null || _u === void 0 ? void 0 : _u[source]) === null || _v === void 0 ? void 0 : _v.afterDatasourceResponse)) {
|
package/modules/restApi.ts
CHANGED
|
@@ -306,6 +306,8 @@ export default class AdminForthRestAPI {
|
|
|
306
306
|
if (res) {
|
|
307
307
|
allowedBulkActions.push(action);
|
|
308
308
|
}
|
|
309
|
+
} else {
|
|
310
|
+
allowedBulkActions.push(action);
|
|
309
311
|
}
|
|
310
312
|
})
|
|
311
313
|
);
|
|
@@ -435,10 +437,12 @@ export default class AdminForthRestAPI {
|
|
|
435
437
|
delete item[key];
|
|
436
438
|
}
|
|
437
439
|
})
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
data.data.forEach((item) => {
|
|
440
|
+
|
|
441
441
|
item._label = resource.recordLabel(item);
|
|
442
|
+
|
|
443
|
+
if (resource.options.listTableClickUrl) {
|
|
444
|
+
item._clickUrl = resource.options.listTableClickUrl(item, adminUser);
|
|
445
|
+
}
|
|
442
446
|
});
|
|
443
447
|
|
|
444
448
|
// only after adminforth made all post processing, give user ability to edit it
|
package/package.json
CHANGED
|
@@ -147,10 +147,10 @@ const toogleItem = (item) => {
|
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
const list = selectedItems.value.map(item => item.value);
|
|
150
|
-
const updValue = list.length ? list :
|
|
150
|
+
const updValue = list.length ? list : null;
|
|
151
151
|
let emitValue;
|
|
152
152
|
if (props.single) {
|
|
153
|
-
emitValue = updValue ? updValue[0] :
|
|
153
|
+
emitValue = updValue ? updValue[0] : null;
|
|
154
154
|
} else {
|
|
155
155
|
emitValue = updValue;
|
|
156
156
|
}
|
|
@@ -76,8 +76,9 @@
|
|
|
76
76
|
</td>
|
|
77
77
|
</tr>
|
|
78
78
|
|
|
79
|
-
<tr @click="onClick($event,row)"
|
|
80
|
-
|
|
79
|
+
<tr @click="onClick($event,row)"
|
|
80
|
+
v-else v-for="(row, rowI) in rows" :key="`row_${row._primaryKeyValue}`"
|
|
81
|
+
class="bg-lightListTable dark:bg-darkListTable border-lightListBorder dark:border-gray-700 hover:bg-lightListTableRowHover dark:hover:bg-darkListTableRowHover cursor-pointer"
|
|
81
82
|
:class="{'border-b': rowI !== rows.length - 1}"
|
|
82
83
|
>
|
|
83
84
|
<td class="w-4 p-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
@@ -105,64 +106,73 @@
|
|
|
105
106
|
</td>
|
|
106
107
|
<td class=" items-center px-6 py-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
107
108
|
<div class="flex">
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
109
|
+
<RouterLink
|
|
110
|
+
v-if="resource.options?.allowedActions.show"
|
|
111
|
+
:to="{
|
|
112
|
+
name: 'resource-show',
|
|
113
|
+
params: {
|
|
114
|
+
resourceId: resource.resourceId,
|
|
115
|
+
primaryKey: row._primaryKeyValue,
|
|
116
|
+
}
|
|
117
|
+
}"
|
|
118
|
+
class="font-medium text-lightPrimary dark:text-darkPrimary hover:underline"
|
|
119
|
+
:data-tooltip-target="`tooltip-show-${rowI}`"
|
|
120
|
+
>
|
|
121
|
+
<IconEyeSolid class="w-5 h-5 me-2"/>
|
|
122
|
+
</RouterLink>
|
|
123
|
+
|
|
124
|
+
<div :id="`tooltip-show-${rowI}`"
|
|
125
|
+
role="tooltip"
|
|
126
|
+
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
127
|
+
Show item
|
|
128
|
+
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<RouterLink v-if="resource.options?.allowedActions.edit"
|
|
132
|
+
:to="{
|
|
133
|
+
name: 'resource-edit',
|
|
134
|
+
params: {
|
|
135
|
+
resourceId: resource.resourceId,
|
|
136
|
+
primaryKey: row._primaryKeyValue
|
|
137
|
+
}
|
|
138
|
+
}"
|
|
139
|
+
class="font-medium text-lightPrimary dark:text-darkPrimary hover:underline ms-3"
|
|
140
|
+
:data-tooltip-target="`tooltip-edit-${rowI}`"
|
|
141
|
+
>
|
|
142
|
+
<IconPenSolid class="w-5 h-5 me-2"/>
|
|
143
|
+
</RouterLink>
|
|
144
|
+
|
|
145
|
+
<div :id="`tooltip-edit-${rowI}`"
|
|
146
|
+
role="tooltip"
|
|
147
|
+
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
148
|
+
Edit
|
|
149
|
+
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<button v-if="resource.options?.allowedActions.delete"
|
|
153
|
+
class="font-medium text-lightPrimary dark:text-darkPrimary hover:underline ms-3"
|
|
154
|
+
:data-tooltip-target="`tooltip-delete-${rowI}`"
|
|
155
|
+
@click="deleteRecord(row)"
|
|
156
|
+
>
|
|
157
|
+
<IconTrashBinSolid class="w-5 h-5 me-2"/>
|
|
158
|
+
</button>
|
|
159
|
+
|
|
160
|
+
<div :id="`tooltip-delete-${rowI}`"
|
|
161
|
+
role="tooltip"
|
|
162
|
+
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
163
|
+
Delete
|
|
164
|
+
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<component
|
|
168
|
+
v-if="coreStore.resourceOptions?.pageInjections?.edit?.customActionIcons"
|
|
169
|
+
:is="getCustomComponent(coreStore.resourceOptions?.pageInjections?.edit?.customActionIcons)"
|
|
170
|
+
:meta="coreStore.resourceOptions?.pageInjections?.edit?.customActionIcons.meta"
|
|
171
|
+
:resource="coreStore.resource"
|
|
172
|
+
:adminUser="coreStore.adminUser"
|
|
173
|
+
:record="row"
|
|
174
|
+
/>
|
|
128
175
|
</div>
|
|
129
|
-
|
|
130
|
-
<RouterLink v-if="resource.options?.allowedActions.edit"
|
|
131
|
-
:to="{
|
|
132
|
-
name: 'resource-edit',
|
|
133
|
-
params: {
|
|
134
|
-
resourceId: resource.resourceId,
|
|
135
|
-
primaryKey: row._primaryKeyValue
|
|
136
|
-
}
|
|
137
|
-
}"
|
|
138
|
-
class="font-medium text-lightPrimary dark:text-darkPrimary hover:underline ms-3"
|
|
139
|
-
:data-tooltip-target="`tooltip-edit-${rowI}`"
|
|
140
|
-
>
|
|
141
|
-
<IconPenSolid class="w-5 h-5 me-2"/>
|
|
142
|
-
</RouterLink>
|
|
143
|
-
|
|
144
|
-
<div :id="`tooltip-edit-${rowI}`"
|
|
145
|
-
role="tooltip"
|
|
146
|
-
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
147
|
-
Edit
|
|
148
|
-
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
149
|
-
</div>
|
|
150
|
-
|
|
151
|
-
<button v-if="resource.options?.allowedActions.delete"
|
|
152
|
-
class="font-medium text-lightPrimary dark:text-darkPrimary hover:underline ms-3"
|
|
153
|
-
:data-tooltip-target="`tooltip-delete-${rowI}`"
|
|
154
|
-
@click="deleteRecord(row)"
|
|
155
|
-
>
|
|
156
|
-
<IconTrashBinSolid class="w-5 h-5 me-2"/>
|
|
157
|
-
</button>
|
|
158
|
-
|
|
159
|
-
<div :id="`tooltip-delete-${rowI}`"
|
|
160
|
-
role="tooltip"
|
|
161
|
-
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
162
|
-
Delete
|
|
163
|
-
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
176
|
</td>
|
|
167
177
|
</tr>
|
|
168
178
|
</tbody>
|
|
@@ -360,18 +370,45 @@ function onSortButtonClick(event, field) {
|
|
|
360
370
|
|
|
361
371
|
|
|
362
372
|
const clickTarget = ref(null);
|
|
373
|
+
|
|
363
374
|
async function onClick(e,row) {
|
|
364
375
|
if(clickTarget.value === e.target) return;
|
|
365
376
|
clickTarget.value = e.target;
|
|
366
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
377
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
367
378
|
if (window.getSelection().toString()) return;
|
|
368
|
-
else {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
379
|
+
else {
|
|
380
|
+
if (e.ctrlKey || e.metaKey) {
|
|
381
|
+
if (row._clickUrl) {
|
|
382
|
+
window.open(row._clickUrl, '_blank');
|
|
383
|
+
} else {
|
|
384
|
+
router.push(
|
|
385
|
+
router.resolve({
|
|
386
|
+
name: 'resource-show',
|
|
387
|
+
params: {
|
|
388
|
+
resourceId: props.resource.resourceId,
|
|
389
|
+
primaryKey: row._primaryKeyValue,
|
|
390
|
+
},
|
|
391
|
+
})
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
if (row._clickUrl) {
|
|
396
|
+
if (row._clickUrl.startsWith('http')) {
|
|
397
|
+
document.location.href = row._clickUrl;
|
|
398
|
+
} else {
|
|
399
|
+
router.push(row._clickUrl);
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
router.push({
|
|
403
|
+
name: 'resource-show',
|
|
404
|
+
params: {
|
|
405
|
+
resourceId: props.resource.resourceId,
|
|
406
|
+
primaryKey: row._primaryKeyValue,
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
375
412
|
}
|
|
376
413
|
|
|
377
414
|
async function deleteRecord(row) {
|
|
@@ -138,7 +138,6 @@ async function saveRecord() {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
saving.value = true;
|
|
141
|
-
|
|
142
141
|
const updates = {};
|
|
143
142
|
for (const key in record.value) {
|
|
144
143
|
if (record.value[key] !== coreStore.record[key]) {
|
|
@@ -162,7 +161,6 @@ async function saveRecord() {
|
|
|
162
161
|
message: 'Record updated successfully',
|
|
163
162
|
variant: 'success',
|
|
164
163
|
timeout: 400000
|
|
165
|
-
|
|
166
164
|
});
|
|
167
165
|
}
|
|
168
166
|
saving.value = false;
|
|
@@ -1027,6 +1027,8 @@ export type AdminForthResource = {
|
|
|
1027
1027
|
*/
|
|
1028
1028
|
listPageSize?: number,
|
|
1029
1029
|
|
|
1030
|
+
listTableClickUrl?: (record: any, adminUser: AdminUser) => string,
|
|
1031
|
+
|
|
1030
1032
|
/**
|
|
1031
1033
|
* Custom components which can be injected into AdminForth CRUD pages.
|
|
1032
1034
|
* Each injection is a path to a custom component which will be displayed in the admin panel.
|
|
@@ -1055,6 +1057,7 @@ export type AdminForthResource = {
|
|
|
1055
1057
|
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1056
1058
|
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1057
1059
|
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1060
|
+
customActionIcons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1058
1061
|
},
|
|
1059
1062
|
|
|
1060
1063
|
/**
|
|
@@ -1066,6 +1069,7 @@ export type AdminForthResource = {
|
|
|
1066
1069
|
beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1067
1070
|
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1068
1071
|
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1072
|
+
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1069
1073
|
},
|
|
1070
1074
|
|
|
1071
1075
|
/**
|
|
@@ -1077,6 +1081,7 @@ export type AdminForthResource = {
|
|
|
1077
1081
|
beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1078
1082
|
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1079
1083
|
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1084
|
+
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1080
1085
|
},
|
|
1081
1086
|
|
|
1082
1087
|
/**
|
|
@@ -1088,6 +1093,7 @@ export type AdminForthResource = {
|
|
|
1088
1093
|
beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1089
1094
|
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1090
1095
|
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1096
|
+
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
1091
1097
|
},
|
|
1092
1098
|
}
|
|
1093
1099
|
},
|