Skip to content

Commit

Permalink
Merge branch 'next-minor' into story/130704-task-data-on-dashboard
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
  • Loading branch information
mbritense committed Jan 2, 2025
2 parents 665fcf3 + 8d6a256 commit 3e81a97
Show file tree
Hide file tree
Showing 20 changed files with 267 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,24 @@
(valueChange)="onValueChange($event.value, $event.inputValue, $event.type)"
></valtimo-value-path-selector-value>
}
@case ('valuePathSelectorDropdownValue') {
<valtimo-value-path-selector-dropdown-value
[keyColumnTitle]="keyColumnTitle"
[dropdownColumnTitle]="dropdownColumnTitle"
[valueColumnTitle]="valueColumnTitle"
[index]="i"
[value]="value"
[fullWidth]="fullWidth"
[disabled]="disabled"
[documentDefinitionName]="valuePathSelectorDocumentDefinitionName"
[prefixes]="valuePathSelectorPrefixes"
[dropdownItems$]="getDropdownItemsForRow(i)"
[dropdownWidth]="dropdownWidth"
[showDocumentDefinitionSelector]="valuePathSelectorShowDocumentDefinitionSelector"
[notation]="valuePathSelectorNotation"
(valueChange)="onValueChange($event.value, $event.inputValue, $event.type)"
></valtimo-value-path-selector-dropdown-value>
}
}

