@seniorsistemas/angular-components 14.9.4 → 14.9.7
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/bundles/seniorsistemas-angular-components.umd.js +54 -6
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/custom-fields/custom-fields.component.d.ts +1 -0
- package/components/dynamic-form/components/lookup/lookup.component.d.ts +2 -0
- package/esm2015/components/custom-fields/custom-fields.component.js +12 -5
- package/esm2015/components/dynamic-form/components/lookup/lookup.component.js +45 -3
- package/esm5/components/custom-fields/custom-fields.component.js +12 -5
- package/esm5/components/dynamic-form/components/lookup/lookup.component.js +45 -3
- package/fesm2015/seniorsistemas-angular-components.js +54 -6
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +54 -6
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -1950,6 +1950,17 @@ var LookupComponent = /** @class */ (function () {
|
|
|
1950
1950
|
this.searchFields = this.searchFields.map(function (value) { return new FormField(__assign(__assign({}, value), { size: { sm: 12, md: 12, lg: 12, xl: 12 } })); });
|
|
1951
1951
|
this.searchGridFields = (this.searchGridFields || this.searchFields).map(function (gridField) {
|
|
1952
1952
|
gridField["width"] = _this.getColWidth(gridField.label);
|
|
1953
|
+
var calendarOptions = gridField.calendarLocaleOptions;
|
|
1954
|
+
if (calendarOptions === null || calendarOptions === void 0 ? void 0 : calendarOptions.dateFormat) {
|
|
1955
|
+
switch (gridField.type) {
|
|
1956
|
+
case FieldType.Date:
|
|
1957
|
+
calendarOptions.dateFormat = _this._convertToMomentDateFormat(calendarOptions.dateFormat);
|
|
1958
|
+
break;
|
|
1959
|
+
case FieldType.Time:
|
|
1960
|
+
calendarOptions.dateFormat = _this._convertToMomentHourFormat(calendarOptions.hourFormat, calendarOptions.dateFormat);
|
|
1961
|
+
break;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1953
1964
|
return gridField;
|
|
1954
1965
|
});
|
|
1955
1966
|
var formGroup = this.searchFields.reduce(function (result, field) {
|
|
@@ -1974,6 +1985,36 @@ var LookupComponent = /** @class */ (function () {
|
|
|
1974
1985
|
_this.onChange(newValue);
|
|
1975
1986
|
});
|
|
1976
1987
|
};
|
|
1988
|
+
LookupComponent.prototype._convertToMomentHourFormat = function (hourFormat, format) {
|
|
1989
|
+
if (format === "dd/mm/yy") { // valor padrão para o format.
|
|
1990
|
+
return "LTS";
|
|
1991
|
+
}
|
|
1992
|
+
if (hourFormat === "12") {
|
|
1993
|
+
return format
|
|
1994
|
+
.replace(/\bH\b/, "h") // hour (12 hour time) (no leading zero)
|
|
1995
|
+
.replace(/\bHH\b/, "hh"); // hour (12 hour time)
|
|
1996
|
+
}
|
|
1997
|
+
if (hourFormat === "24") {
|
|
1998
|
+
return format
|
|
1999
|
+
.replace(/\bh\b/, "H") // hour (24 hour time) (no leading zero)
|
|
2000
|
+
.replace(/\bhh\b/, "HH"); // hour (24 hour time)
|
|
2001
|
+
}
|
|
2002
|
+
return format;
|
|
2003
|
+
};
|
|
2004
|
+
LookupComponent.prototype._convertToMomentDateFormat = function (format) {
|
|
2005
|
+
// A ordem dos replaces é importante.
|
|
2006
|
+
return format
|
|
2007
|
+
.replace(/\bd\b/, "D") // day of month (no leading zero)
|
|
2008
|
+
.replace(/\bdd\b/, "DD") // day of month
|
|
2009
|
+
.replace(/\bo\b/, "DDD") // day of the year (no leading zero)
|
|
2010
|
+
.replace(/\boo\b/, "DDDD") // day of the year
|
|
2011
|
+
.replace(/\bM\b/, "MMM") // month name short
|
|
2012
|
+
.replace(/\bMM\b/, "MMMM") // month name long
|
|
2013
|
+
.replace(/\bm\b/, "M") // month of year (no leading)
|
|
2014
|
+
.replace(/\bmm\b/, "MM") // month of year
|
|
2015
|
+
.replace(/\by\b/, "YY") // year (two digits)
|
|
2016
|
+
.replace(/\byy\b/, "YYYY"); // year (four digits)
|
|
2017
|
+
};
|
|
1977
2018
|
LookupComponent.prototype.ngAfterViewInit = function () {
|
|
1978
2019
|
this.autocomplete.onOverlayAnimationDone = function (event) { };
|
|
1979
2020
|
};
|
|
@@ -1992,7 +2033,7 @@ var LookupComponent = /** @class */ (function () {
|
|
|
1992
2033
|
return this.lookupSuggestions;
|
|
1993
2034
|
};
|
|
1994
2035
|
LookupComponent.prototype.lazyLoadGrid = function (event) {
|
|
1995
|
-
//Ao definir uma ordenação na tabela do lookup esse método é chamado 2 vezes https://github.com/primefaces/primeng/issues/5480
|
|
2036
|
+
// Ao definir uma ordenação na tabela do lookup esse método é chamado 2 vezes https://github.com/primefaces/primeng/issues/5480
|
|
1996
2037
|
var filters = this.formGroupDialog.getRawValue();
|
|
1997
2038
|
var params = __assign(__assign({}, event), { filterData: filters });
|
|
1998
2039
|
var multiSortMeta = event.multiSortMeta;
|
|
@@ -2278,7 +2319,7 @@ var LookupComponent = /** @class */ (function () {
|
|
|
2278
2319
|
LookupComponent = LookupComponent_1 = __decorate([
|
|
2279
2320
|
Component({
|
|
2280
2321
|
selector: "s-lookup",
|
|
2281
|
-
template: "<div [ngClass]=\"{ inputgroup: showSearch }\">\n <p-autoComplete\n #autocomplete\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [dataKey]=\"dataKey\"\n [multiple]=\"multiple\"\n [inputId]=\"id + '-autocomplete'\"\n [forceSelection]=\"true\"\n [suggestions]=\"getLookupSuggestions()\"\n (completeMethod)=\"lazyLoadLookup($event)\"\n (onSelect)=\"onSelect.next($event)\"\n (onBlur)=\"onBlur.next($event)\"\n (onFocus)=\"onFocus.next($event)\"\n (onUnselect)=\"onUnselect.next($event)\"\n (onClear)=\"onClear.next($event)\"\n (onKeyUp)=\"onKeyUp.next($event)\"\n [field]=\"lookupDisplayField\"\n [emptyMessage]=\"lookupEmptyMessage\"\n [dropdown]=\"!showSearch\"\n [appendTo]=\"lookupAppendTo\"\n [placeholder]=\"placeholder || ' '\"\n [autoHighlight]=\"true\"\n inputStyleClass=\"mousetrap\"\n >\n </p-autoComplete>\n\n <button\n *ngIf=\"showSearch\"\n pButton\n type=\"button\"\n icon=\"fa fa-search\"\n class=\"button-addon\"\n [disabled]=\"disabled\"\n (click)=\"showDialog()\"\n ></button>\n</div>\n\n<p-dialog\n appendTo=\"body\"\n styleClass=\"s-lookup-modal\"\n [header]=\"searchTitle\"\n [(visible)]=\"dialogVisible\"\n [modal]=\"true\"\n (onHide)=\"hideDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"true\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n #dialog\n>\n <div *ngIf=\"dialogVisible\" class=\"s-lookup-modal-container\">\n <div *ngIf=\"searchFields && searchFields.length\" class=\"filter\"\n [@collapseContent]=\"collapsed ? {value: 'hidden', params: {transitionParams: transitionOptions }} : {value: 'visible', params: {transitionParams: transitionOptions}}\"\n (@collapseContent.done)=\"onToggleDone()\">\n <form [formGroup]=\"formGroupDialog\" novalidate autocomplete=\"off\">\n <div *ngIf=\"!collapsed\"\n [@childCollapseContent]=\"collapsed ? {value: ':leave', params: {transitionParams: transitionOptions }} : {value: ':enter', params: {transitionParams: transitionOptions}}\"\n class=\"form-content\">\n <div class=\"filter-title sds-section-title\">{{ filterTitle }}</div>\n <div class=\"form-fields\">\n <s-dynamic-form [fields]=\"searchFields\" [form]=\"formGroupDialog\"></s-dynamic-form>\n </div>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <s-button\n [id]=\"id + '-filter-button'\"\n type=\"submit\"\n [label]=\"filterLabel\"\n (onClick)=\"search()\"\n pTooltip=\"(ALT + SHIFT + F)\"\n showDelay=\"500\"\n ></s-button>\n <s-button\n [id]=\"id + '-clear-button'\"\n type=\"button\"\n [label]=\"clearLabel\"\n (onClick)=\"clear()\"\n priority=\"link\"\n pTooltip=\"(ALT + SHIFT + L)\"\n showDelay=\"500\"\n ></s-button>\n </div>\n </div>\n </div>\n </form> \n </div>\n <div *ngIf=\"searchFields && searchFields.length\" class=\"filter-toggle\">\n <div class=\"filter-toggle--start-border-mask\"></div>\n <button [id]=\"id + '-filter-toggle-button'\" type=\"button\" (click)=\"filterToggle()\">\n <span class=\"fa\" [ngClass]=\"{'fa-chevron-left': !collapsed, 'fa-chevron-right': collapsed}\"\n aria-hidden=\"true\"></span>\n </button>\n <div class=\"filter-toggle--end-border-mask\"></div>\n </div>\n <div class=\"content\" [ngClass]=\"{'empty-content': !searchTotalRecords && !loading}\">\n <s-empty-state\n [id]=\"id + '-empty-state'\"\n *ngIf=\"!searchTotalRecords && !loading\"\n [title]=\"searchEmptyTitle\"\n [description]=\"searchEmptyDescription\"\n iconClass=\"fa fa-search\"\n ></s-empty-state>\n\n <p-table\n [dataKey]=\"dataKey\"\n [value]=\"getGridData()\"\n [columns]=\"searchGridFields\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n sortMode=\"multiple\"\n [totalRecords]=\"searchTotalRecords\"\n [rows]=\"10\"\n [selection]=\"selected\"\n (onLazyLoad)=\"lazyLoadGrid($event)\"\n *sLoadingState=\"loading\"\n [multiSortMeta]=\"multiSortMeta\"\n [attr.data-hidden]=\"!searchTotalRecords && !loading\"\n [selectionMode]=\"multiple ? 'multiple' : 'single'\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngIf=\"multiple\" style=\"width: 50px\" />\n <col *ngFor=\"let col of columns\" [style.width]=\"col.width\" />\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngIf=\"multiple\" style=\"width: 50px\">\n <s-table-header-checkbox [useAllObject]=\"lookupRowProps ? false : true\" [rowProps]=\"lookupRowProps\"></s-table-header-checkbox>\n </th>\n <th\n [style.width]=\"col.width\"\n *ngFor=\"let col of columns\"\n [pSortableColumn]=\"col.name\"\n [pSortableColumnDisabled]=\"sortableColumnsDisabled?.includes(col.name)\"\n >\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.label }}</span>\n <p-sortIcon [field]=\"col.name\" *ngIf=\"!sortableColumnsDisabled?.includes(col.name)\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-columns let-rowIndex=\"rowIndex\">\n <tr sNavigation [pSelectableRow]=\"rowData\" [pSelectableRowIndex]=\"rowIndex\">\n <td *ngIf=\"multiple\" style=\"width: 50px\" tabindex=\"0\">\n <p-tableCheckbox [value]=\"rowData\" [pSelectableRow]=\"rowData\"></p-tableCheckbox>\n </td>\n <td\n [style.width]=\"col['width']\"\n *ngFor=\"let col of searchGridFields\"\n [ngSwitch]=\"col.type\"\n tabindex=\"0\"\n >\n <ng-container *ngSwitchCase=\"'Boolean'\">\n <ng-container *ngIf=\"isBooleanValue(rowData, col.name); else emptyTemplate\">\n <span>{{ getBooleanLabel(rowData, col.name, col.optionsLabel) }}</span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Date'\">\n <ng-container *ngIf=\"getFieldValue(rowData, col.name); else emptyTemplate\">\n <span>{{ getFieldValue(rowData, col.name) | localizedDate: \"L\" | async }}</span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <ng-container *ngIf=\"getFieldValue(rowData, col.name); else emptyTemplate\">\n <span>{{ getFieldValue(rowData, col.name) | localizedDate | async }}</span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Time'\">\n <ng-container *ngIf=\"getFieldValue(rowData, col.name); else emptyTemplate\">\n <span>{{ getFieldValue(rowData, col.name) | localizedTime | async }}</span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Double'\">\n <ng-container *ngIf=\"isNumber(rowData, col.name); else emptyTemplate\">\n <span> {{ getFieldValue(rowData, col.name) | localizedNumber: getScale(col.scale) | async }} </span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Money'\">\n <ng-container *ngIf=\"isNumber(rowData, col.name); else emptyTemplate\">\n <span> {{ getFieldValue(rowData, col.name) | localizedCurrency | async }} </span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Number'\">\n <ng-container *ngIf=\"isNumber(rowData, col.name); else emptyTemplate\">\n <span> {{ getFieldValue(rowData, col.name) | localizedBignumber: getNumberMaskConfig(col) | async }} </span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Enum'\">\n <ng-container\n *ngIf=\"getLabelForValue(getFieldValue(rowData, col.name), col.options); else emptyTemplate\"\n >\n <span> {{ getLabelForValue(getFieldValue(rowData, col.name), col.options) }} </span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <ng-container *ngIf=\"col.mask && col.mask()\">\n <ng-container *ngIf=\"(isNumber(rowData, col.name) || getFieldValue(rowData, col.name))\">\n <span>{{ getFieldValue(rowData, col.name) | sMaskFormatter: col.mask() }}</span>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"!(col.mask && col.mask())\">\n <ng-container *ngIf=\"(isNumber(rowData, col.name) || getFieldValue(rowData, col.name)); else emptyTemplate\">\n <span>{{ getFieldValue(rowData, col.name) }}</span>\n </ng-container>\n </ng-container>\n </ng-container>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [attr.data-hidden]=\"loading\">\n {{\n searchTotalRecordsLabel ||\n searchTotalRecords?.toString() + (searchTotalRecords === 1 ? recordLabel : recordsLabel)\n }}\n </span>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <p-footer>\n <s-button\n [id]=\"id + '-select-button'\"\n type=\"button\"\n [label]=\"selectLabel\"\n (onClick)=\"select()\"\n pTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\"\n [disabled]=\"!selected?.length\"\n ></s-button>\n <s-button\n [id]=\"id + '-cancel-button'\"\n type=\"button\"\n priority=\"link\"\n [label]=\"cancelLabel\"\n (onClick)=\"hideDialog()\"\n pTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\"\n ></s-button>\n </p-footer>\n</p-dialog>\n\n<ng-template #emptyTemplate>\n <span [ngClass]=\"'sds-empty-value'\">{{ emptyFieldLabel }}</span>\n</ng-template>\n",
|
|
2322
|
+
template: "<div [ngClass]=\"{ inputgroup: showSearch }\">\n <p-autoComplete\n #autocomplete\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [dataKey]=\"dataKey\"\n [multiple]=\"multiple\"\n [inputId]=\"id + '-autocomplete'\"\n [forceSelection]=\"true\"\n [suggestions]=\"getLookupSuggestions()\"\n (completeMethod)=\"lazyLoadLookup($event)\"\n (onSelect)=\"onSelect.next($event)\"\n (onBlur)=\"onBlur.next($event)\"\n (onFocus)=\"onFocus.next($event)\"\n (onUnselect)=\"onUnselect.next($event)\"\n (onClear)=\"onClear.next($event)\"\n (onKeyUp)=\"onKeyUp.next($event)\"\n [field]=\"lookupDisplayField\"\n [emptyMessage]=\"lookupEmptyMessage\"\n [dropdown]=\"!showSearch\"\n [appendTo]=\"lookupAppendTo\"\n [placeholder]=\"placeholder || ' '\"\n [autoHighlight]=\"true\"\n inputStyleClass=\"mousetrap\"\n >\n </p-autoComplete>\n\n <button\n *ngIf=\"showSearch\"\n pButton\n type=\"button\"\n icon=\"fa fa-search\"\n class=\"button-addon\"\n [disabled]=\"disabled\"\n (click)=\"showDialog()\"\n ></button>\n</div>\n\n<p-dialog\n appendTo=\"body\"\n styleClass=\"s-lookup-modal\"\n [header]=\"searchTitle\"\n [(visible)]=\"dialogVisible\"\n [modal]=\"true\"\n (onHide)=\"hideDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"true\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n #dialog\n>\n <div *ngIf=\"dialogVisible\" class=\"s-lookup-modal-container\">\n <div *ngIf=\"searchFields && searchFields.length\" class=\"filter\"\n [@collapseContent]=\"collapsed ? {value: 'hidden', params: {transitionParams: transitionOptions }} : {value: 'visible', params: {transitionParams: transitionOptions}}\"\n (@collapseContent.done)=\"onToggleDone()\">\n <form [formGroup]=\"formGroupDialog\" novalidate autocomplete=\"off\">\n <div *ngIf=\"!collapsed\"\n [@childCollapseContent]=\"collapsed ? {value: ':leave', params: {transitionParams: transitionOptions }} : {value: ':enter', params: {transitionParams: transitionOptions}}\"\n class=\"form-content\">\n <div class=\"filter-title sds-section-title\">{{ filterTitle }}</div>\n <div class=\"form-fields\">\n <s-dynamic-form [fields]=\"searchFields\" [form]=\"formGroupDialog\"></s-dynamic-form>\n </div>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <s-button\n [id]=\"id + '-filter-button'\"\n type=\"submit\"\n [label]=\"filterLabel\"\n (onClick)=\"search()\"\n pTooltip=\"(ALT + SHIFT + F)\"\n showDelay=\"500\"\n ></s-button>\n <s-button\n [id]=\"id + '-clear-button'\"\n type=\"button\"\n [label]=\"clearLabel\"\n (onClick)=\"clear()\"\n priority=\"link\"\n pTooltip=\"(ALT + SHIFT + L)\"\n showDelay=\"500\"\n ></s-button>\n </div>\n </div>\n </div>\n </form> \n </div>\n <div *ngIf=\"searchFields && searchFields.length\" class=\"filter-toggle\">\n <div class=\"filter-toggle--start-border-mask\"></div>\n <button [id]=\"id + '-filter-toggle-button'\" type=\"button\" (click)=\"filterToggle()\">\n <span class=\"fa\" [ngClass]=\"{'fa-chevron-left': !collapsed, 'fa-chevron-right': collapsed}\"\n aria-hidden=\"true\"></span>\n </button>\n <div class=\"filter-toggle--end-border-mask\"></div>\n </div>\n <div class=\"content\" [ngClass]=\"{'empty-content': !searchTotalRecords && !loading}\">\n <s-empty-state\n [id]=\"id + '-empty-state'\"\n *ngIf=\"!searchTotalRecords && !loading\"\n [title]=\"searchEmptyTitle\"\n [description]=\"searchEmptyDescription\"\n iconClass=\"fa fa-search\"\n ></s-empty-state>\n\n <p-table\n [dataKey]=\"dataKey\"\n [value]=\"getGridData()\"\n [columns]=\"searchGridFields\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n sortMode=\"multiple\"\n [totalRecords]=\"searchTotalRecords\"\n [rows]=\"10\"\n [selection]=\"selected\"\n (onLazyLoad)=\"lazyLoadGrid($event)\"\n *sLoadingState=\"loading\"\n [multiSortMeta]=\"multiSortMeta\"\n [attr.data-hidden]=\"!searchTotalRecords && !loading\"\n [selectionMode]=\"multiple ? 'multiple' : 'single'\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngIf=\"multiple\" style=\"width: 50px\" />\n <col *ngFor=\"let col of columns\" [style.width]=\"col.width\" />\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngIf=\"multiple\" style=\"width: 50px\">\n <s-table-header-checkbox [useAllObject]=\"lookupRowProps ? false : true\" [rowProps]=\"lookupRowProps\"></s-table-header-checkbox>\n </th>\n <th\n [style.width]=\"col.width\"\n *ngFor=\"let col of columns\"\n [pSortableColumn]=\"col.name\"\n [pSortableColumnDisabled]=\"sortableColumnsDisabled?.includes(col.name)\"\n >\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.label }}</span>\n <p-sortIcon [field]=\"col.name\" *ngIf=\"!sortableColumnsDisabled?.includes(col.name)\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-columns let-rowIndex=\"rowIndex\">\n <tr sNavigation [pSelectableRow]=\"rowData\" [pSelectableRowIndex]=\"rowIndex\">\n <td *ngIf=\"multiple\" style=\"width: 50px\" tabindex=\"0\">\n <p-tableCheckbox [value]=\"rowData\" [pSelectableRow]=\"rowData\"></p-tableCheckbox>\n </td>\n <td\n [style.width]=\"col['width']\"\n *ngFor=\"let col of searchGridFields\"\n [ngSwitch]=\"col.type\"\n tabindex=\"0\"\n >\n <ng-container *ngSwitchCase=\"'Boolean'\">\n <ng-container *ngIf=\"isBooleanValue(rowData, col.name); else emptyTemplate\">\n <span>{{ getBooleanLabel(rowData, col.name, col.optionsLabel) }}</span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Date'\">\n <ng-container *ngIf=\"getFieldValue(rowData, col.name); else emptyTemplate\">\n <span>{{ getFieldValue(rowData, col.name) | localizedDate: col.calendarLocaleOptions?.dateFormat || \"L\" | async }}</span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <ng-container *ngIf=\"getFieldValue(rowData, col.name); else emptyTemplate\">\n <span>{{ getFieldValue(rowData, col.name) | localizedDate | async }}</span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Time'\">\n <ng-container *ngIf=\"getFieldValue(rowData, col.name); else emptyTemplate\">\n <span>{{ getFieldValue(rowData, col.name) | localizedTime: col.calendarLocaleOptions?.dateFormat || \"LTS\" | async }}</span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Double'\">\n <ng-container *ngIf=\"isNumber(rowData, col.name); else emptyTemplate\">\n <span> {{ getFieldValue(rowData, col.name) | localizedNumber: getScale(col.scale) | async }} </span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Money'\">\n <ng-container *ngIf=\"isNumber(rowData, col.name); else emptyTemplate\">\n <span> {{ getFieldValue(rowData, col.name) | localizedCurrency | async }} </span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Number'\">\n <ng-container *ngIf=\"isNumber(rowData, col.name); else emptyTemplate\">\n <span> {{ getFieldValue(rowData, col.name) | localizedBignumber: getNumberMaskConfig(col) | async }} </span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Enum'\">\n <ng-container\n *ngIf=\"getLabelForValue(getFieldValue(rowData, col.name), col.options); else emptyTemplate\"\n >\n <span> {{ getLabelForValue(getFieldValue(rowData, col.name), col.options) }} </span>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <ng-container *ngIf=\"col.mask && col.mask()\">\n <ng-container *ngIf=\"(isNumber(rowData, col.name) || getFieldValue(rowData, col.name))\">\n <span>{{ getFieldValue(rowData, col.name) | sMaskFormatter: col.mask() }}</span>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"!(col.mask && col.mask())\">\n <ng-container *ngIf=\"(isNumber(rowData, col.name) || getFieldValue(rowData, col.name)); else emptyTemplate\">\n <span>{{ getFieldValue(rowData, col.name) }}</span>\n </ng-container>\n </ng-container>\n </ng-container>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [attr.data-hidden]=\"loading\">\n {{\n searchTotalRecordsLabel ||\n searchTotalRecords?.toString() + (searchTotalRecords === 1 ? recordLabel : recordsLabel)\n }}\n </span>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <p-footer>\n <s-button\n [id]=\"id + '-select-button'\"\n type=\"button\"\n [label]=\"selectLabel\"\n (onClick)=\"select()\"\n pTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\"\n [disabled]=\"!selected?.length\"\n ></s-button>\n <s-button\n [id]=\"id + '-cancel-button'\"\n type=\"button\"\n priority=\"link\"\n [label]=\"cancelLabel\"\n (onClick)=\"hideDialog()\"\n pTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\"\n ></s-button>\n </p-footer>\n</p-dialog>\n\n<ng-template #emptyTemplate>\n <span [ngClass]=\"'sds-empty-value'\">{{ emptyFieldLabel }}</span>\n</ng-template>\n",
|
|
2282
2323
|
providers: [
|
|
2283
2324
|
{
|
|
2284
2325
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -4931,6 +4972,9 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
4931
4972
|
validators.push(Validators.pattern(validationRegex));
|
|
4932
4973
|
if (fieldType === CustomFieldType.Integer && !formField.mask)
|
|
4933
4974
|
validators.push(Validators.pattern(/^\-?\d*$/));
|
|
4975
|
+
if (formField.required()) {
|
|
4976
|
+
validators.push(Validators.required);
|
|
4977
|
+
}
|
|
4934
4978
|
var control = new FormControl({ value: defaults[fieldType].defaultValue, disabled: _this.formGroup.disabled }, validators);
|
|
4935
4979
|
control.markAsDirty({ onlySelf: true });
|
|
4936
4980
|
_this.formGroup.addControl(formField.name, control);
|
|
@@ -5018,7 +5062,7 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
5018
5062
|
this.fields.forEach(function (field) {
|
|
5019
5063
|
var type = field.type, name = field.name, mask = field.mask, scale = field.scale;
|
|
5020
5064
|
var value = _this.formGroup.get(name).value;
|
|
5021
|
-
if (value)
|
|
5065
|
+
if (value) {
|
|
5022
5066
|
switch (type) {
|
|
5023
5067
|
case FieldType.Number:
|
|
5024
5068
|
if (mask)
|
|
@@ -5034,7 +5078,8 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
5034
5078
|
value = moment$3(value).format("HH:mm:ss");
|
|
5035
5079
|
break;
|
|
5036
5080
|
}
|
|
5037
|
-
|
|
5081
|
+
}
|
|
5082
|
+
if (value !== null && !Number.isNaN(value)) {
|
|
5038
5083
|
parsedValues[name] = value;
|
|
5039
5084
|
}
|
|
5040
5085
|
else if (_this.isTypeNumberOrEnum(type)) {
|
|
@@ -5090,7 +5135,7 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
5090
5135
|
parameters = {};
|
|
5091
5136
|
break;
|
|
5092
5137
|
}
|
|
5093
|
-
return new FormField(__assign({ name: field.id, label: field.customization.label, tooltip: field.customization.tooltip, type: field.type, mask: field.customization.mask, calendarOptions: localeOptions.calendar, currencyOptions: localeOptions.number }, parameters));
|
|
5138
|
+
return new FormField(__assign({ name: field.id, label: field.customization.label, tooltip: field.customization.tooltip, type: field.type, mask: field.customization.mask, required: function () { return field.customization.mandatory; }, calendarOptions: localeOptions.calendar, currencyOptions: localeOptions.number }, parameters));
|
|
5094
5139
|
};
|
|
5095
5140
|
CustomFieldsComponent.prototype.getEnumParameters = function (field) {
|
|
5096
5141
|
return {
|
|
@@ -5322,10 +5367,13 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
5322
5367
|
__decorate([
|
|
5323
5368
|
Input()
|
|
5324
5369
|
], CustomFieldsComponent.prototype, "requestAccessEndpoint", void 0);
|
|
5370
|
+
__decorate([
|
|
5371
|
+
Input()
|
|
5372
|
+
], CustomFieldsComponent.prototype, "requiredErrorMessage", void 0);
|
|
5325
5373
|
CustomFieldsComponent = CustomFieldsComponent_1 = __decorate([
|
|
5326
5374
|
Component({
|
|
5327
5375
|
selector: "s-custom-fields",
|
|
5328
|
-
template: "<s-dynamic-form [fields]=\"fields\" [form]=\"formGroup\" [errorMessages]=\"{pattern: invalidErrorLabel}\"></s-dynamic-form>",
|
|
5376
|
+
template: "<s-dynamic-form [fields]=\"fields\" [form]=\"formGroup\" [errorMessages]=\"{pattern: invalidErrorLabel, required: requiredErrorMessage}\"></s-dynamic-form>",
|
|
5329
5377
|
providers: [
|
|
5330
5378
|
{
|
|
5331
5379
|
provide: NG_VALUE_ACCESSOR,
|