tuain-ng-forms-lib 17.3.7 → 17.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +280 -335
- package/esm2022/lib/classes/forms/action.mjs +3 -3
- package/esm2022/lib/classes/forms/element.mjs +2 -2
- package/esm2022/lib/classes/forms/field.mjs +2 -5
- package/esm2022/lib/classes/forms/form.mjs +4 -6
- package/esm2022/lib/classes/forms/piece-propagate.mjs +1 -1
- package/esm2022/lib/classes/forms/piece.mjs +2 -2
- package/esm2022/lib/classes/forms/section.mjs +2 -2
- package/esm2022/lib/classes/forms/subsection.mjs +1 -1
- package/esm2022/lib/classes/forms/table/action.mjs +1 -1
- package/esm2022/lib/classes/forms/table/column.mjs +1 -1
- package/esm2022/lib/classes/forms/table/row-data.mjs +3 -5
- package/esm2022/lib/classes/forms/table/table.mjs +2 -2
- package/esm2022/lib/components/elements/layout/piece.component.mjs +3 -3
- package/esm2022/lib/components/elements/tables/table-record-action.component.mjs +1 -1
- package/esm2022/lib/components/elements/tables/table-record-field.component.mjs +1 -1
- package/esm2022/lib/components/forms/basic-form.mjs +23 -24
- package/esm2022/lib/interfaces/action.interface.mjs +2 -0
- package/esm2022/lib/interfaces/field.interface.mjs +2 -0
- package/esm2022/lib/interfaces/form-config.interface.mjs +1 -1
- package/esm2022/lib/interfaces/form.interface.mjs +2 -0
- package/esm2022/lib/interfaces/index.mjs +9 -1
- package/esm2022/lib/interfaces/piece.interface.mjs +2 -0
- package/esm2022/lib/interfaces/section.interface.mjs +2 -0
- package/esm2022/lib/interfaces/sse-live-connection.interface.mjs +2 -0
- package/esm2022/lib/interfaces/table.interface.mjs +2 -0
- package/esm2022/lib/services/file-manager.service.mjs +5 -5
- package/esm2022/lib/services/form-manager.service.mjs +5 -5
- package/esm2022/lib/services/icon-dictionary.service.mjs +1 -1
- package/esm2022/lib/services/sse-live-connection.service.mjs +165 -0
- package/esm2022/lib/tokens/sse-live-connection.token.mjs +7 -0
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/tuain-ng-forms-lib.mjs +213 -53
- package/fesm2022/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/action.d.ts +3 -2
- package/lib/classes/forms/element.d.ts +2 -1
- package/lib/classes/forms/field.d.ts +5 -4
- package/lib/classes/forms/form.d.ts +4 -2
- package/lib/classes/forms/piece-propagate.d.ts +2 -1
- package/lib/classes/forms/piece.d.ts +4 -3
- package/lib/classes/forms/section.d.ts +3 -2
- package/lib/classes/forms/subsection.d.ts +2 -1
- package/lib/classes/forms/table/action.d.ts +2 -1
- package/lib/classes/forms/table/column.d.ts +2 -1
- package/lib/classes/forms/table/row-data.d.ts +3 -2
- package/lib/classes/forms/table/table.d.ts +3 -1
- package/lib/components/elements/layout/piece.component.d.ts +2 -2
- package/lib/components/forms/basic-form.d.ts +4 -4
- package/lib/interfaces/action.interface.d.ts +23 -0
- package/lib/interfaces/field.interface.d.ts +70 -0
- package/lib/interfaces/form-config.interface.d.ts +24 -16
- package/lib/interfaces/form.interface.d.ts +106 -0
- package/lib/interfaces/index.d.ts +7 -0
- package/lib/interfaces/piece.interface.d.ts +67 -0
- package/lib/interfaces/section.interface.d.ts +56 -0
- package/lib/interfaces/sse-live-connection.interface.d.ts +59 -0
- package/lib/interfaces/table.interface.d.ts +139 -0
- package/lib/services/file-manager.service.d.ts +4 -4
- package/lib/services/form-manager.service.d.ts +3 -3
- package/lib/services/icon-dictionary.service.d.ts +1 -1
- package/lib/services/sse-live-connection.service.d.ts +48 -0
- package/lib/tokens/sse-live-connection.token.d.ts +7 -0
- package/package.json +2 -1
- package/public-api.d.ts +2 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { FormElement } from './element';
|
|
3
3
|
import { ActionDefinition, IFormConfig } from '../../interfaces/form-config.interface';
|
|
4
|
-
|
|
4
|
+
import type { IAction } from '../../interfaces/action.interface';
|
|
5
|
+
export declare class FormAction extends FormElement implements IAction {
|
|
5
6
|
private readonly _actionActivated;
|
|
6
7
|
private _actionCode;
|
|
7
8
|
private _actionName;
|
|
@@ -34,7 +35,7 @@ export declare class FormAction extends FormElement {
|
|
|
34
35
|
start(): void;
|
|
35
36
|
stop(): void;
|
|
36
37
|
connectWithParentForm(form: any, formChangeSubject: any): void;
|
|
37
|
-
updateRestrictedVisibility(
|
|
38
|
+
updateRestrictedVisibility(_event: unknown): void;
|
|
38
39
|
viewOnState(state: string): boolean;
|
|
39
40
|
get actionActivated(): Observable<string>;
|
|
40
41
|
notifyActivation(): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormPiecePropagate } from './piece-propagate';
|
|
2
2
|
import { ElementAttribute, IFormConfig, PieceDefinition } from '../../interfaces/form-config.interface';
|
|
3
|
-
|
|
3
|
+
import type { IFormElement } from '../../interfaces/piece.interface';
|
|
4
|
+
export declare abstract class FormElement extends FormPiecePropagate implements IFormElement {
|
|
4
5
|
elementType: string | null;
|
|
5
6
|
constructor(elementDefinition: PieceDefinition, formConfig: IFormConfig);
|
|
6
7
|
setAttr(attr: ElementAttribute, value: any): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { FormElement } from './element';
|
|
3
3
|
import { FieldDefinition, FieldEditionEvent, FieldCustomEventData, IFormConfig } from '../../interfaces/form-config.interface';
|
|
4
|
+
import type { IField } from '../../interfaces/field.interface';
|
|
4
5
|
export interface DetailEvent {
|
|
5
6
|
code: string;
|
|
6
7
|
detail: any;
|
|
@@ -9,7 +10,7 @@ export interface FieldOption {
|
|
|
9
10
|
fieldOptionValue: string;
|
|
10
11
|
fieldOptionId: string;
|
|
11
12
|
}
|
|
12
|
-
export declare class FieldDescriptor extends FormElement {
|
|
13
|
+
export declare class FieldDescriptor extends FormElement implements IField {
|
|
13
14
|
private readonly _customEvent;
|
|
14
15
|
private readonly _editionFinish;
|
|
15
16
|
private readonly _editionPartial;
|
|
@@ -175,15 +176,15 @@ export declare class FieldDescriptor extends FormElement {
|
|
|
175
176
|
/**
|
|
176
177
|
* @deprecated Since v17. Use optionText instead. Will be removed in v19.
|
|
177
178
|
*/
|
|
178
|
-
getOptionText(): string;
|
|
179
|
+
getOptionText(): string | null;
|
|
179
180
|
/**
|
|
180
181
|
* @deprecated Since v17. Use options instead. Will be removed in v19.
|
|
181
182
|
*/
|
|
182
|
-
getFieldOptions(): FieldOption[];
|
|
183
|
+
getFieldOptions(): FieldOption[] | null;
|
|
183
184
|
/**
|
|
184
185
|
* @deprecated Since v17. Use options instead. Will be removed in v19.
|
|
185
186
|
*/
|
|
186
|
-
setFieldOptions(newOptions: any):
|
|
187
|
+
setFieldOptions(newOptions: any): void;
|
|
187
188
|
/**
|
|
188
189
|
* @deprecated Since v17. Use intrinsicErrorMessage instead. Will be removed in v19.
|
|
189
190
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
1
2
|
import { FormAction } from './action';
|
|
2
3
|
import { FieldDescriptor, FieldOption } from './field';
|
|
3
4
|
import { RecordTable } from './table/table';
|
|
@@ -5,6 +6,7 @@ import { RecordFormSection } from './section';
|
|
|
5
6
|
import { RecordFormSubSection } from './subsection';
|
|
6
7
|
import { TableRecordData } from './table/row-data';
|
|
7
8
|
import { FormStateEvent, IFormConfig } from '../../interfaces/form-config.interface';
|
|
9
|
+
import type { IForm } from '../../interfaces/form.interface';
|
|
8
10
|
interface Transition {
|
|
9
11
|
name: string;
|
|
10
12
|
source: string;
|
|
@@ -38,7 +40,7 @@ export interface FormPayload {
|
|
|
38
40
|
fields: FieldPayload[];
|
|
39
41
|
tables: TablePayload[];
|
|
40
42
|
}
|
|
41
|
-
export declare class FormStructureAndData {
|
|
43
|
+
export declare class FormStructureAndData implements IForm {
|
|
42
44
|
private readonly _stateChange;
|
|
43
45
|
private _immutableData;
|
|
44
46
|
private _extraInfo;
|
|
@@ -70,7 +72,7 @@ export declare class FormStructureAndData {
|
|
|
70
72
|
supportState(state?: string): boolean;
|
|
71
73
|
getNextStates(): string[];
|
|
72
74
|
changeState(newState: string): boolean;
|
|
73
|
-
get stateChange():
|
|
75
|
+
get stateChange(): Observable<FormStateEvent>;
|
|
74
76
|
setStateFlow(states: any, transitions: any, defaultState?: string, stateDescriptions?: any): void;
|
|
75
77
|
getImmutableElement(name: string): any;
|
|
76
78
|
set immutableData(immutableData: any);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
2
2
|
import { FormPiece } from './piece';
|
|
3
3
|
import { AttributeChange, IFormConfig, PieceDefinition } from '../../interfaces/form-config.interface';
|
|
4
|
-
|
|
4
|
+
import type { IFormPropagate } from '../../interfaces/piece.interface';
|
|
5
|
+
export declare abstract class FormPiecePropagate extends FormPiece implements IFormPropagate {
|
|
5
6
|
protected _attributeChange: BehaviorSubject<AttributeChange | null>;
|
|
6
7
|
constructor(pieceDefinition: PieceDefinition, formConfig: IFormConfig);
|
|
7
8
|
get attributeChange(): Observable<AttributeChange | null>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Subject } from 'rxjs';
|
|
2
2
|
import { IFormConfig, PieceDefinition } from '../../interfaces/form-config.interface';
|
|
3
|
-
|
|
3
|
+
import type { IFormPiece } from '../../interfaces/piece.interface';
|
|
4
|
+
export declare abstract class FormPiece implements IFormPiece {
|
|
4
5
|
protected destroy$: Subject<void>;
|
|
5
6
|
protected _formState: string;
|
|
6
7
|
protected _visibleForced: boolean;
|
|
@@ -11,7 +12,7 @@ export declare abstract class FormPiece {
|
|
|
11
12
|
protected visibleStates: string[];
|
|
12
13
|
protected enabledStates: string[];
|
|
13
14
|
protected _form: any;
|
|
14
|
-
protected _formConfig: IFormConfig;
|
|
15
|
+
protected readonly _formConfig: IFormConfig;
|
|
15
16
|
protected _visible: boolean;
|
|
16
17
|
protected _disabled: boolean;
|
|
17
18
|
customAttributes: Record<string, any>;
|
|
@@ -44,7 +45,7 @@ export declare abstract class FormPiece {
|
|
|
44
45
|
set disabled(disabled: boolean);
|
|
45
46
|
enable(): void;
|
|
46
47
|
disable(): void;
|
|
47
|
-
formStateChangeCustomSubscribe(
|
|
48
|
+
formStateChangeCustomSubscribe(_form: any, _formChangeSubject: any): void;
|
|
48
49
|
formStateChange(state: any): void;
|
|
49
50
|
connectWithParentForm(form: any, formChangeSubject: any): void;
|
|
50
51
|
get form(): any;
|
|
@@ -4,7 +4,8 @@ import { FormAction } from './action';
|
|
|
4
4
|
import { FieldDescriptor } from './field';
|
|
5
5
|
import { RecordFormSubSection } from './subsection';
|
|
6
6
|
import { SectionDefinition, IFormConfig } from '../../interfaces/form-config.interface';
|
|
7
|
-
|
|
7
|
+
import type { ISection } from '../../interfaces/section.interface';
|
|
8
|
+
export declare class RecordFormSection extends FormPiecePropagate implements ISection {
|
|
8
9
|
private readonly _activation;
|
|
9
10
|
private readonly _inactivation;
|
|
10
11
|
private _active;
|
|
@@ -34,7 +35,7 @@ export declare class RecordFormSection extends FormPiecePropagate {
|
|
|
34
35
|
inactivate(): void;
|
|
35
36
|
get title(): string | null;
|
|
36
37
|
set title(title: string | null);
|
|
37
|
-
getVisibleSubsections(
|
|
38
|
+
getVisibleSubsections(_state?: string): RecordFormSubSection[];
|
|
38
39
|
getSubsection(subSectionCode: string): RecordFormSubSection | null;
|
|
39
40
|
activateSubSection(subSectionCode: string): void;
|
|
40
41
|
getFields(): FieldDescriptor[];
|
|
@@ -4,7 +4,8 @@ import { FieldDescriptor } from './field';
|
|
|
4
4
|
import { FormElement } from './element';
|
|
5
5
|
import { RecordTable } from './table/table';
|
|
6
6
|
import { IFormConfig, SubsectionDefinition } from '../../interfaces/form-config.interface';
|
|
7
|
-
|
|
7
|
+
import type { ISubSection } from '../../interfaces/section.interface';
|
|
8
|
+
export declare class RecordFormSubSection extends FormPiecePropagate implements ISubSection {
|
|
8
9
|
private _customRender;
|
|
9
10
|
private _subsectionId;
|
|
10
11
|
private _subsectionCode;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormPiece } from '../piece';
|
|
2
2
|
import { ActionDefinition, IFormConfig } from '../../../interfaces/form-config.interface';
|
|
3
|
-
|
|
3
|
+
import type { ITableAction } from '../../../interfaces/table.interface';
|
|
4
|
+
export declare class TableAction extends FormPiece implements ITableAction {
|
|
4
5
|
private _actionCode;
|
|
5
6
|
private _actionTitle;
|
|
6
7
|
private _iconName;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FormPiece } from '../piece';
|
|
2
2
|
import { ColumnDefinition, IFormConfig } from '../../../interfaces/form-config.interface';
|
|
3
|
+
import type { ITableColumn } from '../../../interfaces/table.interface';
|
|
3
4
|
export interface FilterDef {
|
|
4
5
|
operators: string[];
|
|
5
6
|
options: any[];
|
|
@@ -9,7 +10,7 @@ export interface FilterSetup {
|
|
|
9
10
|
operator: string;
|
|
10
11
|
values: any[];
|
|
11
12
|
}
|
|
12
|
-
export declare class RecordTableColumn extends FormPiece {
|
|
13
|
+
export declare class RecordTableColumn extends FormPiece implements ITableColumn {
|
|
13
14
|
fieldCode: string;
|
|
14
15
|
fieldTitle: string;
|
|
15
16
|
fieldType: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RecordTableColumn } from './column';
|
|
2
|
-
|
|
2
|
+
import type { ITableRecord } from '../../../interfaces/table.interface';
|
|
3
|
+
export declare class TableRecordData implements ITableRecord {
|
|
3
4
|
recordId: string | null;
|
|
4
5
|
selected: boolean;
|
|
5
6
|
recordData: Record<string, any>;
|
|
@@ -7,7 +8,7 @@ export declare class TableRecordData {
|
|
|
7
8
|
toggleSelect(): void;
|
|
8
9
|
select(): void;
|
|
9
10
|
unselect(): void;
|
|
10
|
-
get recordIdKey(): string;
|
|
11
|
+
get recordIdKey(): string | null;
|
|
11
12
|
getFieldValue(fieldCode: string): any;
|
|
12
13
|
hasPattern(words: string[], columnObj: any): boolean;
|
|
13
14
|
hasCondition(columnFilters: any[]): boolean;
|
|
@@ -4,6 +4,7 @@ import { RecordTableColumn, FilterSetup } from './column';
|
|
|
4
4
|
import { TableAction } from './action';
|
|
5
5
|
import { TableRecordData } from './row-data';
|
|
6
6
|
import { TableSorting, TableDefinition, IFormConfig } from '../../../interfaces/form-config.interface';
|
|
7
|
+
import type { ITable } from '../../../interfaces/table.interface';
|
|
7
8
|
export interface TableActionEvent {
|
|
8
9
|
actionCode: string;
|
|
9
10
|
recordId: any;
|
|
@@ -14,7 +15,7 @@ export interface TableEvent {
|
|
|
14
15
|
actionCode: string | null;
|
|
15
16
|
actionDetail: any;
|
|
16
17
|
}
|
|
17
|
-
export declare class RecordTable extends FormElement {
|
|
18
|
+
export declare class RecordTable extends FormElement implements ITable {
|
|
18
19
|
private readonly _inlineActionTrigger;
|
|
19
20
|
private readonly _globalActionTrigger;
|
|
20
21
|
private readonly _recordSelectionTrigger;
|
|
@@ -68,6 +69,7 @@ export declare class RecordTable extends FormElement {
|
|
|
68
69
|
get selectionField(): string;
|
|
69
70
|
get allSelected(): boolean;
|
|
70
71
|
get tableCode(): string;
|
|
72
|
+
get code(): string;
|
|
71
73
|
get tableTitle(): string;
|
|
72
74
|
get currentPage(): number;
|
|
73
75
|
get totalPages(): number;
|
|
@@ -7,10 +7,10 @@ export declare abstract class PieceComponent {
|
|
|
7
7
|
enabled: import("@angular/core").Signal<boolean>;
|
|
8
8
|
customAttributes: import("@angular/core").WritableSignal<Record<string, any>>;
|
|
9
9
|
setForm(form: any): void;
|
|
10
|
-
propagatedAttributeChange(
|
|
10
|
+
propagatedAttributeChange(_attribute: string, _value?: any): void;
|
|
11
11
|
updatePieceAttribute(signaledAttributes: string[], signaledAttribute: string, value: any): void;
|
|
12
12
|
updatePieceAttributes(piece: any, signaledAttributes: string[]): void;
|
|
13
|
-
customAttributeChange(
|
|
13
|
+
customAttributeChange(_subAttribute: string, _value?: any): void;
|
|
14
14
|
updateCustomAttribute(attrName: string, attrValue: any): void;
|
|
15
15
|
replaceCustomAttributes(customAttributes: Record<string, any>): void;
|
|
16
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<PieceComponent, never>;
|
|
@@ -67,9 +67,9 @@ export declare abstract class BasicFormComponent extends FormStructureAndData im
|
|
|
67
67
|
displayActionServerError(): void;
|
|
68
68
|
displayValidationServerError(): void;
|
|
69
69
|
displayTableServerError(): void;
|
|
70
|
-
showFieldInfo(
|
|
71
|
-
showModalDialog(
|
|
72
|
-
openUploadDialog(
|
|
70
|
+
showFieldInfo(_code?: string, _detail?: any): void;
|
|
71
|
+
showModalDialog(_title: any, _body: any, _options: any, _callback?: any, _params?: any): void;
|
|
72
|
+
openUploadDialog(_title: any, _body: any, _options: any, _callback?: any, _params?: any): void;
|
|
73
73
|
subscribeAppEvent(eventName: string, callback: (...args: any[]) => any): void;
|
|
74
74
|
openForm(name: string, data?: any, backData?: any, cleanStack?: boolean): void;
|
|
75
75
|
enableActivityNotification(): void;
|
|
@@ -141,7 +141,7 @@ export declare abstract class BasicFormComponent extends FormStructureAndData im
|
|
|
141
141
|
removeFieldValidationFinish(codes: string[] | string | null): void;
|
|
142
142
|
onFieldValidationFinish(codes: string[] | string | null, callback: (...args: any[]) => any, properties?: Record<string, any> | null): void;
|
|
143
143
|
removeFieldAllEventCallbacks(codes: string[] | string | null): void;
|
|
144
|
-
startFieldInputValidation(code: string,
|
|
144
|
+
startFieldInputValidation(code: string, _intrinsicValidation?: boolean): Promise<boolean>;
|
|
145
145
|
startFieldCustomEvent(code: string, eventName: string, eventData: any): Promise<void>;
|
|
146
146
|
startFieldValidation(code: string, intrinsicValidation?: boolean): Promise<void>;
|
|
147
147
|
startServerFieldValidation(inputField: string | FieldDescriptor): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { IFormElement } from './piece.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Contrato público de una acción de formulario.
|
|
5
|
+
* Implementado por {@link FormAction}.
|
|
6
|
+
*/
|
|
7
|
+
export interface IAction extends IFormElement {
|
|
8
|
+
actionCode: string;
|
|
9
|
+
actionName: string;
|
|
10
|
+
iconName: string;
|
|
11
|
+
inProgress: boolean;
|
|
12
|
+
newState: string;
|
|
13
|
+
backend: boolean;
|
|
14
|
+
restrictedOnField: string | null;
|
|
15
|
+
restrictedOnOperator: string | null;
|
|
16
|
+
restrictedOnValue: string | null;
|
|
17
|
+
readonly actionActivated: Observable<string>;
|
|
18
|
+
start(): void;
|
|
19
|
+
stop(): void;
|
|
20
|
+
notifyActivation(): void;
|
|
21
|
+
updateRestrictedVisibility(event: unknown): void;
|
|
22
|
+
updateFromServer(receivedAction: any): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { IFormElement } from './piece.interface';
|
|
3
|
+
import type { FieldEditionEvent, FieldCustomEventData } from './form-config.interface';
|
|
4
|
+
import type { FieldOption, DetailEvent } from '../classes/forms/field';
|
|
5
|
+
/**
|
|
6
|
+
* Contrato público de un campo de formulario.
|
|
7
|
+
* Implementado por {@link FieldDescriptor}.
|
|
8
|
+
*/
|
|
9
|
+
export interface IField extends IFormElement {
|
|
10
|
+
readonly code: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
title: string;
|
|
13
|
+
type: string;
|
|
14
|
+
captureType: string;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
alignment: string;
|
|
17
|
+
info: any;
|
|
18
|
+
tooltip: string;
|
|
19
|
+
format: RegExp | null;
|
|
20
|
+
value: any;
|
|
21
|
+
defaultValue: any;
|
|
22
|
+
required: boolean;
|
|
23
|
+
outputOnly: boolean;
|
|
24
|
+
visibleLabel: boolean;
|
|
25
|
+
hasChanged: boolean;
|
|
26
|
+
readonly empty: boolean;
|
|
27
|
+
readonly externalValue: any;
|
|
28
|
+
readonly options: FieldOption[] | null;
|
|
29
|
+
readonly optionText: string | null;
|
|
30
|
+
minValue: any;
|
|
31
|
+
maxValue: any;
|
|
32
|
+
minLength: number;
|
|
33
|
+
maxLength: string;
|
|
34
|
+
readonly backend: boolean;
|
|
35
|
+
validateOnServer: boolean;
|
|
36
|
+
serverAction: boolean;
|
|
37
|
+
validating: boolean;
|
|
38
|
+
readonly onValidation: boolean;
|
|
39
|
+
error: {
|
|
40
|
+
type: string;
|
|
41
|
+
code: string;
|
|
42
|
+
message: string;
|
|
43
|
+
};
|
|
44
|
+
errorCode: string;
|
|
45
|
+
errorMessage: string;
|
|
46
|
+
readonly errorType: string;
|
|
47
|
+
readonly editionFinish: Observable<FieldEditionEvent>;
|
|
48
|
+
readonly editionPartial: Observable<FieldEditionEvent>;
|
|
49
|
+
readonly customEvent: Observable<FieldCustomEventData>;
|
|
50
|
+
readonly detailRequest: Observable<DetailEvent>;
|
|
51
|
+
setValue(newValue: any, widgetUpdate?: boolean): void;
|
|
52
|
+
clean(): void;
|
|
53
|
+
focus(): void;
|
|
54
|
+
hasError(): boolean;
|
|
55
|
+
resetError(): void;
|
|
56
|
+
setError(code: string, message: string | null, type?: string): void;
|
|
57
|
+
setEditable(editable?: boolean): void;
|
|
58
|
+
setErrorCode(code: string): void;
|
|
59
|
+
setErrorMessage(msg: string): void;
|
|
60
|
+
getErrorCode(): string;
|
|
61
|
+
getErrorMessage(): string;
|
|
62
|
+
showLabel(): void;
|
|
63
|
+
hideLabel(): void;
|
|
64
|
+
defaultEmpty(): boolean;
|
|
65
|
+
notifyEditionFinish(): void;
|
|
66
|
+
notifyEditionPartial(): void;
|
|
67
|
+
notifyEditionDetailRequest(detail: any): void;
|
|
68
|
+
triggerCustomEvent(eventName: string, eventData: any): void;
|
|
69
|
+
updateFromServer(fld: any): void;
|
|
70
|
+
}
|
|
@@ -34,23 +34,29 @@ export interface FieldCustomEventData {
|
|
|
34
34
|
export interface FormStateEvent {
|
|
35
35
|
state: string;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Configuración del framework por aplicación. Se comparte por referencia entre
|
|
39
|
+
* todas las instancias del modelo, por lo que su contrato es **inmutable**: una
|
|
40
|
+
* vez definido no debe mutarse (las propiedades son `readonly`). La librería solo
|
|
41
|
+
* lo lee, nunca lo modifica.
|
|
42
|
+
*/
|
|
37
43
|
export interface IFormConfig {
|
|
38
|
-
fieldTypes: Record<string, string
|
|
39
|
-
captureTypes: Record<string, string
|
|
40
|
-
captureTypesWithOptions: string
|
|
41
|
-
widgets: {
|
|
42
|
-
byType: Record<string, string
|
|
43
|
-
byCapture: Record<string, string
|
|
44
|
-
}
|
|
45
|
-
fieldValidations: Record<string, IFieldValidation
|
|
46
|
-
tableActions: Record<string, string
|
|
47
|
-
defaultRecordsPerPage: number;
|
|
48
|
-
formStandardErrors: Record<string, string
|
|
49
|
-
tableFieldStyles: Record<string, Record<string, string
|
|
50
|
-
defaultFieldAttributes?: Record<string, any
|
|
51
|
-
defaultActionAttributes?: Record<string, any
|
|
52
|
-
notLabeledFields?: string
|
|
53
|
-
arrayFieldTypes?: Record<string, any
|
|
44
|
+
readonly fieldTypes: Readonly<Record<string, string>>;
|
|
45
|
+
readonly captureTypes: Readonly<Record<string, string>>;
|
|
46
|
+
readonly captureTypesWithOptions: ReadonlyArray<string>;
|
|
47
|
+
readonly widgets: Readonly<{
|
|
48
|
+
byType: Readonly<Record<string, string>>;
|
|
49
|
+
byCapture: Readonly<Record<string, string>>;
|
|
50
|
+
}>;
|
|
51
|
+
readonly fieldValidations: Readonly<Record<string, IFieldValidation>>;
|
|
52
|
+
readonly tableActions: Readonly<Record<string, string>>;
|
|
53
|
+
readonly defaultRecordsPerPage: number;
|
|
54
|
+
readonly formStandardErrors: Readonly<Record<string, string>>;
|
|
55
|
+
readonly tableFieldStyles: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
56
|
+
readonly defaultFieldAttributes?: Readonly<Record<string, any>>;
|
|
57
|
+
readonly defaultActionAttributes?: Readonly<Record<string, any>>;
|
|
58
|
+
readonly notLabeledFields?: ReadonlyArray<string>;
|
|
59
|
+
readonly arrayFieldTypes?: Readonly<Record<string, any>>;
|
|
54
60
|
}
|
|
55
61
|
export interface PieceDefinition {
|
|
56
62
|
visibleStates?: string[] | string;
|
|
@@ -77,6 +83,8 @@ export interface FieldDefinition extends PieceDefinition {
|
|
|
77
83
|
outputOnly?: boolean;
|
|
78
84
|
minLength?: number;
|
|
79
85
|
maxLength?: number;
|
|
86
|
+
minValue?: any;
|
|
87
|
+
maxValue?: any;
|
|
80
88
|
errorCode?: string;
|
|
81
89
|
errorMessage?: string;
|
|
82
90
|
errorType?: string;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { IFormConfig, FormStateEvent } from './form-config.interface';
|
|
3
|
+
import type { IField } from './field.interface';
|
|
4
|
+
import type { IAction } from './action.interface';
|
|
5
|
+
import type { ITable, ITableRecord } from './table.interface';
|
|
6
|
+
import type { ISection, ISubSection } from './section.interface';
|
|
7
|
+
import type { FieldOption } from '../classes/forms/field';
|
|
8
|
+
import type { FormPayload } from '../classes/forms/form';
|
|
9
|
+
/**
|
|
10
|
+
* Contrato público del contenedor de un formulario (estructura + datos).
|
|
11
|
+
* Expone el acceso a campos, acciones, tablas y la gestión de estado.
|
|
12
|
+
* Implementado por {@link FormStructureAndData} (y por herencia, por BasicFormComponent).
|
|
13
|
+
*/
|
|
14
|
+
export interface IForm {
|
|
15
|
+
customAttributes: Record<string, any>;
|
|
16
|
+
formConfig: IFormConfig;
|
|
17
|
+
state: string;
|
|
18
|
+
name: string;
|
|
19
|
+
title: string;
|
|
20
|
+
readonly defaultState: string;
|
|
21
|
+
readonly states: any[];
|
|
22
|
+
readonly stateDescriptions: any[];
|
|
23
|
+
readonly stateChange: Observable<FormStateEvent>;
|
|
24
|
+
supportState(state?: string): boolean;
|
|
25
|
+
getNextStates(): string[];
|
|
26
|
+
changeState(newState: string): boolean;
|
|
27
|
+
setStateFlow(states: any, transitions: any, defaultState?: string, stateDescriptions?: any): void;
|
|
28
|
+
setConfig(formConfig: IFormConfig): void;
|
|
29
|
+
cleanForm(): void;
|
|
30
|
+
loadDefinition(definitionReceived: any): void;
|
|
31
|
+
immutableData: any;
|
|
32
|
+
extraInfo: any;
|
|
33
|
+
getImmutableElement(name: string): any;
|
|
34
|
+
getExtraInfo(name: string): any;
|
|
35
|
+
getCustomAttribute(name: string): any;
|
|
36
|
+
setCustomAttribute(name: string, value: any): void;
|
|
37
|
+
setCustomAttributes(attributes: Record<string, any>): IForm;
|
|
38
|
+
readonly fieldNames: string[];
|
|
39
|
+
getFields(): IField[];
|
|
40
|
+
getFieldNames(): string[];
|
|
41
|
+
getField(code: string): IField;
|
|
42
|
+
enableField(code: string): void;
|
|
43
|
+
disableField(code: string): void;
|
|
44
|
+
getFieldValue(code: string): any;
|
|
45
|
+
getFieldOptionText(code: string): any;
|
|
46
|
+
getFieldOptions(code: string): FieldOption[] | null;
|
|
47
|
+
setFieldValue(code: string, value: any): any;
|
|
48
|
+
setFieldError(code: string, errorCode: string, message: string, type?: string): any;
|
|
49
|
+
setFieldErrorMessage(code: string, message: string): any;
|
|
50
|
+
setFieldRequired(inputCodes: string[] | string | null, required: boolean): any;
|
|
51
|
+
setFieldOptions(code: string, optionsArray: any[], idAttribute: string, valueAttribute: string | string[], separator?: string): any;
|
|
52
|
+
getFieldSet(filter: ((field: IField) => boolean) | null, inputCodes: string[] | string | null, secCode?: string | null, subCode?: string | null): string[];
|
|
53
|
+
applyOnFields(processFunc: (field: IField) => void, inputCodes?: string[] | string | null, secCode?: string, subCode?: string): number;
|
|
54
|
+
enableFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number;
|
|
55
|
+
disableFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number;
|
|
56
|
+
showFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number;
|
|
57
|
+
hideFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number;
|
|
58
|
+
cleanFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number;
|
|
59
|
+
getRequiredFields(codes?: string[] | string | null, secCode?: string, subCode?: string): string[];
|
|
60
|
+
getRequiredEmptyFields(codes?: string[] | string | null, secCode?: string, subCode?: string, onlyVisible?: boolean): string[];
|
|
61
|
+
getChangedFields(codes?: string[] | string | null, secCode?: string, subCode?: string): string[];
|
|
62
|
+
getFieldsWithValidationIssues(codes?: string[] | string | null, secCode?: string, subCode?: string, onlyVisible?: boolean): string[];
|
|
63
|
+
getFieldsValues(inputCodes?: string[] | string | null, secCode?: string, subCode?: string): Record<string, any>;
|
|
64
|
+
getActions(): IAction[];
|
|
65
|
+
getAction(code: string): IAction;
|
|
66
|
+
showActions(codes: string[] | string): void;
|
|
67
|
+
hideActions(codes: string[] | string): void;
|
|
68
|
+
enableActions(codes: string[] | string): void;
|
|
69
|
+
disableActions(codes: string[] | string): void;
|
|
70
|
+
enableAction(code: string): void;
|
|
71
|
+
disableAction(code: string): void;
|
|
72
|
+
showAction(code: string): void;
|
|
73
|
+
hideAction(code: string): void;
|
|
74
|
+
getHeaderActions(): IAction[];
|
|
75
|
+
getActionsByAttribute(name: string, value: any): IAction[];
|
|
76
|
+
getTables(): ITable[];
|
|
77
|
+
getTable(code: string): ITable;
|
|
78
|
+
getTableRecord(code: string, id: string): ITableRecord;
|
|
79
|
+
enableTables(codes: string[] | string): void;
|
|
80
|
+
disableTables(codes: string[] | string): void;
|
|
81
|
+
showTables(codes: string[] | string): void;
|
|
82
|
+
hideTables(codes: string[] | string): void;
|
|
83
|
+
cleanTables(codes: string[] | string): void;
|
|
84
|
+
readonly sectionTitles: string[];
|
|
85
|
+
readonly visibleSections: ISection[];
|
|
86
|
+
getSections(): ISection[];
|
|
87
|
+
getSection(code: string): ISection;
|
|
88
|
+
getSectionsTitles(): string[];
|
|
89
|
+
numSections(): number;
|
|
90
|
+
getSectionsByAttribute(name: string, value: any): ISection[];
|
|
91
|
+
showSections(codes: string[] | string): void;
|
|
92
|
+
hideSections(codes: string[] | string): void;
|
|
93
|
+
showSection(code: string): void;
|
|
94
|
+
hideSection(code: string): void;
|
|
95
|
+
activeSection(): string;
|
|
96
|
+
activateSection(code: string): void;
|
|
97
|
+
getSubSection(code: string, subCode: string): ISubSection;
|
|
98
|
+
showSubSections(code: string, subCodes: string[] | string): void;
|
|
99
|
+
showSubSection(code: string, subCode: string): void;
|
|
100
|
+
hideSubSection(code: string, subCode: string): void;
|
|
101
|
+
hideSubSections(code: string, subCodes: string[] | string): void;
|
|
102
|
+
getSectionActions(code: string): IAction[];
|
|
103
|
+
getSectionActionNames(code: string): string[];
|
|
104
|
+
cleanData(): void;
|
|
105
|
+
getPayload(): FormPayload;
|
|
106
|
+
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export * from './form-config.interface';
|
|
2
2
|
export * from './icon-resolver.interface';
|
|
3
|
+
export * from './sse-live-connection.interface';
|
|
4
|
+
export * from './piece.interface';
|
|
5
|
+
export * from './field.interface';
|
|
6
|
+
export * from './action.interface';
|
|
7
|
+
export * from './table.interface';
|
|
8
|
+
export * from './section.interface';
|
|
9
|
+
export * from './form.interface';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AttributeChange, ElementAttribute, IFormConfig } from './form-config.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Contrato público de la pieza base de un formulario (FormPiece).
|
|
5
|
+
* Define la gestión de visibilidad, habilitación, estados y custom attributes
|
|
6
|
+
* común a campos, acciones, tablas, columnas y acciones de tabla.
|
|
7
|
+
*
|
|
8
|
+
* Implementado por {@link FormPiece}.
|
|
9
|
+
*/
|
|
10
|
+
export interface IFormPiece {
|
|
11
|
+
customAttributes: Record<string, any>;
|
|
12
|
+
readonly absoluteVisible: boolean;
|
|
13
|
+
readonly absoluteDisabled: boolean;
|
|
14
|
+
visible: boolean;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
readonly editable: boolean;
|
|
18
|
+
readonly form: any;
|
|
19
|
+
readonly formConfig: IFormConfig;
|
|
20
|
+
widget: any;
|
|
21
|
+
getCustomAttribute(name: string): any;
|
|
22
|
+
setCustomAttribute(name: string, value: any): void;
|
|
23
|
+
setCustomAttributes(attributes: Record<string, any>): IFormPiece;
|
|
24
|
+
matchAttribute(name: string, value: string): boolean;
|
|
25
|
+
setVisibleStates(newStates: any): void;
|
|
26
|
+
addVisibleState(state: string): void;
|
|
27
|
+
removeVisibleState(state: string): void;
|
|
28
|
+
setEnabledStates(newStates: any): void;
|
|
29
|
+
addEnabledState(state: string): void;
|
|
30
|
+
removeEnabledState(state: string): void;
|
|
31
|
+
viewOnState(state: string): boolean;
|
|
32
|
+
enabledOnState(state: string): boolean;
|
|
33
|
+
visibleOn(state: string): boolean;
|
|
34
|
+
enabledOn(state: string): boolean;
|
|
35
|
+
setVisibility(visible: boolean, forced?: boolean | null): void;
|
|
36
|
+
show(forced?: boolean | null): void;
|
|
37
|
+
hide(forced?: boolean | null): void;
|
|
38
|
+
enable(): void;
|
|
39
|
+
disable(): void;
|
|
40
|
+
formStateChangeCustomSubscribe(form: any, formChangeSubject: any): void;
|
|
41
|
+
formStateChange(state: any): void;
|
|
42
|
+
connectWithParentForm(form: any, formChangeSubject: any): void;
|
|
43
|
+
destroy(): void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Contrato de una pieza con propagación reactiva de atributos (FormPiecePropagate),
|
|
47
|
+
* base común de elementos (campos/acciones/tablas) y secciones/subsecciones.
|
|
48
|
+
*
|
|
49
|
+
* Implementado por {@link FormPiecePropagate}.
|
|
50
|
+
*/
|
|
51
|
+
export interface IFormPropagate extends IFormPiece {
|
|
52
|
+
readonly attributeChange: Observable<AttributeChange | null>;
|
|
53
|
+
propagateAttribute(name: string, value: any): void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Contrato público de un elemento de formulario (FormElement), que añade a
|
|
57
|
+
* {@link IFormPropagate} la identificación de tipo y la actualización de atributos.
|
|
58
|
+
*
|
|
59
|
+
* Implementado por {@link FormElement} y, por herencia, por campos, acciones y tablas.
|
|
60
|
+
*/
|
|
61
|
+
export interface IFormElement extends IFormPropagate {
|
|
62
|
+
elementType: string | null;
|
|
63
|
+
setAttr(attr: ElementAttribute, value: any): void;
|
|
64
|
+
isField(): boolean;
|
|
65
|
+
isAction(): boolean;
|
|
66
|
+
isTable(): boolean;
|
|
67
|
+
}
|