@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
|
@@ -2133,6 +2133,17 @@
|
|
|
2133
2133
|
this.searchFields = this.searchFields.map(function (value) { return new FormField(__assign(__assign({}, value), { size: { sm: 12, md: 12, lg: 12, xl: 12 } })); });
|
|
2134
2134
|
this.searchGridFields = (this.searchGridFields || this.searchFields).map(function (gridField) {
|
|
2135
2135
|
gridField["width"] = _this.getColWidth(gridField.label);
|
|
2136
|
+
var calendarOptions = gridField.calendarLocaleOptions;
|
|
2137
|
+
if (calendarOptions === null || calendarOptions === void 0 ? void 0 : calendarOptions.dateFormat) {
|
|
2138
|
+
switch (gridField.type) {
|
|
2139
|
+
case exports.FieldType.Date:
|
|
2140
|
+
calendarOptions.dateFormat = _this._convertToMomentDateFormat(calendarOptions.dateFormat);
|
|
2141
|
+
break;
|
|
2142
|
+
case exports.FieldType.Time:
|
|
2143
|
+
calendarOptions.dateFormat = _this._convertToMomentHourFormat(calendarOptions.hourFormat, calendarOptions.dateFormat);
|
|
2144
|
+
break;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2136
2147
|
return gridField;
|
|
2137
2148
|
});
|
|
2138
2149
|
var formGroup = this.searchFields.reduce(function (result, field) {
|
|
@@ -2157,6 +2168,36 @@
|
|
|
2157
2168
|
_this.onChange(newValue);
|
|
2158
2169
|
});
|
|
2159
2170
|
};
|
|
2171
|
+
LookupComponent.prototype._convertToMomentHourFormat = function (hourFormat, format) {
|
|
2172
|
+
if (format === "dd/mm/yy") { // valor padrão para o format.
|
|
2173
|
+
return "LTS";
|
|
2174
|
+
}
|
|
2175
|
+
if (hourFormat === "12") {
|
|
2176
|
+
return format
|
|
2177
|
+
.replace(/\bH\b/, "h") // hour (12 hour time) (no leading zero)
|
|
2178
|
+
.replace(/\bHH\b/, "hh"); // hour (12 hour time)
|
|
2179
|
+
}
|
|
2180
|
+
if (hourFormat === "24") {
|
|
2181
|
+
return format
|
|
2182
|
+
.replace(/\bh\b/, "H") // hour (24 hour time) (no leading zero)
|
|
2183
|
+
.replace(/\bhh\b/, "HH"); // hour (24 hour time)
|
|
2184
|
+
}
|
|
2185
|
+
return format;
|
|
2186
|
+
};
|
|
2187
|
+
LookupComponent.prototype._convertToMomentDateFormat = function (format) {
|
|
2188
|
+
// A ordem dos replaces é importante.
|
|
2189
|
+
return format
|
|
2190
|
+
.replace(/\bd\b/, "D") // day of month (no leading zero)
|
|
2191
|
+
.replace(/\bdd\b/, "DD") // day of month
|
|
2192
|
+
.replace(/\bo\b/, "DDD") // day of the year (no leading zero)
|
|
2193
|
+
.replace(/\boo\b/, "DDDD") // day of the year
|
|
2194
|
+
.replace(/\bM\b/, "MMM") // month name short
|
|
2195
|
+
.replace(/\bMM\b/, "MMMM") // month name long
|
|
2196
|
+
.replace(/\bm\b/, "M") // month of year (no leading)
|
|
2197
|
+
.replace(/\bmm\b/, "MM") // month of year
|
|
2198
|
+
.replace(/\by\b/, "YY") // year (two digits)
|
|
2199
|
+
.replace(/\byy\b/, "YYYY"); // year (four digits)
|
|
2200
|
+
};
|
|
2160
2201
|
LookupComponent.prototype.ngAfterViewInit = function () {
|
|
2161
2202
|
this.autocomplete.onOverlayAnimationDone = function (event) { };
|
|
2162
2203
|
};
|
|
@@ -2175,7 +2216,7 @@
|
|
|
2175
2216
|
return this.lookupSuggestions;
|
|
2176
2217
|
};
|
|
2177
2218
|
LookupComponent.prototype.lazyLoadGrid = function (event) {
|
|
2178
|
-
//Ao definir uma ordenação na tabela do lookup esse método é chamado 2 vezes https://github.com/primefaces/primeng/issues/5480
|
|
2219
|
+
// Ao definir uma ordenação na tabela do lookup esse método é chamado 2 vezes https://github.com/primefaces/primeng/issues/5480
|
|
2179
2220
|
var filters = this.formGroupDialog.getRawValue();
|
|
2180
2221
|
var params = __assign(__assign({}, event), { filterData: filters });
|
|
2181
2222
|
var multiSortMeta = event.multiSortMeta;
|
|
@@ -2461,7 +2502,7 @@
|
|
|
2461
2502
|
LookupComponent = LookupComponent_1 = __decorate([
|
|
2462
2503
|
core.Component({
|
|
2463
2504
|
selector: "s-lookup",
|
|
2464
|
-
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",
|
|
2505
|
+
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",
|
|
2465
2506
|
providers: [
|
|
2466
2507
|
{
|
|
2467
2508
|
provide: forms.NG_VALUE_ACCESSOR,
|
|
@@ -5114,6 +5155,9 @@
|
|
|
5114
5155
|
validators.push(forms.Validators.pattern(validationRegex));
|
|
5115
5156
|
if (fieldType === CustomFieldType.Integer && !formField.mask)
|
|
5116
5157
|
validators.push(forms.Validators.pattern(/^\-?\d*$/));
|
|
5158
|
+
if (formField.required()) {
|
|
5159
|
+
validators.push(forms.Validators.required);
|
|
5160
|
+
}
|
|
5117
5161
|
var control = new forms.FormControl({ value: defaults[fieldType].defaultValue, disabled: _this.formGroup.disabled }, validators);
|
|
5118
5162
|
control.markAsDirty({ onlySelf: true });
|
|
5119
5163
|
_this.formGroup.addControl(formField.name, control);
|
|
@@ -5201,7 +5245,7 @@
|
|
|
5201
5245
|
this.fields.forEach(function (field) {
|
|
5202
5246
|
var type = field.type, name = field.name, mask = field.mask, scale = field.scale;
|
|
5203
5247
|
var value = _this.formGroup.get(name).value;
|
|
5204
|
-
if (value)
|
|
5248
|
+
if (value) {
|
|
5205
5249
|
switch (type) {
|
|
5206
5250
|
case exports.FieldType.Number:
|
|
5207
5251
|
if (mask)
|
|
@@ -5217,7 +5261,8 @@
|
|
|
5217
5261
|
value = moment$3(value).format("HH:mm:ss");
|
|
5218
5262
|
break;
|
|
5219
5263
|
}
|
|
5220
|
-
|
|
5264
|
+
}
|
|
5265
|
+
if (value !== null && !Number.isNaN(value)) {
|
|
5221
5266
|
parsedValues[name] = value;
|
|
5222
5267
|
}
|
|
5223
5268
|
else if (_this.isTypeNumberOrEnum(type)) {
|
|
@@ -5273,7 +5318,7 @@
|
|
|
5273
5318
|
parameters = {};
|
|
5274
5319
|
break;
|
|
5275
5320
|
}
|
|
5276
|
-
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));
|
|
5321
|
+
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));
|
|
5277
5322
|
};
|
|
5278
5323
|
CustomFieldsComponent.prototype.getEnumParameters = function (field) {
|
|
5279
5324
|
return {
|
|
@@ -5505,10 +5550,13 @@
|
|
|
5505
5550
|
__decorate([
|
|
5506
5551
|
core.Input()
|
|
5507
5552
|
], CustomFieldsComponent.prototype, "requestAccessEndpoint", void 0);
|
|
5553
|
+
__decorate([
|
|
5554
|
+
core.Input()
|
|
5555
|
+
], CustomFieldsComponent.prototype, "requiredErrorMessage", void 0);
|
|
5508
5556
|
CustomFieldsComponent = CustomFieldsComponent_1 = __decorate([
|
|
5509
5557
|
core.Component({
|
|
5510
5558
|
selector: "s-custom-fields",
|
|
5511
|
-
template: "<s-dynamic-form [fields]=\"fields\" [form]=\"formGroup\" [errorMessages]=\"{pattern: invalidErrorLabel}\"></s-dynamic-form>",
|
|
5559
|
+
template: "<s-dynamic-form [fields]=\"fields\" [form]=\"formGroup\" [errorMessages]=\"{pattern: invalidErrorLabel, required: requiredErrorMessage}\"></s-dynamic-form>",
|
|
5512
5560
|
providers: [
|
|
5513
5561
|
{
|
|
5514
5562
|
provide: forms.NG_VALUE_ACCESSOR,
|