Skip to content

Commit 704d3ae

Browse files
authored
Release 3.40.0
2 parents 28500e1 + 5ca81b7 commit 704d3ae

File tree

22 files changed

+382
-162
lines changed

22 files changed

+382
-162
lines changed

src/app/child-dev-project/children/child-block/child-block.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use "variables/sizes";
2+
@use "variables/colors";
23

34
.child-pic {
45
width: sizes.$icon-block;
@@ -11,7 +12,7 @@
1112
}
1213

1314
.inactive {
14-
color: grey;
15+
color: colors.$inactive;
1516
}
1617

1718
.container {
@@ -24,7 +25,6 @@
2425
font-size: 1em;
2526
margin-right: 3px;
2627
font-weight: 500;
27-
color: #262626;
2828
}
2929

3030
.subnote {

src/app/core/admin/admin-entity-details/admin-entity-form/admin-entity-form.component.html

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,29 @@
2626
cdkDragBoundary=".overall-container"
2727
>
2828
<fa-icon icon="grip-vertical" size="xl" class="drag-handle"></fa-icon>
29-
<button
30-
mat-stroked-button
31-
color="accent"
32-
class="field-edit-button"
33-
(click)="openConfigDetails(field)"
34-
i18n="Button label"
35-
>
36-
Edit Field
37-
</button>
29+
30+
<div class="field-hover-buttons flex-row align-center gap-small">
31+
<button
32+
class="field-edit-button"
33+
mat-stroked-button
34+
color="accent"
35+
(click)="openConfigDetails(field)"
36+
i18n="Button label"
37+
>
38+
Edit Field
39+
</button>
40+
41+
<button
42+
mat-icon-button
43+
color="black"
44+
(click)="hideField(field, group)"
45+
aria-label="Hide Field"
46+
matTooltip="remove (i.e. hide) this field from the form"
47+
i18n-matTooltip
48+
>
49+
<fa-icon icon="times"></fa-icon>
50+
</button>
51+
</div>
3852

3953
<div class="dummy-form-field">
4054
<app-entity-field-edit
@@ -111,7 +125,7 @@
111125
"
112126
mat-stroked-button
113127
color="accent"
114-
class="field-edit-button field-edit-button-small"
128+
class="field-hover-buttons field-edit-button-small"
115129
(click)="openFieldConfig(field)"
116130
>
117131
Edit

src/app/core/admin/admin-entity-details/admin-entity-form/admin-entity-form.component.scss

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ $toolbar-width: 300px;
6666
text-align: center;
6767
}
6868

69-
.field-edit-button {
69+
.field-hover-buttons {
7070
visibility: hidden;
71-
background: white !important;
7271
z-index: 10;
73-
padding: 1.5em;
7472

7573
position: absolute;
7674
/* center within parent: */
@@ -80,14 +78,21 @@ $toolbar-width: 300px;
8078
right: 0;
8179
margin: auto;
8280
width: fit-content;
81+
82+
align-self: center;
8383
}
84-
.admin-form-field:hover .field-edit-button {
84+
.admin-form-field:hover .field-hover-buttons {
8585
visibility: visible;
8686
}
8787
.field-edit-button-small {
8888
left: unset;
8989
}
9090

91+
.field-edit-button {
92+
background: white !important;
93+
padding: 1.5em;
94+
}
95+
9196
.dummy-form-field {
9297
width: 100%;
9398
}
@@ -98,6 +103,9 @@ $toolbar-width: 300px;
98103
.dummy-form-field ::ng-deep mat-form-field {
99104
width: 100%;
100105
}
106+
.dummy-form-field ::ng-deep app-help-button {
107+
opacity: 50%;
108+
}
101109

102110
.drop-area-hint {
103111
text-align: center;

src/app/core/admin/admin-entity-details/admin-entity-form/admin-entity-form.component.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,12 @@ describe("AdminEntityFormComponent", () => {
180180
jasmine.arrayContaining(removedFields),
181181
);
182182
}));
183+
184+
it("should hide a single field", fakeAsync(() => {
185+
const field = "subject";
186+
const group = component.config.fieldGroups[0];
187+
component.hideField(field, group);
188+
189+
expect(component.config.fieldGroups[0].fields).not.toContain(field);
190+
}));
183191
});

src/app/core/admin/admin-entity-details/admin-entity-form/admin-entity-form.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { AdminSectionHeaderComponent } from "../../building-blocks/admin-section
2828
import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
2929
import { FormConfig } from "../../../entity-details/form/form.component";
3030
import { AdminEditDescriptionOnlyFieldComponent } from "../admin-entity-field/admin-edit-description-only-field/admin-edit-description-only-field.component";
31+
import { FieldGroup } from "app/core/entity-details/form/field-group";
3132

3233
@UntilDestroy()
3334
@Component({
@@ -287,4 +288,10 @@ export class AdminEntityFormComponent implements OnChanges {
287288
const [removedFieldGroup] = this.config.fieldGroups.splice(i, 1);
288289
this.initAvailableFields();
289290
}
291+
292+
hideField(field: ColumnConfig, group: FieldGroup) {
293+
const fieldIndex = group.fields.indexOf(field);
294+
group.fields.splice(fieldIndex, 1);
295+
this.initAvailableFields();
296+
}
290297
}

src/app/core/basic-datatypes/entity/entity-block/entity-block.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<span
22
class="block-height truncate-text"
3-
[ngClass]="{ clickable: !linkDisabled }"
3+
[ngClass]="{
4+
clickable: !linkDisabled,
5+
'.inactive': !entityToDisplay?.isActive,
6+
}"
47
(click)="showDetailsPage()"
58
>
69
@if (entityBlockComponent) {

src/app/core/basic-datatypes/entity/entity-block/entity-block.component.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use "variables/sizes";
2+
@use "variables/colors";
23

34
.clickable {
45
pointer-events: all;
@@ -11,3 +12,7 @@
1112
.block-height {
1213
line-height: sizes.$icon-block;
1314
}
15+
16+
.inactive {
17+
color: colors.$inactive;
18+
}

src/app/core/common-components/entities-table/entities-table.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
<tr
7979
mat-row
8080
*matRowDef="let row; columns: _columnsToDisplay"
81+
[class.inactive-row]="!row.record.isActive"
8182
[style.background-color]="getBackgroundColor?.(row.record)"
8283
class="table-row"
8384
(click)="onRowClick(row)"

src/app/core/common-components/entities-table/entities-table.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@
3535
background-color: white;
3636
border-top: none;
3737
}
38+
39+
.inactive-row {
40+
color: colors.$inactive;
41+
}

src/app/core/entity/database-field.decorator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { EntitySchema } from "./schema/entity-schema";
1010
* @param propertySchema (optional) SchemaField definition that configures additional options regarding this field
1111
*/
1212
export function DatabaseField(propertySchema: EntitySchemaField = {}) {
13-
return (target, propertyName: string) => {
13+
return (target: any, propertyName: string) => {
1414
// Retrieve datatype from TypeScript type definition
1515
if (propertySchema.dataType === undefined) {
1616
const type = Reflect.getMetadata("design:type", target, propertyName);

0 commit comments

Comments
 (0)