@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
|
let BreadcrumbComponent = class BreadcrumbComponent {
|
|
47
47
|
constructor(activatedRoute, router) {
|
|
@@ -1111,12 +1111,57 @@ LocaleService = __decorate([
|
|
|
1111
1111
|
Injectable()
|
|
1112
1112
|
], LocaleService);
|
|
1113
1113
|
|
|
1114
|
+
let LocalizedBignumberPipe = class LocalizedBignumberPipe {
|
|
1115
|
+
constructor(localeService) {
|
|
1116
|
+
this.localeService = localeService;
|
|
1117
|
+
}
|
|
1118
|
+
transform(value, options) {
|
|
1119
|
+
return value !== undefined && value !== null ? this.applyMask(value, options) : of(value);
|
|
1120
|
+
}
|
|
1121
|
+
applyMask(value, options) {
|
|
1122
|
+
return this.localeService.get().pipe(map(localeConfig => {
|
|
1123
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1124
|
+
const configs = {
|
|
1125
|
+
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$",
|
|
1126
|
+
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 : ".",
|
|
1127
|
+
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 : ",",
|
|
1128
|
+
scale: (_k = options === null || options === void 0 ? void 0 : options.scale) !== null && _k !== void 0 ? _k : 2
|
|
1129
|
+
};
|
|
1130
|
+
const isNumber = !(new BigNumber(value).isNaN());
|
|
1131
|
+
return applyMask(value, configs, isNumber);
|
|
1132
|
+
}));
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
LocalizedBignumberPipe.ctorParameters = () => [
|
|
1136
|
+
{ type: LocaleService }
|
|
1137
|
+
];
|
|
1138
|
+
LocalizedBignumberPipe = __decorate([
|
|
1139
|
+
Pipe({
|
|
1140
|
+
name: "localizedBignumber",
|
|
1141
|
+
})
|
|
1142
|
+
], LocalizedBignumberPipe);
|
|
1143
|
+
|
|
1144
|
+
let LocalizedBignumberImpurePipe = class LocalizedBignumberImpurePipe extends LocalizedBignumberPipe {
|
|
1145
|
+
transform(value, options) {
|
|
1146
|
+
return super.transform(value, options);
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
LocalizedBignumberImpurePipe = __decorate([
|
|
1150
|
+
Pipe({
|
|
1151
|
+
name: "localizedBignumberImpure",
|
|
1152
|
+
pure: false,
|
|
1153
|
+
})
|
|
1154
|
+
], LocalizedBignumberImpurePipe);
|
|
1155
|
+
|
|
1114
1156
|
class LocalizedCurrencyPipeOptions extends NumberLocaleOptions {
|
|
1115
1157
|
constructor(config = {}) {
|
|
1116
1158
|
super(config);
|
|
1117
1159
|
this.scale = 2;
|
|
1118
1160
|
}
|
|
1119
1161
|
}
|
|
1162
|
+
/**
|
|
1163
|
+
* @deprecated Should use localizedBignumberPipe instead
|
|
1164
|
+
*/
|
|
1120
1165
|
let LocalizedCurrencyPipe = class LocalizedCurrencyPipe {
|
|
1121
1166
|
constructor(localeService) {
|
|
1122
1167
|
this.localeService = localeService;
|
|
@@ -1154,6 +1199,9 @@ LocalizedCurrencyPipe = __decorate([
|
|
|
1154
1199
|
})
|
|
1155
1200
|
], LocalizedCurrencyPipe);
|
|
1156
1201
|
|
|
1202
|
+
/**
|
|
1203
|
+
* @deprecated Should use localizedBignumberPipe instead
|
|
1204
|
+
*/
|
|
1157
1205
|
let LocalizedCurrencyImpurePipe = class LocalizedCurrencyImpurePipe extends LocalizedCurrencyPipe {
|
|
1158
1206
|
transform(value, options = new LocalizedCurrencyPipeOptions()) {
|
|
1159
1207
|
return super.transform(value, options);
|
|
@@ -1193,6 +1241,9 @@ LocalizedDateImpurePipe = __decorate([
|
|
|
1193
1241
|
})
|
|
1194
1242
|
], LocalizedDateImpurePipe);
|
|
1195
1243
|
|
|
1244
|
+
/**
|
|
1245
|
+
* @deprecated Should use localizedBignumberPipe instead
|
|
1246
|
+
*/
|
|
1196
1247
|
let LocalizedNumberPipe = class LocalizedNumberPipe {
|
|
1197
1248
|
constructor(localeService) {
|
|
1198
1249
|
this.localeService = localeService;
|
|
@@ -1256,6 +1307,8 @@ let LocaleModule = LocaleModule_1 = class LocaleModule {
|
|
|
1256
1307
|
LocalizedCurrencyImpurePipe,
|
|
1257
1308
|
LocalizedDateImpurePipe,
|
|
1258
1309
|
LocalizedTimeImpurePipe,
|
|
1310
|
+
LocalizedBignumberPipe,
|
|
1311
|
+
LocalizedBignumberImpurePipe
|
|
1259
1312
|
],
|
|
1260
1313
|
};
|
|
1261
1314
|
}
|
|
@@ -1276,6 +1329,8 @@ LocaleModule = LocaleModule_1 = __decorate([
|
|
|
1276
1329
|
LocalizedCurrencyImpurePipe,
|
|
1277
1330
|
LocalizedDateImpurePipe,
|
|
1278
1331
|
LocalizedTimeImpurePipe,
|
|
1332
|
+
LocalizedBignumberPipe,
|
|
1333
|
+
LocalizedBignumberImpurePipe
|
|
1279
1334
|
],
|
|
1280
1335
|
declarations: [
|
|
1281
1336
|
LocalizedCurrencyPipe,
|
|
@@ -1285,17 +1340,20 @@ LocaleModule = LocaleModule_1 = __decorate([
|
|
|
1285
1340
|
LocalizedCurrencyImpurePipe,
|
|
1286
1341
|
LocalizedDateImpurePipe,
|
|
1287
1342
|
LocalizedTimeImpurePipe,
|
|
1343
|
+
LocalizedBignumberPipe,
|
|
1344
|
+
LocalizedBignumberImpurePipe
|
|
1288
1345
|
],
|
|
1289
1346
|
})
|
|
1290
1347
|
], LocaleModule);
|
|
1291
1348
|
|
|
1292
1349
|
class BignumberField extends Field {
|
|
1293
1350
|
constructor(config) {
|
|
1351
|
+
var _a;
|
|
1294
1352
|
super(config);
|
|
1295
1353
|
this.numberLocaleOptions = config.numberLocaleOptions || DEFAULT_NUMBER_LOCALE_OPTIONS;
|
|
1296
1354
|
this.browserAutocomplete = config.browserAutocomplete;
|
|
1297
1355
|
this.precision = config.precision;
|
|
1298
|
-
this.scale = config.scale
|
|
1356
|
+
this.scale = (_a = config.scale) !== null && _a !== void 0 ? _a : 2;
|
|
1299
1357
|
this.alignTo = this.scale ? AlignmentOptions.RIGHT : AlignmentOptions.LEFT;
|
|
1300
1358
|
this.mask = config.mask;
|
|
1301
1359
|
this.leftAddon = config.leftAddon;
|
|
@@ -1874,7 +1932,7 @@ let LookupComponent = LookupComponent_1 = class LookupComponent {
|
|
|
1874
1932
|
return this.emptyFieldLabel;
|
|
1875
1933
|
}
|
|
1876
1934
|
isNumber(obj, path) {
|
|
1877
|
-
return
|
|
1935
|
+
return !(new BigNumber(this.getFieldValue(obj, path)).isNaN());
|
|
1878
1936
|
}
|
|
1879
1937
|
setHotkeys() {
|
|
1880
1938
|
const clearHotkey = this.newHotkey("alt+shift+l", this.clear.bind(this));
|
|
@@ -1915,6 +1973,15 @@ let LookupComponent = LookupComponent_1 = class LookupComponent {
|
|
|
1915
1973
|
isFunction(value) {
|
|
1916
1974
|
return value instanceof Function;
|
|
1917
1975
|
}
|
|
1976
|
+
getNumberMaskConfig(col) {
|
|
1977
|
+
var _a, _b, _c;
|
|
1978
|
+
return {
|
|
1979
|
+
scale: this.getScale(col.scale),
|
|
1980
|
+
decimalSeparator: (_a = col.numberLocaleOptions) === null || _a === void 0 ? void 0 : _a.decimalSeparator,
|
|
1981
|
+
thousandsSeparator: (_b = col.numberLocaleOptions) === null || _b === void 0 ? void 0 : _b.thousandsSeparator,
|
|
1982
|
+
prefix: (_c = col.numberLocaleOptions) === null || _c === void 0 ? void 0 : _c.currencySymbol
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1918
1985
|
};
|
|
1919
1986
|
LookupComponent.nextId = 0;
|
|
1920
1987
|
LookupComponent.ctorParameters = () => [
|
|
@@ -2049,7 +2116,7 @@ __decorate([
|
|
|
2049
2116
|
LookupComponent = LookupComponent_1 = __decorate([
|
|
2050
2117
|
Component({
|
|
2051
2118
|
selector: "s-lookup",
|
|
2052
|
-
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",
|
|
2119
|
+
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",
|
|
2053
2120
|
providers: [
|
|
2054
2121
|
{
|
|
2055
2122
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -3387,7 +3454,7 @@ let TableColumnsComponent = class TableColumnsComponent {
|
|
|
3387
3454
|
return uninformed;
|
|
3388
3455
|
}
|
|
3389
3456
|
else {
|
|
3390
|
-
const numberConfigs = Object.assign(Object.assign({}, locale.number), { scale: column.scale ? this.getColumnScale(column.scale) : locale.number.scale });
|
|
3457
|
+
const numberConfigs = Object.assign(Object.assign({}, locale.number), { scale: column.scale ? this.getColumnScale(column.scale) : locale.number.scale, prefix: `${locale.number.currencySymbol} ` });
|
|
3391
3458
|
switch (column.type) {
|
|
3392
3459
|
case EnumColumnFieldType.ENUM:
|
|
3393
3460
|
if (column.badgeConfigs && column.badgeConfigs.length) {
|
|
@@ -3395,7 +3462,7 @@ let TableColumnsComponent = class TableColumnsComponent {
|
|
|
3395
3462
|
}
|
|
3396
3463
|
return this.translate.instant(column.enumPrefix + attributeValue.toString().toLowerCase());
|
|
3397
3464
|
case EnumColumnFieldType.CURRENCY:
|
|
3398
|
-
return
|
|
3465
|
+
return applyMask(attributeValue, numberConfigs, this.isNumber(attributeValue));
|
|
3399
3466
|
case EnumColumnFieldType.DATE:
|
|
3400
3467
|
const dateFormat = column.dateFormat ? column.dateFormat : locale.calendar.dateFormat;
|
|
3401
3468
|
return moment_(attributeValue).format(dateFormat);
|
|
@@ -3406,7 +3473,8 @@ let TableColumnsComponent = class TableColumnsComponent {
|
|
|
3406
3473
|
case EnumColumnFieldType.STRING:
|
|
3407
3474
|
return attributeValue;
|
|
3408
3475
|
case EnumColumnFieldType.NUMBER:
|
|
3409
|
-
|
|
3476
|
+
numberConfigs.prefix = "";
|
|
3477
|
+
return applyMask(attributeValue, numberConfigs, this.isNumber(attributeValue));
|
|
3410
3478
|
case EnumColumnFieldType.TOKENS:
|
|
3411
3479
|
return this.getTokens(attributeValue);
|
|
3412
3480
|
}
|
|
@@ -3461,20 +3529,8 @@ let TableColumnsComponent = class TableColumnsComponent {
|
|
|
3461
3529
|
return tooltip;
|
|
3462
3530
|
}
|
|
3463
3531
|
}
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
const currencySymbol = useCurrencySymbol ? options.currencySymbol : "";
|
|
3467
|
-
const rawValue = Number(value ? value : 0).toFixed(scale);
|
|
3468
|
-
const onlyNumbers = rawValue.replace(/[^0-9]/g, ``);
|
|
3469
|
-
const integerPart = onlyNumbers
|
|
3470
|
-
.slice(0, onlyNumbers.length - scale)
|
|
3471
|
-
.replace(/^0*/g, ``)
|
|
3472
|
-
.replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator) || `0`;
|
|
3473
|
-
const decimalPart = onlyNumbers.slice(onlyNumbers.length - scale);
|
|
3474
|
-
const newValue = scale ? integerPart + decimalSeparator + decimalPart : integerPart;
|
|
3475
|
-
const isZero = !Number(onlyNumbers);
|
|
3476
|
-
const operator = rawValue.includes("-") && !isZero ? "-" : "";
|
|
3477
|
-
return `${operator}${currencySymbol} ${newValue}`;
|
|
3532
|
+
isNumber(value) {
|
|
3533
|
+
return !(new BigNumber(value).isNaN());
|
|
3478
3534
|
}
|
|
3479
3535
|
getTokens(values) {
|
|
3480
3536
|
if (!this.isArray(values))
|
|
@@ -3539,9 +3595,9 @@ __decorate([
|
|
|
3539
3595
|
], TableColumnsComponent.prototype, "locale", void 0);
|
|
3540
3596
|
TableColumnsComponent = __decorate([
|
|
3541
3597
|
Component({
|
|
3542
|
-
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-
|
|
3598
|
+
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",
|
|
3543
3599
|
selector: "s-table-columns",
|
|
3544
|
-
styles: ["
|
|
3600
|
+
styles: [":host{display:none}"]
|
|
3545
3601
|
}),
|
|
3546
3602
|
__param(2, Inject("hostProjectConfigs"))
|
|
3547
3603
|
], TableColumnsComponent);
|
|
@@ -4448,6 +4504,21 @@ CustomFieldsService = __decorate([
|
|
|
4448
4504
|
], CustomFieldsService);
|
|
4449
4505
|
|
|
4450
4506
|
var CustomFieldsComponent_1;
|
|
4507
|
+
var CustomFieldType;
|
|
4508
|
+
(function (CustomFieldType) {
|
|
4509
|
+
CustomFieldType["String"] = "String";
|
|
4510
|
+
CustomFieldType["Boolean"] = "Boolean";
|
|
4511
|
+
CustomFieldType["Integer"] = "Integer";
|
|
4512
|
+
CustomFieldType["Double"] = "Double";
|
|
4513
|
+
CustomFieldType["Date"] = "Date";
|
|
4514
|
+
CustomFieldType["DateTime"] = "DateTime";
|
|
4515
|
+
CustomFieldType["Time"] = "Time";
|
|
4516
|
+
CustomFieldType["Money"] = "Money";
|
|
4517
|
+
CustomFieldType["Blob"] = "Blob";
|
|
4518
|
+
CustomFieldType["Binary"] = "Binary";
|
|
4519
|
+
CustomFieldType["Any"] = "Any";
|
|
4520
|
+
CustomFieldType["Enum"] = "Enum";
|
|
4521
|
+
})(CustomFieldType || (CustomFieldType = {}));
|
|
4451
4522
|
const moment$3 = moment_; // @HACK Necessary because of https://github.com/rollup/rollup/issues/670
|
|
4452
4523
|
let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponent {
|
|
4453
4524
|
constructor(customFieldsService, localeService, sanitizer, translateService) {
|
|
@@ -4507,17 +4578,18 @@ let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponen
|
|
|
4507
4578
|
.subscribe((response) => {
|
|
4508
4579
|
const [customFieldsResponse, localeOptions] = response;
|
|
4509
4580
|
const defaults = {};
|
|
4510
|
-
defaults[
|
|
4511
|
-
defaults[
|
|
4512
|
-
defaults[
|
|
4513
|
-
defaults[
|
|
4514
|
-
defaults[
|
|
4515
|
-
defaults[
|
|
4516
|
-
defaults[
|
|
4517
|
-
defaults[
|
|
4518
|
-
defaults[
|
|
4519
|
-
defaults[
|
|
4520
|
-
defaults[
|
|
4581
|
+
defaults[CustomFieldType.String] = {};
|
|
4582
|
+
defaults[CustomFieldType.Boolean] = { defaultValue: false };
|
|
4583
|
+
defaults[CustomFieldType.Integer] = {};
|
|
4584
|
+
defaults[CustomFieldType.Double] = { defaultMask: "" };
|
|
4585
|
+
defaults[CustomFieldType.Money] = {};
|
|
4586
|
+
defaults[CustomFieldType.Date] = {};
|
|
4587
|
+
defaults[CustomFieldType.DateTime] = {};
|
|
4588
|
+
defaults[CustomFieldType.Time] = {};
|
|
4589
|
+
defaults[CustomFieldType.Blob] = {};
|
|
4590
|
+
defaults[CustomFieldType.Enum] = {};
|
|
4591
|
+
defaults[CustomFieldType.Binary] = {};
|
|
4592
|
+
defaults[CustomFieldType.Any] = {};
|
|
4521
4593
|
if (!customFieldsResponse || !customFieldsResponse.entity_)
|
|
4522
4594
|
return;
|
|
4523
4595
|
const { active, fields } = customFieldsResponse.entity_;
|
|
@@ -4527,16 +4599,23 @@ let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponen
|
|
|
4527
4599
|
.filter((field) => field.customizable && field.customization && field.customization.active)
|
|
4528
4600
|
.forEach((field) => {
|
|
4529
4601
|
const formField = this.getFormField(field, localeOptions);
|
|
4530
|
-
|
|
4602
|
+
const fieldType = field.type;
|
|
4603
|
+
if (field.type === CustomFieldType.Blob && this.value && this.value[formField.name])
|
|
4531
4604
|
this.createBlobToFileUpload(formField);
|
|
4532
4605
|
const { validationRegex } = field.customization;
|
|
4533
|
-
const asIsTypes = [
|
|
4606
|
+
const asIsTypes = [
|
|
4607
|
+
CustomFieldType.Boolean,
|
|
4608
|
+
CustomFieldType.Money,
|
|
4609
|
+
CustomFieldType.Date,
|
|
4610
|
+
CustomFieldType.DateTime,
|
|
4611
|
+
CustomFieldType.Time
|
|
4612
|
+
];
|
|
4534
4613
|
const validators = [];
|
|
4535
|
-
if (validationRegex && asIsTypes.
|
|
4614
|
+
if (validationRegex && !asIsTypes.includes(fieldType))
|
|
4536
4615
|
validators.push(Validators.pattern(validationRegex));
|
|
4537
|
-
if (
|
|
4616
|
+
if (fieldType === CustomFieldType.Integer && !formField.mask)
|
|
4538
4617
|
validators.push(Validators.pattern(/^\-?\d*$/));
|
|
4539
|
-
const control = new FormControl({ value: defaults[
|
|
4618
|
+
const control = new FormControl({ value: defaults[fieldType].defaultValue, disabled: this.formGroup.disabled }, validators);
|
|
4540
4619
|
control.markAsDirty({ onlySelf: true });
|
|
4541
4620
|
this.formGroup.addControl(formField.name, control);
|
|
4542
4621
|
this.fields.push(formField);
|
|
@@ -4618,17 +4697,13 @@ let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponen
|
|
|
4618
4697
|
parseFieldsValues() {
|
|
4619
4698
|
const parsedValues = {};
|
|
4620
4699
|
this.fields.forEach(field => {
|
|
4621
|
-
const { type, name, mask } = field;
|
|
4700
|
+
const { type, name, mask, scale } = field;
|
|
4622
4701
|
let value = this.formGroup.get(name).value;
|
|
4623
4702
|
if (value)
|
|
4624
4703
|
switch (type) {
|
|
4625
|
-
case FieldType.
|
|
4704
|
+
case FieldType.Number:
|
|
4626
4705
|
if (mask)
|
|
4627
|
-
value =
|
|
4628
|
-
break;
|
|
4629
|
-
case FieldType.Double:
|
|
4630
|
-
if (mask)
|
|
4631
|
-
value = parseFloat(value.replace(/\./g, "").replace(/,/g, "."));
|
|
4706
|
+
value = new BigNumber(value).toFixed(scale).toString();
|
|
4632
4707
|
break;
|
|
4633
4708
|
case FieldType.Date:
|
|
4634
4709
|
value = moment$3(value).format("YYYY-MM-DD");
|
|
@@ -4640,7 +4715,7 @@ let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponen
|
|
|
4640
4715
|
value = moment$3(value).format("HH:mm:ss");
|
|
4641
4716
|
break;
|
|
4642
4717
|
}
|
|
4643
|
-
if (value
|
|
4718
|
+
if (value !== null && !(new BigNumber(value).isNaN())) {
|
|
4644
4719
|
parsedValues[name] = value;
|
|
4645
4720
|
}
|
|
4646
4721
|
else if (this.isTypeNumberOrEnum(type)) {
|
|
@@ -4652,22 +4727,46 @@ let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponen
|
|
|
4652
4727
|
return parsedValues;
|
|
4653
4728
|
}
|
|
4654
4729
|
isTypeNumberOrEnum(type) {
|
|
4655
|
-
|
|
4730
|
+
const numberOrEnum = [
|
|
4731
|
+
FieldType.Number,
|
|
4732
|
+
FieldType.Enum
|
|
4733
|
+
];
|
|
4734
|
+
return numberOrEnum.includes(type);
|
|
4656
4735
|
}
|
|
4657
4736
|
getFormField(field, localeOptions) {
|
|
4737
|
+
var _a, _b;
|
|
4658
4738
|
let parameters;
|
|
4659
4739
|
switch (field.type) {
|
|
4660
|
-
case
|
|
4740
|
+
case CustomFieldType.Blob:
|
|
4661
4741
|
parameters = this.getBlobParameters();
|
|
4662
4742
|
break;
|
|
4663
|
-
case
|
|
4743
|
+
case CustomFieldType.Boolean:
|
|
4664
4744
|
parameters = this.getBooleanParameters();
|
|
4665
4745
|
break;
|
|
4666
4746
|
case "Enumeration":
|
|
4667
|
-
case
|
|
4747
|
+
case CustomFieldType.Enum:
|
|
4668
4748
|
field.type = FieldType.Enum;
|
|
4669
4749
|
parameters = this.getEnumParameters(field);
|
|
4670
4750
|
break;
|
|
4751
|
+
case CustomFieldType.Money:
|
|
4752
|
+
parameters = {
|
|
4753
|
+
type: FieldType.Number,
|
|
4754
|
+
leftAddon: {
|
|
4755
|
+
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$",
|
|
4756
|
+
},
|
|
4757
|
+
};
|
|
4758
|
+
break;
|
|
4759
|
+
case CustomFieldType.Double:
|
|
4760
|
+
parameters = {
|
|
4761
|
+
type: FieldType.Number
|
|
4762
|
+
};
|
|
4763
|
+
break;
|
|
4764
|
+
case CustomFieldType.Integer:
|
|
4765
|
+
parameters = {
|
|
4766
|
+
type: FieldType.Number,
|
|
4767
|
+
scale: 0
|
|
4768
|
+
};
|
|
4769
|
+
break;
|
|
4671
4770
|
default:
|
|
4672
4771
|
parameters = {};
|
|
4673
4772
|
break;
|
|
@@ -4724,7 +4823,7 @@ let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponen
|
|
|
4724
4823
|
* com os fields inseridos e deletados.
|
|
4725
4824
|
*/
|
|
4726
4825
|
createFieldCustomization(fields) {
|
|
4727
|
-
this.hasBlob = !!fields.filter((field) => field.type ===
|
|
4826
|
+
this.hasBlob = !!fields.filter((field) => field.type === CustomFieldType.Blob).length;
|
|
4728
4827
|
if (this.hasBlob) {
|
|
4729
4828
|
this.formGroup.addControl("fieldCustomization", new FormArray([
|
|
4730
4829
|
new FormGroup({
|
|
@@ -5875,9 +5974,9 @@ let StatsCardComponent = StatsCardComponent_1 = class StatsCardComponent {
|
|
|
5875
5974
|
return this._value;
|
|
5876
5975
|
}
|
|
5877
5976
|
updateDisplayValue() {
|
|
5878
|
-
const previousRawValue = new BigNumber(this.previousValue.replace(/\D/g, ""));
|
|
5879
|
-
const rawValue = new BigNumber(this.value.replace(/\D/g, ""));
|
|
5880
|
-
const eachAnimationDuration = new BigNumber(this.ANIMATION_DURATION_MS).dividedBy(new BigNumber(this.STEP_DURATION_MS));
|
|
5977
|
+
const previousRawValue = new BigNumber$1(this.previousValue.replace(/\D/g, ""));
|
|
5978
|
+
const rawValue = new BigNumber$1(this.value.replace(/\D/g, ""));
|
|
5979
|
+
const eachAnimationDuration = new BigNumber$1(this.ANIMATION_DURATION_MS).dividedBy(new BigNumber$1(this.STEP_DURATION_MS));
|
|
5881
5980
|
const incrementValue = rawValue.minus(previousRawValue).absoluteValue().dividedBy(eachAnimationDuration).dp(0, 7);
|
|
5882
5981
|
const incremental = previousRawValue.isLessThan(rawValue);
|
|
5883
5982
|
clearInterval(this.intervalId);
|
|
@@ -6453,5 +6552,5 @@ AngularComponentsModule = AngularComponentsModule_1 = __decorate([
|
|
|
6453
6552
|
* Generated bundle index. Do not edit.
|
|
6454
6553
|
*/
|
|
6455
6554
|
|
|
6456
|
-
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,
|
|
6555
|
+
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 };
|
|
6457
6556
|
//# sourceMappingURL=seniorsistemas-angular-components.js.map
|