|
|
@ -16,7 +16,17 @@ |
|
|
|
:label="dense ? '' : btn.data[0].label" |
|
|
|
:icon="dense ? undefined : btn.data[0].icon" |
|
|
|
:split="btn.data[0].click ? true : false" |
|
|
|
:disable="btn.data[0].enableIf ? !btn.data[0].enableIf(selectedComputed, tickedComputed, grid) : false" |
|
|
|
:disable=" |
|
|
|
btn.data[0].enableIf |
|
|
|
? !btn.data[0].enableIf({ |
|
|
|
firstSelected: firstSelectedComputed, |
|
|
|
selected: selectedComputed, |
|
|
|
firstTicked: firstTickedComputed, |
|
|
|
ticked: tickedComputed, |
|
|
|
grid: grid, |
|
|
|
}) |
|
|
|
: false |
|
|
|
" |
|
|
|
class="class-action-item" |
|
|
|
@click="buttonClick(btn.data[0])" |
|
|
|
> |
|
|
@ -43,7 +53,17 @@ |
|
|
|
v-close-popup |
|
|
|
clickable |
|
|
|
:dense="dense" |
|
|
|
:disable="childrenBtn.enableIf ? !childrenBtn.enableIf(selectedComputed, tickedComputed, grid) : false" |
|
|
|
:disable=" |
|
|
|
childrenBtn.enableIf |
|
|
|
? !childrenBtn.enableIf({ |
|
|
|
firstSelected: firstSelectedComputed, |
|
|
|
selected: selectedComputed, |
|
|
|
firstTicked: firstTickedComputed, |
|
|
|
ticked: tickedComputed, |
|
|
|
grid: grid, |
|
|
|
}) |
|
|
|
: false |
|
|
|
" |
|
|
|
@click="buttonClick(childrenBtn)" |
|
|
|
> |
|
|
|
<q-item-section> |
|
|
@ -57,7 +77,17 @@ |
|
|
|
<q-btn |
|
|
|
v-else |
|
|
|
:padding="dense ? padding : undefined" |
|
|
|
:disable="btn.data.enableIf ? !btn.data.enableIf(selectedComputed, tickedComputed, grid) : false" |
|
|
|
:disable=" |
|
|
|
btn.data.enableIf |
|
|
|
? !btn.data.enableIf({ |
|
|
|
firstSelected: firstSelectedComputed, |
|
|
|
selected: selectedComputed, |
|
|
|
firstTicked: firstTickedComputed, |
|
|
|
ticked: tickedComputed, |
|
|
|
grid: grid, |
|
|
|
}) |
|
|
|
: false |
|
|
|
" |
|
|
|
no-wrap |
|
|
|
no-caps |
|
|
|
outline |
|
|
@ -106,7 +136,17 @@ |
|
|
|
v-close-popup |
|
|
|
clickable |
|
|
|
:dense="dense" |
|
|
|
:disable="childrenBtn.data.enableIf ? !childrenBtn.data.enableIf(selectedComputed, tickedComputed, grid) : false" |
|
|
|
:disable=" |
|
|
|
childrenBtn.data.enableIf |
|
|
|
? !childrenBtn.data.enableIf({ |
|
|
|
firstSelected: firstSelectedComputed, |
|
|
|
selected: selectedComputed, |
|
|
|
firstTicked: firstTickedComputed, |
|
|
|
ticked: tickedComputed, |
|
|
|
grid: grid, |
|
|
|
}) |
|
|
|
: false |
|
|
|
" |
|
|
|
@click="buttonClick(childrenBtn.data)" |
|
|
|
> |
|
|
|
<q-item-section> |
|
|
@ -304,9 +344,21 @@ const loadingComputed = computed(() => { |
|
|
|
} |
|
|
|
}; |
|
|
|
}); |
|
|
|
const firstSelectedComputed = computed(() => { |
|
|
|
if (Object.keys(props.grid).length > 0 && props.grid.getSelectedRows().length > 0) { |
|
|
|
return props.grid.getSelectedRows()[0]; |
|
|
|
} |
|
|
|
return undefined; |
|
|
|
}); |
|
|
|
const selectedComputed = computed(() => { |
|
|
|
return Object.keys(props.grid).length > 0 ? props.grid.getSelectedRows() : []; |
|
|
|
}); |
|
|
|
const firstTickedComputed = computed(() => { |
|
|
|
if (Object.keys(props.grid).length > 0 && props.grid.getTickedRows().length > 0) { |
|
|
|
return props.grid.getTickedRows()[0]; |
|
|
|
} |
|
|
|
return undefined; |
|
|
|
}); |
|
|
|
const tickedComputed = computed(() => { |
|
|
|
return Object.keys(props.grid).length > 0 ? props.grid.getTickedRows() : []; |
|
|
|
}); |
|
|
@ -314,13 +366,35 @@ const buttonClick = async (button) => { |
|
|
|
let beforeResult = true; |
|
|
|
const context = {}; |
|
|
|
if (button.beforeClick) { |
|
|
|
beforeResult = await button.beforeClick(selectedComputed.value, tickedComputed.value, props.grid, context); |
|
|
|
beforeResult = await button.beforeClick({ |
|
|
|
firstSelected: firstSelectedComputed.value, |
|
|
|
selected: selectedComputed.value, |
|
|
|
firstTicked: firstTickedComputed.value, |
|
|
|
ticked: tickedComputed.value, |
|
|
|
grid: props.grid, |
|
|
|
context: context, |
|
|
|
}); |
|
|
|
} |
|
|
|
if (beforeResult && button.click) { |
|
|
|
await button.click(selectedComputed.value, tickedComputed.value, props.grid, button._click, context); |
|
|
|
await button.click({ |
|
|
|
firstSelected: firstSelectedComputed.value, |
|
|
|
selected: selectedComputed.value, |
|
|
|
firstTicked: firstTickedComputed.value, |
|
|
|
ticked: tickedComputed.value, |
|
|
|
grid: props.grid, |
|
|
|
_click: button._click, |
|
|
|
context: context, |
|
|
|
}); |
|
|
|
if (button.afterClick) { |
|
|
|
nextTick(() => { |
|
|
|
button.afterClick(selectedComputed.value, tickedComputed.value, props.grid, context); |
|
|
|
button.afterClick({ |
|
|
|
firstSelected: firstSelectedComputed.value, |
|
|
|
selected: selectedComputed.value, |
|
|
|
firstTicked: firstTickedComputed.value, |
|
|
|
ticked: tickedComputed.value, |
|
|
|
grid: props.grid, |
|
|
|
context: context, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|