Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
48
VApp/node_modules/vuetify/lib/components/VDataTable/composables/items.mjs
generated
vendored
Normal file
48
VApp/node_modules/vuetify/lib/components/VDataTable/composables/items.mjs
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Utilities
|
||||
import { computed } from 'vue';
|
||||
import { getPropertyFromItem, propsFactory } from "../../../util/index.mjs"; // Types
|
||||
// Composables
|
||||
export const makeDataTableItemsProps = propsFactory({
|
||||
items: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
itemValue: {
|
||||
type: [String, Array, Function],
|
||||
default: 'id'
|
||||
},
|
||||
itemSelectable: {
|
||||
type: [String, Array, Function],
|
||||
default: null
|
||||
},
|
||||
rowProps: [Object, Function],
|
||||
cellProps: [Object, Function],
|
||||
returnObject: Boolean
|
||||
}, 'DataTable-items');
|
||||
export function transformItem(props, item, index, columns) {
|
||||
const value = props.returnObject ? item : getPropertyFromItem(item, props.itemValue);
|
||||
const selectable = getPropertyFromItem(item, props.itemSelectable, true);
|
||||
const itemColumns = columns.reduce((obj, column) => {
|
||||
if (column.key != null) obj[column.key] = getPropertyFromItem(item, column.value);
|
||||
return obj;
|
||||
}, {});
|
||||
return {
|
||||
type: 'item',
|
||||
key: props.returnObject ? getPropertyFromItem(item, props.itemValue) : value,
|
||||
index,
|
||||
value,
|
||||
selectable,
|
||||
columns: itemColumns,
|
||||
raw: item
|
||||
};
|
||||
}
|
||||
export function transformItems(props, items, columns) {
|
||||
return items.map((item, index) => transformItem(props, item, index, columns));
|
||||
}
|
||||
export function useDataTableItems(props, columns) {
|
||||
const items = computed(() => transformItems(props, props.items, columns.value));
|
||||
return {
|
||||
items
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=items.mjs.map
|
||||
Reference in New Issue
Block a user