ng-smn-ui 4.2.8 → 4.2.13

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.
@@ -4226,6 +4226,276 @@
4226
4226
  return UiMaskCnpjDirective;
4227
4227
  }());
4228
4228
 
4229
+ var UiCnpjNovoPipe = /** @class */ (function () {
4230
+ function UiCnpjNovoPipe() {
4231
+ }
4232
+ UiCnpjNovoPipe.prototype.transform = function (value, mask) {
4233
+ if (!value) {
4234
+ return '';
4235
+ }
4236
+ value = value.toString().toUpperCase().replace(/[^0-9A-Z]+/g, '');
4237
+ if (!mask) {
4238
+ var isNumericOnly = /^[0-9]*$/.test(value);
4239
+ if (isNumericOnly) {
4240
+ value = value.padStart(14, '0');
4241
+ }
4242
+ }
4243
+ value = value.toString().toUpperCase().replace(/[^0-9A-Z]+/g, '');
4244
+ if (value.length > 2) {
4245
+ value = value.substring(0, 2) + '.' + value.substring(2);
4246
+ }
4247
+ if (value.length > 6) {
4248
+ value = value.substring(0, 6) + '.' + value.substring(6);
4249
+ }
4250
+ if (value.length > 10) {
4251
+ value = value.substring(0, 10) + '/' + value.substring(10);
4252
+ }
4253
+ if (value.length > 15) {
4254
+ value = value.substring(0, 15) + '-' + value.substring(15);
4255
+ }
4256
+ if (value.length > 18) {
4257
+ value = value.substring(0, 18);
4258
+ }
4259
+ return value;
4260
+ };
4261
+ UiCnpjNovoPipe = __decorate([
4262
+ core.Pipe({
4263
+ name: 'uiCnpjNovo'
4264
+ })
4265
+ ], UiCnpjNovoPipe);
4266
+ return UiCnpjNovoPipe;
4267
+ }());
4268
+
4269
+ var UiMaskCnpjNovoDirective = /** @class */ (function () {
4270
+ function UiMaskCnpjNovoDirective(elementRef, cnpjPipe) {
4271
+ this.elementRef = elementRef;
4272
+ this.cnpjPipe = cnpjPipe;
4273
+ this.symbolsPositions = [2, 6, 10, 15, 18];
4274
+ this.padOnPaste = true;
4275
+ this.ngModelChange = new core.EventEmitter();
4276
+ }
4277
+ UiMaskCnpjNovoDirective_1 = UiMaskCnpjNovoDirective;
4278
+ UiMaskCnpjNovoDirective.prototype.ngOnChanges = function (changes) {
4279
+ if (!changes.ngModel.firstChange && (changes.ngModel.currentValue === null || changes.ngModel.currentValue === undefined)) {
4280
+ this.elementRef.nativeElement.value = '';
4281
+ }
4282
+ };
4283
+ UiMaskCnpjNovoDirective.prototype.ngAfterViewInit = function () {
4284
+ var _this = this;
4285
+ setTimeout(function () {
4286
+ _this.loaded = true;
4287
+ });
4288
+ };
4289
+ UiMaskCnpjNovoDirective.prototype.writeValue = function (rawValue) {
4290
+ var _this = this;
4291
+ if (this.control && this.loaded && rawValue) {
4292
+ this.control.markAsDirty();
4293
+ }
4294
+ if (!this.input) {
4295
+ if (this.ngModel) {
4296
+ var value = this.ngModel.toString().toUpperCase();
4297
+ var cleanValue = value.replace(/[^0-9A-Z]+/g, '');
4298
+ var isNumericOnly = /^[0-9]*$/.test(cleanValue);
4299
+ var paddedValue = isNumericOnly ? cleanValue.padStart(14, '0') : cleanValue;
4300
+ if (paddedValue !== cleanValue) {
4301
+ this.ngModel = paddedValue;
4302
+ setTimeout(function () { return _this.ngModelChange.emit(_this.ngModel); });
4303
+ }
4304
+ else {
4305
+ this.ngModel = paddedValue;
4306
+ }
4307
+ }
4308
+ else {
4309
+ this.ngModel = '';
4310
+ }
4311
+ this.elementRef.nativeElement.value = this.cnpjPipe.transform(this.ngModel, true);
4312
+ }
4313
+ this.input = false;
4314
+ };
4315
+ UiMaskCnpjNovoDirective.prototype.renderViaInput = function (rawValue) {
4316
+ if (rawValue) {
4317
+ this.control.markAsDirty();
4318
+ }
4319
+ this.ngModel = this.format(rawValue);
4320
+ this.ngModelChange.emit(this.ngModel);
4321
+ this.elementRef.nativeElement.value = this.cnpjPipe.transform(this.elementRef.nativeElement.value, true);
4322
+ };
4323
+ UiMaskCnpjNovoDirective.prototype.registerOnChange = function (fn) {
4324
+ this.onChange = fn;
4325
+ };
4326
+ UiMaskCnpjNovoDirective.prototype.registerOnTouched = function (fn) {
4327
+ this.onTouched = fn;
4328
+ };
4329
+ UiMaskCnpjNovoDirective.prototype.format = function (value) {
4330
+ // Aceita números e letras (A-Z), normaliza para maiúsculas
4331
+ value = value.toString().toUpperCase().replace(/[^0-9A-Z]+/g, '');
4332
+ return value.substring(0, 14);
4333
+ };
4334
+ UiMaskCnpjNovoDirective.prototype.validate = function (control) {
4335
+ this.control = control;
4336
+ if (this.input) {
4337
+ if (control.value && this.format(control.value).length < 14) {
4338
+ return { parse: true };
4339
+ }
4340
+ }
4341
+ if (this.uiMaskCnpjNovo === true && control.value) {
4342
+ var value = control.value.toString().toUpperCase().replace(/[^0-9A-Z]+/g, '');
4343
+ var isNumericOnly = /^[0-9]*$/.test(value);
4344
+ if (isNumericOnly) {
4345
+ value = value.padStart(14, '0');
4346
+ }
4347
+ if (!this.cnpjIsValid(value)) {
4348
+ return { parse: true };
4349
+ }
4350
+ }
4351
+ this.input = false;
4352
+ return null;
4353
+ };
4354
+ UiMaskCnpjNovoDirective.prototype.setDisabledState = function (isDisabled) {
4355
+ var method = isDisabled ? 'setAttribute' : 'removeAttribute';
4356
+ this.elementRef.nativeElement[method]('disabled', 'disabled');
4357
+ };
4358
+ /**
4359
+ * Converte um caractere para seu valor numérico.
4360
+ * Usa código ASCII - 48 para todos os caracteres:
4361
+ * - Dígitos 0-9 retornam 0-9
4362
+ * - Letras A-Z retornam 17-42 (A=17, B=18, ..., Z=42)
4363
+ * Referência: https://www.gov.br/receitafederal/pt-br/centrais-de-conteudo/publicacoes/perguntas-e-respostas/cnpj/cnpj-alfanumerico.pdf
4364
+ */
4365
+ UiMaskCnpjNovoDirective.prototype.charToValue = function (char) {
4366
+ return char.toUpperCase().charCodeAt(0) - 48;
4367
+ };
4368
+ /**
4369
+ * Valida CNPJ alfanumérico conforme especificação.
4370
+ * Suporta tanto CNPJs numéricos tradicionais quanto os novos alfanuméricos.
4371
+ * A conversão usa ASCII - 48 para todos os caracteres (A=17, B=18, ..., Z=42).
4372
+ */
4373
+ UiMaskCnpjNovoDirective.prototype.cnpjIsValid = function (cnpj) {
4374
+ if (!cnpj || cnpj.length !== 14) {
4375
+ return false;
4376
+ }
4377
+ // Normaliza para maiúsculas
4378
+ cnpj = cnpj.toUpperCase();
4379
+ // Verifica se contém apenas caracteres válidos (0-9 e A-Z)
4380
+ if (!/^[0-9A-Z]{14}$/.test(cnpj)) {
4381
+ return false;
4382
+ }
4383
+ // Verifica CNPJs com todos os caracteres iguais
4384
+ if (/^(.)\1{13}$/.test(cnpj)) {
4385
+ return false;
4386
+ }
4387
+ var base = cnpj.substring(0, 12);
4388
+ var digits = cnpj.substring(12);
4389
+ // Calcula o primeiro dígito verificador
4390
+ var sum = 0;
4391
+ var pos = 5;
4392
+ for (var i = 0; i < 12; i++) {
4393
+ sum += this.charToValue(base.charAt(i)) * pos--;
4394
+ if (pos < 2) {
4395
+ pos = 9;
4396
+ }
4397
+ }
4398
+ var result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
4399
+ if (result !== this.charToValue(digits.charAt(0))) {
4400
+ return false;
4401
+ }
4402
+ // Calcula o segundo dígito verificador
4403
+ var baseWithFirstDigit = base + digits.charAt(0);
4404
+ sum = 0;
4405
+ pos = 6;
4406
+ for (var i = 0; i < 13; i++) {
4407
+ sum += this.charToValue(baseWithFirstDigit.charAt(i)) * pos--;
4408
+ if (pos < 2) {
4409
+ pos = 9;
4410
+ }
4411
+ }
4412
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
4413
+ return result === this.charToValue(digits.charAt(1));
4414
+ };
4415
+ UiMaskCnpjNovoDirective.prototype.onKeydown = function () {
4416
+ this.beforeSelIndex = UiElement.caretPosition.get(this.elementRef.nativeElement);
4417
+ };
4418
+ UiMaskCnpjNovoDirective.prototype.onInput = function ($event) {
4419
+ var afterSelIndex = UiElement.caretPosition.get(this.elementRef.nativeElement);
4420
+ var rawValue = this.elementRef.nativeElement.value;
4421
+ this.input = this.format(rawValue) !== this.ngModel;
4422
+ this.renderViaInput(rawValue);
4423
+ UiElement.caretPosition.set(this.elementRef.nativeElement, this.beforeSelIndex, afterSelIndex, this.symbolsPositions);
4424
+ };
4425
+ UiMaskCnpjNovoDirective.prototype.padLeft = function (event) {
4426
+ if (this.padOnPaste) {
4427
+ event.preventDefault();
4428
+ var data = void 0;
4429
+ if (window['clipboardData']) {
4430
+ data = window['clipboardData'];
4431
+ }
4432
+ else if (event.clipboardData && event.clipboardData.getData) {
4433
+ data = event.clipboardData;
4434
+ }
4435
+ // Aceita números e letras, normaliza para maiúsculas
4436
+ var text = data.getData('text').toString().toUpperCase().replace(/[^0-9A-Z]+/g, '');
4437
+ // Só faz padStart se for CNPJ numérico puro (retrocompatibilidade)
4438
+ var isNumericOnly = /^[0-9]*$/.test(text);
4439
+ this.renderViaInput(isNumericOnly ? text.padStart(14, '0') : text);
4440
+ }
4441
+ };
4442
+ var UiMaskCnpjNovoDirective_1;
4443
+ UiMaskCnpjNovoDirective.ctorParameters = function () { return [
4444
+ { type: core.ElementRef },
4445
+ { type: UiCnpjNovoPipe }
4446
+ ]; };
4447
+ __decorate([
4448
+ core.Input(),
4449
+ __metadata("design:type", Object)
4450
+ ], UiMaskCnpjNovoDirective.prototype, "ngModel", void 0);
4451
+ __decorate([
4452
+ core.Input(),
4453
+ __metadata("design:type", Boolean)
4454
+ ], UiMaskCnpjNovoDirective.prototype, "padOnPaste", void 0);
4455
+ __decorate([
4456
+ core.Input('uiMaskCnpjNovo'),
4457
+ __metadata("design:type", Object)
4458
+ ], UiMaskCnpjNovoDirective.prototype, "uiMaskCnpjNovo", void 0);
4459
+ __decorate([
4460
+ core.Output(),
4461
+ __metadata("design:type", core.EventEmitter)
4462
+ ], UiMaskCnpjNovoDirective.prototype, "ngModelChange", void 0);
4463
+ __decorate([
4464
+ core.HostListener('keydown'),
4465
+ __metadata("design:type", Function),
4466
+ __metadata("design:paramtypes", []),
4467
+ __metadata("design:returntype", void 0)
4468
+ ], UiMaskCnpjNovoDirective.prototype, "onKeydown", null);
4469
+ __decorate([
4470
+ core.HostListener('input', ['$event']),
4471
+ __metadata("design:type", Function),
4472
+ __metadata("design:paramtypes", [Object]),
4473
+ __metadata("design:returntype", void 0)
4474
+ ], UiMaskCnpjNovoDirective.prototype, "onInput", null);
4475
+ __decorate([
4476
+ core.HostListener('paste', ['$event']),
4477
+ __metadata("design:type", Function),
4478
+ __metadata("design:paramtypes", [Object]),
4479
+ __metadata("design:returntype", void 0)
4480
+ ], UiMaskCnpjNovoDirective.prototype, "padLeft", null);
4481
+ UiMaskCnpjNovoDirective = UiMaskCnpjNovoDirective_1 = __decorate([
4482
+ core.Directive({
4483
+ selector: '[uiMaskCnpjNovo][ngModel]',
4484
+ providers: [{
4485
+ provide: forms.NG_VALUE_ACCESSOR,
4486
+ useExisting: core.forwardRef(function () { return UiMaskCnpjNovoDirective_1; }),
4487
+ multi: true
4488
+ }, {
4489
+ provide: forms.NG_VALIDATORS,
4490
+ useExisting: core.forwardRef(function () { return UiMaskCnpjNovoDirective_1; }),
4491
+ multi: true
4492
+ }, UiCnpjNovoPipe]
4493
+ }),
4494
+ __metadata("design:paramtypes", [core.ElementRef, UiCnpjNovoPipe])
4495
+ ], UiMaskCnpjNovoDirective);
4496
+ return UiMaskCnpjNovoDirective;
4497
+ }());
4498
+
4229
4499
  var UiCepPipe = /** @class */ (function () {
4230
4500
  function UiCepPipe() {
4231
4501
  }
@@ -10782,6 +11052,8 @@
10782
11052
  UiCpfPipe,
10783
11053
  UiMaskCnpjDirective,
10784
11054
  UiCnpjPipe,
11055
+ UiMaskCnpjNovoDirective,
11056
+ UiCnpjNovoPipe,
10785
11057
  UiMaskCepDirective,
10786
11058
  UiCepPipe,
10787
11059
  UiMaskCepNovoDirective,
@@ -10880,6 +11152,7 @@
10880
11152
  exports.SMNUIModule = SMNUIModule;
10881
11153
  exports.UiCepNovoPipe = UiCepNovoPipe;
10882
11154
  exports.UiCepPipe = UiCepPipe;
11155
+ exports.UiCnpjNovoPipe = UiCnpjNovoPipe;
10883
11156
  exports.UiCnpjPipe = UiCnpjPipe;
10884
11157
  exports.UiColor = UiColor;
10885
11158
  exports.UiCookie = UiCookie;
@@ -10911,58 +11184,59 @@
10911
11184
  exports.ɵbe = UiListItemDirective;
10912
11185
  exports.ɵbf = UiMaskCpfDirective;
10913
11186
  exports.ɵbg = UiMaskCnpjDirective;
10914
- exports.ɵbh = UiMaskCepDirective;
10915
- exports.ɵbi = UiMaskCepNovoDirective;
10916
- exports.ɵbj = UiListComponent;
10917
- exports.ɵbk = UiListItemsComponent;
10918
- exports.ɵbl = UiListItemComponent;
10919
- exports.ɵbm = UiSliderComponent;
10920
- exports.ɵbn = UiSliderMultiHandleComponent;
10921
- exports.ɵbo = UiInfiniteLoadDirective;
10922
- exports.ɵbp = UiAutocompleteDirective;
10923
- exports.ɵbq = UiAutocompleteComponent;
10924
- exports.ɵbr = UiMaskIntegerDirective;
10925
- exports.ɵbs = UiTabsComponent;
10926
- exports.ɵbt = UiTabsPagesComponent;
10927
- exports.ɵbu = UiLazyLoadDirective;
10928
- exports.ɵbv = UiDataTableComponent;
10929
- exports.ɵbw = UiBottomSheetComponent;
10930
- exports.ɵbx = UiBottomSheetTriggerDirective;
10931
- exports.ɵby = UiInputFileDirective;
10932
- exports.ɵbz = UiEllipsisDirective;
11187
+ exports.ɵbh = UiMaskCnpjNovoDirective;
11188
+ exports.ɵbi = UiMaskCepDirective;
11189
+ exports.ɵbj = UiMaskCepNovoDirective;
11190
+ exports.ɵbk = UiListComponent;
11191
+ exports.ɵbl = UiListItemsComponent;
11192
+ exports.ɵbm = UiListItemComponent;
11193
+ exports.ɵbn = UiSliderComponent;
11194
+ exports.ɵbo = UiSliderMultiHandleComponent;
11195
+ exports.ɵbp = UiInfiniteLoadDirective;
11196
+ exports.ɵbq = UiAutocompleteDirective;
11197
+ exports.ɵbr = UiAutocompleteComponent;
11198
+ exports.ɵbs = UiMaskIntegerDirective;
11199
+ exports.ɵbt = UiTabsComponent;
11200
+ exports.ɵbu = UiTabsPagesComponent;
11201
+ exports.ɵbv = UiLazyLoadDirective;
11202
+ exports.ɵbw = UiDataTableComponent;
11203
+ exports.ɵbx = UiBottomSheetComponent;
11204
+ exports.ɵby = UiBottomSheetTriggerDirective;
11205
+ exports.ɵbz = UiInputFileDirective;
10933
11206
  exports.ɵc = _window;
10934
- exports.ɵca = UiRequiredDirective;
10935
- exports.ɵcb = UiColorPickerComponent;
10936
- exports.ɵcc = UiColorPickerDirective;
10937
- exports.ɵcd = UiInputAutosizeDirective;
10938
- exports.ɵce = UiClockComponent;
10939
- exports.ɵcf = UiTimePickerDirective;
10940
- exports.ɵcg = UiTimePickerService;
10941
- exports.ɵch = UiTimePickerCallerDirective;
10942
- exports.ɵci = UiMaskTimeDirective;
10943
- exports.ɵcj = UiMaskCurrencyDirective;
10944
- exports.ɵck = UiSelectComponent;
10945
- exports.ɵcl = UiSelectOptionComponent;
10946
- exports.ɵcm = UiSelectFilterPipe;
10947
- exports.ɵcn = UiAvatarComponent;
10948
- exports.ɵco = UiMaskFloatDirective;
10949
- exports.ɵcp = TooltipDirective;
10950
- exports.ɵcq = UiChosenComponent;
10951
- exports.ɵcr = UiChosenOptionComponent;
10952
- exports.ɵcs = UiChosenGroupComponent;
10953
- exports.ɵct = ExpansionPanelComponent;
10954
- exports.ɵcu = UiTabComponent;
10955
- exports.ɵcv = UiTabContentDirective;
10956
- exports.ɵcw = UiTabLabelDirective;
10957
- exports.ɵcx = UiTabGroupComponent;
10958
- exports.ɵcy = tabFakeAnimation;
10959
- exports.ɵcz = tabTransform;
11207
+ exports.ɵca = UiEllipsisDirective;
11208
+ exports.ɵcb = UiRequiredDirective;
11209
+ exports.ɵcc = UiColorPickerComponent;
11210
+ exports.ɵcd = UiColorPickerDirective;
11211
+ exports.ɵce = UiInputAutosizeDirective;
11212
+ exports.ɵcf = UiClockComponent;
11213
+ exports.ɵcg = UiTimePickerDirective;
11214
+ exports.ɵch = UiTimePickerService;
11215
+ exports.ɵci = UiTimePickerCallerDirective;
11216
+ exports.ɵcj = UiMaskTimeDirective;
11217
+ exports.ɵck = UiMaskCurrencyDirective;
11218
+ exports.ɵcl = UiSelectComponent;
11219
+ exports.ɵcm = UiSelectOptionComponent;
11220
+ exports.ɵcn = UiSelectFilterPipe;
11221
+ exports.ɵco = UiAvatarComponent;
11222
+ exports.ɵcp = UiMaskFloatDirective;
11223
+ exports.ɵcq = TooltipDirective;
11224
+ exports.ɵcr = UiChosenComponent;
11225
+ exports.ɵcs = UiChosenOptionComponent;
11226
+ exports.ɵct = UiChosenGroupComponent;
11227
+ exports.ɵcu = ExpansionPanelComponent;
11228
+ exports.ɵcv = UiTabComponent;
11229
+ exports.ɵcw = UiTabContentDirective;
11230
+ exports.ɵcx = UiTabLabelDirective;
11231
+ exports.ɵcy = UiTabGroupComponent;
11232
+ exports.ɵcz = tabFakeAnimation;
10960
11233
  exports.ɵd = UiAddCalendarDirective;
10961
- exports.ɵda = UiTabHeaderComponent;
10962
- exports.ɵdb = UiLabelContentComponent;
10963
- exports.ɵdc = UiUploadComponent;
10964
- exports.ɵdd = Upload;
10965
- exports.ɵde = enterLeaveViewAnimation;
11234
+ exports.ɵda = tabTransform;
11235
+ exports.ɵdb = UiTabHeaderComponent;
11236
+ exports.ɵdc = UiLabelContentComponent;
11237
+ exports.ɵdd = UiUploadComponent;
11238
+ exports.ɵde = Upload;
11239
+ exports.ɵdf = enterLeaveViewAnimation;
10966
11240
  exports.ɵe = UiCalendarComponent;
10967
11241
  exports.ɵf = UiCalendarContentComponent;
10968
11242
  exports.ɵg = UiCapitalizePipe;