ng-smn-ui 4.2.8 → 4.2.11

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,261 @@
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
+ if (this.control && this.loaded && rawValue) {
4291
+ this.control.markAsDirty();
4292
+ }
4293
+ if (!this.input) {
4294
+ if (this.ngModel) {
4295
+ var value = this.ngModel.toString().toUpperCase();
4296
+ var cleanValue = value.replace(/[^0-9A-Z]+/g, '');
4297
+ var isNumericOnly = /^[0-9]*$/.test(cleanValue);
4298
+ this.ngModel = isNumericOnly ? cleanValue.padStart(14, '0') : cleanValue;
4299
+ }
4300
+ else {
4301
+ this.ngModel = '';
4302
+ }
4303
+ this.elementRef.nativeElement.value = this.cnpjPipe.transform(this.ngModel, true);
4304
+ }
4305
+ this.input = false;
4306
+ };
4307
+ UiMaskCnpjNovoDirective.prototype.renderViaInput = function (rawValue) {
4308
+ if (rawValue) {
4309
+ this.control.markAsDirty();
4310
+ }
4311
+ this.ngModel = this.format(rawValue);
4312
+ this.ngModelChange.emit(this.ngModel);
4313
+ this.elementRef.nativeElement.value = this.cnpjPipe.transform(this.elementRef.nativeElement.value, true);
4314
+ };
4315
+ UiMaskCnpjNovoDirective.prototype.registerOnChange = function (fn) {
4316
+ this.onChange = fn;
4317
+ };
4318
+ UiMaskCnpjNovoDirective.prototype.registerOnTouched = function (fn) {
4319
+ this.onTouched = fn;
4320
+ };
4321
+ UiMaskCnpjNovoDirective.prototype.format = function (value) {
4322
+ // Aceita números e letras (A-Z), normaliza para maiúsculas
4323
+ value = value.toString().toUpperCase().replace(/[^0-9A-Z]+/g, '');
4324
+ return value.substring(0, 14);
4325
+ };
4326
+ UiMaskCnpjNovoDirective.prototype.validate = function (control) {
4327
+ this.control = control;
4328
+ if (this.input) {
4329
+ if (control.value && this.format(control.value).length < 14) {
4330
+ return { parse: true };
4331
+ }
4332
+ }
4333
+ if (this.uiMaskCnpjNovo === true && control.value && !this.cnpjIsValid(control.value)) {
4334
+ return { parse: true };
4335
+ }
4336
+ this.input = false;
4337
+ return null;
4338
+ };
4339
+ UiMaskCnpjNovoDirective.prototype.setDisabledState = function (isDisabled) {
4340
+ var method = isDisabled ? 'setAttribute' : 'removeAttribute';
4341
+ this.elementRef.nativeElement[method]('disabled', 'disabled');
4342
+ };
4343
+ /**
4344
+ * Converte um caractere para seu valor numérico.
4345
+ * Usa código ASCII - 48 para todos os caracteres:
4346
+ * - Dígitos 0-9 retornam 0-9
4347
+ * - Letras A-Z retornam 17-42 (A=17, B=18, ..., Z=42)
4348
+ * Referência: https://www.gov.br/receitafederal/pt-br/centrais-de-conteudo/publicacoes/perguntas-e-respostas/cnpj/cnpj-alfanumerico.pdf
4349
+ */
4350
+ UiMaskCnpjNovoDirective.prototype.charToValue = function (char) {
4351
+ return char.toUpperCase().charCodeAt(0) - 48;
4352
+ };
4353
+ /**
4354
+ * Valida CNPJ alfanumérico conforme especificação.
4355
+ * Suporta tanto CNPJs numéricos tradicionais quanto os novos alfanuméricos.
4356
+ * A conversão usa ASCII - 48 para todos os caracteres (A=17, B=18, ..., Z=42).
4357
+ */
4358
+ UiMaskCnpjNovoDirective.prototype.cnpjIsValid = function (cnpj) {
4359
+ if (!cnpj || cnpj.length !== 14) {
4360
+ return false;
4361
+ }
4362
+ // Normaliza para maiúsculas
4363
+ cnpj = cnpj.toUpperCase();
4364
+ // Verifica se contém apenas caracteres válidos (0-9 e A-Z)
4365
+ if (!/^[0-9A-Z]{14}$/.test(cnpj)) {
4366
+ return false;
4367
+ }
4368
+ // Verifica CNPJs com todos os caracteres iguais
4369
+ if (/^(.)\1{13}$/.test(cnpj)) {
4370
+ return false;
4371
+ }
4372
+ var base = cnpj.substring(0, 12);
4373
+ var digits = cnpj.substring(12);
4374
+ // Calcula o primeiro dígito verificador
4375
+ var sum = 0;
4376
+ var pos = 5;
4377
+ for (var i = 0; i < 12; i++) {
4378
+ sum += this.charToValue(base.charAt(i)) * pos--;
4379
+ if (pos < 2) {
4380
+ pos = 9;
4381
+ }
4382
+ }
4383
+ var result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
4384
+ if (result !== this.charToValue(digits.charAt(0))) {
4385
+ return false;
4386
+ }
4387
+ // Calcula o segundo dígito verificador
4388
+ var baseWithFirstDigit = base + digits.charAt(0);
4389
+ sum = 0;
4390
+ pos = 6;
4391
+ for (var i = 0; i < 13; i++) {
4392
+ sum += this.charToValue(baseWithFirstDigit.charAt(i)) * pos--;
4393
+ if (pos < 2) {
4394
+ pos = 9;
4395
+ }
4396
+ }
4397
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
4398
+ return result === this.charToValue(digits.charAt(1));
4399
+ };
4400
+ UiMaskCnpjNovoDirective.prototype.onKeydown = function () {
4401
+ this.beforeSelIndex = UiElement.caretPosition.get(this.elementRef.nativeElement);
4402
+ };
4403
+ UiMaskCnpjNovoDirective.prototype.onInput = function ($event) {
4404
+ var afterSelIndex = UiElement.caretPosition.get(this.elementRef.nativeElement);
4405
+ var rawValue = this.elementRef.nativeElement.value;
4406
+ this.input = this.format(rawValue) !== this.ngModel;
4407
+ this.renderViaInput(rawValue);
4408
+ UiElement.caretPosition.set(this.elementRef.nativeElement, this.beforeSelIndex, afterSelIndex, this.symbolsPositions);
4409
+ };
4410
+ UiMaskCnpjNovoDirective.prototype.padLeft = function (event) {
4411
+ if (this.padOnPaste) {
4412
+ event.preventDefault();
4413
+ var data = void 0;
4414
+ if (window['clipboardData']) {
4415
+ data = window['clipboardData'];
4416
+ }
4417
+ else if (event.clipboardData && event.clipboardData.getData) {
4418
+ data = event.clipboardData;
4419
+ }
4420
+ // Aceita números e letras, normaliza para maiúsculas
4421
+ var text = data.getData('text').toString().toUpperCase().replace(/[^0-9A-Z]+/g, '');
4422
+ // Só faz padStart se for CNPJ numérico puro (retrocompatibilidade)
4423
+ var isNumericOnly = /^[0-9]*$/.test(text);
4424
+ this.renderViaInput(isNumericOnly ? text.padStart(14, '0') : text);
4425
+ }
4426
+ };
4427
+ var UiMaskCnpjNovoDirective_1;
4428
+ UiMaskCnpjNovoDirective.ctorParameters = function () { return [
4429
+ { type: core.ElementRef },
4430
+ { type: UiCnpjNovoPipe }
4431
+ ]; };
4432
+ __decorate([
4433
+ core.Input(),
4434
+ __metadata("design:type", Object)
4435
+ ], UiMaskCnpjNovoDirective.prototype, "ngModel", void 0);
4436
+ __decorate([
4437
+ core.Input(),
4438
+ __metadata("design:type", Boolean)
4439
+ ], UiMaskCnpjNovoDirective.prototype, "padOnPaste", void 0);
4440
+ __decorate([
4441
+ core.Input('uiMaskCnpjNovo'),
4442
+ __metadata("design:type", Object)
4443
+ ], UiMaskCnpjNovoDirective.prototype, "uiMaskCnpjNovo", void 0);
4444
+ __decorate([
4445
+ core.Output(),
4446
+ __metadata("design:type", core.EventEmitter)
4447
+ ], UiMaskCnpjNovoDirective.prototype, "ngModelChange", void 0);
4448
+ __decorate([
4449
+ core.HostListener('keydown'),
4450
+ __metadata("design:type", Function),
4451
+ __metadata("design:paramtypes", []),
4452
+ __metadata("design:returntype", void 0)
4453
+ ], UiMaskCnpjNovoDirective.prototype, "onKeydown", null);
4454
+ __decorate([
4455
+ core.HostListener('input', ['$event']),
4456
+ __metadata("design:type", Function),
4457
+ __metadata("design:paramtypes", [Object]),
4458
+ __metadata("design:returntype", void 0)
4459
+ ], UiMaskCnpjNovoDirective.prototype, "onInput", null);
4460
+ __decorate([
4461
+ core.HostListener('paste', ['$event']),
4462
+ __metadata("design:type", Function),
4463
+ __metadata("design:paramtypes", [Object]),
4464
+ __metadata("design:returntype", void 0)
4465
+ ], UiMaskCnpjNovoDirective.prototype, "padLeft", null);
4466
+ UiMaskCnpjNovoDirective = UiMaskCnpjNovoDirective_1 = __decorate([
4467
+ core.Directive({
4468
+ selector: '[uiMaskCnpjNovo][ngModel]',
4469
+ providers: [{
4470
+ provide: forms.NG_VALUE_ACCESSOR,
4471
+ useExisting: core.forwardRef(function () { return UiMaskCnpjNovoDirective_1; }),
4472
+ multi: true
4473
+ }, {
4474
+ provide: forms.NG_VALIDATORS,
4475
+ useExisting: core.forwardRef(function () { return UiMaskCnpjNovoDirective_1; }),
4476
+ multi: true
4477
+ }, UiCnpjNovoPipe]
4478
+ }),
4479
+ __metadata("design:paramtypes", [core.ElementRef, UiCnpjNovoPipe])
4480
+ ], UiMaskCnpjNovoDirective);
4481
+ return UiMaskCnpjNovoDirective;
4482
+ }());
4483
+
4229
4484
  var UiCepPipe = /** @class */ (function () {
4230
4485
  function UiCepPipe() {
4231
4486
  }
@@ -10782,6 +11037,8 @@
10782
11037
  UiCpfPipe,
10783
11038
  UiMaskCnpjDirective,
10784
11039
  UiCnpjPipe,
11040
+ UiMaskCnpjNovoDirective,
11041
+ UiCnpjNovoPipe,
10785
11042
  UiMaskCepDirective,
10786
11043
  UiCepPipe,
10787
11044
  UiMaskCepNovoDirective,
@@ -10880,6 +11137,7 @@
10880
11137
  exports.SMNUIModule = SMNUIModule;
10881
11138
  exports.UiCepNovoPipe = UiCepNovoPipe;
10882
11139
  exports.UiCepPipe = UiCepPipe;
11140
+ exports.UiCnpjNovoPipe = UiCnpjNovoPipe;
10883
11141
  exports.UiCnpjPipe = UiCnpjPipe;
10884
11142
  exports.UiColor = UiColor;
10885
11143
  exports.UiCookie = UiCookie;
@@ -10911,58 +11169,59 @@
10911
11169
  exports.ɵbe = UiListItemDirective;
10912
11170
  exports.ɵbf = UiMaskCpfDirective;
10913
11171
  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;
11172
+ exports.ɵbh = UiMaskCnpjNovoDirective;
11173
+ exports.ɵbi = UiMaskCepDirective;
11174
+ exports.ɵbj = UiMaskCepNovoDirective;
11175
+ exports.ɵbk = UiListComponent;
11176
+ exports.ɵbl = UiListItemsComponent;
11177
+ exports.ɵbm = UiListItemComponent;
11178
+ exports.ɵbn = UiSliderComponent;
11179
+ exports.ɵbo = UiSliderMultiHandleComponent;
11180
+ exports.ɵbp = UiInfiniteLoadDirective;
11181
+ exports.ɵbq = UiAutocompleteDirective;
11182
+ exports.ɵbr = UiAutocompleteComponent;
11183
+ exports.ɵbs = UiMaskIntegerDirective;
11184
+ exports.ɵbt = UiTabsComponent;
11185
+ exports.ɵbu = UiTabsPagesComponent;
11186
+ exports.ɵbv = UiLazyLoadDirective;
11187
+ exports.ɵbw = UiDataTableComponent;
11188
+ exports.ɵbx = UiBottomSheetComponent;
11189
+ exports.ɵby = UiBottomSheetTriggerDirective;
11190
+ exports.ɵbz = UiInputFileDirective;
10933
11191
  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;
11192
+ exports.ɵca = UiEllipsisDirective;
11193
+ exports.ɵcb = UiRequiredDirective;
11194
+ exports.ɵcc = UiColorPickerComponent;
11195
+ exports.ɵcd = UiColorPickerDirective;
11196
+ exports.ɵce = UiInputAutosizeDirective;
11197
+ exports.ɵcf = UiClockComponent;
11198
+ exports.ɵcg = UiTimePickerDirective;
11199
+ exports.ɵch = UiTimePickerService;
11200
+ exports.ɵci = UiTimePickerCallerDirective;
11201
+ exports.ɵcj = UiMaskTimeDirective;
11202
+ exports.ɵck = UiMaskCurrencyDirective;
11203
+ exports.ɵcl = UiSelectComponent;
11204
+ exports.ɵcm = UiSelectOptionComponent;
11205
+ exports.ɵcn = UiSelectFilterPipe;
11206
+ exports.ɵco = UiAvatarComponent;
11207
+ exports.ɵcp = UiMaskFloatDirective;
11208
+ exports.ɵcq = TooltipDirective;
11209
+ exports.ɵcr = UiChosenComponent;
11210
+ exports.ɵcs = UiChosenOptionComponent;
11211
+ exports.ɵct = UiChosenGroupComponent;
11212
+ exports.ɵcu = ExpansionPanelComponent;
11213
+ exports.ɵcv = UiTabComponent;
11214
+ exports.ɵcw = UiTabContentDirective;
11215
+ exports.ɵcx = UiTabLabelDirective;
11216
+ exports.ɵcy = UiTabGroupComponent;
11217
+ exports.ɵcz = tabFakeAnimation;
10960
11218
  exports.ɵd = UiAddCalendarDirective;
10961
- exports.ɵda = UiTabHeaderComponent;
10962
- exports.ɵdb = UiLabelContentComponent;
10963
- exports.ɵdc = UiUploadComponent;
10964
- exports.ɵdd = Upload;
10965
- exports.ɵde = enterLeaveViewAnimation;
11219
+ exports.ɵda = tabTransform;
11220
+ exports.ɵdb = UiTabHeaderComponent;
11221
+ exports.ɵdc = UiLabelContentComponent;
11222
+ exports.ɵdd = UiUploadComponent;
11223
+ exports.ɵde = Upload;
11224
+ exports.ɵdf = enterLeaveViewAnimation;
10966
11225
  exports.ɵe = UiCalendarComponent;
10967
11226
  exports.ɵf = UiCalendarContentComponent;
10968
11227
  exports.ɵg = UiCapitalizePipe;