@seniorsistemas/angular-components 14.5.1 → 14.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/seniorsistemas-angular-components.umd.js +197 -90
- 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/dynamic-form/components/lookup/lookup.component.d.ts +3 -0
- package/components/locale/pipes/localized-bignumber-impure.pipe.d.ts +6 -0
- package/components/locale/pipes/localized-bignumber.pipe.d.ts +9 -0
- package/components/locale/pipes/localized-currency-impure.pipe.d.ts +3 -0
- package/components/locale/pipes/localized-currency.pipe.d.ts +3 -0
- package/components/locale/pipes/localized-number.pipe.d.ts +3 -0
- package/components/table/table-column/table-columns.component.d.ts +1 -1
- package/esm2015/components/custom-fields/custom-fields.component.js +74 -30
- package/esm2015/components/dynamic-form/components/lookup/lookup.component.js +13 -3
- package/esm2015/components/dynamic-form/configurations/fields/bignumber-field.js +3 -2
- package/esm2015/components/locale/locale.module.js +9 -1
- package/esm2015/components/locale/pipes/localized-bignumber-impure.pipe.js +16 -0
- package/esm2015/components/locale/pipes/localized-bignumber.pipe.js +38 -0
- package/esm2015/components/locale/pipes/localized-currency-impure.pipe.js +4 -1
- package/esm2015/components/locale/pipes/localized-currency.pipe.js +4 -1
- package/esm2015/components/locale/pipes/localized-number.pipe.js +4 -1
- package/esm2015/components/table/table-column/table-columns.component.js +11 -20
- package/esm2015/seniorsistemas-angular-components.js +34 -32
- package/esm5/components/custom-fields/custom-fields.component.js +74 -30
- package/esm5/components/dynamic-form/components/lookup/lookup.component.js +13 -3
- package/esm5/components/dynamic-form/configurations/fields/bignumber-field.js +3 -2
- package/esm5/components/locale/locale.module.js +9 -1
- package/esm5/components/locale/pipes/localized-bignumber-impure.pipe.js +21 -0
- package/esm5/components/locale/pipes/localized-bignumber.pipe.js +39 -0
- package/esm5/components/locale/pipes/localized-currency-impure.pipe.js +4 -1
- package/esm5/components/locale/pipes/localized-currency.pipe.js +4 -1
- package/esm5/components/locale/pipes/localized-number.pipe.js +4 -1
- package/esm5/components/table/table-column/table-columns.component.js +11 -21
- package/esm5/seniorsistemas-angular-components.js +34 -32
- package/fesm2015/seniorsistemas-angular-components.js +156 -57
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +162 -58
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +2 -2
- package/seniorsistemas-angular-components.d.ts +33 -31
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -13,10 +13,11 @@ import { trigger, state, style, transition, animate, group, query, animateChild
|
|
|
13
13
|
import { FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR, FormControl, FormGroup, NG_VALIDATORS, Validators, FormArray } from '@angular/forms';
|
|
14
14
|
import { HttpClient, HttpEventType, HttpClientModule } from '@angular/common/http';
|
|
15
15
|
import { Hotkey, HotkeysService, HotkeyModule } from 'angular2-hotkeys';
|
|
16
|
+
import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';
|
|
16
17
|
import { AutoComplete, AutoCompleteModule } from 'primeng/autocomplete';
|
|
17
18
|
import { Dialog, DialogModule } from 'primeng/dialog';
|
|
18
19
|
import { Table, TableService, RowToggler, TableModule as TableModule$1 } from 'primeng/table';
|
|
19
|
-
import { AlignmentOptions, CurrencyMaskDirective as CurrencyMaskDirective$1 } from '@seniorsistemas/ng2-currency-mask';
|
|
20
|
+
import { applyMask, AlignmentOptions, CurrencyMaskDirective as CurrencyMaskDirective$1 } from '@seniorsistemas/ng2-currency-mask';
|
|
20
21
|
import { user } from '@seniorsistemas/senior-platform-data';
|
|
21
22
|
import * as moment_ from 'moment';
|
|
22
23
|
import { CookieService } from 'ngx-cookie-service';
|
|
@@ -41,7 +42,6 @@ import * as elementResizeDetectorMaker_ from 'element-resize-detector';
|
|
|
41
42
|
import { FocusTrapFactory, A11yModule } from '@angular/cdk/a11y';
|
|
42
43
|
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
|
43
44
|
import { Sidebar, SidebarModule as SidebarModule$1 } from 'primeng/sidebar';
|
|
44
|
-
import { BigNumber } from 'bignumber.js';
|
|
45
45
|
|
|
46
46
|
var BreadcrumbComponent = /** @class */ (function () {
|
|
47
47
|
function BreadcrumbComponent(activatedRoute, router) {
|
|
@@ -1170,6 +1170,54 @@ var LocaleService = /** @class */ (function () {
|
|
|
1170
1170
|
return LocaleService;
|
|
1171
1171
|
}());
|
|
1172
1172
|
|
|
1173
|
+
var LocalizedBignumberPipe = /** @class */ (function () {
|
|
1174
|
+
function LocalizedBignumberPipe(localeService) {
|
|
1175
|
+
this.localeService = localeService;
|
|
1176
|
+
}
|
|
1177
|
+
LocalizedBignumberPipe.prototype.transform = function (value, options) {
|
|
1178
|
+
return value !== undefined && value !== null ? this.applyMask(value, options) : of(value);
|
|
1179
|
+
};
|
|
1180
|
+
LocalizedBignumberPipe.prototype.applyMask = function (value, options) {
|
|
1181
|
+
return this.localeService.get().pipe(map(function (localeConfig) {
|
|
1182
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1183
|
+
var configs = {
|
|
1184
|
+
prefix: (_c = (_a = options.prefix) !== null && _a !== void 0 ? _a : (_b = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _b === void 0 ? void 0 : _b.currencySymbol) !== null && _c !== void 0 ? _c : "R$",
|
|
1185
|
+
thousandsSeparator: (_f = (_d = options === null || options === void 0 ? void 0 : options.thousandsSeparator) !== null && _d !== void 0 ? _d : (_e = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _e === void 0 ? void 0 : _e.thousandsSeparator) !== null && _f !== void 0 ? _f : ".",
|
|
1186
|
+
decimalSeparator: (_j = (_g = options === null || options === void 0 ? void 0 : options.decimalSeparator) !== null && _g !== void 0 ? _g : (_h = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _h === void 0 ? void 0 : _h.decimalSeparator) !== null && _j !== void 0 ? _j : ",",
|
|
1187
|
+
scale: (_k = options === null || options === void 0 ? void 0 : options.scale) !== null && _k !== void 0 ? _k : 2
|
|
1188
|
+
};
|
|
1189
|
+
var isNumber = !(new BigNumber(value).isNaN());
|
|
1190
|
+
return applyMask(value, configs, isNumber);
|
|
1191
|
+
}));
|
|
1192
|
+
};
|
|
1193
|
+
LocalizedBignumberPipe.ctorParameters = function () { return [
|
|
1194
|
+
{ type: LocaleService }
|
|
1195
|
+
]; };
|
|
1196
|
+
LocalizedBignumberPipe = __decorate([
|
|
1197
|
+
Pipe({
|
|
1198
|
+
name: "localizedBignumber",
|
|
1199
|
+
})
|
|
1200
|
+
], LocalizedBignumberPipe);
|
|
1201
|
+
return LocalizedBignumberPipe;
|
|
1202
|
+
}());
|
|
1203
|
+
|
|
1204
|
+
var LocalizedBignumberImpurePipe = /** @class */ (function (_super) {
|
|
1205
|
+
__extends(LocalizedBignumberImpurePipe, _super);
|
|
1206
|
+
function LocalizedBignumberImpurePipe() {
|
|
1207
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1208
|
+
}
|
|
1209
|
+
LocalizedBignumberImpurePipe.prototype.transform = function (value, options) {
|
|
1210
|
+
return _super.prototype.transform.call(this, value, options);
|
|
1211
|
+
};
|
|
1212
|
+
LocalizedBignumberImpurePipe = __decorate([
|
|
1213
|
+
Pipe({
|
|
1214
|
+
name: "localizedBignumberImpure",
|
|
1215
|
+
pure: false,
|
|
1216
|
+
})
|
|
1217
|
+
], LocalizedBignumberImpurePipe);
|
|
1218
|
+
return LocalizedBignumberImpurePipe;
|
|
1219
|
+
}(LocalizedBignumberPipe));
|
|
1220
|
+
|
|
1173
1221
|
var LocalizedCurrencyPipeOptions = /** @class */ (function (_super) {
|
|
1174
1222
|
__extends(LocalizedCurrencyPipeOptions, _super);
|
|
1175
1223
|
function LocalizedCurrencyPipeOptions(config) {
|
|
@@ -1180,6 +1228,9 @@ var LocalizedCurrencyPipeOptions = /** @class */ (function (_super) {
|
|
|
1180
1228
|
}
|
|
1181
1229
|
return LocalizedCurrencyPipeOptions;
|
|
1182
1230
|
}(NumberLocaleOptions));
|
|
1231
|
+
/**
|
|
1232
|
+
* @deprecated Should use localizedBignumberPipe instead
|
|
1233
|
+
*/
|
|
1183
1234
|
var LocalizedCurrencyPipe = /** @class */ (function () {
|
|
1184
1235
|
function LocalizedCurrencyPipe(localeService) {
|
|
1185
1236
|
this.localeService = localeService;
|
|
@@ -1218,6 +1269,9 @@ var LocalizedCurrencyPipe = /** @class */ (function () {
|
|
|
1218
1269
|
return LocalizedCurrencyPipe;
|
|
1219
1270
|
}());
|
|
1220
1271
|
|
|
1272
|
+
/**
|
|
1273
|
+
* @deprecated Should use localizedBignumberPipe instead
|
|
1274
|
+
*/
|
|
1221
1275
|
var LocalizedCurrencyImpurePipe = /** @class */ (function (_super) {
|
|
1222
1276
|
__extends(LocalizedCurrencyImpurePipe, _super);
|
|
1223
1277
|
function LocalizedCurrencyImpurePipe() {
|
|
@@ -1270,6 +1324,9 @@ var LocalizedDateImpurePipe = /** @class */ (function (_super) {
|
|
|
1270
1324
|
return LocalizedDateImpurePipe;
|
|
1271
1325
|
}(LocalizedDatePipe));
|
|
1272
1326
|
|
|
1327
|
+
/**
|
|
1328
|
+
* @deprecated Should use localizedBignumberPipe instead
|
|
1329
|
+
*/
|
|
1273
1330
|
var LocalizedNumberPipe = /** @class */ (function () {
|
|
1274
1331
|
function LocalizedNumberPipe(localeService) {
|
|
1275
1332
|
this.localeService = localeService;
|
|
@@ -1343,6 +1400,8 @@ var LocaleModule = /** @class */ (function () {
|
|
|
1343
1400
|
LocalizedCurrencyImpurePipe,
|
|
1344
1401
|
LocalizedDateImpurePipe,
|
|
1345
1402
|
LocalizedTimeImpurePipe,
|
|
1403
|
+
LocalizedBignumberPipe,
|
|
1404
|
+
LocalizedBignumberImpurePipe
|
|
1346
1405
|
],
|
|
1347
1406
|
};
|
|
1348
1407
|
};
|
|
@@ -1363,6 +1422,8 @@ var LocaleModule = /** @class */ (function () {
|
|
|
1363
1422
|
LocalizedCurrencyImpurePipe,
|
|
1364
1423
|
LocalizedDateImpurePipe,
|
|
1365
1424
|
LocalizedTimeImpurePipe,
|
|
1425
|
+
LocalizedBignumberPipe,
|
|
1426
|
+
LocalizedBignumberImpurePipe
|
|
1366
1427
|
],
|
|
1367
1428
|
declarations: [
|
|
1368
1429
|
LocalizedCurrencyPipe,
|
|
@@ -1372,6 +1433,8 @@ var LocaleModule = /** @class */ (function () {
|
|
|
1372
1433
|
LocalizedCurrencyImpurePipe,
|
|
1373
1434
|
LocalizedDateImpurePipe,
|
|
1374
1435
|
LocalizedTimeImpurePipe,
|
|
1436
|
+
LocalizedBignumberPipe,
|
|
1437
|
+
LocalizedBignumberImpurePipe
|
|
1375
1438
|
],
|
|
1376
1439
|
})
|
|
1377
1440
|
], LocaleModule);
|
|
@@ -1381,11 +1444,12 @@ var LocaleModule = /** @class */ (function () {
|
|
|
1381
1444
|
var BignumberField = /** @class */ (function (_super) {
|
|
1382
1445
|
__extends(BignumberField, _super);
|
|
1383
1446
|
function BignumberField(config) {
|
|
1447
|
+
var _a;
|
|
1384
1448
|
var _this = _super.call(this, config) || this;
|
|
1385
1449
|
_this.numberLocaleOptions = config.numberLocaleOptions || DEFAULT_NUMBER_LOCALE_OPTIONS;
|
|
1386
1450
|
_this.browserAutocomplete = config.browserAutocomplete;
|
|
1387
1451
|
_this.precision = config.precision;
|
|
1388
|
-
_this.scale = config.scale
|
|
1452
|
+
_this.scale = (_a = config.scale) !== null && _a !== void 0 ? _a : 2;
|
|
1389
1453
|
_this.alignTo = _this.scale ? AlignmentOptions.RIGHT : AlignmentOptions.LEFT;
|
|
1390
1454
|
_this.mask = config.mask;
|
|
1391
1455
|
_this.leftAddon = config.leftAddon;
|
|
@@ -2029,7 +2093,7 @@ var LookupComponent = /** @class */ (function () {
|
|
|
2029
2093
|
return this.emptyFieldLabel;
|
|
2030
2094
|
};
|
|
2031
2095
|
LookupComponent.prototype.isNumber = function (obj, path) {
|
|
2032
|
-
return
|
|
2096
|
+
return !(new BigNumber(this.getFieldValue(obj, path)).isNaN());
|
|
2033
2097
|
};
|
|
2034
2098
|
LookupComponent.prototype.setHotkeys = function () {
|
|
2035
2099
|
var _this = this;
|
|
@@ -2071,6 +2135,15 @@ var LookupComponent = /** @class */ (function () {
|
|
|
2071
2135
|
LookupComponent.prototype.isFunction = function (value) {
|
|
2072
2136
|
return value instanceof Function;
|
|
2073
2137
|
};
|
|
2138
|
+
LookupComponent.prototype.getNumberMaskConfig = function (col) {
|
|
2139
|
+
var _a, _b, _c;
|
|
2140
|
+
return {
|
|
2141
|
+
scale: this.getScale(col.scale),
|
|
2142
|
+
decimalSeparator: (_a = col.numberLocaleOptions) === null || _a === void 0 ? void 0 : _a.decimalSeparator,
|
|
2143
|
+
thousandsSeparator: (_b = col.numberLocaleOptions) === null || _b === void 0 ? void 0 : _b.thousandsSeparator,
|
|
2144
|
+
prefix: (_c = col.numberLocaleOptions) === null || _c === void 0 ? void 0 : _c.currencySymbol
|
|
2145
|
+
};
|
|
2146
|
+
};
|
|
2074
2147
|
var LookupComponent_1;
|
|
2075
2148
|
LookupComponent.nextId = 0;
|
|
2076
2149
|
LookupComponent.ctorParameters = function () { return [
|
|
@@ -2205,7 +2278,7 @@ var LookupComponent = /** @class */ (function () {
|
|
|
2205
2278
|
LookupComponent = LookupComponent_1 = __decorate([
|
|
2206
2279
|
Component({
|
|
2207
2280
|
selector: "s-lookup",
|
|
2208
|
-
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=\"'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",
|
|
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",
|
|
2209
2282
|
providers: [
|
|
2210
2283
|
{
|
|
2211
2284
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -3636,7 +3709,7 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
3636
3709
|
return uninformed;
|
|
3637
3710
|
}
|
|
3638
3711
|
else {
|
|
3639
|
-
var numberConfigs = __assign(__assign({}, locale.number), { scale: column.scale ? _this.getColumnScale(column.scale) : locale.number.scale });
|
|
3712
|
+
var numberConfigs = __assign(__assign({}, locale.number), { scale: column.scale ? _this.getColumnScale(column.scale) : locale.number.scale, prefix: locale.number.currencySymbol + " " });
|
|
3640
3713
|
switch (column.type) {
|
|
3641
3714
|
case EnumColumnFieldType.ENUM:
|
|
3642
3715
|
if (column.badgeConfigs && column.badgeConfigs.length) {
|
|
@@ -3644,7 +3717,7 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
3644
3717
|
}
|
|
3645
3718
|
return _this.translate.instant(column.enumPrefix + attributeValue.toString().toLowerCase());
|
|
3646
3719
|
case EnumColumnFieldType.CURRENCY:
|
|
3647
|
-
return
|
|
3720
|
+
return applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
|
|
3648
3721
|
case EnumColumnFieldType.DATE:
|
|
3649
3722
|
var dateFormat = column.dateFormat ? column.dateFormat : locale.calendar.dateFormat;
|
|
3650
3723
|
return moment_(attributeValue).format(dateFormat);
|
|
@@ -3655,7 +3728,8 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
3655
3728
|
case EnumColumnFieldType.STRING:
|
|
3656
3729
|
return attributeValue;
|
|
3657
3730
|
case EnumColumnFieldType.NUMBER:
|
|
3658
|
-
|
|
3731
|
+
numberConfigs.prefix = "";
|
|
3732
|
+
return applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
|
|
3659
3733
|
case EnumColumnFieldType.TOKENS:
|
|
3660
3734
|
return _this.getTokens(attributeValue);
|
|
3661
3735
|
}
|
|
@@ -3710,21 +3784,8 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
3710
3784
|
return tooltip;
|
|
3711
3785
|
}
|
|
3712
3786
|
};
|
|
3713
|
-
TableColumnsComponent.prototype.
|
|
3714
|
-
|
|
3715
|
-
var scale = options.scale, thousandsSeparator = options.thousandsSeparator, decimalSeparator = options.decimalSeparator;
|
|
3716
|
-
var currencySymbol = useCurrencySymbol ? options.currencySymbol : "";
|
|
3717
|
-
var rawValue = Number(value ? value : 0).toFixed(scale);
|
|
3718
|
-
var onlyNumbers = rawValue.replace(/[^0-9]/g, "");
|
|
3719
|
-
var integerPart = onlyNumbers
|
|
3720
|
-
.slice(0, onlyNumbers.length - scale)
|
|
3721
|
-
.replace(/^0*/g, "")
|
|
3722
|
-
.replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator) || "0";
|
|
3723
|
-
var decimalPart = onlyNumbers.slice(onlyNumbers.length - scale);
|
|
3724
|
-
var newValue = scale ? integerPart + decimalSeparator + decimalPart : integerPart;
|
|
3725
|
-
var isZero = !Number(onlyNumbers);
|
|
3726
|
-
var operator = rawValue.includes("-") && !isZero ? "-" : "";
|
|
3727
|
-
return "" + operator + currencySymbol + " " + newValue;
|
|
3787
|
+
TableColumnsComponent.prototype.isNumber = function (value) {
|
|
3788
|
+
return !(new BigNumber(value).isNaN());
|
|
3728
3789
|
};
|
|
3729
3790
|
TableColumnsComponent.prototype.getTokens = function (values) {
|
|
3730
3791
|
if (!this.isArray(values))
|
|
@@ -3788,9 +3849,9 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
3788
3849
|
], TableColumnsComponent.prototype, "locale", void 0);
|
|
3789
3850
|
TableColumnsComponent = __decorate([
|
|
3790
3851
|
Component({
|
|
3791
|
-
template: "\n<ng-template #columnsTemplate>\n <td *ngFor=\"let column of formattedColumns\" [ngStyle]=\"column.style\" (click)=\"column.onColumnClick ? column.onColumnClick(rowValue) : null\">\n\n <div *ngIf=\"column.type !== 'TOKENS' || !isArray(column.columnValue); else tokensTemplate\">\n\n <span *ngIf=\"column.type !== 'LINK'\" [pTooltip]=\"column.tooltip\" [escape]=\"false\" [ngClass]=\"column.badgeClass\">\n <ng-container *ngTemplateOutlet=\"columnValueTemplate\"></ng-container> \n </span>\n\n <a *ngIf=\"column.type === 'LINK'\" [pTooltip]=\"column.tooltip\" [escape]=\"false\" (click)=\"column.onLinkClick ? column.onLinkClick(rowValue) : null\">\n <ng-container *ngTemplateOutlet=\"columnValueTemplate\"></ng-container> \n </a>\n\n <ng-template #columnValueTemplate>\n <span *ngFor=\"let value of getSplittedString(column)\">\n <span [ngClass]=\"{ 'sds-
|
|
3852
|
+
template: "\n<ng-template #columnsTemplate>\n <td *ngFor=\"let column of formattedColumns\" [ngStyle]=\"column.style\" (click)=\"column.onColumnClick ? column.onColumnClick(rowValue) : null\">\n\n <div *ngIf=\"column.type !== 'TOKENS' || !isArray(column.columnValue); else tokensTemplate\">\n\n <span *ngIf=\"column.type !== 'LINK'\" [pTooltip]=\"column.tooltip\" [escape]=\"false\" [ngClass]=\"column.badgeClass\">\n <ng-container *ngTemplateOutlet=\"columnValueTemplate\"></ng-container> \n </span>\n\n <a *ngIf=\"column.type === 'LINK'\" [pTooltip]=\"column.tooltip\" [escape]=\"false\" (click)=\"column.onLinkClick ? column.onLinkClick(rowValue) : null\">\n <ng-container *ngTemplateOutlet=\"columnValueTemplate\"></ng-container> \n </a>\n\n <ng-template #columnValueTemplate>\n <span *ngFor=\"let value of getSplittedString(column)\">\n <span [ngClass]=\"{ 'sds-empty-value': value.isUninformed }\">{{value.value}}</span>\n <span>{{value.separator}}</span>\n </span>\n </ng-template>\n\n </div>\n\n <ng-template #tokensTemplate>\n <s-token-list\n [tokens]=\"column.columnValue\"\n [hidePointerEvents]=\"true\"\n >\n </s-token-list>\n </ng-template>\n\n </td>\n</ng-template>\n",
|
|
3792
3853
|
selector: "s-table-columns",
|
|
3793
|
-
styles: ["
|
|
3854
|
+
styles: [":host{display:none}"]
|
|
3794
3855
|
}),
|
|
3795
3856
|
__param(2, Inject("hostProjectConfigs"))
|
|
3796
3857
|
], TableColumnsComponent);
|
|
@@ -4756,6 +4817,21 @@ var CustomFieldsService = /** @class */ (function () {
|
|
|
4756
4817
|
return CustomFieldsService;
|
|
4757
4818
|
}());
|
|
4758
4819
|
|
|
4820
|
+
var CustomFieldType;
|
|
4821
|
+
(function (CustomFieldType) {
|
|
4822
|
+
CustomFieldType["String"] = "String";
|
|
4823
|
+
CustomFieldType["Boolean"] = "Boolean";
|
|
4824
|
+
CustomFieldType["Integer"] = "Integer";
|
|
4825
|
+
CustomFieldType["Double"] = "Double";
|
|
4826
|
+
CustomFieldType["Date"] = "Date";
|
|
4827
|
+
CustomFieldType["DateTime"] = "DateTime";
|
|
4828
|
+
CustomFieldType["Time"] = "Time";
|
|
4829
|
+
CustomFieldType["Money"] = "Money";
|
|
4830
|
+
CustomFieldType["Blob"] = "Blob";
|
|
4831
|
+
CustomFieldType["Binary"] = "Binary";
|
|
4832
|
+
CustomFieldType["Any"] = "Any";
|
|
4833
|
+
CustomFieldType["Enum"] = "Enum";
|
|
4834
|
+
})(CustomFieldType || (CustomFieldType = {}));
|
|
4759
4835
|
var moment$3 = moment_; // @HACK Necessary because of https://github.com/rollup/rollup/issues/670
|
|
4760
4836
|
var CustomFieldsComponent = /** @class */ (function () {
|
|
4761
4837
|
function CustomFieldsComponent(customFieldsService, localeService, sanitizer, translateService) {
|
|
@@ -4818,17 +4894,18 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
4818
4894
|
.subscribe(function (response) {
|
|
4819
4895
|
var _a = __read(response, 2), customFieldsResponse = _a[0], localeOptions = _a[1];
|
|
4820
4896
|
var defaults = {};
|
|
4821
|
-
defaults[
|
|
4822
|
-
defaults[
|
|
4823
|
-
defaults[
|
|
4824
|
-
defaults[
|
|
4825
|
-
defaults[
|
|
4826
|
-
defaults[
|
|
4827
|
-
defaults[
|
|
4828
|
-
defaults[
|
|
4829
|
-
defaults[
|
|
4830
|
-
defaults[
|
|
4831
|
-
defaults[
|
|
4897
|
+
defaults[CustomFieldType.String] = {};
|
|
4898
|
+
defaults[CustomFieldType.Boolean] = { defaultValue: false };
|
|
4899
|
+
defaults[CustomFieldType.Integer] = {};
|
|
4900
|
+
defaults[CustomFieldType.Double] = { defaultMask: "" };
|
|
4901
|
+
defaults[CustomFieldType.Money] = {};
|
|
4902
|
+
defaults[CustomFieldType.Date] = {};
|
|
4903
|
+
defaults[CustomFieldType.DateTime] = {};
|
|
4904
|
+
defaults[CustomFieldType.Time] = {};
|
|
4905
|
+
defaults[CustomFieldType.Blob] = {};
|
|
4906
|
+
defaults[CustomFieldType.Enum] = {};
|
|
4907
|
+
defaults[CustomFieldType.Binary] = {};
|
|
4908
|
+
defaults[CustomFieldType.Any] = {};
|
|
4832
4909
|
if (!customFieldsResponse || !customFieldsResponse.entity_)
|
|
4833
4910
|
return;
|
|
4834
4911
|
var _b = customFieldsResponse.entity_, active = _b.active, fields = _b.fields;
|
|
@@ -4838,16 +4915,23 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
4838
4915
|
.filter(function (field) { return field.customizable && field.customization && field.customization.active; })
|
|
4839
4916
|
.forEach(function (field) {
|
|
4840
4917
|
var formField = _this.getFormField(field, localeOptions);
|
|
4841
|
-
|
|
4918
|
+
var fieldType = field.type;
|
|
4919
|
+
if (field.type === CustomFieldType.Blob && _this.value && _this.value[formField.name])
|
|
4842
4920
|
_this.createBlobToFileUpload(formField);
|
|
4843
4921
|
var validationRegex = field.customization.validationRegex;
|
|
4844
|
-
var asIsTypes = [
|
|
4922
|
+
var asIsTypes = [
|
|
4923
|
+
CustomFieldType.Boolean,
|
|
4924
|
+
CustomFieldType.Money,
|
|
4925
|
+
CustomFieldType.Date,
|
|
4926
|
+
CustomFieldType.DateTime,
|
|
4927
|
+
CustomFieldType.Time
|
|
4928
|
+
];
|
|
4845
4929
|
var validators = [];
|
|
4846
|
-
if (validationRegex && asIsTypes.
|
|
4930
|
+
if (validationRegex && !asIsTypes.includes(fieldType))
|
|
4847
4931
|
validators.push(Validators.pattern(validationRegex));
|
|
4848
|
-
if (
|
|
4932
|
+
if (fieldType === CustomFieldType.Integer && !formField.mask)
|
|
4849
4933
|
validators.push(Validators.pattern(/^\-?\d*$/));
|
|
4850
|
-
var control = new FormControl({ value: defaults[
|
|
4934
|
+
var control = new FormControl({ value: defaults[fieldType].defaultValue, disabled: _this.formGroup.disabled }, validators);
|
|
4851
4935
|
control.markAsDirty({ onlySelf: true });
|
|
4852
4936
|
_this.formGroup.addControl(formField.name, control);
|
|
4853
4937
|
_this.fields.push(formField);
|
|
@@ -4932,17 +5016,13 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
4932
5016
|
var _this = this;
|
|
4933
5017
|
var parsedValues = {};
|
|
4934
5018
|
this.fields.forEach(function (field) {
|
|
4935
|
-
var type = field.type, name = field.name, mask = field.mask;
|
|
5019
|
+
var type = field.type, name = field.name, mask = field.mask, scale = field.scale;
|
|
4936
5020
|
var value = _this.formGroup.get(name).value;
|
|
4937
5021
|
if (value)
|
|
4938
5022
|
switch (type) {
|
|
4939
|
-
case FieldType.
|
|
4940
|
-
if (mask)
|
|
4941
|
-
value = parseInt(value, 10);
|
|
4942
|
-
break;
|
|
4943
|
-
case FieldType.Double:
|
|
5023
|
+
case FieldType.Number:
|
|
4944
5024
|
if (mask)
|
|
4945
|
-
value =
|
|
5025
|
+
value = new BigNumber(value).toFixed(scale).toString();
|
|
4946
5026
|
break;
|
|
4947
5027
|
case FieldType.Date:
|
|
4948
5028
|
value = moment$3(value).format("YYYY-MM-DD");
|
|
@@ -4954,7 +5034,7 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
4954
5034
|
value = moment$3(value).format("HH:mm:ss");
|
|
4955
5035
|
break;
|
|
4956
5036
|
}
|
|
4957
|
-
if (value
|
|
5037
|
+
if (value !== null && !(new BigNumber(value).isNaN())) {
|
|
4958
5038
|
parsedValues[name] = value;
|
|
4959
5039
|
}
|
|
4960
5040
|
else if (_this.isTypeNumberOrEnum(type)) {
|
|
@@ -4966,22 +5046,46 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
4966
5046
|
return parsedValues;
|
|
4967
5047
|
};
|
|
4968
5048
|
CustomFieldsComponent.prototype.isTypeNumberOrEnum = function (type) {
|
|
4969
|
-
|
|
5049
|
+
var numberOrEnum = [
|
|
5050
|
+
FieldType.Number,
|
|
5051
|
+
FieldType.Enum
|
|
5052
|
+
];
|
|
5053
|
+
return numberOrEnum.includes(type);
|
|
4970
5054
|
};
|
|
4971
5055
|
CustomFieldsComponent.prototype.getFormField = function (field, localeOptions) {
|
|
5056
|
+
var _a, _b;
|
|
4972
5057
|
var parameters;
|
|
4973
5058
|
switch (field.type) {
|
|
4974
|
-
case
|
|
5059
|
+
case CustomFieldType.Blob:
|
|
4975
5060
|
parameters = this.getBlobParameters();
|
|
4976
5061
|
break;
|
|
4977
|
-
case
|
|
5062
|
+
case CustomFieldType.Boolean:
|
|
4978
5063
|
parameters = this.getBooleanParameters();
|
|
4979
5064
|
break;
|
|
4980
5065
|
case "Enumeration":
|
|
4981
|
-
case
|
|
5066
|
+
case CustomFieldType.Enum:
|
|
4982
5067
|
field.type = FieldType.Enum;
|
|
4983
5068
|
parameters = this.getEnumParameters(field);
|
|
4984
5069
|
break;
|
|
5070
|
+
case CustomFieldType.Money:
|
|
5071
|
+
parameters = {
|
|
5072
|
+
type: FieldType.Number,
|
|
5073
|
+
leftAddon: {
|
|
5074
|
+
label: (_b = (_a = localeOptions === null || localeOptions === void 0 ? void 0 : localeOptions.number) === null || _a === void 0 ? void 0 : _a.currencySymbol) !== null && _b !== void 0 ? _b : "R$",
|
|
5075
|
+
},
|
|
5076
|
+
};
|
|
5077
|
+
break;
|
|
5078
|
+
case CustomFieldType.Double:
|
|
5079
|
+
parameters = {
|
|
5080
|
+
type: FieldType.Number
|
|
5081
|
+
};
|
|
5082
|
+
break;
|
|
5083
|
+
case CustomFieldType.Integer:
|
|
5084
|
+
parameters = {
|
|
5085
|
+
type: FieldType.Number,
|
|
5086
|
+
scale: 0
|
|
5087
|
+
};
|
|
5088
|
+
break;
|
|
4985
5089
|
default:
|
|
4986
5090
|
parameters = {};
|
|
4987
5091
|
break;
|
|
@@ -5039,7 +5143,7 @@ var CustomFieldsComponent = /** @class */ (function () {
|
|
|
5039
5143
|
* com os fields inseridos e deletados.
|
|
5040
5144
|
*/
|
|
5041
5145
|
CustomFieldsComponent.prototype.createFieldCustomization = function (fields) {
|
|
5042
|
-
this.hasBlob = !!fields.filter(function (field) { return field.type ===
|
|
5146
|
+
this.hasBlob = !!fields.filter(function (field) { return field.type === CustomFieldType.Blob; }).length;
|
|
5043
5147
|
if (this.hasBlob) {
|
|
5044
5148
|
this.formGroup.addControl("fieldCustomization", new FormArray([
|
|
5045
5149
|
new FormGroup({
|
|
@@ -6285,9 +6389,9 @@ var StatsCardComponent = /** @class */ (function () {
|
|
|
6285
6389
|
});
|
|
6286
6390
|
StatsCardComponent.prototype.updateDisplayValue = function () {
|
|
6287
6391
|
var _this = this;
|
|
6288
|
-
var previousRawValue = new BigNumber(this.previousValue.replace(/\D/g, ""));
|
|
6289
|
-
var rawValue = new BigNumber(this.value.replace(/\D/g, ""));
|
|
6290
|
-
var eachAnimationDuration = new BigNumber(this.ANIMATION_DURATION_MS).dividedBy(new BigNumber(this.STEP_DURATION_MS));
|
|
6392
|
+
var previousRawValue = new BigNumber$1(this.previousValue.replace(/\D/g, ""));
|
|
6393
|
+
var rawValue = new BigNumber$1(this.value.replace(/\D/g, ""));
|
|
6394
|
+
var eachAnimationDuration = new BigNumber$1(this.ANIMATION_DURATION_MS).dividedBy(new BigNumber$1(this.STEP_DURATION_MS));
|
|
6291
6395
|
var incrementValue = rawValue.minus(previousRawValue).absoluteValue().dividedBy(eachAnimationDuration).dp(0, 7);
|
|
6292
6396
|
var incremental = previousRawValue.isLessThan(rawValue);
|
|
6293
6397
|
clearInterval(this.intervalId);
|
|
@@ -6905,5 +7009,5 @@ var AngularComponentsModule = /** @class */ (function () {
|
|
|
6905
7009
|
* Generated bundle index. Do not edit.
|
|
6906
7010
|
*/
|
|
6907
7011
|
|
|
6908
|
-
export { AngularComponentsModule, AutocompleteField, BignumberField, BignumberInputDirective, BignumberInputModule, BooleanField, BooleanOptionsLabel, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ButtonComponent, ButtonModule, ButtonPriority, ButtonSize, CalendarField, CalendarLocaleOptions, CalendarMaskDirective, CalendarMaskModule, ChipsField, CollapseLinkComponent, CollapseLinkModule, ControlErrorsComponent, ControlErrorsModule, CurrencyField, CustomFieldsComponent, CustomFieldsModule, CustomFieldsService, DEFAULT_CALENDAR_LOCALE_OPTIONS, DEFAULT_LOCALE_OPTIONS, DEFAULT_NUMBER_LOCALE_OPTIONS, DynamicConfig, DynamicFormComponent, DynamicFormModule, DynamicType, EditableOverlayDirective, EditableOverlayModule, EmptyStateComponent, EmptyStateModule, EnumBadgeColors, EnumColumnFieldType, ExportUtils, Field, FieldType, Fieldset, FileUploadComponent, FileUploadModule, FormField, GlobalSearchComponent, GlobalSearchDropdownItemComponent, GlobalSearchModule, GlobalSearchSizeEnum, ImageCropperComponent, ImageCropperModule, ImageCropperService, InfoSignDirective, InfoSignModule, LoadingStateComponent, LoadingStateDirective, LoadingStateModule, LocaleModule, LocaleOptions, LocaleService, LocalizedCurrencyPipe, LocalizedCurrencyPipeOptions, LocalizedDateImpurePipe, LocalizedDatePipe, LocalizedNumberInputDirective, LocalizedNumberInputModule, LocalizedNumberPipe, LocalizedTimeImpurePipe, LocalizedTimePipe, LongPressDirective, LookupComponent, LookupField, MaskFormatterModule, MaskFormatterPipe, MouseEventsModule, NavigationDirective, NumberAlignmentOption, NumberField, NumberInputDirective, NumberInputModule, NumberLocaleOptions, ObjectCardComponent, ObjectCardFieldComponent, ObjectCardMainComponent, ObjectCardModule, Option, ProductHeaderComponent, ProductHeaderModule, RadioButtonField, RationButtonOption, RowTogllerDirective, Section, SelectField, SelectOption, SidebarComponent, SidebarModule, StatsCardComponent, StatsCardModule, StepState, StepsComponent, StepsModule, Structure, TableHeaderCheckboxComponent, TableHeaderCheckboxModule, TableModule, TextAreaField, TextField, ThumbnailComponent, ThumbnailModule, ThumbnailSize, TileComponent, TileModule, TokenListComponent, TokenListModule, ValidateErrors, LocalizedCurrencyImpurePipe as ɵa,
|
|
7012
|
+
export { AngularComponentsModule, AutocompleteField, BignumberField, BignumberInputDirective, BignumberInputModule, BooleanField, BooleanOptionsLabel, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ButtonComponent, ButtonModule, ButtonPriority, ButtonSize, CalendarField, CalendarLocaleOptions, CalendarMaskDirective, CalendarMaskModule, ChipsField, CollapseLinkComponent, CollapseLinkModule, ControlErrorsComponent, ControlErrorsModule, CurrencyField, CustomFieldsComponent, CustomFieldsModule, CustomFieldsService, DEFAULT_CALENDAR_LOCALE_OPTIONS, DEFAULT_LOCALE_OPTIONS, DEFAULT_NUMBER_LOCALE_OPTIONS, DynamicConfig, DynamicFormComponent, DynamicFormModule, DynamicType, EditableOverlayDirective, EditableOverlayModule, EmptyStateComponent, EmptyStateModule, EnumBadgeColors, EnumColumnFieldType, ExportUtils, Field, FieldType, Fieldset, FileUploadComponent, FileUploadModule, FormField, GlobalSearchComponent, GlobalSearchDropdownItemComponent, GlobalSearchModule, GlobalSearchSizeEnum, ImageCropperComponent, ImageCropperModule, ImageCropperService, InfoSignDirective, InfoSignModule, LoadingStateComponent, LoadingStateDirective, LoadingStateModule, LocaleModule, LocaleOptions, LocaleService, LocalizedCurrencyPipe, LocalizedCurrencyPipeOptions, LocalizedDateImpurePipe, LocalizedDatePipe, LocalizedNumberInputDirective, LocalizedNumberInputModule, LocalizedNumberPipe, LocalizedTimeImpurePipe, LocalizedTimePipe, LongPressDirective, LookupComponent, LookupField, MaskFormatterModule, MaskFormatterPipe, MouseEventsModule, NavigationDirective, NumberAlignmentOption, NumberField, NumberInputDirective, NumberInputModule, NumberLocaleOptions, ObjectCardComponent, ObjectCardFieldComponent, ObjectCardMainComponent, ObjectCardModule, Option, ProductHeaderComponent, ProductHeaderModule, RadioButtonField, RationButtonOption, RowTogllerDirective, Section, SelectField, SelectOption, SidebarComponent, SidebarModule, StatsCardComponent, StatsCardModule, StepState, StepsComponent, StepsModule, Structure, TableHeaderCheckboxComponent, TableHeaderCheckboxModule, TableModule, TextAreaField, TextField, ThumbnailComponent, ThumbnailModule, ThumbnailSize, TileComponent, TileModule, TokenListComponent, TokenListModule, ValidateErrors, LocalizedCurrencyImpurePipe as ɵa, LocalizedBignumberPipe as ɵb, DecimalField as ɵba, StructureModule as ɵbb, HeaderComponent as ɵbc, FooterComponent as ɵbd, InfoSignComponent as ɵbe, NumberLocaleOptions as ɵbf, ThumbnailService as ɵbg, InfiniteScrollModule as ɵbh, InfiniteScrollDirective as ɵbi, LocalizedBignumberImpurePipe as ɵc, TokenListModule as ɵd, TableColumnsComponent as ɵe, InfoSignModule as ɵf, AutocompleteFieldComponent as ɵg, BooleanFieldComponent as ɵh, CalendarFieldComponent as ɵi, ChipsFieldComponent as ɵj, CurrencyFieldComponent as ɵk, BaseFieldComponent as ɵl, DynamicFieldComponent as ɵm, DynamicFormDirective as ɵn, FieldsetComponent as ɵo, FileUploadComponent$1 as ɵp, LookupFieldComponent as ɵq, NumberFieldComponent as ɵr, BignumberFieldComponent as ɵs, RadioButtonComponent as ɵt, RowComponent as ɵu, SectionComponent as ɵv, SelectFieldComponent as ɵw, TextAreaFieldComponent as ɵx, TextFieldComponent as ɵy };
|
|
6909
7013
|
//# sourceMappingURL=seniorsistemas-angular-components.js.map
|