Skip to content

Commit

Permalink
Merge branch 'next' into ascott/new-template
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Sep 4, 2024
2 parents 5994fd0 + 71e18f1 commit 57c3dd6
Show file tree
Hide file tree
Showing 28 changed files with 479 additions and 1,207 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ Effectively, this is a server-driven autocomplete list.
/>
```

``` ts
const selectedTitle = ref<string>();
```
``` vue-html
<c-select-string-value
v-model="title"
v-model="selectedTitle"
label="Job Title"
for="Person"
method="getSuggestedJobTitles"
Expand Down Expand Up @@ -54,9 +57,8 @@ class Person

A metadata specifier for the value being bound. One of:

- A string with the name of the value belonging to `model`.
- A direct reference to a metadata object.
- A string in dot-notation that starts with a type name.
- A string with the name of the bound value belonging to `model`, or a direct reference to a metadata object that describes the bound value belonging to `model`.
- A string equal to the name of the type that owns the method described by `method`. Use `v-model` to bind the selected string value.

<Prop def="model: Model" lang="ts" />

Expand Down
21 changes: 10 additions & 11 deletions docs/stacks/vue/coalesce-vue-vuetify/components/c-table.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
# c-table

<!-- MARKER:summary -->

A table component for displaying the contents of a [ListViewModel](/stacks/vue/layers/viewmodels.md). Also supports modifying the list's [sort parameters](/modeling/model-components/data-sources.md#standard-parameters) by clicking on column headers. Pairs well with a [c-list-pagination](/stacks/vue/coalesce-vue-vuetify/components/c-list-pagination.md).

<!-- MARKER:summary-end -->


## Example Usage

A simple table, rendering the items of a [ListViewModel](/stacks/vue/layers/viewmodels.md):

``` vue-html
```vue-html
<c-table :list="list" />
```

A more complex example using more of the available options:
A more complex example using more of the available options:

``` vue-html
```vue-html
<c-table
:list="list"
:props="['firstName', 'lastName']"
:extra-headers="['Actions']"
>
<template #item-append="{item}">
<template #item-append="{item}">
<td>
<v-btn
title="Edit"
Expand All @@ -45,13 +44,13 @@ The [ListViewModel](/stacks/vue/layers/viewmodels.md) to display pagination info

<Prop def="props?: string[]" lang="ts" />

If provided, specifies which properties, and their ordering, should be given a column in the table.
If provided, specifies which properties, and their ordering, should be given a column in the table.

If not provided, all non-key columns that aren't annotated with [[Hidden(HiddenAttribute.Areas.List)]](/modeling/model-components/attributes/hidden.md) are given a column.

<Prop def="extraHeaders?: string[]" lang="ts" />
<Prop def="extraHeaders?: string[] | {header: string; isFixed: boolean }[]" lang="ts" />

The text contents of one or more extra ``th`` elements to render in the table. Should be used in conjunction with the ``item-append`` slot.
The text contents of one or more extra `th` elements to render in the table. Each header can be defined as either fixed (sticky) or scrollable. Should be used in conjunction with the `item-append` slot.

<Prop def="editable: boolean = false" lang="ts" />

Expand All @@ -63,4 +62,4 @@ If true, properties in each table cell will be rendered with [c-admin-display](/

## Slots

``item-append`` - A slot rendered after the ``td`` elements on each row that render the properties of each item in the table. Should be provided zero or more additional ``td`` elements. The number should match the number of additional headers provided to the `extraHeaders` prop.
`item-append` - A slot rendered after the `td` elements on each row that render the properties of each item in the table. Should be provided zero or more additional `td` elements. The number should match the number of additional headers provided to the `extraHeaders` prop.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ComplexModel
public IEnumerable<Test> UnmappedCollectionOfMappedModels => Tests.Reverse();

public int SingleTestId { get; set; }
[Display(Description = "The active Test record for the model.")]
public Test SingleTest { get; set; }

public EnumPkId EnumPkId { get; set; }
Expand Down Expand Up @@ -101,6 +102,8 @@ public class ComplexModel
[DefaultOrderBy(FieldOrder = 1)]
public string Name { get; set; }

public bool IsActive { get; set; }

public byte[] ByteArrayProp { get; set; }

public string String { get; set; }
Expand Down Expand Up @@ -175,8 +178,8 @@ public ExternalParent MethodWithManyParams(
bool boolParam,
Case.Statuses enumParam,
Case.Statuses[] enumsParam,
Company model,
Company[] modelCollection
Test model,
Test[] modelCollection
)
{
return collectionExternal.FirstOrDefault() ?? singleExternal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using IntelliTect.Coalesce.Tests.TargetClasses.TestDbContext;
using IntelliTect.Coalesce.DataAnnotations;
using IntelliTect.Coalesce.Tests.TargetClasses.TestDbContext;
using System;
using System.Collections.Generic;
using System.Text;
Expand All @@ -14,6 +15,7 @@ public class Test
public int ComplexModelId { get; set; }
public ComplexModel ComplexModel { get; set; }

[ListText]
public string TestName { get; set; }
}
}
95 changes: 49 additions & 46 deletions src/coalesce-vue-vuetify3/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/coalesce-vue-vuetify3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"vitest": "^2.0.3",
"vue": "^3.4.6",
"vue-router": "^4.2.5",
"vue-tsc": "^1.8.27",
"vue-tsc": "^2.1.4",
"vuetify": "^3.6.14"
},
"postcss": {
Expand Down
12 changes: 9 additions & 3 deletions src/coalesce-vue-vuetify3/src/components/admin/c-admin-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
:editable="editable"
:list="viewModel"
:extra-headers="
canEdit || canDelete || hasInstanceMethods ? ['Actions'] : []
canEdit || canDelete || hasInstanceMethods
? [{ header: 'Actions', isFixed: true }]
: []
"
:loaders="{
'': list.$modelOnlyMode
Expand All @@ -32,8 +34,12 @@
],
}"
>
<template #item-append="{ item }">
<td width="1%" class="c-admin-table--actions">
<template #item-append="{ item, isHorizontalScrollbarVisible }">
<td
width="1%"
:class="{ ['fixed-column-right']: isHorizontalScrollbarVisible }"
class="c-admin-table--actions"
>
<div class="d-flex flex-nowrap text-no-wrap ga-1" no-gutters>
<v-btn
v-if="editable && !effectiveAutoSave"
Expand Down
Loading

0 comments on commit 57c3dd6

Please sign in to comment.