bpm-core 0.0.113 → 0.0.115
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/fesm2022/bpm-core.mjs +256 -248
- package/fesm2022/bpm-core.mjs.map +1 -1
- package/lib/components/shared-components/form-field/shared-imports.d.ts +1 -1
- package/lib/functions/validators.d.ts +4 -0
- package/lib/testComponent/request-details-section/request-details-section.component.d.ts +0 -2
- package/package.json +1 -1
- package/src/lib/assets/scss/components/_fields.scss +4 -1
package/fesm2022/bpm-core.mjs
CHANGED
|
@@ -1841,6 +1841,7 @@ class ControlValueAccessorDirective {
|
|
|
1841
1841
|
this.isDisabled = isDisabled;
|
|
1842
1842
|
}
|
|
1843
1843
|
setValue(value) {
|
|
1844
|
+
this.value = value;
|
|
1844
1845
|
this.onChangeFn(value);
|
|
1845
1846
|
}
|
|
1846
1847
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: ControlValueAccessorDirective, deps: [{ token: i0.Injector }, { token: CoreI18nService }, { token: i2$1.ToastrService }, { token: CoreService }, { token: i3.DomSanitizer }, { token: i4.FormBuilder }, { token: ActionStateService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -2308,6 +2309,9 @@ class CheckBoxComponent extends ControlValueAccessorDirective {
|
|
|
2308
2309
|
valueChange(event) {
|
|
2309
2310
|
const checked = event.checked;
|
|
2310
2311
|
this.control.setValue(checked.toString());
|
|
2312
|
+
if (!this.control.touched) {
|
|
2313
|
+
this.control.markAsTouched();
|
|
2314
|
+
}
|
|
2311
2315
|
}
|
|
2312
2316
|
openTermsPopup() {
|
|
2313
2317
|
const dialogRef = this.dialog.open(TermsConditionsComponent, {
|
|
@@ -2325,7 +2329,7 @@ class CheckBoxComponent extends ControlValueAccessorDirective {
|
|
|
2325
2329
|
useExisting: forwardRef(() => CheckBoxComponent),
|
|
2326
2330
|
multi: true,
|
|
2327
2331
|
},
|
|
2328
|
-
], usesInheritance: true, ngImport: i0, template: "<mat-checkbox\r\n [ngClass]=\"{'mx-3': isReadOnly}\"\r\n class=\"
|
|
2332
|
+
], usesInheritance: true, ngImport: i0, template: "<mat-checkbox\r\n [ngClass]=\"{'mx-3': isReadOnly}\"\r\n class=\"mt-3 mb-1\"\r\n [style.pointerEvents]=\"isReadOnly ? 'none' : 'auto'\"\r\n id=\"{{ name }}{{ randomID }}\"\r\n [name]=\"name\"\r\n (change)=\"valueChange($event)\"\r\n [checked]=\"control.value === 'true' ? true : false\">\r\n\r\n <div class=\"d-flex pt-1\">\r\n @if(label){\r\n <app-form-label class=\"mb-0\" [label]=\"label\" [optional]=\"required || mandatory ? false : true\" [tooltip]=\"tooltip\"></app-form-label>\r\n }\r\n @if(containTerms) {\r\n <span\r\n class=\"fs-12 fw-bold fc-coral cursor-pointer mx-1\"\r\n (click)=\"openTermsPopup(); false\">\r\n {{ termsLabel ? termsLabel : 'termsAndConditions' | translate }}\r\n </span>\r\n }\r\n </div>\r\n\r\n @if(link) {\r\n <ng-container>\r\n <span> | </span>\r\n <a\r\n class=\"fs-12 fw-bold fc-coral cursor-pointer mx-1 d-inline-flex align-items-center gap-1\"\r\n href=\"{{ hrefLink }}\"\r\n target=\"_blank\">\r\n <ds-icon icon=\"external-link\"></ds-icon>\r\n <span class=\"underline\">{{ linkText }}</span>\r\n </a>\r\n </ng-container>\r\n }\r\n</mat-checkbox>\r\n<div>\r\n @if (control.touched) {\r\n <mat-error \r\n app-validation-errors \r\n [errors]=\"control.errors\" \r\n [customErrorMessages]=\"customErrorMessages\">\r\n </mat-error>\r\n }\r\n</div>\r\n", styles: [".checkbox{margin-top:10px!important;position:relative;margin-bottom:0!important}.checkbox label{padding-left:30px;font-size:14px;color:#414142}.checkbox input[type=checkbox]{opacity:0}.checkbox input[type=checkbox]+label.checkboxInput{position:absolute;width:25px;height:25px;top:0;left:0;padding-left:0}@media (max-width: 768px){.checkbox input[type=checkbox]+label.checkboxInput{top:8px!important}}.checkbox input[type=checkbox]+label.checkboxInput:before{content:\"\\f096\";font-family:FontAwesome;font-size:25px;display:block;margin-top:-7px;color:#ddd}.checkbox input[type=checkbox]:checked+label.checkboxInput:before{content:\"\\f14a\";color:#da3f7b;background-color:#fff}.mat-mdc-checkbox.mat-accent .mdc-form-field>label{margin:0}.rtlCheckbox.checkbox input[type=checkbox]+label.checkboxInput{left:inherit;right:0;padding-left:0;padding-right:0}.rtlCheckbox.checkbox label{padding-left:0;padding-right:30px}.mat-mdc-checkbox label{cursor:pointer}\n"], dependencies: [{ kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: FormLabelComponent, selector: "app-form-label", inputs: ["tooltip", "label", "optional"] }, { kind: "component", type: ValidationErrorsComponent, selector: "app-validation-errors,[app-validation-errors]", inputs: ["errors", "customErrorMessages"] }, { kind: "ngmodule", type: i4.ReactiveFormsModule }, { kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
|
|
2329
2333
|
}
|
|
2330
2334
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: CheckBoxComponent, decorators: [{
|
|
2331
2335
|
type: Component,
|
|
@@ -2339,7 +2343,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
2339
2343
|
useExisting: forwardRef(() => CheckBoxComponent),
|
|
2340
2344
|
multi: true,
|
|
2341
2345
|
},
|
|
2342
|
-
], template: "<mat-checkbox\r\n [ngClass]=\"{'mx-3': isReadOnly}\"\r\n class=\"
|
|
2346
|
+
], template: "<mat-checkbox\r\n [ngClass]=\"{'mx-3': isReadOnly}\"\r\n class=\"mt-3 mb-1\"\r\n [style.pointerEvents]=\"isReadOnly ? 'none' : 'auto'\"\r\n id=\"{{ name }}{{ randomID }}\"\r\n [name]=\"name\"\r\n (change)=\"valueChange($event)\"\r\n [checked]=\"control.value === 'true' ? true : false\">\r\n\r\n <div class=\"d-flex pt-1\">\r\n @if(label){\r\n <app-form-label class=\"mb-0\" [label]=\"label\" [optional]=\"required || mandatory ? false : true\" [tooltip]=\"tooltip\"></app-form-label>\r\n }\r\n @if(containTerms) {\r\n <span\r\n class=\"fs-12 fw-bold fc-coral cursor-pointer mx-1\"\r\n (click)=\"openTermsPopup(); false\">\r\n {{ termsLabel ? termsLabel : 'termsAndConditions' | translate }}\r\n </span>\r\n }\r\n </div>\r\n\r\n @if(link) {\r\n <ng-container>\r\n <span> | </span>\r\n <a\r\n class=\"fs-12 fw-bold fc-coral cursor-pointer mx-1 d-inline-flex align-items-center gap-1\"\r\n href=\"{{ hrefLink }}\"\r\n target=\"_blank\">\r\n <ds-icon icon=\"external-link\"></ds-icon>\r\n <span class=\"underline\">{{ linkText }}</span>\r\n </a>\r\n </ng-container>\r\n }\r\n</mat-checkbox>\r\n<div>\r\n @if (control.touched) {\r\n <mat-error \r\n app-validation-errors \r\n [errors]=\"control.errors\" \r\n [customErrorMessages]=\"customErrorMessages\">\r\n </mat-error>\r\n }\r\n</div>\r\n", styles: [".checkbox{margin-top:10px!important;position:relative;margin-bottom:0!important}.checkbox label{padding-left:30px;font-size:14px;color:#414142}.checkbox input[type=checkbox]{opacity:0}.checkbox input[type=checkbox]+label.checkboxInput{position:absolute;width:25px;height:25px;top:0;left:0;padding-left:0}@media (max-width: 768px){.checkbox input[type=checkbox]+label.checkboxInput{top:8px!important}}.checkbox input[type=checkbox]+label.checkboxInput:before{content:\"\\f096\";font-family:FontAwesome;font-size:25px;display:block;margin-top:-7px;color:#ddd}.checkbox input[type=checkbox]:checked+label.checkboxInput:before{content:\"\\f14a\";color:#da3f7b;background-color:#fff}.mat-mdc-checkbox.mat-accent .mdc-form-field>label{margin:0}.rtlCheckbox.checkbox input[type=checkbox]+label.checkboxInput{left:inherit;right:0;padding-left:0;padding-right:0}.rtlCheckbox.checkbox label{padding-left:0;padding-right:30px}.mat-mdc-checkbox label{cursor:pointer}\n"] }]
|
|
2343
2347
|
}], propDecorators: { containTerms: [{
|
|
2344
2348
|
type: Input
|
|
2345
2349
|
}], termsLabel: [{
|
|
@@ -7253,6 +7257,240 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
7253
7257
|
type: Input
|
|
7254
7258
|
}] } });
|
|
7255
7259
|
|
|
7260
|
+
function encodePassword(formId, password) {
|
|
7261
|
+
const formIdString = Array.from(new TextEncoder().encode(formId), (x) => String.fromCodePoint(x)).join('');
|
|
7262
|
+
let encodedFormId = btoa(formIdString);
|
|
7263
|
+
let x = Math.floor(Math.random() * password.length);
|
|
7264
|
+
let [first, second] = [
|
|
7265
|
+
password.slice(0, x),
|
|
7266
|
+
password.slice(x),
|
|
7267
|
+
];
|
|
7268
|
+
let newPassword = first + encodedFormId + second;
|
|
7269
|
+
const binString = Array.from(new TextEncoder().encode(newPassword), (x) => String.fromCodePoint(x)).join('');
|
|
7270
|
+
newPassword = btoa(binString);
|
|
7271
|
+
return newPassword;
|
|
7272
|
+
}
|
|
7273
|
+
|
|
7274
|
+
const ACTION_ERROR_SUFFIX = '_ACTION';
|
|
7275
|
+
class ManageActionErrors {
|
|
7276
|
+
/*
|
|
7277
|
+
action error structure
|
|
7278
|
+
{error_key}_{action_name}ACTION_ERROR_SUFFIX
|
|
7279
|
+
e.g. required_REJECT_ACTION
|
|
7280
|
+
*/
|
|
7281
|
+
hasActionError(errors, action) {
|
|
7282
|
+
if (!errors)
|
|
7283
|
+
return false;
|
|
7284
|
+
return !!Object.keys(errors).filter(key => key.endsWith(`${action}${ACTION_ERROR_SUFFIX}`)).length;
|
|
7285
|
+
}
|
|
7286
|
+
hasOtherError(errors) {
|
|
7287
|
+
if (!errors)
|
|
7288
|
+
return false;
|
|
7289
|
+
const actionErrorKeys = this.getActionErrorKeys(errors);
|
|
7290
|
+
const allErrorKeys = this.getAllErrorKeys(errors);
|
|
7291
|
+
if (actionErrorKeys.size === allErrorKeys.size)
|
|
7292
|
+
return false;
|
|
7293
|
+
return true;
|
|
7294
|
+
}
|
|
7295
|
+
getActionErrorKeys(errors) {
|
|
7296
|
+
return new Set(
|
|
7297
|
+
//required_REJECT_ACTION => required
|
|
7298
|
+
Object.keys(errors).filter(actionKey => actionKey.endsWith(ACTION_ERROR_SUFFIX)).map(key => key.split('_')[0]));
|
|
7299
|
+
}
|
|
7300
|
+
getAllErrorKeys(errors) {
|
|
7301
|
+
return new Set(Object.keys(errors).filter(key => !key.endsWith(ACTION_ERROR_SUFFIX)));
|
|
7302
|
+
}
|
|
7303
|
+
addActionError(actions, errors) {
|
|
7304
|
+
const actionErrors = {};
|
|
7305
|
+
actions.forEach(action => {
|
|
7306
|
+
for (let key in errors) {
|
|
7307
|
+
actionErrors[`${key}_${action}${ACTION_ERROR_SUFFIX}`] = errors[key];
|
|
7308
|
+
}
|
|
7309
|
+
});
|
|
7310
|
+
return { ...errors, ...actionErrors };
|
|
7311
|
+
}
|
|
7312
|
+
}
|
|
7313
|
+
/**
|
|
7314
|
+
* Checks if the form group is valid for a specific action.
|
|
7315
|
+
* You should use this function to check form validity if you use `validateIfAction` function.
|
|
7316
|
+
* @param action The action to check against.
|
|
7317
|
+
* @param formGroup The form group or form array to validate.
|
|
7318
|
+
* @returns {boolean} True if all controls are valid for the action, false otherwise.
|
|
7319
|
+
*/
|
|
7320
|
+
function isValidForAction(action, formGroup) {
|
|
7321
|
+
return Object.entries(formGroup.controls).every(([controlName, control]) => {
|
|
7322
|
+
if (control instanceof FormGroup || control instanceof FormArray) {
|
|
7323
|
+
return isValidForAction(action, control);
|
|
7324
|
+
}
|
|
7325
|
+
const errors = control.errors;
|
|
7326
|
+
if (!errors)
|
|
7327
|
+
return true;
|
|
7328
|
+
const invalidAction = new ManageActionErrors().hasActionError(errors, action);
|
|
7329
|
+
if (invalidAction)
|
|
7330
|
+
return false;
|
|
7331
|
+
const hasOtherError = new ManageActionErrors().hasOtherError(errors);
|
|
7332
|
+
if (hasOtherError)
|
|
7333
|
+
return false;
|
|
7334
|
+
return true;
|
|
7335
|
+
});
|
|
7336
|
+
}
|
|
7337
|
+
/**
|
|
7338
|
+
* Updates the value and validity of all controls.
|
|
7339
|
+
* Use this function when your validators depend on the values of other controls.
|
|
7340
|
+
* @param formGroup The FormGroup or FormArray to update.
|
|
7341
|
+
* @returns {void}
|
|
7342
|
+
*/
|
|
7343
|
+
function updateValueAndValidity(formGroup) {
|
|
7344
|
+
Object.values(formGroup.controls).forEach((control) => {
|
|
7345
|
+
if (control instanceof FormGroup || control instanceof FormArray) {
|
|
7346
|
+
updateValueAndValidity(control);
|
|
7347
|
+
}
|
|
7348
|
+
else {
|
|
7349
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
7350
|
+
}
|
|
7351
|
+
});
|
|
7352
|
+
}
|
|
7353
|
+
/**
|
|
7354
|
+
* Validates a control only when a certain condition is met.
|
|
7355
|
+
* @param condition A function that returns a boolean indicating whether to apply the validator.
|
|
7356
|
+
* @param validator A single ValidatorFn or an array of ValidatorFns to apply if the condition is true.
|
|
7357
|
+
* @returns {ValidatorFn} A ValidatorFn that applies the given validator only when the condition is true.
|
|
7358
|
+
*/
|
|
7359
|
+
function validateOnlyWhen(condition, validator) {
|
|
7360
|
+
return (control) => {
|
|
7361
|
+
if (condition()) {
|
|
7362
|
+
return Array.isArray(validator) ? Validators.compose(validator)(control) : validator(control);
|
|
7363
|
+
}
|
|
7364
|
+
return null;
|
|
7365
|
+
};
|
|
7366
|
+
}
|
|
7367
|
+
/**
|
|
7368
|
+
* Validates a control if the current action is one of the specified actions.
|
|
7369
|
+
* @param actions An array of action names to check against.
|
|
7370
|
+
* @param validator A single ValidatorFn or an array of ValidatorFns to apply if the current action matches one of the actions.
|
|
7371
|
+
* @returns {ValidatorFn} A ValidatorFn that applies the given validator only if the current action is one of the specified actions.
|
|
7372
|
+
* */
|
|
7373
|
+
function validateIfAction(actions, validator) {
|
|
7374
|
+
return (control) => {
|
|
7375
|
+
const output = Array.isArray(validator) ? Validators.compose(validator)(control) : validator(control);
|
|
7376
|
+
if (output) {
|
|
7377
|
+
return new ManageActionErrors().addActionError(actions, output);
|
|
7378
|
+
}
|
|
7379
|
+
return null;
|
|
7380
|
+
};
|
|
7381
|
+
}
|
|
7382
|
+
/**
|
|
7383
|
+
* Logs the status of all controls in a FormGroup.
|
|
7384
|
+
* It traverses the form structure and logs whether each control is valid or invalid.
|
|
7385
|
+
* @param formGroup The FormGroup to log the status of.
|
|
7386
|
+
* @returns {void} This function does not return anything, it logs the status to the console.
|
|
7387
|
+
*/
|
|
7388
|
+
function logFormStatus(formGroup) {
|
|
7389
|
+
const stack = [{ controls: formGroup.controls, path: '' }];
|
|
7390
|
+
const status = {
|
|
7391
|
+
all: {},
|
|
7392
|
+
valid: {},
|
|
7393
|
+
invalid: {}
|
|
7394
|
+
};
|
|
7395
|
+
while (stack.length) {
|
|
7396
|
+
const { controls, path } = stack.pop();
|
|
7397
|
+
for (const key in controls) {
|
|
7398
|
+
const control = controls[key];
|
|
7399
|
+
const newPath = path ? `${path}.${key}` : key;
|
|
7400
|
+
if (control instanceof FormGroup) {
|
|
7401
|
+
stack.push({ controls: control.controls, path: newPath });
|
|
7402
|
+
}
|
|
7403
|
+
else if (control instanceof FormArray) {
|
|
7404
|
+
const formArrayControlsAsObj = control.controls.reduce((prev, current, index) => {
|
|
7405
|
+
prev[index] = current;
|
|
7406
|
+
return prev;
|
|
7407
|
+
}, {});
|
|
7408
|
+
stack.push({ controls: formArrayControlsAsObj, path: newPath });
|
|
7409
|
+
}
|
|
7410
|
+
else {
|
|
7411
|
+
status.all[newPath] = control.valid;
|
|
7412
|
+
if (control.valid)
|
|
7413
|
+
status.valid[newPath] = control.valid;
|
|
7414
|
+
else
|
|
7415
|
+
status.invalid[newPath] = control.valid;
|
|
7416
|
+
}
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7419
|
+
console.log(status);
|
|
7420
|
+
}
|
|
7421
|
+
/**
|
|
7422
|
+
* A collection of custom validators for various data types.
|
|
7423
|
+
*/
|
|
7424
|
+
class DataValidators {
|
|
7425
|
+
/**
|
|
7426
|
+
* Validates that the control's value is the string 'true'
|
|
7427
|
+
*/
|
|
7428
|
+
static checkboxRequired(control) {
|
|
7429
|
+
if (control.value === 'true')
|
|
7430
|
+
return null;
|
|
7431
|
+
return { required: true };
|
|
7432
|
+
}
|
|
7433
|
+
/**
|
|
7434
|
+
* Validates that the control's value is a valid employee object.
|
|
7435
|
+
*/
|
|
7436
|
+
static employeeRequired(control) {
|
|
7437
|
+
if (control.value?.personEmail)
|
|
7438
|
+
return null;
|
|
7439
|
+
return { required: true };
|
|
7440
|
+
}
|
|
7441
|
+
/**
|
|
7442
|
+
* Validates that the control's value is a valid attachment object.
|
|
7443
|
+
*/
|
|
7444
|
+
static fileUploaderRequired(control) {
|
|
7445
|
+
if (control.value?.attachmentId)
|
|
7446
|
+
return null;
|
|
7447
|
+
return { required: true };
|
|
7448
|
+
}
|
|
7449
|
+
/**
|
|
7450
|
+
* Validates that the control's value is a valid attachments list.
|
|
7451
|
+
*/
|
|
7452
|
+
static multiFileUploaderRequired(control) {
|
|
7453
|
+
if (!Array.isArray(control.value))
|
|
7454
|
+
return { required: true };
|
|
7455
|
+
if (!control.value.length)
|
|
7456
|
+
return { required: true };
|
|
7457
|
+
if (control.value.every(item => item.attachmentId))
|
|
7458
|
+
return null;
|
|
7459
|
+
return { required: true };
|
|
7460
|
+
}
|
|
7461
|
+
/**
|
|
7462
|
+
* Validates that the control's value is a valid select object.
|
|
7463
|
+
* The select object should have a 'key' property.
|
|
7464
|
+
*/
|
|
7465
|
+
static selectRequired(control) {
|
|
7466
|
+
if (control.value?.key)
|
|
7467
|
+
return null;
|
|
7468
|
+
return { required: true };
|
|
7469
|
+
}
|
|
7470
|
+
}
|
|
7471
|
+
|
|
7472
|
+
function handelErrorResponse(obj, errorMsgs) {
|
|
7473
|
+
if (!obj.form) {
|
|
7474
|
+
obj.form = new Form(NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, errorMsgs);
|
|
7475
|
+
}
|
|
7476
|
+
else {
|
|
7477
|
+
obj.form.messages = errorMsgs;
|
|
7478
|
+
}
|
|
7479
|
+
window.scrollTo(0, 0);
|
|
7480
|
+
}
|
|
7481
|
+
|
|
7482
|
+
function dataURItoBlob(dataURI, mimeType) {
|
|
7483
|
+
const byteString = atob(dataURI);
|
|
7484
|
+
const arrayBuffer = new ArrayBuffer(byteString.length);
|
|
7485
|
+
const int8Array = new Uint8Array(arrayBuffer);
|
|
7486
|
+
for (let i = 0; i < byteString.length; i++) {
|
|
7487
|
+
int8Array[i] = byteString.charCodeAt(i);
|
|
7488
|
+
}
|
|
7489
|
+
const blob = new Blob([arrayBuffer], { type: mimeType || 'image/jpeg' });
|
|
7490
|
+
return blob;
|
|
7491
|
+
}
|
|
7492
|
+
;
|
|
7493
|
+
|
|
7256
7494
|
// import { TranslatePipe } from '../../pipes/translate.pipe';
|
|
7257
7495
|
class RequestDetailsSectionComponent {
|
|
7258
7496
|
i18n;
|
|
@@ -7466,11 +7704,11 @@ class RequestDetailsSectionComponent {
|
|
|
7466
7704
|
ngOnInit() {
|
|
7467
7705
|
this.createForm();
|
|
7468
7706
|
let data = this.section.body.details;
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7707
|
+
for (const key in data) {
|
|
7708
|
+
if (key !== 'decision') {
|
|
7709
|
+
this.formGroup.patchValue({ [key]: data[key] });
|
|
7710
|
+
}
|
|
7711
|
+
}
|
|
7474
7712
|
// this.initializeTableConfig()
|
|
7475
7713
|
/* this.formGroup.get('checkbox').valueChanges.subscribe(res=> {
|
|
7476
7714
|
if (res){
|
|
@@ -7552,9 +7790,9 @@ class RequestDetailsSectionComponent {
|
|
|
7552
7790
|
// currencyInput: new FormControl(null, Validators.required),
|
|
7553
7791
|
// emailInput: new FormControl({value: null, disabled: true}, Validators.required),
|
|
7554
7792
|
// numberInput: new FormControl(null, Validators.required),
|
|
7555
|
-
customSearchable: new FormControl(null, Validators.required),
|
|
7556
|
-
|
|
7557
|
-
textArea: new FormControl('
|
|
7793
|
+
// customSearchable: new FormControl(null, Validators.required),
|
|
7794
|
+
checkbox: new FormControl(null, [DataValidators.checkboxRequired]),
|
|
7795
|
+
textArea: new FormControl('default val', [Validators.required, Validators.maxLength(5)]),
|
|
7558
7796
|
// datePicker: new FormControl(null, Validators.required),
|
|
7559
7797
|
// datePickerRange: new FormControl(null, Validators.required),
|
|
7560
7798
|
// radio: new FormControl(null, Validators.required),
|
|
@@ -7597,12 +7835,11 @@ class RequestDetailsSectionComponent {
|
|
|
7597
7835
|
// console.log(this.section.body.detils);
|
|
7598
7836
|
// console.log(this.lov?.['approverActions']?.options)
|
|
7599
7837
|
this.formGroup.valueChanges.subscribe(value => {
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
// })
|
|
7838
|
+
this.lov?.['decision']?.options?.forEach(option => {
|
|
7839
|
+
let isActionValid = this.checkValidity(option.value);
|
|
7840
|
+
this.actionStateService.setActionValid(option.value, isActionValid);
|
|
7841
|
+
this.section.body.details = { ...this.section.body.details, ...this.formGroup.value };
|
|
7842
|
+
});
|
|
7606
7843
|
});
|
|
7607
7844
|
}
|
|
7608
7845
|
// this.formGroup.valueChanges.subscribe(value => {
|
|
@@ -7642,7 +7879,6 @@ class RequestDetailsSectionComponent {
|
|
|
7642
7879
|
// this.formGroup.setValue(this.section.body.details);
|
|
7643
7880
|
// console.log('customCallSubmit', this.formGroup.value)
|
|
7644
7881
|
// }
|
|
7645
|
-
textArea = 'testtt';
|
|
7646
7882
|
editAsset(asset) {
|
|
7647
7883
|
console.log(asset);
|
|
7648
7884
|
}
|
|
@@ -7658,7 +7894,6 @@ class RequestDetailsSectionComponent {
|
|
|
7658
7894
|
deleteAsset(asset) {
|
|
7659
7895
|
console.log(asset);
|
|
7660
7896
|
}
|
|
7661
|
-
log(d) { console.log(d); }
|
|
7662
7897
|
formValue(form) {
|
|
7663
7898
|
console.log(form.value);
|
|
7664
7899
|
}
|
|
@@ -7689,7 +7924,7 @@ class RequestDetailsSectionComponent {
|
|
|
7689
7924
|
this.pageSize = event.pageSize;
|
|
7690
7925
|
}
|
|
7691
7926
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: RequestDetailsSectionComponent, deps: [{ token: CoreI18nService }, { token: i4.FormBuilder }, { token: ActionStateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
7692
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: RequestDetailsSectionComponent, isStandalone: true, selector: "app-request-details-section", inputs: { isReadOnly: "isReadOnly", section: "section", form: "form", lov: "lov", className: "className" }, ngImport: i0, template: "<div>\r\n <form [ngClass]=\"{'form-section-divide form-section':!section?.header?.readOnly,'info-section':section?.header?.readOnly}\" [formGroup]=\"formGroup\">\r\n\r\n
|
|
7927
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: RequestDetailsSectionComponent, isStandalone: true, selector: "app-request-details-section", inputs: { isReadOnly: "isReadOnly", section: "section", form: "form", lov: "lov", className: "className" }, ngImport: i0, template: "<div>\r\n <form [ngClass]=\"{'form-section-divide form-section':!section?.header?.readOnly,'info-section':section?.header?.readOnly}\" [formGroup]=\"formGroup\">\r\n\r\n <!-- <app-attachment-section\r\n class=\"section-item full\"\r\n [descriptionRequired]=\"false\"\r\n label=\"Attachment section\"\r\n [commentsRequired]=\"false\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"attachmentSection\"></app-attachment-section> -->\r\n\r\n<!-- {{formGroup.valid}}-->\r\n<!-- <app-input class=\"section-item full\" [isReadOnly]=\"false\" [mandatory]=\"true\" [loading]=\"true\" type=\"enOnly\" formControlName=\"input\" label=\"Input\"></app-input>-->\r\n<!-- <app-checkbox\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"checkbox\"\r\n termsLabel=\"Terms and conditions\"\r\n label=\"check-box\"></app-checkbox> -->\r\n\r\n <app-textarea class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"textArea\" label=\"Text-area\"></app-textarea>\r\n <!--\r\n <app-search-employee\r\n class=\"section-item full\"\r\n [multiple]=\"true\"\r\n [arrayList]=\"formGroup.get('searchEmployee').value\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"searchEmployee\"\r\n label=\"Search-employee\"></app-search-employee>\r\n <app-input class=\"section-item full\" [isReadOnly]=\"isReadOnly\" [loading]=\"true\" type=\"enOnly\" formControlName=\"input\" label=\"Input\"></app-input>\r\n <app-input-currency class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"currencyInput\" label=\"currency\"></app-input-currency>\r\n <app-input-email class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"emailInput\" label=\"email\"></app-input-email>\r\n <app-input-number class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"numberInput\" label=\"number\"></app-input-number>\r\n <app-custom-searchable\r\n class=\"section-item mb-0 full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"customSearchable\"\r\n label=\"Custom-searchable\"\r\n [options]=\"lov?.['approverActions']?.options\"\r\n [displayedLabel]=\"'name'\"\r\n [key]=\"'name'\"></app-custom-searchable>\r\n <app-checkbox\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"checkbox\"\r\n termsLabel=\"Terms and conditions\"\r\n label=\"check-box\"\r\n [containTerms]=\"true\"></app-checkbox>\r\n <app-textarea class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"textArea\" label=\"Text-area\"></app-textarea>\r\n\r\n <app-date-range-picker\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"datePickerRange\"\r\n label=\"Date-picker-range\"\r\n [matSuffix]=\"true\"></app-date-range-picker>\r\n <app-radio class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"radio\" [options]=\"options\" label=\"Radio\"></app-radio>-->\r\n <!-- <app-toggle-button\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"toggle\"\r\n [options]=\"lov?.['decision']?.options\"\r\n label=\"Toggle-button\"\r\n [displayedLabel]=\"'description'\"\r\n [key]=\"'value'\"></app-toggle-button>-->\r\n <!--<app-input-telephone class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"telephone\" label=\"Telephone\"></app-input-telephone>\r\n\r\n <app-file-uploader\r\n class=\"section-item full\"\r\n [callApi]=\"true\"\r\n [isReadOnly]=\"isReadOnly\"\r\n [multiple]=\"false\"\r\n label=\"attachment\"\r\n formControlName=\"attachment\"></app-file-uploader>\r\n\r\n <app-attachment-section\r\n class=\"section-item full\"\r\n [descriptionRequired]=\"false\"\r\n label=\"Attachment section\"\r\n [commentsRequired]=\"false\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"attachmentSection\"></app-attachment-section>\r\n-->\r\n\r\n\r\n\r\n <!-- <app-table\r\n [columnsConfig]=\"columnsConfig\"\r\n [columns]=\"columns\"\r\n [isError]=\"isError\"\r\n [isLoading]=\"isLoading\"\r\n [rows]=\"categoryData\" [hasPaginator]=\"true\"\r\n [pageSize]=\"pageSize\" [currentPage]=\"pageNumber\"\r\n [totalElements]=\"totalElements\"\r\n (pageChange)=\"pageChanged($event)\"\r\n class=\"new-primary-table full\">\r\n </app-table> -->\r\n\r\n<!-- <app-datepicker\r\n class=\"section-item full\"\r\n [isReadOnly]=\"false\"\r\n formControlName=\"datePicker\"\r\n [matSuffix]=\"true\"\r\n label=\"Date-picker\"></app-datepicker>-->\r\n\r\n\r\n </form>\r\n\r\n\r\n</div>\r\n@if (!section?.header?.readOnly) {\r\n <div class=\"mt-4\">\r\n <lib-action-buttons\r\n [lovOptions]=\"lov?.['decision']?.options\"\r\n [lovType]=\"lov?.['decision']?.type\"\r\n [section]=\"section\"\r\n [form]=\"form\"\r\n [sections]=\"form.sections\"\r\n [showApprovalCycle]=\"true\"\r\n [customCall]=\"false\"\r\n [fieldsForm]=\"formGroup\"\r\n (customCallEmit)=\"customCallSubmit($event)\"\r\n (resetFormEmit)=\"resetForm()\"\r\n />\r\n </div>\r\n}\r\n", styles: [".form-section-divide{--form-section-columns: 1fr 1fr}@media (max-width: 756px){.form-section-divide{--form-section-columns: 100%}}.form-section-divide .full{grid-column:1/-1}.head-title{position:relative;margin-bottom:12px}.head-title h3{display:inline-block;color:#8e9aa0;font-size:14px;font-weight:500;background-color:#fff;padding-inline-end:20px;position:relative;z-index:2;margin:0}.head-title:after{content:\"\";position:absolute;width:100%;height:1px;background-color:#dee0e2;top:50%;left:0;right:0;transform:translateY(-50%);z-index:1}.chamber{margin-bottom:20px}.chamber .chamber-content{background-color:#f8f8f8;padding:20px}.chamber .chamber-content .chamber-select{display:flex}.chamber .chamber-content mat-checkbox{font-size:14px}.section-item{margin-bottom:20px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ActionButtonsComponent, selector: "lib-action-buttons", inputs: ["lovOptions", "lovType", "fieldsForm", "form", "section", "sections", "showApprovalCycle", "customCall"], outputs: ["resetFormEmit", "customCallEmit"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: TextareaComponent, selector: "app-textarea", inputs: ["className", "preventSpecailChar", "maxLength"] }] });
|
|
7693
7928
|
}
|
|
7694
7929
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: RequestDetailsSectionComponent, decorators: [{
|
|
7695
7930
|
type: Component,
|
|
@@ -7713,9 +7948,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
7713
7948
|
SearchEmployeeComponent,
|
|
7714
7949
|
AttachmentSectionComponent,
|
|
7715
7950
|
TableComponent,
|
|
7716
|
-
TranslatePipe
|
|
7717
|
-
|
|
7718
|
-
], template: "<div>\r\n <form [ngClass]=\"{'form-section-divide form-section':!section?.header?.readOnly,'info-section':section?.header?.readOnly}\" [formGroup]=\"formGroup\">\r\n\r\n<app-textarea \r\n class=\"section-item full\" [isReadOnly]=\"isReadOnly\" \r\n formControlName=\"textArea\" \r\n label=\"Text-area\"></app-textarea>\r\n<!-- <app-textarea \r\n class=\"section-item full\" [isReadOnly]=\"isReadOnly\" \r\n [(ngModel)]=\"textArea\" (ngModelChange)=\"log($event)\"\r\n [ngModelOptions]=\"{standalone: true}\" [required]=\"true\"\r\n label=\"Text-area\"></app-textarea> -->\r\n <!-- <app-custom-searchable\r\n class=\"section-item mb-0 full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"customSearchable\"\r\n label=\"Custom searchable\"\r\n [options]=\"lov?.['approverActions']?.options\"\r\n [displayedLabel]=\"'name'\"\r\n [key]=\"'name'\"></app-custom-searchable> -->\r\n\r\n <!-- <app-attachment-section\r\n class=\"section-item full\"\r\n [descriptionRequired]=\"false\"\r\n label=\"Attachment section\"\r\n [commentsRequired]=\"false\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"attachmentSection\"></app-attachment-section> -->\r\n\r\n<!-- {{formGroup.valid}}-->\r\n<!-- <app-input class=\"section-item full\" [isReadOnly]=\"false\" [mandatory]=\"true\" [loading]=\"true\" type=\"enOnly\" formControlName=\"input\" label=\"Input\"></app-input>-->\r\n<!-- <app-checkbox\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"checkbox\"\r\n termsLabel=\"Terms and conditions\"\r\n label=\"check-box\"\r\n [containTerms]=\"true\"></app-checkbox>-->\r\n <!--\r\n <app-search-employee\r\n class=\"section-item full\"\r\n [multiple]=\"true\"\r\n [arrayList]=\"formGroup.get('searchEmployee').value\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"searchEmployee\"\r\n label=\"Search-employee\"></app-search-employee>\r\n <app-input class=\"section-item full\" [isReadOnly]=\"isReadOnly\" [loading]=\"true\" type=\"enOnly\" formControlName=\"input\" label=\"Input\"></app-input>\r\n <app-input-currency class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"currencyInput\" label=\"currency\"></app-input-currency>\r\n <app-input-email class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"emailInput\" label=\"email\"></app-input-email>\r\n <app-input-number class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"numberInput\" label=\"number\"></app-input-number>\r\n <app-custom-searchable\r\n class=\"section-item mb-0 full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"customSearchable\"\r\n label=\"Custom-searchable\"\r\n [options]=\"lov?.['approverActions']?.options\"\r\n [displayedLabel]=\"'name'\"\r\n [key]=\"'name'\"></app-custom-searchable>\r\n <app-checkbox\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"checkbox\"\r\n termsLabel=\"Terms and conditions\"\r\n label=\"check-box\"\r\n [containTerms]=\"true\"></app-checkbox>\r\n <app-textarea class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"textArea\" label=\"Text-area\"></app-textarea>\r\n\r\n <app-date-range-picker\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"datePickerRange\"\r\n label=\"Date-picker-range\"\r\n [matSuffix]=\"true\"></app-date-range-picker>\r\n <app-radio class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"radio\" [options]=\"options\" label=\"Radio\"></app-radio>-->\r\n <!-- <app-toggle-button\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"toggle\"\r\n [options]=\"lov?.['decision']?.options\"\r\n label=\"Toggle-button\"\r\n [displayedLabel]=\"'description'\"\r\n [key]=\"'value'\"></app-toggle-button>-->\r\n <!--<app-input-telephone class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"telephone\" label=\"Telephone\"></app-input-telephone>\r\n\r\n <app-file-uploader\r\n class=\"section-item full\"\r\n [callApi]=\"true\"\r\n [isReadOnly]=\"isReadOnly\"\r\n [multiple]=\"false\"\r\n label=\"attachment\"\r\n formControlName=\"attachment\"></app-file-uploader>\r\n\r\n <app-attachment-section\r\n class=\"section-item full\"\r\n [descriptionRequired]=\"false\"\r\n label=\"Attachment section\"\r\n [commentsRequired]=\"false\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"attachmentSection\"></app-attachment-section>\r\n-->\r\n\r\n\r\n\r\n <!-- <app-table\r\n [columnsConfig]=\"columnsConfig\"\r\n [columns]=\"columns\"\r\n [isError]=\"isError\"\r\n [isLoading]=\"isLoading\"\r\n [rows]=\"categoryData\" [hasPaginator]=\"true\"\r\n [pageSize]=\"pageSize\" [currentPage]=\"pageNumber\"\r\n [totalElements]=\"totalElements\"\r\n (pageChange)=\"pageChanged($event)\"\r\n class=\"new-primary-table full\">\r\n </app-table> -->\r\n\r\n<!-- <app-datepicker\r\n class=\"section-item full\"\r\n [isReadOnly]=\"false\"\r\n formControlName=\"datePicker\"\r\n [matSuffix]=\"true\"\r\n label=\"Date-picker\"></app-datepicker>-->\r\n\r\n\r\n </form>\r\n\r\n\r\n</div>\r\n@if (!section?.header?.readOnly) {\r\n <div class=\"mt-4\">\r\n <lib-action-buttons\r\n [lovOptions]=\"lov?.['decision']?.options\"\r\n [lovType]=\"lov?.['decision']?.type\"\r\n [section]=\"section\"\r\n [form]=\"form\"\r\n [sections]=\"form.sections\"\r\n [showApprovalCycle]=\"true\"\r\n [customCall]=\"false\"\r\n [fieldsForm]=\"formGroup\"\r\n (customCallEmit)=\"customCallSubmit($event)\"\r\n (resetFormEmit)=\"resetForm()\"\r\n />\r\n </div>\r\n}\r\n", styles: [".form-section-divide{--form-section-columns: 1fr 1fr}@media (max-width: 756px){.form-section-divide{--form-section-columns: 100%}}.form-section-divide .full{grid-column:1/-1}.head-title{position:relative;margin-bottom:12px}.head-title h3{display:inline-block;color:#8e9aa0;font-size:14px;font-weight:500;background-color:#fff;padding-inline-end:20px;position:relative;z-index:2;margin:0}.head-title:after{content:\"\";position:absolute;width:100%;height:1px;background-color:#dee0e2;top:50%;left:0;right:0;transform:translateY(-50%);z-index:1}.chamber{margin-bottom:20px}.chamber .chamber-content{background-color:#f8f8f8;padding:20px}.chamber .chamber-content .chamber-select{display:flex}.chamber .chamber-content mat-checkbox{font-size:14px}.section-item{margin-bottom:20px}\n"] }]
|
|
7951
|
+
TranslatePipe
|
|
7952
|
+
], template: "<div>\r\n <form [ngClass]=\"{'form-section-divide form-section':!section?.header?.readOnly,'info-section':section?.header?.readOnly}\" [formGroup]=\"formGroup\">\r\n\r\n <!-- <app-attachment-section\r\n class=\"section-item full\"\r\n [descriptionRequired]=\"false\"\r\n label=\"Attachment section\"\r\n [commentsRequired]=\"false\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"attachmentSection\"></app-attachment-section> -->\r\n\r\n<!-- {{formGroup.valid}}-->\r\n<!-- <app-input class=\"section-item full\" [isReadOnly]=\"false\" [mandatory]=\"true\" [loading]=\"true\" type=\"enOnly\" formControlName=\"input\" label=\"Input\"></app-input>-->\r\n<!-- <app-checkbox\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"checkbox\"\r\n termsLabel=\"Terms and conditions\"\r\n label=\"check-box\"></app-checkbox> -->\r\n\r\n <app-textarea class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"textArea\" label=\"Text-area\"></app-textarea>\r\n <!--\r\n <app-search-employee\r\n class=\"section-item full\"\r\n [multiple]=\"true\"\r\n [arrayList]=\"formGroup.get('searchEmployee').value\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"searchEmployee\"\r\n label=\"Search-employee\"></app-search-employee>\r\n <app-input class=\"section-item full\" [isReadOnly]=\"isReadOnly\" [loading]=\"true\" type=\"enOnly\" formControlName=\"input\" label=\"Input\"></app-input>\r\n <app-input-currency class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"currencyInput\" label=\"currency\"></app-input-currency>\r\n <app-input-email class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"emailInput\" label=\"email\"></app-input-email>\r\n <app-input-number class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"numberInput\" label=\"number\"></app-input-number>\r\n <app-custom-searchable\r\n class=\"section-item mb-0 full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"customSearchable\"\r\n label=\"Custom-searchable\"\r\n [options]=\"lov?.['approverActions']?.options\"\r\n [displayedLabel]=\"'name'\"\r\n [key]=\"'name'\"></app-custom-searchable>\r\n <app-checkbox\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"checkbox\"\r\n termsLabel=\"Terms and conditions\"\r\n label=\"check-box\"\r\n [containTerms]=\"true\"></app-checkbox>\r\n <app-textarea class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"textArea\" label=\"Text-area\"></app-textarea>\r\n\r\n <app-date-range-picker\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"datePickerRange\"\r\n label=\"Date-picker-range\"\r\n [matSuffix]=\"true\"></app-date-range-picker>\r\n <app-radio class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"radio\" [options]=\"options\" label=\"Radio\"></app-radio>-->\r\n <!-- <app-toggle-button\r\n class=\"section-item full\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"toggle\"\r\n [options]=\"lov?.['decision']?.options\"\r\n label=\"Toggle-button\"\r\n [displayedLabel]=\"'description'\"\r\n [key]=\"'value'\"></app-toggle-button>-->\r\n <!--<app-input-telephone class=\"section-item full\" [isReadOnly]=\"isReadOnly\" formControlName=\"telephone\" label=\"Telephone\"></app-input-telephone>\r\n\r\n <app-file-uploader\r\n class=\"section-item full\"\r\n [callApi]=\"true\"\r\n [isReadOnly]=\"isReadOnly\"\r\n [multiple]=\"false\"\r\n label=\"attachment\"\r\n formControlName=\"attachment\"></app-file-uploader>\r\n\r\n <app-attachment-section\r\n class=\"section-item full\"\r\n [descriptionRequired]=\"false\"\r\n label=\"Attachment section\"\r\n [commentsRequired]=\"false\"\r\n [isReadOnly]=\"isReadOnly\"\r\n formControlName=\"attachmentSection\"></app-attachment-section>\r\n-->\r\n\r\n\r\n\r\n <!-- <app-table\r\n [columnsConfig]=\"columnsConfig\"\r\n [columns]=\"columns\"\r\n [isError]=\"isError\"\r\n [isLoading]=\"isLoading\"\r\n [rows]=\"categoryData\" [hasPaginator]=\"true\"\r\n [pageSize]=\"pageSize\" [currentPage]=\"pageNumber\"\r\n [totalElements]=\"totalElements\"\r\n (pageChange)=\"pageChanged($event)\"\r\n class=\"new-primary-table full\">\r\n </app-table> -->\r\n\r\n<!-- <app-datepicker\r\n class=\"section-item full\"\r\n [isReadOnly]=\"false\"\r\n formControlName=\"datePicker\"\r\n [matSuffix]=\"true\"\r\n label=\"Date-picker\"></app-datepicker>-->\r\n\r\n\r\n </form>\r\n\r\n\r\n</div>\r\n@if (!section?.header?.readOnly) {\r\n <div class=\"mt-4\">\r\n <lib-action-buttons\r\n [lovOptions]=\"lov?.['decision']?.options\"\r\n [lovType]=\"lov?.['decision']?.type\"\r\n [section]=\"section\"\r\n [form]=\"form\"\r\n [sections]=\"form.sections\"\r\n [showApprovalCycle]=\"true\"\r\n [customCall]=\"false\"\r\n [fieldsForm]=\"formGroup\"\r\n (customCallEmit)=\"customCallSubmit($event)\"\r\n (resetFormEmit)=\"resetForm()\"\r\n />\r\n </div>\r\n}\r\n", styles: [".form-section-divide{--form-section-columns: 1fr 1fr}@media (max-width: 756px){.form-section-divide{--form-section-columns: 100%}}.form-section-divide .full{grid-column:1/-1}.head-title{position:relative;margin-bottom:12px}.head-title h3{display:inline-block;color:#8e9aa0;font-size:14px;font-weight:500;background-color:#fff;padding-inline-end:20px;position:relative;z-index:2;margin:0}.head-title:after{content:\"\";position:absolute;width:100%;height:1px;background-color:#dee0e2;top:50%;left:0;right:0;transform:translateY(-50%);z-index:1}.chamber{margin-bottom:20px}.chamber .chamber-content{background-color:#f8f8f8;padding:20px}.chamber .chamber-content .chamber-select{display:flex}.chamber .chamber-content mat-checkbox{font-size:14px}.section-item{margin-bottom:20px}\n"] }]
|
|
7719
7953
|
}], ctorParameters: () => [{ type: CoreI18nService }, { type: i4.FormBuilder }, { type: ActionStateService }], propDecorators: { isReadOnly: [{
|
|
7720
7954
|
type: Input
|
|
7721
7955
|
}], section: [{
|
|
@@ -7981,232 +8215,6 @@ var loadForm = {
|
|
|
7981
8215
|
}
|
|
7982
8216
|
};
|
|
7983
8217
|
|
|
7984
|
-
function encodePassword(formId, password) {
|
|
7985
|
-
const formIdString = Array.from(new TextEncoder().encode(formId), (x) => String.fromCodePoint(x)).join('');
|
|
7986
|
-
let encodedFormId = btoa(formIdString);
|
|
7987
|
-
let x = Math.floor(Math.random() * password.length);
|
|
7988
|
-
let [first, second] = [
|
|
7989
|
-
password.slice(0, x),
|
|
7990
|
-
password.slice(x),
|
|
7991
|
-
];
|
|
7992
|
-
let newPassword = first + encodedFormId + second;
|
|
7993
|
-
const binString = Array.from(new TextEncoder().encode(newPassword), (x) => String.fromCodePoint(x)).join('');
|
|
7994
|
-
newPassword = btoa(binString);
|
|
7995
|
-
return newPassword;
|
|
7996
|
-
}
|
|
7997
|
-
|
|
7998
|
-
const ACTION_ERROR_SUFFIX = '_ACTION';
|
|
7999
|
-
class ManageActionErrors {
|
|
8000
|
-
/*
|
|
8001
|
-
action error structure
|
|
8002
|
-
{error_key}_{action_name}ACTION_ERROR_SUFFIX
|
|
8003
|
-
e.g. required_REJECT_ACTION
|
|
8004
|
-
*/
|
|
8005
|
-
hasActionError(errors, action) {
|
|
8006
|
-
if (!errors)
|
|
8007
|
-
return false;
|
|
8008
|
-
return !!Object.keys(errors).filter(key => key.endsWith(`${action}${ACTION_ERROR_SUFFIX}`)).length;
|
|
8009
|
-
}
|
|
8010
|
-
hasOtherError(errors) {
|
|
8011
|
-
if (!errors)
|
|
8012
|
-
return false;
|
|
8013
|
-
const actionErrorKeys = this.getActionErrorKeys(errors);
|
|
8014
|
-
const allErrorKeys = this.getAllErrorKeys(errors);
|
|
8015
|
-
if (actionErrorKeys.size === allErrorKeys.size)
|
|
8016
|
-
return false;
|
|
8017
|
-
return true;
|
|
8018
|
-
}
|
|
8019
|
-
getActionErrorKeys(errors) {
|
|
8020
|
-
return new Set(
|
|
8021
|
-
//required_REJECT_ACTION => required
|
|
8022
|
-
Object.keys(errors).filter(actionKey => actionKey.endsWith(ACTION_ERROR_SUFFIX)).map(key => key.split('_')[0]));
|
|
8023
|
-
}
|
|
8024
|
-
getAllErrorKeys(errors) {
|
|
8025
|
-
return new Set(Object.keys(errors).filter(key => !key.endsWith(ACTION_ERROR_SUFFIX)));
|
|
8026
|
-
}
|
|
8027
|
-
addActionError(actions, errors) {
|
|
8028
|
-
const actionErrors = {};
|
|
8029
|
-
actions.forEach(action => {
|
|
8030
|
-
for (let key in errors) {
|
|
8031
|
-
actionErrors[`${key}_${action}${ACTION_ERROR_SUFFIX}`] = errors[key];
|
|
8032
|
-
}
|
|
8033
|
-
});
|
|
8034
|
-
return { ...errors, ...actionErrors };
|
|
8035
|
-
}
|
|
8036
|
-
}
|
|
8037
|
-
/**
|
|
8038
|
-
* Checks if the form group is valid for a specific action.
|
|
8039
|
-
* You should use this function to check form validity if you use `validateIfAction` function.
|
|
8040
|
-
* @param action The action to check against.
|
|
8041
|
-
* @param formGroup The form group or form array to validate.
|
|
8042
|
-
* @returns {boolean} True if all controls are valid for the action, false otherwise.
|
|
8043
|
-
*/
|
|
8044
|
-
function isValidForAction(action, formGroup) {
|
|
8045
|
-
return Object.entries(formGroup.controls).every(([controlName, control]) => {
|
|
8046
|
-
if (control instanceof FormGroup || control instanceof FormArray) {
|
|
8047
|
-
return isValidForAction(action, control);
|
|
8048
|
-
}
|
|
8049
|
-
const errors = control.errors;
|
|
8050
|
-
if (!errors)
|
|
8051
|
-
return true;
|
|
8052
|
-
const invalidAction = new ManageActionErrors().hasActionError(errors, action);
|
|
8053
|
-
if (invalidAction)
|
|
8054
|
-
return false;
|
|
8055
|
-
const hasOtherError = new ManageActionErrors().hasOtherError(errors);
|
|
8056
|
-
if (hasOtherError)
|
|
8057
|
-
return false;
|
|
8058
|
-
return true;
|
|
8059
|
-
});
|
|
8060
|
-
}
|
|
8061
|
-
/**
|
|
8062
|
-
* Updates the value and validity of all controls.
|
|
8063
|
-
* Use this function when your validators depend on the values of other controls.
|
|
8064
|
-
* @param formGroup The FormGroup or FormArray to update.
|
|
8065
|
-
* @returns {void}
|
|
8066
|
-
*/
|
|
8067
|
-
function updateValueAndValidity(formGroup) {
|
|
8068
|
-
Object.values(formGroup.controls).forEach((control) => {
|
|
8069
|
-
if (control instanceof FormGroup || control instanceof FormArray) {
|
|
8070
|
-
updateValueAndValidity(control);
|
|
8071
|
-
}
|
|
8072
|
-
else {
|
|
8073
|
-
control.updateValueAndValidity({ emitEvent: false });
|
|
8074
|
-
}
|
|
8075
|
-
});
|
|
8076
|
-
}
|
|
8077
|
-
/**
|
|
8078
|
-
* Validates a control only when a certain condition is met.
|
|
8079
|
-
* @param condition A function that returns a boolean indicating whether to apply the validator.
|
|
8080
|
-
* @param validator A single ValidatorFn or an array of ValidatorFns to apply if the condition is true.
|
|
8081
|
-
* @returns {ValidatorFn} A ValidatorFn that applies the given validator only when the condition is true.
|
|
8082
|
-
*/
|
|
8083
|
-
function validateOnlyWhen(condition, validator) {
|
|
8084
|
-
return (control) => {
|
|
8085
|
-
if (condition()) {
|
|
8086
|
-
return Array.isArray(validator) ? Validators.compose(validator)(control) : validator(control);
|
|
8087
|
-
}
|
|
8088
|
-
return null;
|
|
8089
|
-
};
|
|
8090
|
-
}
|
|
8091
|
-
/**
|
|
8092
|
-
* Validates a control if the current action is one of the specified actions.
|
|
8093
|
-
* @param actions An array of action names to check against.
|
|
8094
|
-
* @param validator A single ValidatorFn or an array of ValidatorFns to apply if the current action matches one of the actions.
|
|
8095
|
-
* @returns {ValidatorFn} A ValidatorFn that applies the given validator only if the current action is one of the specified actions.
|
|
8096
|
-
* */
|
|
8097
|
-
function validateIfAction(actions, validator) {
|
|
8098
|
-
return (control) => {
|
|
8099
|
-
const output = Array.isArray(validator) ? Validators.compose(validator)(control) : validator(control);
|
|
8100
|
-
if (output) {
|
|
8101
|
-
return new ManageActionErrors().addActionError(actions, output);
|
|
8102
|
-
}
|
|
8103
|
-
return null;
|
|
8104
|
-
};
|
|
8105
|
-
}
|
|
8106
|
-
/**
|
|
8107
|
-
* Logs the status of all controls in a FormGroup.
|
|
8108
|
-
* It traverses the form structure and logs whether each control is valid or invalid.
|
|
8109
|
-
* @param formGroup The FormGroup to log the status of.
|
|
8110
|
-
* @returns {void} This function does not return anything, it logs the status to the console.
|
|
8111
|
-
*/
|
|
8112
|
-
function logFormStatus(formGroup) {
|
|
8113
|
-
const stack = [{ controls: formGroup.controls, path: '' }];
|
|
8114
|
-
const status = {
|
|
8115
|
-
all: {},
|
|
8116
|
-
valid: {},
|
|
8117
|
-
invalid: {}
|
|
8118
|
-
};
|
|
8119
|
-
while (stack.length) {
|
|
8120
|
-
const { controls, path } = stack.pop();
|
|
8121
|
-
for (const key in controls) {
|
|
8122
|
-
const control = controls[key];
|
|
8123
|
-
const newPath = path ? `${path}.${key}` : key;
|
|
8124
|
-
if (control instanceof FormGroup) {
|
|
8125
|
-
stack.push({ controls: control.controls, path: newPath });
|
|
8126
|
-
}
|
|
8127
|
-
else if (control instanceof FormArray) {
|
|
8128
|
-
const formArrayControlsAsObj = control.controls.reduce((prev, current, index) => {
|
|
8129
|
-
prev[index] = current;
|
|
8130
|
-
return prev;
|
|
8131
|
-
}, {});
|
|
8132
|
-
stack.push({ controls: formArrayControlsAsObj, path: newPath });
|
|
8133
|
-
}
|
|
8134
|
-
else {
|
|
8135
|
-
status.all[newPath] = control.valid;
|
|
8136
|
-
if (control.valid)
|
|
8137
|
-
status.valid[newPath] = control.valid;
|
|
8138
|
-
else
|
|
8139
|
-
status.invalid[newPath] = control.valid;
|
|
8140
|
-
}
|
|
8141
|
-
}
|
|
8142
|
-
}
|
|
8143
|
-
console.log(status);
|
|
8144
|
-
}
|
|
8145
|
-
/**
|
|
8146
|
-
* A collection of custom validators for various data types.
|
|
8147
|
-
*/
|
|
8148
|
-
class DataValidators {
|
|
8149
|
-
/**
|
|
8150
|
-
* Validates that the control's value is a valid employee object.
|
|
8151
|
-
*/
|
|
8152
|
-
static employeeRequired(control) {
|
|
8153
|
-
if (control.value?.personEmail)
|
|
8154
|
-
return null;
|
|
8155
|
-
return { required: true };
|
|
8156
|
-
}
|
|
8157
|
-
/**
|
|
8158
|
-
* Validates that the control's value is a valid attachment object.
|
|
8159
|
-
*/
|
|
8160
|
-
static fileUploaderRequired(control) {
|
|
8161
|
-
if (control.value?.attachmentId)
|
|
8162
|
-
return null;
|
|
8163
|
-
return { required: true };
|
|
8164
|
-
}
|
|
8165
|
-
/**
|
|
8166
|
-
* Validates that the control's value is a valid attachments list.
|
|
8167
|
-
*/
|
|
8168
|
-
static multiFileUploaderRequired(control) {
|
|
8169
|
-
if (!Array.isArray(control.value))
|
|
8170
|
-
return { required: true };
|
|
8171
|
-
if (!control.value.length)
|
|
8172
|
-
return { required: true };
|
|
8173
|
-
if (control.value.every(item => item.attachmentId))
|
|
8174
|
-
return null;
|
|
8175
|
-
return { required: true };
|
|
8176
|
-
}
|
|
8177
|
-
/**
|
|
8178
|
-
* Validates that the control's value is a valid select object.
|
|
8179
|
-
* The select object should have a 'key' property.
|
|
8180
|
-
*/
|
|
8181
|
-
static selectRequired(control) {
|
|
8182
|
-
if (control.value?.key)
|
|
8183
|
-
return null;
|
|
8184
|
-
return { required: true };
|
|
8185
|
-
}
|
|
8186
|
-
}
|
|
8187
|
-
|
|
8188
|
-
function handelErrorResponse(obj, errorMsgs) {
|
|
8189
|
-
if (!obj.form) {
|
|
8190
|
-
obj.form = new Form(NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, errorMsgs);
|
|
8191
|
-
}
|
|
8192
|
-
else {
|
|
8193
|
-
obj.form.messages = errorMsgs;
|
|
8194
|
-
}
|
|
8195
|
-
window.scrollTo(0, 0);
|
|
8196
|
-
}
|
|
8197
|
-
|
|
8198
|
-
function dataURItoBlob(dataURI, mimeType) {
|
|
8199
|
-
const byteString = atob(dataURI);
|
|
8200
|
-
const arrayBuffer = new ArrayBuffer(byteString.length);
|
|
8201
|
-
const int8Array = new Uint8Array(arrayBuffer);
|
|
8202
|
-
for (let i = 0; i < byteString.length; i++) {
|
|
8203
|
-
int8Array[i] = byteString.charCodeAt(i);
|
|
8204
|
-
}
|
|
8205
|
-
const blob = new Blob([arrayBuffer], { type: mimeType || 'image/jpeg' });
|
|
8206
|
-
return blob;
|
|
8207
|
-
}
|
|
8208
|
-
;
|
|
8209
|
-
|
|
8210
8218
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8211
8219
|
function validateSAID() {
|
|
8212
8220
|
if (this?.personalInfoFormTemp) {
|