<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class CarbonMultiInputComponent implements OnInit, OnDestroy {
private getMappedValue(valueToMap: MultiInputKeyValue): MultiInputKeyValue | string {
if (this.type === 'keyValue' || this.type === 'keyValuePathSelector') {
return {key: valueToMap.key, value: valueToMap.value};
} else if (this.type === 'keyDropdownValue') {
} else if (this.type === 'keyDropdownValue' || this.type === 'valuePathSelectorDropdownValue') {
return {key: valueToMap.key, value: valueToMap.value, dropdown: valueToMap.dropdown};
} else if (this.type === 'arbitraryAmount') {
const objCopy = {...valueToMap};
Expand Down Expand Up @@ -244,6 +244,7 @@ export class CarbonMultiInputComponent implements OnInit, OnDestroy {
case 'keyValuePathSelector':
return !!((value as MultiInputKeyValue).value || (value as MultiInputKeyValue).key);
case 'keyDropdownValue':
case 'valuePathSelectorDropdownValue':
return !!(
(value as MultiInputKeyValue).value &&
(value as MultiInputKeyValue).key &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ import {
KeyValueComponent,
KeyValuePathSelectorComponent,
SingleValueComponent,
ValuePathSelectorDropdownValueComponent,
ValuePathSelectorValueComponent,
} from './components';
import {ValuePathSelectorValueComponent} from './components/value-path-selector-value';

@NgModule({
declarations: [CarbonMultiInputComponent],
Expand All @@ -54,6 +55,7 @@ import {ValuePathSelectorValueComponent} from './components/value-path-selector-
ArbitraryAmountValueComponent,
KeyValuePathSelectorComponent,
ValuePathSelectorValueComponent,
ValuePathSelectorDropdownValueComponent,
],
exports: [CarbonMultiInputComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
(input)="onInputChange(i, $event.target.value)"
/>
</div>

@if (((amountOfArbitraryValuesArray$ | async) || []).length - 1 !== i) {
<div class="v-multi-input__separator"></div>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ export * from './single-value';
export * from './key-dropdown-value';
export * from './arbitrary-amount-value';
export * from './key-value-path-selector';
export * from './value-path-selector-value';
export * from './value-path-selector-dropdown-value';
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
/>
</div>

<div class="v-multi-input__separator"></div>

<div
class="v-multi-input__input"
[ngClass]="{'--full-width': fullWidth}"
Expand All @@ -37,6 +39,8 @@
</cds-dropdown>
</div>

<div class="v-multi-input__separator"></div>

<div class="v-multi-input__input" [ngClass]="{'--full-width': fullWidth}">
<cds-label *ngIf="index === 0 && valueColumnTitle">{{ valueColumnTitle }}</cds-label>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
/>
</div>

<div class="v-multi-input__separator"></div>

<div class="v-multi-input__input" [ngClass]="{'--full-width': fullWidth}">
<cds-label *ngIf="index === 0 && valueColumnTitle">{{ valueColumnTitle }}</cds-label>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2015-2024 Ritense BV, the Netherlands.
*
* Licensed under EUPL, Version 1.2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export * from './value-path-selector-dropdown-value.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!--
~ Copyright 2015-2024 Ritense BV, the Netherlands.
~
~ Licensed under EUPL, Version 1.2 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" basis,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<div class="v-multi-input__input path-selector" [ngClass]="{'--full-width': fullWidth}">
<cds-label *ngIf="index === 0 && keyColumnTitle">{{ keyColumnTitle }}</cds-label>

<valtimo-value-path-selector
[documentDefinitionName]="documentDefinitionName"
[prefixes]="prefixes"
[showDocumentDefinitionSelector]="showDocumentDefinitionSelector"
[disabled]="disabled"
[defaultValue]="value?.key"
[notation]="notation"
(valueChangeEvent)="onInputChange('key', $event)"
></valtimo-value-path-selector>
</div>

<div class="v-multi-input__separator"></div>

<div
class="v-multi-input__input"
[ngClass]="{'--full-width': fullWidth}"
[style.minWidth.px]="dropdownWidth"
>
<cds-label *ngIf="index === 0 && dropdownColumnTitle">{{ dropdownColumnTitle }}</cds-label>

<cds-dropdown (selected)="onInputChange('dropdown', $event.item.id)" [appendInline]="true">
<cds-dropdown-list [items]="dropdownItems$ | async" type="multi"></cds-dropdown-list>
</cds-dropdown>
</div>

<div class="v-multi-input__separator"></div>

<div class="v-multi-input__input" [ngClass]="{'--full-width': fullWidth}">
<cds-label *ngIf="index === 0 && valueColumnTitle">{{ valueColumnTitle }}</cds-label>

<input
cdsText
[defaultValue]="value.value"
[disabled]="disabled"
(input)="onInputChange('value', $event.target.value)"
/>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*!
* Copyright 2015-2024 Ritense BV, the Netherlands.
*
* Licensed under EUPL, Version 1.2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

:host {
display: flex;
align-items: flex-end;

&.--full-width {
width: 100%;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright 2015-2024 Ritense BV, the Netherlands.
*
* Licensed under EUPL, Version 1.2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {Component, EventEmitter, HostBinding, Input, Output} from '@angular/core';
import {
ListItemWithId,
MultiInputChangeEventType,
MultiInputKeyValue,
ValuePathSelectorNotation,
ValuePathSelectorPrefix,
} from '../../../../models';
import {CommonModule} from '@angular/common';
import {DropdownModule, InputModule} from 'carbon-components-angular';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {ValuePathSelectorComponent} from '../../../value-path-selector';
import {Observable} from 'rxjs';

@Component({
selector: 'valtimo-value-path-selector-dropdown-value',
templateUrl: './value-path-selector-dropdown-value.component.html',
styleUrls: ['./value-path-selector-dropdown-value.component.scss'],
standalone: true,
imports: [
CommonModule,
InputModule,
DropdownModule,
ValuePathSelectorComponent,
FormsModule,
ReactiveFormsModule,
],
})
export class ValuePathSelectorDropdownValueComponent {
@Input() public readonly keyColumnTitle!: string;
@Input() public readonly valueColumnTitle!: string;
@Input() public readonly dropdownColumnTitle!: string;
@Input() public readonly index!: number;
@Input() public readonly value!: MultiInputKeyValue;
@Input() public readonly dropdownItems$!: Observable<Array<ListItemWithId>>;
@Input() public readonly documentDefinitionName = '';
@Input() public readonly prefixes: ValuePathSelectorPrefix[] = [];
@Input() public readonly showDocumentDefinitionSelector = false;
@Input() public readonly notation: ValuePathSelectorNotation = 'dots';
@Input() public readonly dropdownWidth = 250;
@Input() @HostBinding('class.--full-width') public readonly fullWidth = false;
@Input() public readonly disabled = false;

@Output() public readonly valueChange: EventEmitter<{
value: MultiInputKeyValue;
inputValue: string;
type: MultiInputChangeEventType;
}> = new EventEmitter();

public onInputChange(type: MultiInputChangeEventType, inputValue: string): void {
this.valueChange.emit({value: this.value, inputValue, type});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ type MultiInputType =
| 'keyDropdownValue'
| 'arbitraryAmount'
| 'keyValuePathSelector'
| 'valuePathSelectorValue';
| 'valuePathSelectorValue'
| 'valuePathSelectorDropdownValue';

interface MultiInputKeyValue {
uuid?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
>{{ 'conditions' | widgetTranslate: dataSourceKey | async }}</cds-label
>
<valtimo-carbon-multi-input
type="valuePathSelectorDropdownValue"
[addRowText]="'addCondition' | widgetTranslate: dataSourceKey | async"
[defaultValues]="defaultConditionValues$ | async"
[dropdownColumnTitle]="'operator' | widgetTranslate: dataSourceKey | async"
Expand All @@ -49,9 +50,12 @@
[keyColumnTitle]="'path' | widgetTranslate: dataSourceKey | async"
[minimumAmountOfRows]="0"
[valueColumnTitle]="'value' | widgetTranslate: dataSourceKey | async"
type="keyDropdownValue"
(allValuesValidEvent)="onAllConditionsValid($event)"
(valueChange)="conditionsValueChange($event)"
valuePathSelectorNotation="dots"
[valuePathSelectorPrefixes]="[ValuePathSelectorPrefix.DOC, ValuePathSelectorPrefix.CASE]"
[valuePathSelectorShowDocumentDefinitionSelector]="false"
[valuePathSelectorDocumentDefinitionName]="selectedDocumentDefinition$ | async"
></valtimo-carbon-multi-input>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ import {FormBuilder, Validators} from '@angular/forms';
import {CaseCountConfiguration} from '../../models';
import {DocumentService} from '@valtimo/document';
import {ListItem} from 'carbon-components-angular';
import {ListItemWithId, MultiInputKeyValue, MultiInputValues} from '@valtimo/components';
import {
ListItemWithId,
MultiInputKeyValue,
MultiInputValues,
ValuePathSelectorPrefix,
} from '@valtimo/components';
import {TranslateService} from '@ngx-translate/core';
import {WidgetTranslationService} from '../../../../services';

Expand All @@ -56,11 +61,11 @@ export class CaseCountConfigurationComponent
}
}

private readonly _selectedDocumentDefinition$ = new BehaviorSubject<string>('');
public readonly selectedDocumentDefinition$ = new BehaviorSubject<string>('');

public readonly documentItems$: Observable<Array<ListItem>> = combineLatest([
this.documentService.getAllDefinitions(),
this._selectedDocumentDefinition$,
this.selectedDocumentDefinition$,
]).pipe(
map(([documentDefinitions, selectedDocumentDefintion]) =>
documentDefinitions.content.map(definition => ({
Expand Down Expand Up @@ -123,6 +128,8 @@ export class CaseCountConfigurationComponent
ConfigurationOutput<CaseCountConfiguration>
>();

public readonly ValuePathSelectorPrefix = ValuePathSelectorPrefix;

private _subscriptions = new Subscription();

constructor(
Expand All @@ -145,7 +152,7 @@ export class CaseCountConfigurationComponent
return;
}

this._selectedDocumentDefinition$.next(documentDefinitionItem?.item?.content);
this.selectedDocumentDefinition$.next(documentDefinitionItem?.item?.content);
this.documentDefinition.setValue(documentDefinitionItem?.item?.content);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
documentItems: documentItems$ | async,
operatorItems: operatorItems$,
queryItemsValue: queryItemsValue$ | async,
selectedDocumentDefinition: selectedDocumentDefinition$ | async,
} as obs"
[formGroup]="form"
>
Expand Down Expand Up @@ -60,6 +61,7 @@
</v-input>

<valtimo-carbon-multi-input
type="valuePathSelectorDropdownValue"
[disabled]="formDisabled"
[addRowText]="'addCondition' | widgetTranslate: dataSourceKey | async"
[defaultValues]="obs.queryItemsValue[i]?.queryConditions"
Expand All @@ -70,7 +72,10 @@
[keyColumnTitle]="'path' | widgetTranslate: dataSourceKey | async"
[minimumAmountOfRows]="1"
[valueColumnTitle]="'value' | widgetTranslate: dataSourceKey | async"
type="keyDropdownValue"
valuePathSelectorNotation="dots"
[valuePathSelectorPrefixes]="[ValuePathSelectorPrefix.DOC, ValuePathSelectorPrefix.CASE]"
[valuePathSelectorShowDocumentDefinitionSelector]="false"
[valuePathSelectorDocumentDefinitionName]="obs.selectedDocumentDefinition"
(valueChange)="conditionsValueChange(i, $event)"
></valtimo-carbon-multi-input>
</div>
Expand Down
Loading

0 comments on commit 3e81a97

Please sign in to comment.