FIX: Error when deleting selected rows that have attachment (#13006)
* Deprecate selectedRowIds * Delete selected rows table * Add selectedRows to table block context * update account-portal * update account-portal * Lowercase deprecated
This commit is contained in:
parent
e171873b10
commit
f8073c3f5a
|
@ -617,6 +617,7 @@ const getDeviceBindings = () => {
|
||||||
/**
|
/**
|
||||||
* Gets all selected rows bindings for tables in the current asset.
|
* Gets all selected rows bindings for tables in the current asset.
|
||||||
* TODO: remove in future because we don't need a separate store for this
|
* TODO: remove in future because we don't need a separate store for this
|
||||||
|
* DEPRECATED
|
||||||
*/
|
*/
|
||||||
const getSelectedRowsBindings = asset => {
|
const getSelectedRowsBindings = asset => {
|
||||||
let bindings = []
|
let bindings = []
|
||||||
|
@ -632,8 +633,8 @@ const getSelectedRowsBindings = asset => {
|
||||||
runtimeBinding: `${safeState}.${makePropSafe(table._id)}.${makePropSafe(
|
runtimeBinding: `${safeState}.${makePropSafe(table._id)}.${makePropSafe(
|
||||||
"selectedRows"
|
"selectedRows"
|
||||||
)}`,
|
)}`,
|
||||||
readableBinding: `${table._instanceName}.Selected rows`,
|
readableBinding: `${table._instanceName}.Selected Row IDs (deprecated)`,
|
||||||
category: "Selected rows",
|
category: "Selected Row IDs (deprecated)",
|
||||||
icon: "ViewRow",
|
icon: "ViewRow",
|
||||||
display: { name: table._instanceName },
|
display: { name: table._instanceName },
|
||||||
}))
|
}))
|
||||||
|
@ -649,8 +650,8 @@ const getSelectedRowsBindings = asset => {
|
||||||
runtimeBinding: `${safeState}.${makePropSafe(
|
runtimeBinding: `${safeState}.${makePropSafe(
|
||||||
block._id + "-table"
|
block._id + "-table"
|
||||||
)}.${makePropSafe("selectedRows")}`,
|
)}.${makePropSafe("selectedRows")}`,
|
||||||
readableBinding: `${block._instanceName}.Selected rows`,
|
readableBinding: `${block._instanceName}.Selected Row IDs (deprecated)`,
|
||||||
category: "Selected rows",
|
category: "Selected Row IDs (deprecated)",
|
||||||
icon: "ViewRow",
|
icon: "ViewRow",
|
||||||
display: { name: block._instanceName },
|
display: { name: block._instanceName },
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -4719,10 +4719,22 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"context": {
|
"context": [
|
||||||
|
{
|
||||||
"type": "schema",
|
"type": "schema",
|
||||||
"scope": "local"
|
"scope": "local"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "static",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"label": "Selected Rows",
|
||||||
|
"key": "selectedRows",
|
||||||
|
"type": "array"
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"daterangepicker": {
|
"daterangepicker": {
|
||||||
"name": "Date Range",
|
"name": "Date Range",
|
||||||
|
@ -5610,7 +5622,8 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"context": {
|
"context": [
|
||||||
|
{
|
||||||
"type": "static",
|
"type": "static",
|
||||||
"suffix": "provider",
|
"suffix": "provider",
|
||||||
"values": [
|
"values": [
|
||||||
|
@ -5640,7 +5653,19 @@
|
||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "static",
|
||||||
|
"suffix": "table",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"label": "Selected Rows",
|
||||||
|
"key": "selectedRows",
|
||||||
|
"type": "array"
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"cardsblock": {
|
"cardsblock": {
|
||||||
"block": true,
|
"block": true,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import { Table } from "@budibase/bbui"
|
import { Table } from "@budibase/bbui"
|
||||||
import SlotRenderer from "./SlotRenderer.svelte"
|
import SlotRenderer from "./SlotRenderer.svelte"
|
||||||
import { canBeSortColumn } from "@budibase/shared-core"
|
import { canBeSortColumn } from "@budibase/shared-core"
|
||||||
|
import Provider from "../../context/Provider.svelte"
|
||||||
|
|
||||||
export let dataProvider
|
export let dataProvider
|
||||||
export let columns
|
export let columns
|
||||||
|
@ -55,6 +56,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build our data context
|
||||||
|
$: dataContext = {
|
||||||
|
selectedRows,
|
||||||
|
}
|
||||||
|
|
||||||
const getFields = (
|
const getFields = (
|
||||||
schema,
|
schema,
|
||||||
customColumns,
|
customColumns,
|
||||||
|
@ -156,6 +162,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div use:styleable={$component.styles} class={size}>
|
<div use:styleable={$component.styles} class={size}>
|
||||||
|
<Provider data={dataContext}>
|
||||||
<Table
|
<Table
|
||||||
{data}
|
{data}
|
||||||
{schema}
|
{schema}
|
||||||
|
@ -177,6 +184,7 @@
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</Table>
|
</Table>
|
||||||
|
</Provider>
|
||||||
{#if allowSelectRows && selectedRows.length}
|
{#if allowSelectRows && selectedRows.length}
|
||||||
<div class="row-count">
|
<div class="row-count">
|
||||||
{selectedRows.length} row{selectedRows.length === 1 ? "" : "s"} selected
|
{selectedRows.length} row{selectedRows.length === 1 ? "" : "s"} selected
|
||||||
|
|
|
@ -5,7 +5,7 @@ const createRowSelectionStore = () => {
|
||||||
|
|
||||||
function updateSelection(componentId, tableId, selectedRows) {
|
function updateSelection(componentId, tableId, selectedRows) {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state[componentId] = { tableId: tableId, selectedRows: selectedRows }
|
state[componentId] = { tableId, selectedRows }
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue