diff --git a/packages/ui/src/components/CheckBox.svelte b/packages/ui/src/components/CheckBox.svelte index 3e4e90bda8..0f3bb70838 100644 --- a/packages/ui/src/components/CheckBox.svelte +++ b/packages/ui/src/components/CheckBox.svelte @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - - + {#if !circle} - + {/if} {#if symbol === 'minus'} - + {:else} - + {/if} @@ -57,23 +60,33 @@ &:checked + .checkSVG { & .back { fill: var(--theme-bg-check); - &.primary { fill: var(--primary-button-enabled); } + &.primary { + fill: var(--primary-button-enabled); + } } & .check { visibility: visible; fill: var(--theme-button-bg-enabled); - &.primary { fill: var(--primary-button-color); } + &.primary { + fill: var(--primary-button-color); + } } } - &:not(:disabled) + .checkSVG { cursor: pointer; } - &:disabled + .checkSVG { filter: grayscale(70%); } + &:not(:disabled) + .checkSVG { + cursor: pointer; + } + &:disabled + .checkSVG { + filter: grayscale(70%); + } } .checkSVG { width: 1rem; height: 1rem; - border-radius: .25rem; + border-radius: 0.25rem; - .back { fill: var(--theme-button-bg-hovered); } + .back { + fill: var(--theme-button-bg-hovered); + } .check { visibility: hidden; fill: var(--theme-button-bg-enabled); @@ -88,10 +101,14 @@ border: 1px solid var(--theme-bg-focused-color); border-radius: 50%; - &.checked { background-color: var(--theme-bg-check); } + &.checked { + background-color: var(--theme-bg-check); + } &.primary { border-color: transparent; - &.checked { background-color: var(--primary-button-enabled); } + &.checked { + background-color: var(--primary-button-enabled); + } } } diff --git a/plugins/view-resources/src/components/TableView.svelte b/plugins/view-resources/src/components/TableView.svelte index 0f1eedf0c0..0448371760 100644 --- a/plugins/view-resources/src/components/TableView.svelte +++ b/plugins/view-resources/src/components/TableView.svelte @@ -1,15 +1,15 @@ @@ -58,7 +58,7 @@ } const client = getClient() - let checking: boolean = false + let checked: Set> = new Set>() const showMenu = (ev: MouseEvent, object: Doc, row: number): void => { selectRow = row @@ -78,6 +78,17 @@ sortOrder = sortOrder === SortingOrder.Ascending ? SortingOrder.Descending : SortingOrder.Ascending } } + + function check (id: Ref, e: Event) { + const target = e.target as HTMLInputElement + const value = target.checked + if (value) { + checked.add(id) + } else { + checked.delete(id) + } + checked = checked + } {#await buildModel({ client, _class, keys: config, options })} @@ -91,12 +102,17 @@ {#each model as attribute, cellHead} {#if !cellHead} - - + 0}> + { + objects.map((o) => check(o._id, e)) + }} + /> {/if} - {#each objects as object, row (object._id)} - + {#each model as attribute, cell} {#if !cell} - + + { + check(object._id, e) + }} + /> +