@main-class/componentes 1.18.8 → 1.19.2
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/arquivo/index.d.ts +6 -4
- package/arquivo/main-class-componentes-arquivo.d.ts +4 -0
- package/arquivo/main-class-componentes-arquivo.metadata.json +1 -0
- package/arquivo/package.json +11 -0
- package/arquivo/{download-arquivo.directive.d.ts → src/download-arquivo.directive.d.ts} +1 -1
- package/{core/imagem → arquivo/src}/imagem.directive.d.ts +1 -1
- package/arquivo/{preview-arquivo → src/preview-arquivo}/dialog-preview-arquivo/dialog-preview-arquivo.component.d.ts +1 -1
- package/arquivo/{preview-arquivo → src/preview-arquivo}/preview-arquivo.component.d.ts +1 -1
- package/bundles/main-class-componentes-arquivo.umd.js +687 -0
- package/bundles/main-class-componentes-arquivo.umd.js.map +1 -0
- package/bundles/main-class-componentes-arquivo.umd.min.js +16 -0
- package/bundles/main-class-componentes-arquivo.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-core.umd.js +252 -0
- package/bundles/main-class-componentes-core.umd.js.map +1 -0
- package/bundles/main-class-componentes-core.umd.min.js +2 -0
- package/bundles/main-class-componentes-core.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-crud.umd.js +543 -0
- package/bundles/main-class-componentes-crud.umd.js.map +1 -0
- package/bundles/main-class-componentes-crud.umd.min.js +16 -0
- package/bundles/main-class-componentes-crud.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-date.umd.js +185 -0
- package/bundles/main-class-componentes-date.umd.js.map +1 -0
- package/bundles/main-class-componentes-date.umd.min.js +2 -0
- package/bundles/main-class-componentes-date.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-dialog.umd.js +206 -0
- package/bundles/main-class-componentes-dialog.umd.js.map +1 -0
- package/bundles/main-class-componentes-dialog.umd.min.js +2 -0
- package/bundles/main-class-componentes-dialog.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-form.umd.js +211 -0
- package/bundles/main-class-componentes-form.umd.js.map +1 -0
- package/bundles/main-class-componentes-form.umd.min.js +2 -0
- package/bundles/main-class-componentes-form.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-input.umd.js +2244 -0
- package/bundles/main-class-componentes-input.umd.js.map +1 -0
- package/bundles/main-class-componentes-input.umd.min.js +17 -0
- package/bundles/main-class-componentes-input.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-loader.umd.js +233 -0
- package/bundles/main-class-componentes-loader.umd.js.map +1 -0
- package/bundles/main-class-componentes-loader.umd.min.js +2 -0
- package/bundles/main-class-componentes-loader.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-misc.umd.js +1122 -0
- package/bundles/main-class-componentes-misc.umd.js.map +1 -0
- package/bundles/main-class-componentes-misc.umd.min.js +16 -0
- package/bundles/main-class-componentes-misc.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-model.umd.js +196 -0
- package/bundles/main-class-componentes-model.umd.js.map +1 -0
- package/bundles/main-class-componentes-model.umd.min.js +2 -0
- package/bundles/main-class-componentes-model.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-pipe.umd.js +58 -0
- package/bundles/main-class-componentes-pipe.umd.js.map +1 -0
- package/bundles/main-class-componentes-pipe.umd.min.js +2 -0
- package/bundles/main-class-componentes-pipe.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-scroll.umd.js +106 -0
- package/bundles/main-class-componentes-scroll.umd.js.map +1 -0
- package/bundles/main-class-componentes-scroll.umd.min.js +2 -0
- package/bundles/main-class-componentes-scroll.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-table.umd.js +787 -0
- package/bundles/main-class-componentes-table.umd.js.map +1 -0
- package/bundles/main-class-componentes-table.umd.min.js +17 -0
- package/bundles/main-class-componentes-table.umd.min.js.map +1 -0
- package/bundles/main-class-componentes-util.umd.js +31 -0
- package/bundles/main-class-componentes-util.umd.js.map +1 -0
- package/bundles/main-class-componentes-util.umd.min.js +2 -0
- package/bundles/main-class-componentes-util.umd.min.js.map +1 -0
- package/bundles/main-class-componentes.umd.js +13 -5511
- package/bundles/main-class-componentes.umd.js.map +1 -1
- package/bundles/main-class-componentes.umd.min.js +1 -1
- package/bundles/main-class-componentes.umd.min.js.map +1 -1
- package/core/index.d.ts +5 -14
- package/core/main-class-componentes-core.d.ts +4 -0
- package/core/main-class-componentes-core.metadata.json +1 -0
- package/core/package.json +11 -0
- package/core/src/core.module.d.ts +4 -0
- package/core/{mensageria → src/mensageria}/mensageria.service.d.ts +1 -2
- package/crud/index.d.ts +4 -5
- package/crud/main-class-componentes-crud.d.ts +4 -0
- package/crud/main-class-componentes-crud.metadata.json +1 -0
- package/crud/package.json +11 -0
- package/crud/{abstract-consulta-component.d.ts → src/abstract-consulta-component.d.ts} +3 -2
- package/crud/{abstract-consulta-paginada-component.d.ts → src/abstract-consulta-paginada-component.d.ts} +3 -2
- package/crud/{abstract-edicao-component.d.ts → src/abstract-edicao-component.d.ts} +2 -1
- package/crud/{abstract-edicao-modal-component.d.ts → src/abstract-edicao-modal-component.d.ts} +3 -1
- package/date/index.d.ts +3 -3
- package/date/main-class-componentes-date.d.ts +4 -0
- package/date/main-class-componentes-date.metadata.json +1 -0
- package/date/package.json +11 -0
- package/dialog/index.d.ts +4 -0
- package/dialog/main-class-componentes-dialog.d.ts +4 -0
- package/dialog/main-class-componentes-dialog.metadata.json +1 -0
- package/dialog/package.json +11 -0
- package/dialog/src/dialog.module.d.ts +2 -0
- package/esm2015/arquivo/index.js +7 -5
- package/esm2015/arquivo/main-class-componentes-arquivo.js +5 -0
- package/esm2015/arquivo/src/arquivo-manager.service.js +3 -0
- package/esm2015/arquivo/src/arquivo.module.js +30 -0
- package/esm2015/arquivo/src/download-arquivo.directive.js +44 -0
- package/esm2015/arquivo/src/imagem.directive.js +80 -0
- package/esm2015/arquivo/src/preview-arquivo/dialog-preview-arquivo/dialog-preview-arquivo.component.js +56 -0
- package/esm2015/arquivo/src/preview-arquivo/preview-arquivo.component.js +136 -0
- package/esm2015/core/index.js +6 -15
- package/esm2015/core/main-class-componentes-core.js +5 -0
- package/esm2015/core/src/core.module.js +27 -0
- package/esm2015/core/src/criptografia/criptografia.service.js +13 -0
- package/esm2015/core/src/mensageria/mensageria.service.js +48 -0
- package/esm2015/core/src/mobile/mobile.service.js +45 -0
- package/esm2015/core/src/validator/valida-modulo11.service.js +92 -0
- package/esm2015/crud/index.js +5 -6
- package/esm2015/crud/main-class-componentes-crud.js +5 -0
- package/esm2015/crud/src/abstract-consulta-component.js +60 -0
- package/esm2015/crud/src/abstract-consulta-paginada-component.js +48 -0
- package/esm2015/crud/src/abstract-edicao-component.js +29 -0
- package/esm2015/crud/src/abstract-edicao-modal-component.js +24 -0
- package/esm2015/date/index.js +4 -4
- package/esm2015/date/main-class-componentes-date.js +5 -0
- package/esm2015/date/src/date.module.js +19 -0
- package/esm2015/date/src/validator/data-validator.directive.js +97 -0
- package/esm2015/date/src/validator/futuro.directive.js +26 -0
- package/esm2015/dialog/index.js +5 -0
- package/esm2015/dialog/main-class-componentes-dialog.js +5 -0
- package/esm2015/dialog/src/dialog-confirmacao/dialog-confirmacao.component.js +40 -0
- package/esm2015/dialog/src/dialog-iframe/dialog-iframe.component.js +59 -0
- package/esm2015/dialog/src/dialog.module.js +28 -0
- package/esm2015/dialog/src/dialog.service.js +55 -0
- package/esm2015/form/index.js +5 -5
- package/esm2015/form/main-class-componentes-form.js +5 -0
- package/esm2015/form/src/form.component.js +103 -0
- package/esm2015/form/src/form.module.js +25 -0
- package/esm2015/form/src/mensagens-erro/mensagens-erro.component.js +31 -0
- package/esm2015/form/src/single-click.directive.js +35 -0
- package/esm2015/input/index.js +22 -22
- package/esm2015/input/main-class-componentes-input.js +6 -0
- package/esm2015/input/src/abstract-mat-form-field-control.js +110 -0
- package/esm2015/input/src/input-datetime/input-datetime.component.js +114 -0
- package/esm2015/input/{input-datetime → src/input-datetime}/input-datetime.module.js +3 -3
- package/esm2015/input/src/input-fileupload/input-fileupload.component.js +324 -0
- package/esm2015/input/src/input-fileupload/input-fileupload.directive.js +34 -0
- package/esm2015/input/src/input-fileupload/input-fileupload.module.js +34 -0
- package/esm2015/input/src/input-telefone-internacional/input-telefone-internacional-validator.directive.js +22 -0
- package/esm2015/input/src/input-telefone-internacional/input-telefone-internacional.component.js +66 -0
- package/esm2015/input/src/input-telefone-internacional/input-telefone-internacional.module.js +23 -0
- package/esm2015/input/src/option-checkbox/all-option-checkbox.component.js +36 -0
- package/esm2015/input/src/option-checkbox/node-pool.js +93 -0
- package/esm2015/input/src/option-checkbox/option-checkbox-group.component.js +71 -0
- package/esm2015/input/src/option-checkbox/option-checkbox.component.js +59 -0
- package/esm2015/input/src/option-checkbox/option-checkbox.module.js +23 -0
- package/esm2015/input/src/option-checkbox/option-checkbox.service.js +52 -0
- package/esm2015/input/src/option-checkbox/option-node.js +24 -0
- package/esm2015/input/src/select-chips/select-chips.component.js +177 -0
- package/esm2015/input/src/select-chips/select-chips.module.js +25 -0
- package/esm2015/input/src/select-item/select-item.component.js +20 -0
- package/esm2015/input/src/select-item/select-item.module.js +15 -0
- package/esm2015/input/src/select-many-checkbox/select-many-checkbox.component.js +150 -0
- package/esm2015/input/src/select-many-checkbox/select-many-checkbox.module.js +21 -0
- package/esm2015/input/src/select-radio/select-radio.component.js +124 -0
- package/esm2015/input/src/select-radio/select-radio.module.js +21 -0
- package/esm2015/loader/index.js +4 -0
- package/esm2015/loader/main-class-componentes-loader.js +5 -0
- package/esm2015/loader/src/loader.component.js +112 -0
- package/esm2015/loader/src/loader.module.js +21 -0
- package/esm2015/loader/src/loader.service.js +70 -0
- package/esm2015/misc/index.js +27 -27
- package/esm2015/misc/main-class-componentes-misc.js +5 -0
- package/esm2015/misc/src/cnpj/cnpj-model.directive.js +13 -0
- package/esm2015/misc/src/cnpj/cnpj.directive.js +31 -0
- package/esm2015/misc/src/cnpj/cnpj.module.js +19 -0
- package/esm2015/misc/src/cnpj/cnpjs.pipe.js +15 -0
- package/esm2015/misc/src/cpf/cpf-model.directive.js +13 -0
- package/esm2015/misc/src/cpf/cpf.directive.js +31 -0
- package/esm2015/misc/src/cpf/cpf.module.js +19 -0
- package/esm2015/misc/src/cpf/cpf.pipe.js +15 -0
- package/esm2015/misc/src/cpf-cnpj/cpf-cnpj-model.directive.js +25 -0
- package/esm2015/misc/src/cpf-cnpj/cpf-cnpj.directive.js +32 -0
- package/esm2015/misc/src/cpf-cnpj/cpf-cnpj.module.js +19 -0
- package/esm2015/misc/src/cpf-cnpj/cpf-cnpj.pipe.js +18 -0
- package/esm2015/misc/{info → src/info}/info.component.js +1 -1
- package/esm2015/misc/src/info/info.module.js +17 -0
- package/esm2015/misc/src/monetario/monetario-mask.js +34 -0
- package/esm2015/misc/src/monetario/monetario-model.directive.js +124 -0
- package/esm2015/misc/src/monetario/monetario.module.js +16 -0
- package/esm2015/misc/src/monetario/monetario.pipe.js +13 -0
- package/esm2015/misc/src/porcentagem/porcentagem-mask.js +34 -0
- package/esm2015/misc/src/porcentagem/porcentagem-model.directive.js +99 -0
- package/esm2015/misc/src/porcentagem/porcentagem.module.js +16 -0
- package/esm2015/misc/src/porcentagem/porcentagem.pipe.js +13 -0
- package/esm2015/misc/src/telefone/telefone-model.directive.js +25 -0
- package/esm2015/misc/src/telefone/telefone.module.js +18 -0
- package/esm2015/misc/src/telefone/telefone.pipe.js +33 -0
- package/esm2015/misc/src/unsafe-inner-html/unsafe-inner-html.directive.js +23 -0
- package/esm2015/misc/src/unsafe-inner-html/unsafe-inner-html.module.js +15 -0
- package/esm2015/model/index.js +3 -0
- package/esm2015/model/main-class-componentes-model.js +5 -0
- package/esm2015/model/src/masked-model.directive.js +149 -0
- package/esm2015/model/src/model.module.js +19 -0
- package/esm2015/pipe/index.js +3 -0
- package/esm2015/pipe/main-class-componentes-pipe.js +5 -0
- package/esm2015/pipe/src/nome-resumido.pipe.js +16 -0
- package/esm2015/pipe/src/pipe.module.js +19 -0
- package/esm2015/public-api.js +2 -11
- package/esm2015/scroll/index.js +3 -3
- package/esm2015/scroll/main-class-componentes-scroll.js +5 -0
- package/esm2015/scroll/src/scroll-container/scroll-container.component.js +69 -0
- package/esm2015/scroll/src/scroll.module.js +17 -0
- package/esm2015/table/index.js +12 -12
- package/esm2015/table/main-class-componentes-table.js +6 -0
- package/esm2015/table/src/column/column-cell.directive.js +15 -0
- package/esm2015/table/src/column/column-footer.directive.js +15 -0
- package/esm2015/table/src/column/column-header.directive.js +15 -0
- package/esm2015/table/src/column/column.directive.js +28 -0
- package/esm2015/table/src/infinite-table/infinite-table.component.js +92 -0
- package/esm2015/table/src/paginated-table/paginated-table.component.js +43 -0
- package/esm2015/table/{paginator → src/paginator}/paginator.component.js +1 -1
- package/esm2015/table/src/paginator-i18n.js +23 -0
- package/esm2015/table/src/table/table.component.js +119 -0
- package/esm2015/table/src/table.module.js +74 -0
- package/esm2015/table/src/td/td.component.js +19 -0
- package/esm2015/table/src/th/th.component.js +19 -0
- package/esm2015/util/index.js +2 -2
- package/esm2015/util/main-class-componentes-util.js +5 -0
- package/esm2015/util/src/string.util.js +12 -0
- package/fesm2015/main-class-componentes-arquivo.js +338 -0
- package/fesm2015/main-class-componentes-arquivo.js.map +1 -0
- package/fesm2015/main-class-componentes-core.js +219 -0
- package/fesm2015/main-class-componentes-core.js.map +1 -0
- package/fesm2015/main-class-componentes-crud.js +162 -0
- package/fesm2015/main-class-componentes-crud.js.map +1 -0
- package/fesm2015/main-class-componentes-date.js +143 -0
- package/fesm2015/main-class-componentes-date.js.map +1 -0
- package/fesm2015/main-class-componentes-dialog.js +177 -0
- package/fesm2015/main-class-componentes-dialog.js.map +1 -0
- package/fesm2015/main-class-componentes-form.js +191 -0
- package/fesm2015/main-class-componentes-form.js.map +1 -0
- package/fesm2015/main-class-componentes-input.js +1604 -0
- package/fesm2015/main-class-componentes-input.js.map +1 -0
- package/fesm2015/main-class-componentes-loader.js +206 -0
- package/fesm2015/main-class-componentes-loader.js.map +1 -0
- package/fesm2015/main-class-componentes-misc.js +688 -0
- package/fesm2015/main-class-componentes-misc.js.map +1 -0
- package/fesm2015/main-class-componentes-model.js +173 -0
- package/fesm2015/main-class-componentes-model.js.map +1 -0
- package/fesm2015/main-class-componentes-pipe.js +40 -0
- package/fesm2015/main-class-componentes-pipe.js.map +1 -0
- package/fesm2015/main-class-componentes-scroll.js +91 -0
- package/fesm2015/main-class-componentes-scroll.js.map +1 -0
- package/fesm2015/main-class-componentes-table.js +446 -0
- package/fesm2015/main-class-componentes-table.js.map +1 -0
- package/fesm2015/main-class-componentes-util.js +18 -0
- package/fesm2015/main-class-componentes-util.js.map +1 -0
- package/fesm2015/main-class-componentes.js +1 -4308
- package/fesm2015/main-class-componentes.js.map +1 -1
- package/form/index.d.ts +4 -4
- package/form/main-class-componentes-form.d.ts +4 -0
- package/form/main-class-componentes-form.metadata.json +1 -0
- package/form/package.json +11 -0
- package/input/index.d.ts +21 -21
- package/input/main-class-componentes-input.d.ts +5 -0
- package/input/main-class-componentes-input.metadata.json +1 -0
- package/input/package.json +11 -0
- package/input/{input-fileupload → src/input-fileupload}/input-fileupload.component.d.ts +2 -2
- package/loader/index.d.ts +3 -0
- package/loader/main-class-componentes-loader.d.ts +4 -0
- package/loader/main-class-componentes-loader.metadata.json +1 -0
- package/loader/package.json +11 -0
- package/{core/loader → loader/src}/loader.component.d.ts +1 -1
- package/loader/src/loader.module.d.ts +2 -0
- package/main-class-componentes.metadata.json +1 -1
- package/misc/index.d.ts +26 -26
- package/misc/main-class-componentes-misc.d.ts +4 -0
- package/misc/main-class-componentes-misc.metadata.json +1 -0
- package/misc/package.json +11 -0
- package/misc/{cnpj → src/cnpj}/cnpj-model.directive.d.ts +1 -1
- package/misc/{cnpj → src/cnpj}/cnpj.directive.d.ts +1 -1
- package/misc/{cpf → src/cpf}/cpf-model.directive.d.ts +1 -1
- package/misc/{cpf → src/cpf}/cpf.directive.d.ts +1 -1
- package/misc/{cpf-cnpj → src/cpf-cnpj}/cpf-cnpj-model.directive.d.ts +1 -1
- package/misc/{cpf-cnpj → src/cpf-cnpj}/cpf-cnpj.directive.d.ts +1 -1
- package/misc/{telefone → src/telefone}/telefone-model.directive.d.ts +1 -1
- package/model/index.d.ts +2 -0
- package/model/main-class-componentes-model.d.ts +4 -0
- package/model/main-class-componentes-model.metadata.json +1 -0
- package/model/package.json +11 -0
- package/model/src/model.module.d.ts +2 -0
- package/package.json +1 -1
- package/pipe/index.d.ts +2 -0
- package/pipe/main-class-componentes-pipe.d.ts +4 -0
- package/pipe/main-class-componentes-pipe.metadata.json +1 -0
- package/pipe/package.json +11 -0
- package/pipe/src/pipe.module.d.ts +2 -0
- package/public-api.d.ts +2 -10
- package/scroll/index.d.ts +2 -2
- package/scroll/main-class-componentes-scroll.d.ts +4 -0
- package/scroll/main-class-componentes-scroll.metadata.json +1 -0
- package/scroll/package.json +11 -0
- package/table/index.d.ts +11 -11
- package/table/main-class-componentes-table.d.ts +5 -0
- package/table/main-class-componentes-table.metadata.json +1 -0
- package/table/package.json +11 -0
- package/table/{infinite-table → src/infinite-table}/infinite-table.component.d.ts +2 -1
- package/table/{paginated-table → src/paginated-table}/paginated-table.component.d.ts +2 -2
- package/table/{table → src/table}/table.component.d.ts +1 -1
- package/util/index.d.ts +1 -1
- package/util/main-class-componentes-util.d.ts +4 -0
- package/util/main-class-componentes-util.metadata.json +1 -0
- package/util/package.json +11 -0
- package/core/componentes.module.d.ts +0 -4
- package/crud/crud.module.d.ts +0 -2
- package/esm2015/arquivo/arquivo.module.js +0 -29
- package/esm2015/arquivo/download-arquivo.directive.js +0 -44
- package/esm2015/arquivo/preview-arquivo/dialog-preview-arquivo/dialog-preview-arquivo.component.js +0 -56
- package/esm2015/arquivo/preview-arquivo/preview-arquivo.component.js +0 -136
- package/esm2015/core/arquivo/arquivo-manager.service.js +0 -3
- package/esm2015/core/componentes.module.js +0 -65
- package/esm2015/core/criptografia/criptografia.service.js +0 -13
- package/esm2015/core/dialog/dialog-confirmacao/dialog-confirmacao.component.js +0 -40
- package/esm2015/core/dialog/dialog-iframe/dialog-iframe.component.js +0 -59
- package/esm2015/core/dialog/dialog.service.js +0 -56
- package/esm2015/core/form/model/masked-model.directive.js +0 -149
- package/esm2015/core/form/validator/valida-modulo11.service.js +0 -92
- package/esm2015/core/imagem/imagem.directive.js +0 -80
- package/esm2015/core/loader/loader.component.js +0 -112
- package/esm2015/core/loader/loader.service.js +0 -70
- package/esm2015/core/mensageria/mensageria.service.js +0 -49
- package/esm2015/core/mobile/mobile.service.js +0 -46
- package/esm2015/core/pipe/nome-resumido.pipe.js +0 -16
- package/esm2015/crud/abstract-consulta-component.js +0 -60
- package/esm2015/crud/abstract-consulta-paginada-component.js +0 -48
- package/esm2015/crud/abstract-edicao-component.js +0 -29
- package/esm2015/crud/abstract-edicao-modal-component.js +0 -24
- package/esm2015/crud/crud.module.js +0 -14
- package/esm2015/date/date.module.js +0 -19
- package/esm2015/date/validator/data-validator.directive.js +0 -96
- package/esm2015/date/validator/futuro.directive.js +0 -26
- package/esm2015/form/form.component.js +0 -103
- package/esm2015/form/form.module.js +0 -25
- package/esm2015/form/mensagens-erro/mensagens-erro.component.js +0 -31
- package/esm2015/form/single-click.directive.js +0 -35
- package/esm2015/input/abstract-mat-form-field-control.js +0 -110
- package/esm2015/input/input-datetime/input-datetime.component.js +0 -114
- package/esm2015/input/input-fileupload/input-fileupload.component.js +0 -324
- package/esm2015/input/input-fileupload/input-fileupload.directive.js +0 -34
- package/esm2015/input/input-fileupload/input-fileupload.module.js +0 -34
- package/esm2015/input/input-telefone-internacional/input-telefone-internacional-validator.directive.js +0 -22
- package/esm2015/input/input-telefone-internacional/input-telefone-internacional.component.js +0 -66
- package/esm2015/input/input-telefone-internacional/input-telefone-internacional.module.js +0 -23
- package/esm2015/input/option-checkbox/all-option-checkbox.component.js +0 -36
- package/esm2015/input/option-checkbox/node-pool.js +0 -93
- package/esm2015/input/option-checkbox/option-checkbox-group.component.js +0 -71
- package/esm2015/input/option-checkbox/option-checkbox.component.js +0 -59
- package/esm2015/input/option-checkbox/option-checkbox.module.js +0 -23
- package/esm2015/input/option-checkbox/option-checkbox.service.js +0 -52
- package/esm2015/input/option-checkbox/option-node.js +0 -24
- package/esm2015/input/select-chips/select-chips.component.js +0 -177
- package/esm2015/input/select-chips/select-chips.module.js +0 -25
- package/esm2015/input/select-item/select-item.component.js +0 -20
- package/esm2015/input/select-item/select-item.module.js +0 -15
- package/esm2015/input/select-many-checkbox/select-many-checkbox.component.js +0 -150
- package/esm2015/input/select-many-checkbox/select-many-checkbox.module.js +0 -21
- package/esm2015/input/select-radio/select-radio.component.js +0 -124
- package/esm2015/input/select-radio/select-radio.module.js +0 -21
- package/esm2015/misc/cnpj/cnpj-model.directive.js +0 -13
- package/esm2015/misc/cnpj/cnpj.directive.js +0 -31
- package/esm2015/misc/cnpj/cnpj.module.js +0 -19
- package/esm2015/misc/cnpj/cnpjs.pipe.js +0 -15
- package/esm2015/misc/cpf/cpf-model.directive.js +0 -13
- package/esm2015/misc/cpf/cpf.directive.js +0 -31
- package/esm2015/misc/cpf/cpf.module.js +0 -19
- package/esm2015/misc/cpf/cpf.pipe.js +0 -15
- package/esm2015/misc/cpf-cnpj/cpf-cnpj-model.directive.js +0 -25
- package/esm2015/misc/cpf-cnpj/cpf-cnpj.directive.js +0 -32
- package/esm2015/misc/cpf-cnpj/cpf-cnpj.module.js +0 -19
- package/esm2015/misc/cpf-cnpj/cpf-cnpj.pipe.js +0 -18
- package/esm2015/misc/info/info.module.js +0 -17
- package/esm2015/misc/monetario/monetario-mask.js +0 -34
- package/esm2015/misc/monetario/monetario-model.directive.js +0 -124
- package/esm2015/misc/monetario/monetario.module.js +0 -16
- package/esm2015/misc/monetario/monetario.pipe.js +0 -13
- package/esm2015/misc/porcentagem/porcentagem-mask.js +0 -34
- package/esm2015/misc/porcentagem/porcentagem-model.directive.js +0 -99
- package/esm2015/misc/porcentagem/porcentagem.module.js +0 -16
- package/esm2015/misc/porcentagem/porcentagem.pipe.js +0 -13
- package/esm2015/misc/telefone/telefone-model.directive.js +0 -25
- package/esm2015/misc/telefone/telefone.module.js +0 -18
- package/esm2015/misc/telefone/telefone.pipe.js +0 -33
- package/esm2015/misc/unsafe-inner-html/unsafe-inner-html.directive.js +0 -23
- package/esm2015/misc/unsafe-inner-html/unsafe-inner-html.module.js +0 -15
- package/esm2015/scroll/scroll-container/scroll-container.component.js +0 -69
- package/esm2015/scroll/scroll.module.js +0 -17
- package/esm2015/table/column/column-cell.directive.js +0 -15
- package/esm2015/table/column/column-footer.directive.js +0 -15
- package/esm2015/table/column/column-header.directive.js +0 -15
- package/esm2015/table/column/column.directive.js +0 -28
- package/esm2015/table/infinite-table/infinite-table.component.js +0 -91
- package/esm2015/table/paginated-table/paginated-table.component.js +0 -43
- package/esm2015/table/paginator-i18n.js +0 -23
- package/esm2015/table/table/table.component.js +0 -119
- package/esm2015/table/table.module.js +0 -74
- package/esm2015/table/td/td.component.js +0 -19
- package/esm2015/table/th/th.component.js +0 -19
- package/esm2015/util/string.util.js +0 -12
- /package/{core/arquivo → arquivo/src}/arquivo-manager.service.d.ts +0 -0
- /package/arquivo/{arquivo.module.d.ts → src/arquivo.module.d.ts} +0 -0
- /package/core/{criptografia → src/criptografia}/criptografia.service.d.ts +0 -0
- /package/core/{mobile → src/mobile}/mobile.service.d.ts +0 -0
- /package/core/{form → src}/validator/valida-modulo11.service.d.ts +0 -0
- /package/date/{date.module.d.ts → src/date.module.d.ts} +0 -0
- /package/date/{validator → src/validator}/data-validator.directive.d.ts +0 -0
- /package/date/{validator → src/validator}/futuro.directive.d.ts +0 -0
- /package/{core/dialog → dialog/src}/dialog-confirmacao/dialog-confirmacao.component.d.ts +0 -0
- /package/{core/dialog → dialog/src}/dialog-iframe/dialog-iframe.component.d.ts +0 -0
- /package/{core/dialog → dialog/src}/dialog.service.d.ts +0 -0
- /package/form/{form.component.d.ts → src/form.component.d.ts} +0 -0
- /package/form/{form.module.d.ts → src/form.module.d.ts} +0 -0
- /package/form/{mensagens-erro → src/mensagens-erro}/mensagens-erro.component.d.ts +0 -0
- /package/form/{single-click.directive.d.ts → src/single-click.directive.d.ts} +0 -0
- /package/input/{abstract-mat-form-field-control.d.ts → src/abstract-mat-form-field-control.d.ts} +0 -0
- /package/input/{input-datetime → src/input-datetime}/input-datetime.component.d.ts +0 -0
- /package/input/{input-datetime → src/input-datetime}/input-datetime.module.d.ts +0 -0
- /package/input/{input-fileupload → src/input-fileupload}/input-fileupload.directive.d.ts +0 -0
- /package/input/{input-fileupload → src/input-fileupload}/input-fileupload.module.d.ts +0 -0
- /package/input/{input-telefone-internacional → src/input-telefone-internacional}/input-telefone-internacional-validator.directive.d.ts +0 -0
- /package/input/{input-telefone-internacional → src/input-telefone-internacional}/input-telefone-internacional.component.d.ts +0 -0
- /package/input/{input-telefone-internacional → src/input-telefone-internacional}/input-telefone-internacional.module.d.ts +0 -0
- /package/input/{option-checkbox → src/option-checkbox}/all-option-checkbox.component.d.ts +0 -0
- /package/input/{option-checkbox → src/option-checkbox}/node-pool.d.ts +0 -0
- /package/input/{option-checkbox → src/option-checkbox}/option-checkbox-group.component.d.ts +0 -0
- /package/input/{option-checkbox → src/option-checkbox}/option-checkbox.component.d.ts +0 -0
- /package/input/{option-checkbox → src/option-checkbox}/option-checkbox.module.d.ts +0 -0
- /package/input/{option-checkbox → src/option-checkbox}/option-checkbox.service.d.ts +0 -0
- /package/input/{option-checkbox → src/option-checkbox}/option-node.d.ts +0 -0
- /package/input/{select-chips → src/select-chips}/select-chips.component.d.ts +0 -0
- /package/input/{select-chips → src/select-chips}/select-chips.module.d.ts +0 -0
- /package/input/{select-item → src/select-item}/select-item.component.d.ts +0 -0
- /package/input/{select-item → src/select-item}/select-item.module.d.ts +0 -0
- /package/input/{select-many-checkbox → src/select-many-checkbox}/select-many-checkbox.component.d.ts +0 -0
- /package/input/{select-many-checkbox → src/select-many-checkbox}/select-many-checkbox.module.d.ts +0 -0
- /package/input/{select-radio → src/select-radio}/select-radio.component.d.ts +0 -0
- /package/input/{select-radio → src/select-radio}/select-radio.module.d.ts +0 -0
- /package/{core/loader → loader/src}/loader.service.d.ts +0 -0
- /package/misc/{cnpj → src/cnpj}/cnpj.module.d.ts +0 -0
- /package/misc/{cnpj → src/cnpj}/cnpjs.pipe.d.ts +0 -0
- /package/misc/{cpf → src/cpf}/cpf.module.d.ts +0 -0
- /package/misc/{cpf → src/cpf}/cpf.pipe.d.ts +0 -0
- /package/misc/{cpf-cnpj → src/cpf-cnpj}/cpf-cnpj.module.d.ts +0 -0
- /package/misc/{cpf-cnpj → src/cpf-cnpj}/cpf-cnpj.pipe.d.ts +0 -0
- /package/misc/{info → src/info}/info.component.d.ts +0 -0
- /package/misc/{info → src/info}/info.module.d.ts +0 -0
- /package/misc/{monetario → src/monetario}/monetario-mask.d.ts +0 -0
- /package/misc/{monetario → src/monetario}/monetario-model.directive.d.ts +0 -0
- /package/misc/{monetario → src/monetario}/monetario.module.d.ts +0 -0
- /package/misc/{monetario → src/monetario}/monetario.pipe.d.ts +0 -0
- /package/misc/{porcentagem → src/porcentagem}/porcentagem-mask.d.ts +0 -0
- /package/misc/{porcentagem → src/porcentagem}/porcentagem-model.directive.d.ts +0 -0
- /package/misc/{porcentagem → src/porcentagem}/porcentagem.module.d.ts +0 -0
- /package/misc/{porcentagem → src/porcentagem}/porcentagem.pipe.d.ts +0 -0
- /package/misc/{telefone → src/telefone}/telefone.module.d.ts +0 -0
- /package/misc/{telefone → src/telefone}/telefone.pipe.d.ts +0 -0
- /package/misc/{unsafe-inner-html → src/unsafe-inner-html}/unsafe-inner-html.directive.d.ts +0 -0
- /package/misc/{unsafe-inner-html → src/unsafe-inner-html}/unsafe-inner-html.module.d.ts +0 -0
- /package/{core/form/model → model/src}/masked-model.directive.d.ts +0 -0
- /package/{core/pipe → pipe/src}/nome-resumido.pipe.d.ts +0 -0
- /package/scroll/{scroll-container → src/scroll-container}/scroll-container.component.d.ts +0 -0
- /package/scroll/{scroll.module.d.ts → src/scroll.module.d.ts} +0 -0
- /package/table/{column → src/column}/column-cell.directive.d.ts +0 -0
- /package/table/{column → src/column}/column-footer.directive.d.ts +0 -0
- /package/table/{column → src/column}/column-header.directive.d.ts +0 -0
- /package/table/{column → src/column}/column.directive.d.ts +0 -0
- /package/table/{paginator → src/paginator}/paginator.component.d.ts +0 -0
- /package/table/{paginator-i18n.d.ts → src/paginator-i18n.d.ts} +0 -0
- /package/table/{table.module.d.ts → src/table.module.d.ts} +0 -0
- /package/table/{td → src/td}/td.component.d.ts +0 -0
- /package/table/{th → src/th}/th.component.d.ts +0 -0
- /package/util/{string.util.d.ts → src/string.util.d.ts} +0 -0
|
@@ -1,4316 +1,9 @@
|
|
|
1
|
-
import { Component, ElementRef, Host, Optional, Input, ViewChild, Injectable, Inject, EventEmitter, Directive, Output, HostListener, Pipe, ɵɵdefineInjectable, ɵɵinject, InjectionToken, Self, NgModule, TemplateRef, ContentChild, ContentChildren, HostBinding, LOCALE_ID, ChangeDetectorRef, Sanitizer } from '@angular/core';
|
|
2
|
-
import { CommonModule, DatePipe } from '@angular/common';
|
|
3
|
-
import { __awaiter } from 'tslib';
|
|
4
|
-
import { MAT_DIALOG_DATA, MatDialogRef, MatDialog, MatDialogModule } from '@angular/material/dialog';
|
|
5
|
-
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
6
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
7
|
-
import { Observable, from, Subject as Subject$1 } from 'rxjs/index';
|
|
8
|
-
import { delay } from 'rxjs/internal/operators';
|
|
9
|
-
import { from as from$1, Observable as Observable$1, BehaviorSubject, Subject, combineLatest, fromEvent } from 'rxjs';
|
|
10
|
-
import { NgControl, FormsModule, NG_VALIDATORS, NgForm, FormGroupDirective, NG_VALUE_ACCESSOR, FormControl, ReactiveFormsModule, NgModel } from '@angular/forms';
|
|
11
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
12
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
13
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
14
|
-
import { FlexModule, FlexLayoutModule } from '@angular/flex-layout';
|
|
15
|
-
import JSEncrypt from 'jsencrypt';
|
|
16
|
-
import { DomSanitizer } from '@angular/platform-browser';
|
|
17
|
-
import { map, switchMap, startWith, throttleTime } from 'rxjs/operators';
|
|
18
|
-
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
19
|
-
import { MediaMatcher } from '@angular/cdk/layout';
|
|
20
|
-
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
|
21
|
-
import { ImageViewerModule } from '@jmcrommen/ngx-image-viewer';
|
|
22
|
-
import { MatColumnDef, MatCellDef, MatHeaderCellDef, MatFooterCellDef, MatTable, MatTableModule } from '@angular/material/table';
|
|
23
|
-
import { MatPaginatorIntl, MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
24
|
-
import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
|
|
25
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
26
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
27
|
-
import { ErrorStateMatcher, MAT_DATE_LOCALE } from '@angular/material/core';
|
|
28
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
29
|
-
import { MatInputModule } from '@angular/material/input';
|
|
30
|
-
import { DatetimeAdapter, MAT_DATETIME_FORMATS, MatDatetimepickerModule } from '@mat-datetimepicker/core';
|
|
31
|
-
import { MomentDatetimeModule, MomentDatetimeAdapter } from '@mat-datetimepicker/moment';
|
|
32
|
-
import * as moment$1 from 'moment';
|
|
33
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
34
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
35
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
36
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
37
|
-
import { MatRadioModule } from '@angular/material/radio';
|
|
38
|
-
import { phoneNumberValidator, LacMatTelInputModule } from 'lac-mat-tel-input';
|
|
39
|
-
import { throttle } from 'lodash-es';
|
|
40
|
-
|
|
41
|
-
class LoaderComponent {
|
|
42
|
-
constructor(parent) {
|
|
43
|
-
this.parent = parent;
|
|
44
|
-
this.$shown = false;
|
|
45
|
-
this.labelLoading = 'Aguarde...';
|
|
46
|
-
this.showOnInit = false;
|
|
47
|
-
}
|
|
48
|
-
ngOnInit() {
|
|
49
|
-
this.$shown = this.showOnInit;
|
|
50
|
-
}
|
|
51
|
-
get shown() {
|
|
52
|
-
return this.$shown;
|
|
53
|
-
}
|
|
54
|
-
get component() {
|
|
55
|
-
return this.$component;
|
|
56
|
-
}
|
|
57
|
-
set component(component) {
|
|
58
|
-
if (this.$component !== component) {
|
|
59
|
-
if (typeof this.$component === 'boolean') {
|
|
60
|
-
if (this.parent && this.$component) {
|
|
61
|
-
this.parent.nativeElement.parentElement.classList.remove('component-loading');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
if (this.$component) {
|
|
66
|
-
this.$component.classList.remove('component-loading');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (typeof component === 'boolean') {
|
|
70
|
-
if (this.parent && component) {
|
|
71
|
-
this.parent.nativeElement.parentElement.classList.add('component-loading');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (component) {
|
|
76
|
-
component.classList.add('component-loading');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
this.$component = component;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
listen(observable) {
|
|
83
|
-
if (this.buscando) {
|
|
84
|
-
this.buscando.unsubscribe();
|
|
85
|
-
}
|
|
86
|
-
return new Observable(observer => {
|
|
87
|
-
this.show();
|
|
88
|
-
this.buscando = from(observable)
|
|
89
|
-
.pipe(delay(300))
|
|
90
|
-
.subscribe(t => {
|
|
91
|
-
if (this.buscando) {
|
|
92
|
-
this.hide();
|
|
93
|
-
this.buscando = undefined;
|
|
94
|
-
}
|
|
95
|
-
observer.next(t);
|
|
96
|
-
}, err => {
|
|
97
|
-
if (this.buscando) {
|
|
98
|
-
this.hide();
|
|
99
|
-
this.buscando = undefined;
|
|
100
|
-
}
|
|
101
|
-
observer.error(err);
|
|
102
|
-
}, () => observer.complete());
|
|
103
|
-
return () => {
|
|
104
|
-
if (this.buscando) {
|
|
105
|
-
this.buscando.unsubscribe();
|
|
106
|
-
this.hide();
|
|
107
|
-
this.buscando = undefined;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
get visibility() {
|
|
113
|
-
return this.$shown ? 'shown' : 'hidden';
|
|
114
|
-
}
|
|
115
|
-
show() {
|
|
116
|
-
this.$shown = true;
|
|
117
|
-
}
|
|
118
|
-
hide() {
|
|
119
|
-
this.$shown = false;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
LoaderComponent.decorators = [
|
|
123
|
-
{ type: Component, args: [{
|
|
124
|
-
selector: 'mcl-loader',
|
|
125
|
-
template: "<div #loader class=\"preloader\" [ngClass]=\"{'preloader-component':component}\" [@visibility]=\"visibility\">\n <div class=\"cssload-speeding-wheel\"></div>\n <p class=\"preloader-text\">{{'mcl.loader.aguarde' | translate}}</p>\n</div>\n",
|
|
126
|
-
animations: [
|
|
127
|
-
trigger('visibility', [
|
|
128
|
-
state('shown', style({ opacity: 0.75, display: 'block' })),
|
|
129
|
-
state('hidden', style({ opacity: 0, display: 'none' })),
|
|
130
|
-
transition('* => *', animate('.3s'))
|
|
131
|
-
])
|
|
132
|
-
],
|
|
133
|
-
exportAs: 'loader',
|
|
134
|
-
styles: [".preloader{left:0;bottom:0;top:0;right:0;opacity:1;width:100%;height:100%;background:hsla(0,0%,100%,.8)}.preloader:not(.preloader-component){position:fixed;z-index:99999}.preloader.preloader-component{position:absolute;z-index:99999}.preloader .cssload-speeding-wheel{position:absolute;top:calc(50% - 25px);left:calc(50% - 15px);width:30px;height:30px;margin:0 auto;border-radius:50%;border-color:currentcolor transparent;border-style:solid;border-width:2px;animation:cssload-spin 425ms linear infinite;-o-animation:cssload-spin 425ms infinite linear;-ms-animation:cssload-spin 425ms infinite linear;-webkit-animation:cssload-spin 425ms linear infinite;-moz-animation:cssload-spin 425ms infinite linear}@keyframes cssload-spin{to{transform:rotate(1turn)}}@-webkit-keyframes cssload-spin{to{transform:rotate(1turn)}}.preloader-text{display:block;text-align:center;width:100%;height:30px;color:#2b2b2b;position:relative;top:calc(50% + 15px)}"]
|
|
135
|
-
},] }
|
|
136
|
-
];
|
|
137
|
-
LoaderComponent.ctorParameters = () => [
|
|
138
|
-
{ type: ElementRef, decorators: [{ type: Host }, { type: Optional }] }
|
|
139
|
-
];
|
|
140
|
-
LoaderComponent.propDecorators = {
|
|
141
|
-
progresso: [{ type: Input }],
|
|
142
|
-
$shown: [{ type: Input, args: ['show',] }],
|
|
143
|
-
loader: [{ type: ViewChild, args: ['loader',] }],
|
|
144
|
-
labelLoading: [{ type: Input }],
|
|
145
|
-
showOnInit: [{ type: Input }],
|
|
146
|
-
component: [{ type: Input }]
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
class LoaderService {
|
|
150
|
-
constructor() {
|
|
151
|
-
this.executando = false;
|
|
152
|
-
this.ajaxCount = [];
|
|
153
|
-
}
|
|
154
|
-
init(loader) {
|
|
155
|
-
if (this.loader) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
this.loader = loader;
|
|
159
|
-
}
|
|
160
|
-
incrementaAJAX(executando = false) {
|
|
161
|
-
this.executando = this.executando || executando;
|
|
162
|
-
const token = String(Math.random() * 1E10);
|
|
163
|
-
this.ajaxCount.push(token);
|
|
164
|
-
if (this.loader && this.executando &&
|
|
165
|
-
this.ajaxCount.length > 0 && !this.loader.shown) {
|
|
166
|
-
setTimeout(() => {
|
|
167
|
-
if (this.executando && this.ajaxCount.length > 0 && !this.loader.shown) {
|
|
168
|
-
this.loader.show();
|
|
169
|
-
}
|
|
170
|
-
}, 150);
|
|
171
|
-
}
|
|
172
|
-
return token;
|
|
173
|
-
}
|
|
174
|
-
decrementaAJAX(token) {
|
|
175
|
-
const index = this.ajaxCount.indexOf(token);
|
|
176
|
-
if (index >= 0) {
|
|
177
|
-
this.ajaxCount.splice(index, 1);
|
|
178
|
-
setTimeout(() => {
|
|
179
|
-
if (this.ajaxCount.length <= 0) {
|
|
180
|
-
if (this.loader &&
|
|
181
|
-
this.loader.shown) {
|
|
182
|
-
this.loader.hide();
|
|
183
|
-
this.executando = false;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}, 500);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
listen(call) {
|
|
190
|
-
this.executando = true;
|
|
191
|
-
return this.doExecuta(from$1(call));
|
|
192
|
-
}
|
|
193
|
-
doExecuta(call) {
|
|
194
|
-
return new Observable$1(subscriber => {
|
|
195
|
-
const token = this.incrementaAJAX();
|
|
196
|
-
const unsubs = call.subscribe(resp => {
|
|
197
|
-
subscriber.next(resp);
|
|
198
|
-
}, err => {
|
|
199
|
-
this.decrementaAJAX(token);
|
|
200
|
-
subscriber.error(err);
|
|
201
|
-
}, () => {
|
|
202
|
-
this.decrementaAJAX(token);
|
|
203
|
-
subscriber.complete();
|
|
204
|
-
});
|
|
205
|
-
return () => {
|
|
206
|
-
this.decrementaAJAX(token);
|
|
207
|
-
unsubs.unsubscribe();
|
|
208
|
-
};
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
LoaderService.decorators = [
|
|
213
|
-
{ type: Injectable }
|
|
214
|
-
];
|
|
215
|
-
LoaderService.ctorParameters = () => [];
|
|
216
|
-
|
|
217
|
-
class DialogConfirmacaoComponent {
|
|
218
|
-
constructor(data, dialogRef) {
|
|
219
|
-
this.data = data;
|
|
220
|
-
this.dialogRef = dialogRef;
|
|
221
|
-
}
|
|
222
|
-
get titulo() {
|
|
223
|
-
return this.data.titulo;
|
|
224
|
-
}
|
|
225
|
-
get mensagem() {
|
|
226
|
-
return this.data.mensagem;
|
|
227
|
-
}
|
|
228
|
-
get okLabel() {
|
|
229
|
-
return this.data.okLabel;
|
|
230
|
-
}
|
|
231
|
-
get cancelLabel() {
|
|
232
|
-
return this.data.cancelLabel;
|
|
233
|
-
}
|
|
234
|
-
ngOnInit() {
|
|
235
|
-
}
|
|
236
|
-
confirma(form) {
|
|
237
|
-
if (!form.valid) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
this.dialogRef.close(true);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
DialogConfirmacaoComponent.decorators = [
|
|
244
|
-
{ type: Component, args: [{
|
|
245
|
-
selector: 'mcl-dialog-confirmacao',
|
|
246
|
-
template: "<div mat-dialog-title>\n {{titulo | translate}}\n</div>\n\n<form (ngSubmit)=\"confirma(form)\" #form=\"ngForm\">\n <mat-dialog-content>\n\n <p [innerHTML]=\"mensagem | translate\"></p>\n\n </mat-dialog-content>\n\n <div mat-dialog-actions>\n <button mat-stroked-button color=\"accent\">\n {{okLabel | translate}}\n </button>\n <button mat-flat-button color=\"warn\" type=\"button\" mat-dialog-close *ngIf=\"cancelLabel\">\n {{cancelLabel | translate}}\n </button>\n </div>\n</form>\n",
|
|
247
|
-
styles: [".mat-dialog-content{width:95vw;max-width:280px;min-width:auto;margin:10px 60px;text-align:center;min-height:120px;display:flex;flex-direction:column;justify-content:center}[mat-dialog-title]{text-align:center;margin:40px 60px 20px}[mat-dialog-actions]{justify-content:center;margin:20px 60px 40px;flex-direction:row}@media (max-width:750px){.mat-dialog-content{margin:10px 20px}}"]
|
|
248
|
-
},] }
|
|
249
|
-
];
|
|
250
|
-
DialogConfirmacaoComponent.ctorParameters = () => [
|
|
251
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
|
|
252
|
-
{ type: MatDialogRef }
|
|
253
|
-
];
|
|
254
|
-
|
|
255
|
-
function doApplyMask(val, mask) {
|
|
256
|
-
let valorFormatado = '';
|
|
257
|
-
if (val !== null && val !== undefined && val.length) {
|
|
258
|
-
if (mask) {
|
|
259
|
-
for (let idx = 0; idx < val.length && mask.length > valorFormatado.length;) {
|
|
260
|
-
if (mask.charAt(valorFormatado.length) === '#') {
|
|
261
|
-
if (val.charAt(idx).match(/\d/)) {
|
|
262
|
-
valorFormatado += val.charAt(idx);
|
|
263
|
-
}
|
|
264
|
-
idx++;
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
valorFormatado += mask.charAt(valorFormatado.length);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
valorFormatado = val;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return valorFormatado;
|
|
276
|
-
}
|
|
277
|
-
function doRemoveMask(val, mask) {
|
|
278
|
-
if (val !== null && val !== undefined) {
|
|
279
|
-
if (mask) {
|
|
280
|
-
const unmasked = val.toString().replace(/\D/g, '');
|
|
281
|
-
const digits = mask.replace(/[^#]/g, '');
|
|
282
|
-
if (unmasked.length > digits.length) {
|
|
283
|
-
return unmasked.substring(0, digits.length);
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
return unmasked;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return val;
|
|
290
|
-
}
|
|
291
|
-
return undefined;
|
|
292
|
-
}
|
|
293
|
-
class MaskedModelDirective {
|
|
294
|
-
constructor(ngControl) {
|
|
295
|
-
this.ngControl = ngControl;
|
|
296
|
-
this.value = null;
|
|
297
|
-
this.displayValue = null;
|
|
298
|
-
this.mclModelChange = new EventEmitter();
|
|
299
|
-
}
|
|
300
|
-
delay(ms = 0) {
|
|
301
|
-
return new Observable(observer => {
|
|
302
|
-
const timeout = setTimeout(() => observer.next(), ms);
|
|
303
|
-
return () => clearTimeout(timeout);
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
processValue(displayValue) {
|
|
307
|
-
return this.keepMask ? displayValue : this.removeMask(displayValue);
|
|
308
|
-
}
|
|
309
|
-
get mask() {
|
|
310
|
-
return this.$mask;
|
|
311
|
-
}
|
|
312
|
-
set mask(mask) {
|
|
313
|
-
if (mask !== this.$mask) {
|
|
314
|
-
this.$mask = mask;
|
|
315
|
-
this.defineValue();
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
set maskValue(value) {
|
|
319
|
-
if (value !== this.value) {
|
|
320
|
-
this.value = value;
|
|
321
|
-
this.defineValue();
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
onInput(event) {
|
|
325
|
-
const target = event.target;
|
|
326
|
-
const value = target.value;
|
|
327
|
-
this.onValueChange(value);
|
|
328
|
-
}
|
|
329
|
-
updateValue(value) {
|
|
330
|
-
this.value = value;
|
|
331
|
-
this.mclModelChange.emit(value);
|
|
332
|
-
this.delay().subscribe(() => this.ngControl.control.updateValueAndValidity());
|
|
333
|
-
}
|
|
334
|
-
defineValue() {
|
|
335
|
-
let value = this.value;
|
|
336
|
-
let displayValue = null;
|
|
337
|
-
if (this.mask) {
|
|
338
|
-
if (value != null) {
|
|
339
|
-
displayValue = this.applyMask(value);
|
|
340
|
-
value = this.processValue(displayValue);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
displayValue = this.value;
|
|
345
|
-
}
|
|
346
|
-
this.delay().subscribe(() => {
|
|
347
|
-
if (this.displayValue !== displayValue) {
|
|
348
|
-
this.displayValue = displayValue;
|
|
349
|
-
this.ngControl.control.setValue(displayValue);
|
|
350
|
-
this.delay().subscribe(() => {
|
|
351
|
-
if (value !== this.value) {
|
|
352
|
-
return this.updateValue(value);
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
onValueChange(newValue) {
|
|
359
|
-
if (newValue !== this.displayValue) {
|
|
360
|
-
let displayValue = newValue;
|
|
361
|
-
let value = newValue;
|
|
362
|
-
if ((newValue == null) || (newValue.trim() === '')) {
|
|
363
|
-
value = null;
|
|
364
|
-
}
|
|
365
|
-
else if (this.mask) {
|
|
366
|
-
displayValue = this.applyMask(newValue);
|
|
367
|
-
value = this.processValue(displayValue);
|
|
368
|
-
}
|
|
369
|
-
this.displayValue = displayValue;
|
|
370
|
-
if (newValue !== displayValue) {
|
|
371
|
-
this.ngControl.control.setValue(displayValue);
|
|
372
|
-
}
|
|
373
|
-
if (value !== this.value) {
|
|
374
|
-
this.updateValue(value);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
removeMask(value) {
|
|
379
|
-
return doRemoveMask(value, this.mask);
|
|
380
|
-
}
|
|
381
|
-
applyMask(value) {
|
|
382
|
-
return doApplyMask(value, this.mask);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
MaskedModelDirective.decorators = [
|
|
386
|
-
{ type: Directive, args: [{
|
|
387
|
-
selector: '[mclModel][ngModel][mask]',
|
|
388
|
-
},] }
|
|
389
|
-
];
|
|
390
|
-
MaskedModelDirective.ctorParameters = () => [
|
|
391
|
-
{ type: NgControl }
|
|
392
|
-
];
|
|
393
|
-
MaskedModelDirective.propDecorators = {
|
|
394
|
-
keepMask: [{ type: Input }],
|
|
395
|
-
mclModelChange: [{ type: Output }],
|
|
396
|
-
mask: [{ type: Input }],
|
|
397
|
-
maskValue: [{ type: Input, args: ['mclModel',] }],
|
|
398
|
-
onInput: [{ type: HostListener, args: ['input', ['$event'],] }]
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
class ValidaModulo11Service {
|
|
402
|
-
/**
|
|
403
|
-
* Método que verifica a validade de um CPF.
|
|
404
|
-
*
|
|
405
|
-
* @param cpf - String com CPF a ser validado.
|
|
406
|
-
* @return True se CPF é válido e false caso contrário.
|
|
407
|
-
*/
|
|
408
|
-
isValidCpf(cpf) {
|
|
409
|
-
if ((cpf.length === 11) && !this.isRepeatedNumber(cpf) &&
|
|
410
|
-
(Number(cpf.charAt(9)) === this.calculateDvMod11(cpf, 9, 2, 11)) &&
|
|
411
|
-
(Number(cpf.charAt(10)) === this.calculateDvMod11(cpf, 10, 2, 11))) {
|
|
412
|
-
return true;
|
|
413
|
-
}
|
|
414
|
-
return false;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* <P>
|
|
418
|
-
* Método que verifica a validade de um CGC.
|
|
419
|
-
* </p>
|
|
420
|
-
* <P>
|
|
421
|
-
* Um CGC é válido se tiver o seguinte formato: RRRRRRRRFFFFDD (tamanho 14), onde:
|
|
422
|
-
* </p>
|
|
423
|
-
* <UL>
|
|
424
|
-
* <li>RRRRRRRR - Raiz do CGC;</li>
|
|
425
|
-
* <li>FFFF - Filial (deve ser menor que 7100);</li>
|
|
426
|
-
* <li>DD - Dígito verificador.</li>
|
|
427
|
-
* </ul>
|
|
428
|
-
*
|
|
429
|
-
* @param cgc - String com CGC a ser validado.
|
|
430
|
-
* @return True se CGC é válido e false caso contrário.
|
|
431
|
-
*/
|
|
432
|
-
isValidCgc(cgc) {
|
|
433
|
-
let filial = Number(cgc.substring(9, 12));
|
|
434
|
-
if ((cgc.length === 14) && (!this.isRepeatedNumber(cgc)) &&
|
|
435
|
-
(Number(cgc.charAt(12)) === this.calculateDvMod11(cgc, 12, 2, 9)) &&
|
|
436
|
-
(Number(cgc.charAt(13)) === this.calculateDvMod11(cgc, 13, 2, 9)) &&
|
|
437
|
-
(filial > 0) && (filial < 7100)) {
|
|
438
|
-
return true;
|
|
439
|
-
}
|
|
440
|
-
return false;
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Método que verifica se cadeia é composta apenas por caracteres numéricos repetidos (tudo 0 ou tudo 1, ...). Utilizado nas rotinas que
|
|
444
|
-
* testam cpf e cgc.
|
|
445
|
-
*
|
|
446
|
-
* @param cadeia - Cadeia a ser checada.
|
|
447
|
-
* @return True caso cadeia seja formado somente com dígitos e false caso contrário.
|
|
448
|
-
*/
|
|
449
|
-
isRepeatedNumber(cadeia) {
|
|
450
|
-
let ind = 1;
|
|
451
|
-
let ch = cadeia.charAt(0);
|
|
452
|
-
while (ind < cadeia.length) {
|
|
453
|
-
if (ch === cadeia.charAt(ind)) {
|
|
454
|
-
ind++;
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
return true;
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Método que calcula o dígito verificador módulo 11 de uma cadeia.
|
|
464
|
-
*
|
|
465
|
-
* @param cadeia - Cadeia ser calculado o dígito verificador.
|
|
466
|
-
* @param tam - Número de dígitos a serem utilizados no cálculo.
|
|
467
|
-
* @param fatorInicial - Valor base no fator de multiplicação.
|
|
468
|
-
* @param fatorFinal - Valor limite do fator de multiplicação.
|
|
469
|
-
* @return Valor (decimal) do d�gito verificador.
|
|
470
|
-
*/
|
|
471
|
-
calculateDvMod11(cadeia, tam, fatorInicial, fatorFinal) {
|
|
472
|
-
let fator = fatorInicial;
|
|
473
|
-
let total = 0;
|
|
474
|
-
for (let ind = 0; ind < tam; ind++) {
|
|
475
|
-
total += Number(cadeia.charAt(tam - ind - 1)) * fator;
|
|
476
|
-
fator++;
|
|
477
|
-
if (fator > fatorFinal) {
|
|
478
|
-
fator = fatorInicial;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
total %= 11;
|
|
482
|
-
if (total < 2) {
|
|
483
|
-
return 0;
|
|
484
|
-
}
|
|
485
|
-
return (11 - total);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
ValidaModulo11Service.decorators = [
|
|
489
|
-
{ type: Injectable }
|
|
490
|
-
];
|
|
491
|
-
|
|
492
|
-
class NomeResumidoPipe {
|
|
493
|
-
transform(value, ...args) {
|
|
494
|
-
if (value && value.trim().indexOf(' ') >= 0) {
|
|
495
|
-
const parts = value.trim().split(' ');
|
|
496
|
-
return parts[0] + ' ' + parts[parts.length - 1];
|
|
497
|
-
}
|
|
498
|
-
return value;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
NomeResumidoPipe.decorators = [
|
|
502
|
-
{ type: Pipe, args: [{
|
|
503
|
-
name: 'nomeResumido'
|
|
504
|
-
},] }
|
|
505
|
-
];
|
|
506
|
-
|
|
507
|
-
class CriptografiaService {
|
|
508
|
-
criptografa(chavePublica, senha) {
|
|
509
|
-
const rsa = new JSEncrypt(undefined);
|
|
510
|
-
rsa.setPublicKey(chavePublica);
|
|
511
|
-
return rsa.encrypt(senha);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
CriptografiaService.decorators = [
|
|
515
|
-
{ type: Injectable }
|
|
516
|
-
];
|
|
517
|
-
|
|
518
|
-
class DialogIframeComponent {
|
|
519
|
-
constructor(dados, dialogRef, sanitizer) {
|
|
520
|
-
this.dialogRef = dialogRef;
|
|
521
|
-
this.titulo = dados.titulo;
|
|
522
|
-
this.url = sanitizer.bypassSecurityTrustResourceUrl(dados.url);
|
|
523
|
-
}
|
|
524
|
-
ngAfterViewInit() {
|
|
525
|
-
registerDialogOnIframe(this.iframe.nativeElement, () => this.close());
|
|
526
|
-
}
|
|
527
|
-
returnValue() {
|
|
528
|
-
var _a;
|
|
529
|
-
const fraContent = this.iframe.nativeElement.contentDocument || ((_a = this.iframe.nativeElement.contentWindow) === null || _a === void 0 ? void 0 : _a.document);
|
|
530
|
-
if (fraContent) {
|
|
531
|
-
const divRetornoValue = fraContent.getElementById('returnValue');
|
|
532
|
-
if (divRetornoValue) {
|
|
533
|
-
const returnValue = divRetornoValue.innerText;
|
|
534
|
-
if (returnValue) {
|
|
535
|
-
return JSON.parse(returnValue);
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
return undefined;
|
|
540
|
-
}
|
|
541
|
-
close() {
|
|
542
|
-
this.dialogRef.close(this.returnValue());
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
DialogIframeComponent.decorators = [
|
|
546
|
-
{ type: Component, args: [{
|
|
547
|
-
selector: 'mcl-dialog-iframe',
|
|
548
|
-
template: "<div mat-dialog-title >\n <h2>{{titulo}}</h2>\n <button mat-icon-button mat-dialog-close class=\"pull-right\" tabindex=\"-1\">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n<mat-dialog-content>\n <iframe #iframe width=\"560\" height=\"315\" [src]=\"url\" (close)=\"close()\" frameborder=\"0\"\n ></iframe>\n</mat-dialog-content>\n",
|
|
549
|
-
styles: ["[mat-dialog-title]{display:flex}[mat-dialog-title] h2{font-size:25px;flex:1 1 auto;margin:0 0 20px}[mat-dialog-title] mat-icon{vertical-align:middle}mat-dialog-content{margin:-24px;width:calc(100% + 48px);padding:0}mat-dialog-content iframe{width:100%;height:60vh;border:0}"]
|
|
550
|
-
},] }
|
|
551
|
-
];
|
|
552
|
-
DialogIframeComponent.ctorParameters = () => [
|
|
553
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
|
|
554
|
-
{ type: MatDialogRef },
|
|
555
|
-
{ type: DomSanitizer }
|
|
556
|
-
];
|
|
557
|
-
DialogIframeComponent.propDecorators = {
|
|
558
|
-
iframe: [{ type: ViewChild, args: ['iframe',] }]
|
|
559
|
-
};
|
|
560
|
-
function registerDialogOnIframe(iframe, callback) {
|
|
561
|
-
window.addEventListener('dialogIframeClosed', () => callback());
|
|
562
|
-
}
|
|
563
|
-
function closeDialogIframe(returnValue) {
|
|
564
|
-
if (returnValue) {
|
|
565
|
-
const returnDiv = document.createElement('div');
|
|
566
|
-
returnDiv.id = 'returnValue';
|
|
567
|
-
returnDiv.innerText = JSON.stringify(returnValue);
|
|
568
|
-
returnDiv.style.display = 'none';
|
|
569
|
-
document.body.appendChild(returnDiv);
|
|
570
|
-
}
|
|
571
|
-
window.parent.dispatchEvent(new Event('dialogIframeClosed'));
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
class DialogService {
|
|
575
|
-
constructor(dialog) {
|
|
576
|
-
this.dialog = dialog;
|
|
577
|
-
}
|
|
578
|
-
confirma(mensagem, config = {}) {
|
|
579
|
-
return this.dialog.open(DialogConfirmacaoComponent, {
|
|
580
|
-
data: {
|
|
581
|
-
titulo: config.titulo || 'mcl.dialog.confirmacao',
|
|
582
|
-
mensagem,
|
|
583
|
-
okLabel: config.okLabel || 'mcl.dialog.sim',
|
|
584
|
-
cancelLabel: config.cancelLabel || 'mcl.dialog.nao'
|
|
585
|
-
}
|
|
586
|
-
}).afterClosed().pipe(map(result => !!result));
|
|
587
|
-
}
|
|
588
|
-
informa(mensagem, config = {}) {
|
|
589
|
-
return this.dialog.open(DialogConfirmacaoComponent, {
|
|
590
|
-
data: {
|
|
591
|
-
titulo: config.titulo || 'mcl.dialog.informacao',
|
|
592
|
-
mensagem,
|
|
593
|
-
okLabel: config.okLabel || 'mcl.dialog.ok',
|
|
594
|
-
}
|
|
595
|
-
}).afterClosed().pipe(map(result => !!result));
|
|
596
|
-
}
|
|
597
|
-
iframe(url, titulo) {
|
|
598
|
-
if (!!window.parent && window.parent !== window) {
|
|
599
|
-
window.location.href = url;
|
|
600
|
-
}
|
|
601
|
-
else {
|
|
602
|
-
return this.dialog.open(DialogIframeComponent, {
|
|
603
|
-
data: {
|
|
604
|
-
titulo,
|
|
605
|
-
url,
|
|
606
|
-
},
|
|
607
|
-
panelClass: 'dialog-frame',
|
|
608
|
-
}).afterClosed();
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
DialogService.ɵprov = ɵɵdefineInjectable({ factory: function DialogService_Factory() { return new DialogService(ɵɵinject(MatDialog)); }, token: DialogService, providedIn: "root" });
|
|
613
|
-
DialogService.decorators = [
|
|
614
|
-
{ type: Injectable, args: [{
|
|
615
|
-
providedIn: 'root'
|
|
616
|
-
},] }
|
|
617
|
-
];
|
|
618
|
-
DialogService.ctorParameters = () => [
|
|
619
|
-
{ type: MatDialog }
|
|
620
|
-
];
|
|
621
|
-
|
|
622
|
-
class MensageriaService {
|
|
623
|
-
constructor(snackBar, translateService) {
|
|
624
|
-
this.snackBar = snackBar;
|
|
625
|
-
this.translateService = translateService;
|
|
626
|
-
this.defaultHorizontalPosition = 'right';
|
|
627
|
-
this.defaultVerticalPosition = 'top';
|
|
628
|
-
this.defaultDuration = 2000;
|
|
629
|
-
}
|
|
630
|
-
setDefaultComponent(defaultComponent) {
|
|
631
|
-
this.$defaultComponent = defaultComponent;
|
|
632
|
-
}
|
|
633
|
-
addMensagemFromComponent(component, config) {
|
|
634
|
-
this.snackBar.openFromComponent(component, Object.assign({ horizontalPosition: this.defaultHorizontalPosition, verticalPosition: this.defaultVerticalPosition, duration: this.defaultDuration }, config));
|
|
635
|
-
}
|
|
636
|
-
addMensagem(mensagem, args = {}, action = 'OK', config) {
|
|
637
|
-
const parsedConfig = Object.assign({ horizontalPosition: this.defaultHorizontalPosition, verticalPosition: this.defaultVerticalPosition, duration: this.defaultDuration }, config);
|
|
638
|
-
let ref;
|
|
639
|
-
if (!!this.$defaultComponent) {
|
|
640
|
-
ref = this.snackBar.openFromComponent(this.$defaultComponent, Object.assign(Object.assign({}, parsedConfig), { data: {
|
|
641
|
-
message: this.translateService.instant(mensagem, args),
|
|
642
|
-
data: parsedConfig.data,
|
|
643
|
-
} }));
|
|
644
|
-
}
|
|
645
|
-
else {
|
|
646
|
-
ref = this.snackBar.open(this.translateService.instant(mensagem, args), 'OK', parsedConfig);
|
|
647
|
-
}
|
|
648
|
-
ref.onAction().subscribe(() => {
|
|
649
|
-
ref.dismiss();
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
MensageriaService.ɵprov = ɵɵdefineInjectable({ factory: function MensageriaService_Factory() { return new MensageriaService(ɵɵinject(MatSnackBar), ɵɵinject(TranslateService)); }, token: MensageriaService, providedIn: "root" });
|
|
654
|
-
MensageriaService.decorators = [
|
|
655
|
-
{ type: Injectable, args: [{
|
|
656
|
-
providedIn: 'root'
|
|
657
|
-
},] }
|
|
658
|
-
];
|
|
659
|
-
MensageriaService.ctorParameters = () => [
|
|
660
|
-
{ type: MatSnackBar },
|
|
661
|
-
{ type: TranslateService }
|
|
662
|
-
];
|
|
663
|
-
|
|
664
|
-
class MobileService {
|
|
665
|
-
constructor(media) {
|
|
666
|
-
this.listeners = [];
|
|
667
|
-
this.mobileQuery = media.matchMedia('(max-width: 600px)');
|
|
668
|
-
this.tabletQuery = media.matchMedia('(max-width: 950px)');
|
|
669
|
-
this.mobileQueryListener = () => {
|
|
670
|
-
this.listeners.forEach(listener => {
|
|
671
|
-
try {
|
|
672
|
-
listener(this.mobile, this.tablet);
|
|
673
|
-
}
|
|
674
|
-
catch (e) {
|
|
675
|
-
console.error(e);
|
|
676
|
-
}
|
|
677
|
-
});
|
|
678
|
-
};
|
|
679
|
-
this.mobileQuery.addEventListener('change', this.mobileQueryListener);
|
|
680
|
-
this.tabletQuery.addEventListener('change', this.mobileQueryListener);
|
|
681
|
-
}
|
|
682
|
-
addListener(listener) {
|
|
683
|
-
this.listeners.push(listener);
|
|
684
|
-
}
|
|
685
|
-
removeListener(listener) {
|
|
686
|
-
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
687
|
-
}
|
|
688
|
-
get mobile() {
|
|
689
|
-
return this.mobileQuery.matches;
|
|
690
|
-
}
|
|
691
|
-
get tablet() {
|
|
692
|
-
return this.tabletQuery.matches;
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
MobileService.ɵprov = ɵɵdefineInjectable({ factory: function MobileService_Factory() { return new MobileService(ɵɵinject(MediaMatcher)); }, token: MobileService, providedIn: "root" });
|
|
696
|
-
MobileService.decorators = [
|
|
697
|
-
{ type: Injectable, args: [{
|
|
698
|
-
providedIn: 'root'
|
|
699
|
-
},] }
|
|
700
|
-
];
|
|
701
|
-
MobileService.ctorParameters = () => [
|
|
702
|
-
{ type: MediaMatcher }
|
|
703
|
-
];
|
|
704
|
-
|
|
705
|
-
const ARQUIVO_MANAGER_SERVICE = new InjectionToken('ARQUIVO_MANAGER_SERVICE');
|
|
706
|
-
|
|
707
|
-
const MCL_IMAGE_PADRAO = new InjectionToken('MCL_IMAGE_PADRAO');
|
|
708
|
-
class ImagemDirective {
|
|
709
|
-
constructor(_padrao, element, arquivoManagerService) {
|
|
710
|
-
this._padrao = _padrao;
|
|
711
|
-
this.element = element;
|
|
712
|
-
this.arquivoManagerService = arquivoManagerService;
|
|
713
|
-
this.backgroundSetter = (url) => {
|
|
714
|
-
this.element.nativeElement.style.backgroundImage = `url(${url})`;
|
|
715
|
-
};
|
|
716
|
-
this.srcSetter = (url) => {
|
|
717
|
-
this.element.nativeElement.src = url;
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
set imagemSrc(imagem) {
|
|
721
|
-
this._setter = this.srcSetter;
|
|
722
|
-
if (imagem) {
|
|
723
|
-
if (this._path !== imagem) {
|
|
724
|
-
this._path = imagem;
|
|
725
|
-
this.setPath();
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
else {
|
|
729
|
-
this._setter(this._padrao);
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
set imagemBackground(imagem) {
|
|
733
|
-
this._setter = this.backgroundSetter;
|
|
734
|
-
if (imagem) {
|
|
735
|
-
if (this._path !== imagem) {
|
|
736
|
-
this._path = imagem;
|
|
737
|
-
this.setPath();
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
this._setter(this._padrao);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
set padrao(padrao) {
|
|
745
|
-
this._padrao = padrao;
|
|
746
|
-
if (this._setter) {
|
|
747
|
-
this._setter(this.padrao);
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
setPath() {
|
|
751
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
752
|
-
const path = typeof this._path === 'string' ? this._path : this._path.path;
|
|
753
|
-
if (path) {
|
|
754
|
-
let url;
|
|
755
|
-
if (path.startsWith('http://') || this._path.startsWith('https://')) {
|
|
756
|
-
url = path;
|
|
757
|
-
}
|
|
758
|
-
else {
|
|
759
|
-
url = yield this.arquivoManagerService.downloadURL(path).toPromise();
|
|
760
|
-
}
|
|
761
|
-
this._setter(url);
|
|
762
|
-
}
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
ngOnInit() {
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
ImagemDirective.decorators = [
|
|
769
|
-
{ type: Directive, args: [{
|
|
770
|
-
selector: '[mclImagemSrc],[mclImagemBackground]'
|
|
771
|
-
},] }
|
|
772
|
-
];
|
|
773
|
-
ImagemDirective.ctorParameters = () => [
|
|
774
|
-
{ type: String, decorators: [{ type: Inject, args: [MCL_IMAGE_PADRAO,] }, { type: Optional }] },
|
|
775
|
-
{ type: ElementRef, decorators: [{ type: Self }] },
|
|
776
|
-
{ type: undefined, decorators: [{ type: Inject, args: [ARQUIVO_MANAGER_SERVICE,] }] }
|
|
777
|
-
];
|
|
778
|
-
ImagemDirective.propDecorators = {
|
|
779
|
-
imagemSrc: [{ type: Input, args: ['mclImagemSrc',] }],
|
|
780
|
-
imagemBackground: [{ type: Input, args: ['mclImagemBackground',] }],
|
|
781
|
-
padrao: [{ type: Input }]
|
|
782
|
-
};
|
|
783
|
-
|
|
784
|
-
class ComponentesModule {
|
|
785
|
-
static forRoot() {
|
|
786
|
-
return {
|
|
787
|
-
ngModule: ComponentesModule,
|
|
788
|
-
providers: [
|
|
789
|
-
LoaderService,
|
|
790
|
-
ValidaModulo11Service,
|
|
791
|
-
CriptografiaService,
|
|
792
|
-
DialogService,
|
|
793
|
-
MensageriaService,
|
|
794
|
-
MobileService,
|
|
795
|
-
]
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
ComponentesModule.decorators = [
|
|
800
|
-
{ type: NgModule, args: [{
|
|
801
|
-
declarations: [
|
|
802
|
-
LoaderComponent,
|
|
803
|
-
DialogConfirmacaoComponent,
|
|
804
|
-
MaskedModelDirective,
|
|
805
|
-
NomeResumidoPipe,
|
|
806
|
-
DialogIframeComponent,
|
|
807
|
-
ImagemDirective,
|
|
808
|
-
],
|
|
809
|
-
exports: [
|
|
810
|
-
LoaderComponent,
|
|
811
|
-
MaskedModelDirective,
|
|
812
|
-
NomeResumidoPipe,
|
|
813
|
-
ImagemDirective,
|
|
814
|
-
],
|
|
815
|
-
imports: [
|
|
816
|
-
CommonModule,
|
|
817
|
-
FormsModule,
|
|
818
|
-
TranslateModule,
|
|
819
|
-
MatDialogModule,
|
|
820
|
-
MatIconModule,
|
|
821
|
-
MatButtonModule,
|
|
822
|
-
MatProgressSpinnerModule,
|
|
823
|
-
FlexModule,
|
|
824
|
-
]
|
|
825
|
-
},] }
|
|
826
|
-
];
|
|
827
|
-
|
|
828
|
-
class DialogPreviewArquivoComponent {
|
|
829
|
-
constructor(dadosPreview, arquivoService) {
|
|
830
|
-
this.dadosPreview = dadosPreview;
|
|
831
|
-
this.arquivoService = arquivoService;
|
|
832
|
-
this.loadingFile = true;
|
|
833
|
-
}
|
|
834
|
-
ngOnInit() {
|
|
835
|
-
if (this.type === 'image') {
|
|
836
|
-
this.previewCarregado();
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
get src() {
|
|
840
|
-
return this.dadosPreview.src;
|
|
841
|
-
}
|
|
842
|
-
get type() {
|
|
843
|
-
return this.dadosPreview.type;
|
|
844
|
-
}
|
|
845
|
-
get group() {
|
|
846
|
-
return this.dadosPreview.group;
|
|
847
|
-
}
|
|
848
|
-
handleEvent(evento) {
|
|
849
|
-
if (evento.name === 'download') {
|
|
850
|
-
this.download();
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
previewCarregado(e) {
|
|
854
|
-
this.loadingFile = false;
|
|
855
|
-
}
|
|
856
|
-
download() {
|
|
857
|
-
if (typeof this.src === 'string') {
|
|
858
|
-
const link = document.createElement('a');
|
|
859
|
-
link.href = this.src;
|
|
860
|
-
link.target = '_blank';
|
|
861
|
-
document.body.appendChild(link);
|
|
862
|
-
link.click();
|
|
863
|
-
document.body.removeChild(link);
|
|
864
|
-
}
|
|
865
|
-
else {
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
DialogPreviewArquivoComponent.decorators = [
|
|
870
|
-
{ type: Component, args: [{
|
|
871
|
-
selector: 'mcl-dialog-preview-arquivo',
|
|
872
|
-
template: "<mat-dialog-content>\r\n <div class=\"spinner-wrapper\" *ngIf=\"loadingFile\">\r\n <mat-spinner style=\"margin: 0 auto\" [diameter]=\"50\" color=\"warn\"></mat-spinner>\r\n </div>\r\n\r\n <pdf-viewer (page-rendered)=\"previewCarregado($event)\" *ngIf=\"type === 'pdf'\"\r\n [src]=\"src\" [original-size]=\"false\"></pdf-viewer>\r\n\r\n <ngx-image-viewer [src]=\"group\" [index]=\"group.indexOf(src)\" *ngIf=\"type === 'image' && group\"\r\n [config]=\"{customBtns:[{name: 'download', icon: 'fa fa-download'}]}\"\r\n (customEvent)=\"handleEvent($event)\"></ngx-image-viewer>\r\n\r\n <ngx-image-viewer [src]=\"[src]\" [index]=\"0\" *ngIf=\"type === 'image' && !group\"\r\n [config]=\"{customBtns:[{name: 'download', icon: 'fa fa-download'}]}\"\r\n (customEvent)=\"handleEvent($event)\"></ngx-image-viewer>\r\n</mat-dialog-content>\r\n\r\n<div mat-dialog-actions>\r\n <button mat-button mat-dialog-close>\r\n <mat-icon>close</mat-icon>\r\n Fechar\r\n </button>\r\n\r\n <div class=\"spacer\"></div>\r\n\r\n <button mat-stroked-button (click)=\"download()\" *ngIf=\"!loadingFile\">\r\n <mat-icon>cloud_download</mat-icon>\r\n Realizar o Download\r\n </button>\r\n</div>\r\n",
|
|
873
|
-
styles: ["pdf-viewer{width:100%;display:block}.spinner-wrapper{margin:30px auto;width:800px;height:400px}.dialog-title-text{margin-right:10px;line-height:38px}[mat-dialog-title]{display:flex;padding:8px 24px 7px}[mat-dialog-title] .spacer{flex:1 1 auto}[mat-dialog-actions]{text-align:right}[mat-dialog-actions] button{margin-left:auto}[mat-dialog-actions] button mat-icon{vertical-align:middle;margin-right:10px}"]
|
|
874
|
-
},] }
|
|
875
|
-
];
|
|
876
|
-
DialogPreviewArquivoComponent.ctorParameters = () => [
|
|
877
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
|
|
878
|
-
{ type: undefined, decorators: [{ type: Inject, args: [ARQUIVO_MANAGER_SERVICE,] }] }
|
|
879
|
-
];
|
|
880
|
-
|
|
881
|
-
class PreviewArquivoComponent {
|
|
882
|
-
constructor(arquivoManagerService, dialog) {
|
|
883
|
-
this.arquivoManagerService = arquivoManagerService;
|
|
884
|
-
this.dialog = dialog;
|
|
885
|
-
this.showLoading = false;
|
|
886
|
-
this.height = '200px';
|
|
887
|
-
this.width = '200px';
|
|
888
|
-
}
|
|
889
|
-
ngOnInit() {
|
|
890
|
-
}
|
|
891
|
-
get arquivo() {
|
|
892
|
-
return this.$url;
|
|
893
|
-
}
|
|
894
|
-
set arquivo(arquivo) {
|
|
895
|
-
if (this.$arquivo !== arquivo) {
|
|
896
|
-
this.$arquivo = arquivo;
|
|
897
|
-
this.parseArquivo(arquivo)
|
|
898
|
-
.subscribe(arq => {
|
|
899
|
-
this.src = arq.src;
|
|
900
|
-
this.filename = arq.filename;
|
|
901
|
-
this.$url = arq.url;
|
|
902
|
-
this.type = arq.type;
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
parseArquivo(arquivo) {
|
|
907
|
-
return new Observable$1(observer => {
|
|
908
|
-
if (arquivo.loading) { // uploading
|
|
909
|
-
const type = this.parseType(arquivo.file.name);
|
|
910
|
-
observer.next({
|
|
911
|
-
type,
|
|
912
|
-
filename: arquivo.file.name,
|
|
913
|
-
});
|
|
914
|
-
this.carregaArrayBuffFile(arquivo.file)
|
|
915
|
-
.then(src => {
|
|
916
|
-
observer.next({
|
|
917
|
-
src,
|
|
918
|
-
type,
|
|
919
|
-
filename: arquivo.file.name,
|
|
920
|
-
});
|
|
921
|
-
observer.complete();
|
|
922
|
-
})
|
|
923
|
-
.catch(err => observer.error(err));
|
|
924
|
-
}
|
|
925
|
-
else if (typeof arquivo === 'string') { // puploading
|
|
926
|
-
const type = this.parseType(arquivo.split('?')[0]);
|
|
927
|
-
observer.next({
|
|
928
|
-
type,
|
|
929
|
-
url: arquivo,
|
|
930
|
-
src: arquivo,
|
|
931
|
-
});
|
|
932
|
-
observer.complete();
|
|
933
|
-
}
|
|
934
|
-
else { // attachment
|
|
935
|
-
const type = this.parseType(arquivo.nome);
|
|
936
|
-
this.arquivoManagerService.downloadURL(arquivo).subscribe(url => {
|
|
937
|
-
observer.next({
|
|
938
|
-
type,
|
|
939
|
-
url,
|
|
940
|
-
src: url,
|
|
941
|
-
});
|
|
942
|
-
observer.complete();
|
|
943
|
-
}, err => observer.error(err));
|
|
944
|
-
}
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
carregaArrayBuffFile(file) {
|
|
948
|
-
return new Promise(((resolve, reject) => {
|
|
949
|
-
if (typeof (FileReader) !== 'undefined') {
|
|
950
|
-
const reader = new FileReader();
|
|
951
|
-
reader.onload = (e) => resolve(e.target.result);
|
|
952
|
-
reader.onerror = e => reject(e);
|
|
953
|
-
reader.readAsArrayBuffer(file);
|
|
954
|
-
}
|
|
955
|
-
else {
|
|
956
|
-
reject('FileReader not defined');
|
|
957
|
-
}
|
|
958
|
-
}));
|
|
959
|
-
}
|
|
960
|
-
parseType(filename) {
|
|
961
|
-
const format = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
962
|
-
switch (format) {
|
|
963
|
-
case 'jpeg':
|
|
964
|
-
case 'jpg':
|
|
965
|
-
case 'png':
|
|
966
|
-
case 'gif':
|
|
967
|
-
return 'image';
|
|
968
|
-
case 'pdf':
|
|
969
|
-
return 'pdf';
|
|
970
|
-
}
|
|
971
|
-
return 'other';
|
|
972
|
-
}
|
|
973
|
-
abrePreview() {
|
|
974
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
975
|
-
let group;
|
|
976
|
-
let src = this.src;
|
|
977
|
-
if (this.group) {
|
|
978
|
-
group = (yield Promise.all(this.group.map(arq => this.parseArquivo(arq).toPromise())));
|
|
979
|
-
src = group[this.group.indexOf(this.$arquivo)].src;
|
|
980
|
-
group = group.filter(g => !!g.src && g.type === this.type).map(g => g.src);
|
|
981
|
-
}
|
|
982
|
-
this.dialog.open(DialogPreviewArquivoComponent, {
|
|
983
|
-
data: {
|
|
984
|
-
src,
|
|
985
|
-
group,
|
|
986
|
-
type: this.type,
|
|
987
|
-
},
|
|
988
|
-
});
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
PreviewArquivoComponent.decorators = [
|
|
993
|
-
{ type: Component, args: [{
|
|
994
|
-
selector: 'mcl-preview-arquivo',
|
|
995
|
-
template: "<img *ngIf=\"src && type==='image'\" [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n (click)=\"abrePreview()\"/>\r\n\r\n<div class=\"other\" *ngIf=\"!src || type === 'other'\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [mclDownloadArquivo]=\"arquivo\">\r\n <mat-icon>insert_drive_file</mat-icon>\r\n <small>{{ filename }}</small>\r\n</div>\r\n\r\n<pdf-viewer [src]=\"src\" *ngIf=\"src && type === 'pdf'\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [original-size]=\"false\"\r\n [page]=\"1\"\r\n [render-text]=\"false\"\r\n (click)=\"abrePreview()\"\r\n></pdf-viewer>\r\n",
|
|
996
|
-
styles: [".other,img,pdf-viewer{overflow:hidden;display:block;border-radius:5px;background:#efefef;border:1px solid #a9a9a9}.other.other,img.other,pdf-viewer.other{display:flex;flex-direction:column;justify-items:center}.other.other mat-icon,img.other mat-icon,pdf-viewer.other mat-icon{margin:auto;text-align:center;font-size:75px;height:75px;width:75px;line-height:75px}.other:hover,img:hover,pdf-viewer:hover{cursor:pointer}"]
|
|
997
|
-
},] }
|
|
998
|
-
];
|
|
999
|
-
PreviewArquivoComponent.ctorParameters = () => [
|
|
1000
|
-
{ type: undefined, decorators: [{ type: Inject, args: [ARQUIVO_MANAGER_SERVICE,] }] },
|
|
1001
|
-
{ type: MatDialog }
|
|
1002
|
-
];
|
|
1003
|
-
PreviewArquivoComponent.propDecorators = {
|
|
1004
|
-
showLoading: [{ type: Input }],
|
|
1005
|
-
height: [{ type: Input }],
|
|
1006
|
-
width: [{ type: Input }],
|
|
1007
|
-
group: [{ type: Input }],
|
|
1008
|
-
arquivo: [{ type: Input }]
|
|
1009
|
-
};
|
|
1010
|
-
|
|
1011
|
-
class DownloadArquivoDirective {
|
|
1012
|
-
constructor(arquivoService) {
|
|
1013
|
-
this.arquivoService = arquivoService;
|
|
1014
|
-
this.target = '_blank';
|
|
1015
|
-
}
|
|
1016
|
-
getUrlArquivo() {
|
|
1017
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1018
|
-
if (typeof this.attachment === 'string') {
|
|
1019
|
-
return this.attachment;
|
|
1020
|
-
}
|
|
1021
|
-
return yield this.arquivoService.downloadURL(this.attachment).toPromise();
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
download() {
|
|
1025
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1026
|
-
if (!this.attachment) {
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
const link = document.createElement('a');
|
|
1030
|
-
link.href = yield this.getUrlArquivo();
|
|
1031
|
-
link.target = this.target;
|
|
1032
|
-
document.body.appendChild(link);
|
|
1033
|
-
link.click();
|
|
1034
|
-
document.body.removeChild(link);
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
DownloadArquivoDirective.decorators = [
|
|
1039
|
-
{ type: Directive, args: [{
|
|
1040
|
-
selector: '[mclDownloadArquivo]'
|
|
1041
|
-
},] }
|
|
1042
|
-
];
|
|
1043
|
-
DownloadArquivoDirective.ctorParameters = () => [
|
|
1044
|
-
{ type: undefined, decorators: [{ type: Inject, args: [ARQUIVO_MANAGER_SERVICE,] }] }
|
|
1045
|
-
];
|
|
1046
|
-
DownloadArquivoDirective.propDecorators = {
|
|
1047
|
-
attachment: [{ type: Input, args: ['mclDownloadArquivo',] }],
|
|
1048
|
-
target: [{ type: Input }],
|
|
1049
|
-
download: [{ type: HostListener, args: ['click',] }]
|
|
1050
|
-
};
|
|
1051
|
-
|
|
1052
|
-
class ArquivoModule {
|
|
1053
|
-
}
|
|
1054
|
-
ArquivoModule.decorators = [
|
|
1055
|
-
{ type: NgModule, args: [{
|
|
1056
|
-
declarations: [PreviewArquivoComponent, DownloadArquivoDirective, DialogPreviewArquivoComponent],
|
|
1057
|
-
exports: [PreviewArquivoComponent, DownloadArquivoDirective],
|
|
1058
|
-
imports: [
|
|
1059
|
-
CommonModule,
|
|
1060
|
-
MatIconModule,
|
|
1061
|
-
PdfViewerModule,
|
|
1062
|
-
MatDialogModule,
|
|
1063
|
-
MatProgressSpinnerModule,
|
|
1064
|
-
MatButtonModule,
|
|
1065
|
-
ImageViewerModule
|
|
1066
|
-
]
|
|
1067
|
-
},] }
|
|
1068
|
-
];
|
|
1069
|
-
|
|
1070
|
-
class ColumnHeaderDirective {
|
|
1071
|
-
constructor(template) {
|
|
1072
|
-
this.template = template;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
ColumnHeaderDirective.decorators = [
|
|
1076
|
-
{ type: Directive, args: [{
|
|
1077
|
-
selector: '[mclColumnHeader]'
|
|
1078
|
-
},] }
|
|
1079
|
-
];
|
|
1080
|
-
ColumnHeaderDirective.ctorParameters = () => [
|
|
1081
|
-
{ type: TemplateRef }
|
|
1082
|
-
];
|
|
1083
|
-
|
|
1084
|
-
class ColumnCellDirective {
|
|
1085
|
-
constructor(template) {
|
|
1086
|
-
this.template = template;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
ColumnCellDirective.decorators = [
|
|
1090
|
-
{ type: Directive, args: [{
|
|
1091
|
-
selector: '[mclColumnCell]'
|
|
1092
|
-
},] }
|
|
1093
|
-
];
|
|
1094
|
-
ColumnCellDirective.ctorParameters = () => [
|
|
1095
|
-
{ type: TemplateRef }
|
|
1096
|
-
];
|
|
1097
|
-
|
|
1098
|
-
class ColumnFooterDirective {
|
|
1099
|
-
constructor(template) {
|
|
1100
|
-
this.template = template;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
ColumnFooterDirective.decorators = [
|
|
1104
|
-
{ type: Directive, args: [{
|
|
1105
|
-
selector: '[mclColumnFooter]'
|
|
1106
|
-
},] }
|
|
1107
|
-
];
|
|
1108
|
-
ColumnFooterDirective.ctorParameters = () => [
|
|
1109
|
-
{ type: TemplateRef }
|
|
1110
|
-
];
|
|
1111
|
-
|
|
1112
|
-
class ColumnDirective {
|
|
1113
|
-
constructor() {
|
|
1114
|
-
this.name = 'column_' + (++ColumnDirective.lastId);
|
|
1115
|
-
this.viewType = 'both';
|
|
1116
|
-
}
|
|
1117
|
-
get columnDefName() {
|
|
1118
|
-
return this.viewType + '-' + this.name;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
ColumnDirective.lastId = 0;
|
|
1122
|
-
ColumnDirective.decorators = [
|
|
1123
|
-
{ type: Directive, args: [{
|
|
1124
|
-
selector: 'mcl-column,[mclColumn]'
|
|
1125
|
-
},] }
|
|
1126
|
-
];
|
|
1127
|
-
ColumnDirective.ctorParameters = () => [];
|
|
1128
|
-
ColumnDirective.propDecorators = {
|
|
1129
|
-
name: [{ type: Input }],
|
|
1130
|
-
viewType: [{ type: Input }],
|
|
1131
|
-
header: [{ type: ContentChild, args: [ColumnHeaderDirective,] }],
|
|
1132
|
-
cell: [{ type: ContentChild, args: [ColumnCellDirective,] }],
|
|
1133
|
-
footer: [{ type: ContentChild, args: [ColumnFooterDirective,] }]
|
|
1134
|
-
};
|
|
1135
|
-
|
|
1136
|
-
class TableComponent {
|
|
1137
|
-
constructor(mobileService) {
|
|
1138
|
-
this.mobileService = mobileService;
|
|
1139
|
-
this.itemsSubject = new BehaviorSubject([]);
|
|
1140
|
-
this.emptyStateMessage = 'mcl.table.nenhum_registro_encontrado';
|
|
1141
|
-
this.sticky = false;
|
|
1142
|
-
this.currentColumns = [];
|
|
1143
|
-
this.$activeColumnNames = [];
|
|
1144
|
-
this.oldLength = 0;
|
|
1145
|
-
this.mobileListener = (mobile) => this.mergeColumnsDef(mobile);
|
|
1146
|
-
this.mobileService.addListener(this.mobileListener);
|
|
1147
|
-
}
|
|
1148
|
-
get activeColumnNames() {
|
|
1149
|
-
return this.$activeColumnNames;
|
|
1150
|
-
}
|
|
1151
|
-
get hasFooter() {
|
|
1152
|
-
return !!this.currentColumns.find(col => !!col.footerCell);
|
|
1153
|
-
}
|
|
1154
|
-
mergeColumnsDef(mobile = this.mobileService.mobile) {
|
|
1155
|
-
clearTimeout(this.$loading);
|
|
1156
|
-
this.$loading = setTimeout(() => {
|
|
1157
|
-
const ngContentModels = this.columnsDef
|
|
1158
|
-
.toArray().filter(model => (mobile && model.viewType !== 'web') ||
|
|
1159
|
-
(!mobile && model.viewType !== 'mobile'));
|
|
1160
|
-
for (let i = 0; i < this.currentColumns.length;) {
|
|
1161
|
-
const model = this.currentColumns[i];
|
|
1162
|
-
if (!ngContentModels.find(col => col.columnDefName === model.name)) {
|
|
1163
|
-
this.currentColumns.splice(i, 1);
|
|
1164
|
-
this.removeColumnDef(model);
|
|
1165
|
-
}
|
|
1166
|
-
else {
|
|
1167
|
-
i++;
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
ngContentModels.forEach(model => {
|
|
1171
|
-
if (!this.currentColumnsContains(model)) {
|
|
1172
|
-
const columnDef = this.mapColumnDef(model);
|
|
1173
|
-
this.currentColumns.push(columnDef);
|
|
1174
|
-
this.addColumnDef(columnDef);
|
|
1175
|
-
}
|
|
1176
|
-
});
|
|
1177
|
-
this.items = this.getItems() || [];
|
|
1178
|
-
this.itemsSubject.next(this.items);
|
|
1179
|
-
this.$activeColumnNames = this.currentColumns.map(col => col.name);
|
|
1180
|
-
}, 80);
|
|
1181
|
-
}
|
|
1182
|
-
ngAfterViewInit() {
|
|
1183
|
-
this.columnsChangeSubscription = this.columnsDef.changes.subscribe((_) => {
|
|
1184
|
-
this.mergeColumnsDef();
|
|
1185
|
-
});
|
|
1186
|
-
this.mergeColumnsDef();
|
|
1187
|
-
}
|
|
1188
|
-
ngDoCheck() {
|
|
1189
|
-
const currentLength = this.getCurrentLength();
|
|
1190
|
-
if (this.oldLength !== currentLength) {
|
|
1191
|
-
this.oldLength = currentLength;
|
|
1192
|
-
this.items = this.getItems() || [];
|
|
1193
|
-
this.itemsSubject.next(this.items);
|
|
1194
|
-
}
|
|
1195
|
-
else if (this.items !== this.getItems()) {
|
|
1196
|
-
this.items = this.getItems() || [];
|
|
1197
|
-
this.itemsSubject.next(this.items);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
getItems() {
|
|
1201
|
-
return this.outerItems;
|
|
1202
|
-
}
|
|
1203
|
-
getCurrentLength() {
|
|
1204
|
-
return (this.outerItems ? this.outerItems.length : 0);
|
|
1205
|
-
}
|
|
1206
|
-
ngOnDestroy() {
|
|
1207
|
-
this.mobileService.removeListener(this.mobileListener);
|
|
1208
|
-
this.columnsChangeSubscription.unsubscribe();
|
|
1209
|
-
this.itemsSubject.complete();
|
|
1210
|
-
}
|
|
1211
|
-
removeColumnDef(columnDef) {
|
|
1212
|
-
this.table.removeColumnDef(columnDef);
|
|
1213
|
-
}
|
|
1214
|
-
addColumnDef(columnDef) {
|
|
1215
|
-
this.table.addColumnDef(columnDef);
|
|
1216
|
-
}
|
|
1217
|
-
mapColumnDef(column) {
|
|
1218
|
-
const cdef = new MatColumnDef();
|
|
1219
|
-
cdef.name = column.viewType + '-' + column.name;
|
|
1220
|
-
cdef.cell = new MatCellDef(column.cell.template);
|
|
1221
|
-
cdef.headerCell = new MatHeaderCellDef(column.header.template);
|
|
1222
|
-
if (column.footer) {
|
|
1223
|
-
cdef.footerCell = new MatFooterCellDef(column.footer.template);
|
|
1224
|
-
}
|
|
1225
|
-
return cdef;
|
|
1226
|
-
}
|
|
1227
|
-
currentColumnsContains(model) {
|
|
1228
|
-
return !!this.currentColumns.find(def => def.name === model.columnDefName);
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
TableComponent.decorators = [
|
|
1232
|
-
{ type: Component, args: [{
|
|
1233
|
-
selector: 'mcl-table:not([page])',
|
|
1234
|
-
template: "<table mat-table [dataSource]=\"itemsSubject\">\n\n <tr mat-header-row *matHeaderRowDef=\"activeColumnNames; sticky: sticky\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: activeColumnNames;\"></tr>\n <ng-container *ngIf=\"hasFooter\">\n <tr mat-footer-row *matFooterRowDef=\"activeColumnNames;\"></tr>\n </ng-container>\n\n</table>\n\n<div *ngIf=\"!items?.length && !emptyStatePlaceholder\" class=\"empty-state\">\n {{emptyStateMessage | translate}}\n</div>\n<ng-container *ngIf=\"!items?.length && emptyStatePlaceholder\">\n <ng-content select=\"[mclEmptyState]\"></ng-content>\n</ng-container>\n",
|
|
1235
|
-
styles: ["table{width:100%}table::ng-deep th:not(:last-child),table td:not(:last-child){padding-right:5px}table::ng-deep th.text-center,table td.text-center{text-align:center}table::ng-deep th.text-right,table td.text-right{text-align:right}table::ng-deep th.text-left,table td.text-left{text-align:left}.empty-state{padding:10px;text-align:center}table::ng-deep tbody tr{transition:.5s}table::ng-deep tbody tr:hover{background-color:rgba(0,0,0,.03)}table::ng-deep tbody td[routerLink]{cursor:pointer}"]
|
|
1236
|
-
},] }
|
|
1237
|
-
];
|
|
1238
|
-
TableComponent.ctorParameters = () => [
|
|
1239
|
-
{ type: MobileService }
|
|
1240
|
-
];
|
|
1241
|
-
TableComponent.propDecorators = {
|
|
1242
|
-
emptyStateMessage: [{ type: Input }],
|
|
1243
|
-
table: [{ type: ViewChild, args: [MatTable,] }],
|
|
1244
|
-
emptyStatePlaceholder: [{ type: ContentChild, args: ['[mclEmptyState]', { read: ElementRef },] }],
|
|
1245
|
-
columnsDef: [{ type: ContentChildren, args: [ColumnDirective,] }],
|
|
1246
|
-
outerItems: [{ type: Input, args: ['items',] }],
|
|
1247
|
-
sticky: [{ type: Input }]
|
|
1248
|
-
};
|
|
1249
|
-
|
|
1250
|
-
class ThComponent {
|
|
1251
|
-
constructor(element) {
|
|
1252
|
-
element.nativeElement.classList.add('mat-header-cell');
|
|
1253
|
-
}
|
|
1254
|
-
ngOnInit() {
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
ThComponent.decorators = [
|
|
1258
|
-
{ type: Component, args: [{
|
|
1259
|
-
selector: 'th,mcl-th',
|
|
1260
|
-
template: "<ng-content></ng-content>\n",
|
|
1261
|
-
styles: [""]
|
|
1262
|
-
},] }
|
|
1263
|
-
];
|
|
1264
|
-
ThComponent.ctorParameters = () => [
|
|
1265
|
-
{ type: ElementRef, decorators: [{ type: Self }] }
|
|
1266
|
-
];
|
|
1267
|
-
|
|
1268
|
-
class TdComponent {
|
|
1269
|
-
constructor(element) {
|
|
1270
|
-
element.nativeElement.classList.add('mat-cell');
|
|
1271
|
-
}
|
|
1272
|
-
ngOnInit() {
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
TdComponent.decorators = [
|
|
1276
|
-
{ type: Component, args: [{
|
|
1277
|
-
selector: 'td,mcl-td',
|
|
1278
|
-
template: "<ng-content></ng-content>\n",
|
|
1279
|
-
styles: [""]
|
|
1280
|
-
},] }
|
|
1281
|
-
];
|
|
1282
|
-
TdComponent.ctorParameters = () => [
|
|
1283
|
-
{ type: ElementRef, decorators: [{ type: Self }] }
|
|
1284
|
-
];
|
|
1285
|
-
|
|
1286
|
-
const PAGINATION_CONFIGURATION = new InjectionToken('PAGINATION_CONFIGURATION');
|
|
1287
|
-
class PaginatedTableComponent extends TableComponent {
|
|
1288
|
-
constructor(mobileService, paginationConfiguration) {
|
|
1289
|
-
super(mobileService);
|
|
1290
|
-
this.paginate = new EventEmitter();
|
|
1291
|
-
this.sizes = (paginationConfiguration === null || paginationConfiguration === void 0 ? void 0 : paginationConfiguration.sizes) || [10, 25, 50];
|
|
1292
|
-
}
|
|
1293
|
-
getCurrentLength() {
|
|
1294
|
-
return this.page && this.page.itens ? this.page.itens.length : 0;
|
|
1295
|
-
}
|
|
1296
|
-
getItems() {
|
|
1297
|
-
return this.page ? this.page.itens : undefined;
|
|
1298
|
-
}
|
|
1299
|
-
paginaEvent(event) {
|
|
1300
|
-
this.paginate.emit({
|
|
1301
|
-
pagina: event.pageIndex + 1,
|
|
1302
|
-
tamanhoPagina: event.pageSize,
|
|
1303
|
-
loader: this.loader,
|
|
1304
|
-
});
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
PaginatedTableComponent.decorators = [
|
|
1308
|
-
{ type: Component, args: [{
|
|
1309
|
-
selector: 'mcl-table[page]',
|
|
1310
|
-
template: "<div #div>\n <table mat-table #matTable [dataSource]=\"itemsSubject\">\n\n <tr mat-header-row *matHeaderRowDef=\"activeColumnNames; sticky: page && !page.totalItens\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: activeColumnNames;\"></tr>\n <ng-container *ngIf=\"hasFooter\">\n <tr mat-footer-row *matFooterRowDef=\"activeColumnNames;\"></tr>\n </ng-container>\n\n </table>\n\n <mcl-loader [showOnInit]=\"true\" [component]=\"div\"></mcl-loader>\n</div>\n\n<div *ngIf=\"!items?.length && !emptyStatePlaceholder\" class=\"empty-state\">\n {{emptyStateMessage | translate}}\n</div>\n<ng-container *ngIf=\"!items?.length && emptyStatePlaceholder\">\n <ng-content select=\"[mclEmptyState]\"></ng-content>\n</ng-container>\n\n<mcl-paginator [pageSize]=\"page?.tamanhoPagina\"\n (page)=\"paginaEvent($event)\"\n [pageIndex]=\"(page?.paginaAtual || 1) - 1\"\n [length]=\"page?.totalItens\"\n [pageSizeOptions]=\"sizes\"\n [showFirstLastButtons]=\"true\"\n *ngIf=\"page?.totalItens\">\n</mcl-paginator>\n",
|
|
1311
|
-
styles: ["", "table{width:100%}table::ng-deep th:not(:last-child),table td:not(:last-child){padding-right:5px}table::ng-deep th.text-center,table td.text-center{text-align:center}table::ng-deep th.text-right,table td.text-right{text-align:right}table::ng-deep th.text-left,table td.text-left{text-align:left}.empty-state{padding:10px;text-align:center}table::ng-deep tbody tr{transition:.5s}table::ng-deep tbody tr:hover{background-color:rgba(0,0,0,.03)}table::ng-deep tbody td[routerLink]{cursor:pointer}"]
|
|
1312
|
-
},] }
|
|
1313
|
-
];
|
|
1314
|
-
PaginatedTableComponent.ctorParameters = () => [
|
|
1315
|
-
{ type: MobileService },
|
|
1316
|
-
{ type: undefined, decorators: [{ type: Inject, args: [PAGINATION_CONFIGURATION,] }, { type: Optional }] }
|
|
1317
|
-
];
|
|
1318
|
-
PaginatedTableComponent.propDecorators = {
|
|
1319
|
-
sizes: [{ type: Input }],
|
|
1320
|
-
paginate: [{ type: Output }],
|
|
1321
|
-
page: [{ type: Input }],
|
|
1322
|
-
loader: [{ type: ViewChild, args: [LoaderComponent,] }]
|
|
1323
|
-
};
|
|
1324
|
-
|
|
1325
|
-
const getScrollParent = (node) => {
|
|
1326
|
-
const regex = /(auto|scroll)/;
|
|
1327
|
-
const parents = ($node, ps) => {
|
|
1328
|
-
if ($node.parentNode === null || $node.parentNode === undefined) {
|
|
1329
|
-
return ps;
|
|
1330
|
-
}
|
|
1331
|
-
return parents($node.parentNode, ps.concat([$node]));
|
|
1332
|
-
};
|
|
1333
|
-
const style = ($node, prop) => getComputedStyle($node, null).getPropertyValue(prop);
|
|
1334
|
-
const overflow = $node => style($node, 'overflow') + style($node, 'overflow-y');
|
|
1335
|
-
const scroll = $node => regex.test(overflow($node));
|
|
1336
|
-
/* eslint-disable consistent-return */
|
|
1337
|
-
const scrollParent = ($node) => {
|
|
1338
|
-
if (!($node instanceof HTMLElement || $node instanceof SVGElement)) {
|
|
1339
|
-
return;
|
|
1340
|
-
}
|
|
1341
|
-
const ps = parents($node, []);
|
|
1342
|
-
for (const pi of ps) {
|
|
1343
|
-
if (scroll(pi)) {
|
|
1344
|
-
return pi;
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
return document.scrollingElement || document.documentElement;
|
|
1348
|
-
};
|
|
1349
|
-
return scrollParent(node);
|
|
1350
|
-
/* eslint-enable consistent-return */
|
|
1351
|
-
};
|
|
1352
|
-
const ɵ0 = getScrollParent;
|
|
1353
|
-
class InfiniteTableComponent extends TableComponent {
|
|
1354
|
-
constructor(element, mobileService) {
|
|
1355
|
-
super(mobileService);
|
|
1356
|
-
this.element = element;
|
|
1357
|
-
this.next = new EventEmitter();
|
|
1358
|
-
this.hasNext = false;
|
|
1359
|
-
this.scrollHeight = 200;
|
|
1360
|
-
}
|
|
1361
|
-
get loading() {
|
|
1362
|
-
return !this.loader || this.loader.shown;
|
|
1363
|
-
}
|
|
1364
|
-
// tslint:disable-next-line:use-lifecycle-interface
|
|
1365
|
-
ngAfterViewInit() {
|
|
1366
|
-
super.ngAfterViewInit();
|
|
1367
|
-
this.parent = getScrollParent(this.element.nativeElement);
|
|
1368
|
-
this.parent.onscroll = () => {
|
|
1369
|
-
if (this.hasNext && !this.loader.shown &&
|
|
1370
|
-
(this.parent.scrollHeight - this.parent.clientHeight) - this.parent.scrollTop < this.scrollHeight) {
|
|
1371
|
-
this.loadMore();
|
|
1372
|
-
}
|
|
1373
|
-
};
|
|
1374
|
-
this.next.emit(this.loader);
|
|
1375
|
-
}
|
|
1376
|
-
// tslint:disable-next-line:use-lifecycle-interface
|
|
1377
|
-
ngDoCheck() {
|
|
1378
|
-
super.ngDoCheck();
|
|
1379
|
-
if (this.hasNext && !this.loader.shown && this.parent.scrollHeight === this.parent.clientHeight) {
|
|
1380
|
-
this.loadMore();
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
// tslint:disable-next-line:use-lifecycle-interface
|
|
1384
|
-
ngOnDestroy() {
|
|
1385
|
-
super.ngOnDestroy();
|
|
1386
|
-
this.parent.onscroll = undefined;
|
|
1387
|
-
}
|
|
1388
|
-
loadMore() {
|
|
1389
|
-
if (this.hasNext) {
|
|
1390
|
-
this.next.emit(this.loader);
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
InfiniteTableComponent.decorators = [
|
|
1395
|
-
{ type: Component, args: [{
|
|
1396
|
-
selector: 'mcl-infinite-table',
|
|
1397
|
-
template: "<table mat-table [dataSource]=\"itemsSubject\">\n\n <tr mat-header-row *matHeaderRowDef=\"activeColumnNames; sticky: true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: activeColumnNames;\"></tr>\n <ng-container *ngIf=\"hasFooter\">\n <tr mat-footer-row *matFooterRowDef=\"activeColumnNames;\"></tr>\n </ng-container>\n\n</table>\n\n<ng-container *ngIf=\"!hasNext && !loading && !items?.length\">\n <div *ngIf=\"!emptyStatePlaceholder\" class=\"empty-state\">\n {{emptyStateMessage | translate}}\n </div>\n <ng-container *ngIf=\"emptyStatePlaceholder\">\n <ng-content select=\"[mclEmptyState]\"></ng-content>\n </ng-container>\n</ng-container>\n\n<div #div class=\"loading\" [ngClass]=\"{'hidden':!loading}\">\n <mcl-loader #loader [showOnInit]=\"true\" [component]=\"div\"></mcl-loader>\n</div>\n",
|
|
1398
|
-
styles: [":host{justify-content:flex-start;display:flex;flex-direction:column}mcl-loader{flex-grow:0;flex-shrink:0;flex-basis:auto}.loading{height:100px;display:block}.loading.hidden{height:0;display:none}", "table{width:100%}table::ng-deep th:not(:last-child),table td:not(:last-child){padding-right:5px}table::ng-deep th.text-center,table td.text-center{text-align:center}table::ng-deep th.text-right,table td.text-right{text-align:right}table::ng-deep th.text-left,table td.text-left{text-align:left}.empty-state{padding:10px;text-align:center}table::ng-deep tbody tr{transition:.5s}table::ng-deep tbody tr:hover{background-color:rgba(0,0,0,.03)}table::ng-deep tbody td[routerLink]{cursor:pointer}"]
|
|
1399
|
-
},] }
|
|
1400
|
-
];
|
|
1401
|
-
InfiniteTableComponent.ctorParameters = () => [
|
|
1402
|
-
{ type: ElementRef, decorators: [{ type: Self }] },
|
|
1403
|
-
{ type: MobileService }
|
|
1404
|
-
];
|
|
1405
|
-
InfiniteTableComponent.propDecorators = {
|
|
1406
|
-
next: [{ type: Output }],
|
|
1407
|
-
hasNext: [{ type: Input }],
|
|
1408
|
-
scrollHeight: [{ type: Input }],
|
|
1409
|
-
loader: [{ type: ViewChild, args: [LoaderComponent,] }]
|
|
1410
|
-
};
|
|
1411
|
-
|
|
1412
|
-
class PaginatorI18n {
|
|
1413
|
-
constructor(translate) {
|
|
1414
|
-
this.translate = translate;
|
|
1415
|
-
}
|
|
1416
|
-
getPaginatorIntl() {
|
|
1417
|
-
const paginatorIntl = new MatPaginatorIntl();
|
|
1418
|
-
paginatorIntl.itemsPerPageLabel = this.translate.instant('mcl.table.items_per_page');
|
|
1419
|
-
paginatorIntl.nextPageLabel = this.translate.instant('mcl.table.next_page');
|
|
1420
|
-
paginatorIntl.previousPageLabel = this.translate.instant('mcl.table.previous_page');
|
|
1421
|
-
paginatorIntl.firstPageLabel = this.translate.instant('mcl.table.first_page');
|
|
1422
|
-
paginatorIntl.lastPageLabel = this.translate.instant('mcl.table.last_page');
|
|
1423
|
-
paginatorIntl.getRangeLabel = this.getRangeLabel.bind(this);
|
|
1424
|
-
return paginatorIntl;
|
|
1425
|
-
}
|
|
1426
|
-
getRangeLabel(page, pageSize, length) {
|
|
1427
|
-
length = Math.max(length, 0);
|
|
1428
|
-
const startIndex = page * pageSize;
|
|
1429
|
-
const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize;
|
|
1430
|
-
return this.translate.instant('mcl.table.range', { startIndex: startIndex + 1, endIndex, length });
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
class PaginatorComponent extends MatPaginator {
|
|
1435
|
-
}
|
|
1436
|
-
PaginatorComponent.decorators = [
|
|
1437
|
-
{ type: Component, args: [{
|
|
1438
|
-
selector: 'mcl-paginator',
|
|
1439
|
-
template: "<div class=\"mat-paginator-outer-container\">\n <div class=\"mat-paginator-container\">\n <div class=\"mat-paginator-page-size\" *ngIf=\"!hidePageSize\">\n <div class=\"mat-paginator-page-size-label\">\n {{_intl.itemsPerPageLabel}}\n </div>\n\n <mat-form-field\n *ngIf=\"_displayedPageSizeOptions.length > 1\"\n appearance=\"standard\"\n [color]=\"color\"\n class=\"mat-paginator-page-size-select\">\n <mat-select\n [value]=\"pageSize\"\n [disabled]=\"disabled\"\n [aria-label]=\"_intl.itemsPerPageLabel\"\n (selectionChange)=\"_changePageSize($event.value)\">\n <mat-option *ngFor=\"let pageSizeOption of _displayedPageSizeOptions\" [value]=\"pageSizeOption\">\n {{'mcl.table.option' | translate:{option:pageSizeOption} }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <div\n class=\"mat-paginator-page-size-value\"\n *ngIf=\"_displayedPageSizeOptions.length <= 1\">{{pageSize}}</div>\n </div>\n\n <div class=\"mat-paginator-range-actions\">\n\n <button mat-icon-button type=\"button\"\n class=\"mat-paginator-navigation-first\"\n (click)=\"firstPage()\"\n [attr.aria-label]=\"_intl.firstPageLabel\"\n [matTooltip]=\"_intl.firstPageLabel\"\n [matTooltipDisabled]=\"_previousButtonsDisabled()\"\n [matTooltipPosition]=\"'above'\"\n [disabled]=\"_previousButtonsDisabled()\"\n *ngIf=\"showFirstLastButtons\">\n <svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z\"/>\n </svg>\n </button>\n <button mat-icon-button type=\"button\"\n class=\"mat-paginator-navigation-previous\"\n (click)=\"previousPage()\"\n [attr.aria-label]=\"_intl.previousPageLabel\"\n [matTooltip]=\"_intl.previousPageLabel\"\n [matTooltipDisabled]=\"_previousButtonsDisabled()\"\n [matTooltipPosition]=\"'above'\"\n [disabled]=\"_previousButtonsDisabled()\">\n <svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"/>\n </svg>\n </button>\n\n <div class=\"mat-paginator-range-label\">\n {{_intl.getRangeLabel(pageIndex, pageSize, length)}}\n </div>\n\n <button mat-icon-button type=\"button\"\n class=\"mat-paginator-navigation-next\"\n (click)=\"nextPage()\"\n [attr.aria-label]=\"_intl.nextPageLabel\"\n [matTooltip]=\"_intl.nextPageLabel\"\n [matTooltipDisabled]=\"_nextButtonsDisabled()\"\n [matTooltipPosition]=\"'above'\"\n [disabled]=\"_nextButtonsDisabled()\">\n <svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"/>\n </svg>\n </button>\n <button mat-icon-button type=\"button\"\n class=\"mat-paginator-navigation-last\"\n (click)=\"lastPage()\"\n [attr.aria-label]=\"_intl.lastPageLabel\"\n [matTooltip]=\"_intl.lastPageLabel\"\n [matTooltipDisabled]=\"_nextButtonsDisabled()\"\n [matTooltipPosition]=\"'above'\"\n [disabled]=\"_nextButtonsDisabled()\"\n *ngIf=\"showFirstLastButtons\">\n <svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z\"/>\n </svg>\n </button>\n </div>\n </div>\n</div>\n",
|
|
1440
|
-
styles: [".mat-paginator{display:block}.mat-paginator-outer-container{display:flex}.mat-paginator-container{display:flex;align-items:center;justify-content:flex-end;padding:0 8px;flex-wrap:wrap-reverse;width:100%}.mat-paginator-page-size{display:flex;align-items:baseline;margin-right:8px}[dir=rtl] .mat-paginator-page-size{margin-right:0;margin-left:8px}.mat-paginator-page-size-label{margin:0 4px}.mat-paginator-page-size-select{margin:6px 4px 0;width:81px}.mat-paginator-range-label{margin:0 32px 0 24px}.mat-paginator-range-actions{display:flex;align-items:center}.mat-paginator-icon{width:28px;fill:currentColor}[dir=rtl] .mat-paginator-icon{transform:rotate(180deg)}"]
|
|
1441
|
-
},] }
|
|
1442
|
-
];
|
|
1443
|
-
|
|
1444
|
-
class TableModule {
|
|
1445
|
-
}
|
|
1446
|
-
TableModule.decorators = [
|
|
1447
|
-
{ type: NgModule, args: [{
|
|
1448
|
-
exports: [
|
|
1449
|
-
TableComponent,
|
|
1450
|
-
ColumnDirective,
|
|
1451
|
-
ColumnHeaderDirective,
|
|
1452
|
-
ColumnCellDirective,
|
|
1453
|
-
ColumnFooterDirective,
|
|
1454
|
-
ThComponent,
|
|
1455
|
-
TdComponent,
|
|
1456
|
-
PaginatedTableComponent,
|
|
1457
|
-
InfiniteTableComponent,
|
|
1458
|
-
PaginatorComponent
|
|
1459
|
-
],
|
|
1460
|
-
declarations: [
|
|
1461
|
-
TableComponent,
|
|
1462
|
-
ColumnDirective,
|
|
1463
|
-
ColumnHeaderDirective,
|
|
1464
|
-
ColumnCellDirective,
|
|
1465
|
-
ColumnFooterDirective,
|
|
1466
|
-
ThComponent,
|
|
1467
|
-
TdComponent,
|
|
1468
|
-
PaginatedTableComponent,
|
|
1469
|
-
InfiniteTableComponent,
|
|
1470
|
-
PaginatorComponent
|
|
1471
|
-
],
|
|
1472
|
-
imports: [
|
|
1473
|
-
CommonModule,
|
|
1474
|
-
MatTableModule,
|
|
1475
|
-
MatPaginatorModule,
|
|
1476
|
-
MatButtonModule,
|
|
1477
|
-
MatIconModule,
|
|
1478
|
-
ComponentesModule,
|
|
1479
|
-
TranslateModule,
|
|
1480
|
-
MatFormFieldModule,
|
|
1481
|
-
MatSelectModule,
|
|
1482
|
-
MatTooltipModule,
|
|
1483
|
-
],
|
|
1484
|
-
providers: [
|
|
1485
|
-
{
|
|
1486
|
-
provide: MatPaginatorIntl, deps: [TranslateService],
|
|
1487
|
-
useFactory: PaginatorIntlFactory
|
|
1488
|
-
}
|
|
1489
|
-
]
|
|
1490
|
-
},] }
|
|
1491
|
-
];
|
|
1492
|
-
function PaginatorIntlFactory(translateService) {
|
|
1493
|
-
return new PaginatorI18n(translateService).getPaginatorIntl();
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
class AbstractConsultaComponent {
|
|
1497
|
-
constructor() {
|
|
1498
|
-
this.filtro = {};
|
|
1499
|
-
this.items = [];
|
|
1500
|
-
}
|
|
1501
|
-
get hasNext() {
|
|
1502
|
-
return !!this.nextPage;
|
|
1503
|
-
}
|
|
1504
|
-
ngAfterViewInit() {
|
|
1505
|
-
this.reset();
|
|
1506
|
-
}
|
|
1507
|
-
reset(filtro = this.filtro) {
|
|
1508
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1509
|
-
this.filtro = filtro;
|
|
1510
|
-
this.items = [];
|
|
1511
|
-
this.nextPage = undefined;
|
|
1512
|
-
yield this.next();
|
|
1513
|
-
});
|
|
1514
|
-
}
|
|
1515
|
-
next(loader = this.infiniteTable.loader) {
|
|
1516
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1517
|
-
clearTimeout(this.timeoutConsulta);
|
|
1518
|
-
this.timeoutConsulta = setTimeout(() => {
|
|
1519
|
-
loader.listen(this.consulta(loader)).toPromise();
|
|
1520
|
-
}, 800);
|
|
1521
|
-
});
|
|
1522
|
-
}
|
|
1523
|
-
consulta(loader) {
|
|
1524
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1525
|
-
const pagina = yield this.consultaEntidades(this.nextPage);
|
|
1526
|
-
this.items = [
|
|
1527
|
-
...this.items,
|
|
1528
|
-
...(pagina.itens || []),
|
|
1529
|
-
];
|
|
1530
|
-
this.nextPage = pagina.nextPage;
|
|
1531
|
-
});
|
|
1532
|
-
}
|
|
1533
|
-
remove(entidade) {
|
|
1534
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1535
|
-
const confirmacao = yield this.dialogService
|
|
1536
|
-
.confirma('mcl.consulta.confirma-remocao').toPromise();
|
|
1537
|
-
if (confirmacao) {
|
|
1538
|
-
yield this.loaderService.listen(this.deleteEntidade(entidade)).toPromise();
|
|
1539
|
-
this.reset();
|
|
1540
|
-
}
|
|
1541
|
-
});
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
AbstractConsultaComponent.decorators = [
|
|
1545
|
-
{ type: Component, args: [{
|
|
1546
|
-
template: ''
|
|
1547
|
-
},] }
|
|
1548
|
-
];
|
|
1549
|
-
AbstractConsultaComponent.propDecorators = {
|
|
1550
|
-
infiniteTable: [{ type: ViewChild, args: [InfiniteTableComponent,] }]
|
|
1551
|
-
};
|
|
1552
|
-
|
|
1553
|
-
class AbstractConsultaPaginadaComponent {
|
|
1554
|
-
constructor() {
|
|
1555
|
-
this.filtro = {};
|
|
1556
|
-
}
|
|
1557
|
-
ngAfterViewInit() {
|
|
1558
|
-
this.reset();
|
|
1559
|
-
}
|
|
1560
|
-
reset(filtro = this.filtro) {
|
|
1561
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1562
|
-
this.filtro = filtro;
|
|
1563
|
-
this.page = undefined;
|
|
1564
|
-
yield this.busca();
|
|
1565
|
-
});
|
|
1566
|
-
}
|
|
1567
|
-
busca(event = {
|
|
1568
|
-
pagina: 1,
|
|
1569
|
-
tamanhoPagina: (this.page && this.page.tamanhoPagina) || this.infiniteTable.sizes[0],
|
|
1570
|
-
loader: this.infiniteTable.loader
|
|
1571
|
-
}) {
|
|
1572
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1573
|
-
clearTimeout(this.timeoutConsulta);
|
|
1574
|
-
this.timeoutConsulta = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
1575
|
-
this.page = yield event.loader.listen(this.consultaEntidades(event.pagina, event.tamanhoPagina)).toPromise();
|
|
1576
|
-
}), 300);
|
|
1577
|
-
});
|
|
1578
|
-
}
|
|
1579
|
-
remove(entidade) {
|
|
1580
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1581
|
-
const confirmacao = yield this.dialogService
|
|
1582
|
-
.confirma('mcl.consulta.confirma-remocao').toPromise();
|
|
1583
|
-
if (confirmacao) {
|
|
1584
|
-
yield this.loaderService.listen(this.deleteEntidade(entidade)).toPromise();
|
|
1585
|
-
}
|
|
1586
|
-
});
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
AbstractConsultaPaginadaComponent.decorators = [
|
|
1590
|
-
{ type: Component, args: [{
|
|
1591
|
-
template: ''
|
|
1592
|
-
},] }
|
|
1593
|
-
];
|
|
1594
|
-
AbstractConsultaPaginadaComponent.propDecorators = {
|
|
1595
|
-
infiniteTable: [{ type: ViewChild, args: [PaginatedTableComponent,] }]
|
|
1596
|
-
};
|
|
1597
|
-
|
|
1598
|
-
class AbstractEdicaoComponent {
|
|
1599
|
-
constructor() {
|
|
1600
|
-
this.entidade = {};
|
|
1601
|
-
}
|
|
1602
|
-
ngOnInit() {
|
|
1603
|
-
this.activatedRoute.params.subscribe(params => {
|
|
1604
|
-
if (params.id) {
|
|
1605
|
-
this.loaderService.listen(this.detalhaEntidade(params.id)).subscribe(entidade => this.entidade = entidade);
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
|
-
salva(form) {
|
|
1610
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1611
|
-
if (!form.valid) {
|
|
1612
|
-
return;
|
|
1613
|
-
}
|
|
1614
|
-
yield this.loaderService.listen(this.salvaEntidade()).toPromise();
|
|
1615
|
-
this.mensageriaService.addMensagem('mcl.edicao.salvo-sucesso');
|
|
1616
|
-
});
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
AbstractEdicaoComponent.decorators = [
|
|
1620
|
-
{ type: Component, args: [{
|
|
1621
|
-
template: ''
|
|
1622
|
-
},] }
|
|
1623
|
-
];
|
|
1624
|
-
|
|
1625
|
-
class AbstractEdicaoModalComponent {
|
|
1626
|
-
salva(form) {
|
|
1627
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1628
|
-
if (!form.valid) {
|
|
1629
|
-
return;
|
|
1630
|
-
}
|
|
1631
|
-
const salvo = yield this.loaderService.listen(this.salvaEntidade()).toPromise();
|
|
1632
|
-
this.mensageriaService.addMensagem('mcl.edicao.salvo-sucesso');
|
|
1633
|
-
this.dialogRef.close(salvo);
|
|
1634
|
-
});
|
|
1635
|
-
}
|
|
1636
|
-
remove(entidade) {
|
|
1637
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1638
|
-
const confirmacao = yield this.dialogService
|
|
1639
|
-
.confirma('mcl.consulta.confirma-remocao').toPromise();
|
|
1640
|
-
if (confirmacao) {
|
|
1641
|
-
yield this.loaderService.listen(this.deleteEntidade(entidade)).toPromise();
|
|
1642
|
-
this.dialogRef.close(true);
|
|
1643
|
-
}
|
|
1644
|
-
});
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
class CrudModule {
|
|
1649
|
-
}
|
|
1650
|
-
CrudModule.decorators = [
|
|
1651
|
-
{ type: NgModule, args: [{
|
|
1652
|
-
declarations: [],
|
|
1653
|
-
exports: [],
|
|
1654
|
-
imports: [
|
|
1655
|
-
CommonModule,
|
|
1656
|
-
]
|
|
1657
|
-
},] }
|
|
1658
|
-
];
|
|
1659
|
-
|
|
1660
|
-
class FuturoDirective {
|
|
1661
|
-
constructor() {
|
|
1662
|
-
}
|
|
1663
|
-
validate(control) {
|
|
1664
|
-
if (control.value) {
|
|
1665
|
-
if (control.value.getTime() <= new Date().getTime()) {
|
|
1666
|
-
return { futuro: true };
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
return undefined;
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
FuturoDirective.decorators = [
|
|
1673
|
-
{ type: Directive, args: [{
|
|
1674
|
-
selector: '[mclFuturo]',
|
|
1675
|
-
providers: [{
|
|
1676
|
-
provide: NG_VALIDATORS,
|
|
1677
|
-
useExisting: FuturoDirective,
|
|
1678
|
-
multi: true
|
|
1679
|
-
}]
|
|
1680
|
-
},] }
|
|
1681
|
-
];
|
|
1682
|
-
FuturoDirective.ctorParameters = () => [];
|
|
1683
|
-
|
|
1684
|
-
class DataValidadorDirective {
|
|
1685
|
-
constructor() {
|
|
1686
|
-
this.datePipe = new DatePipe('pt-br');
|
|
1687
|
-
this.permiteDataIgual = true;
|
|
1688
|
-
this.onValidatorChange = () => {
|
|
1689
|
-
};
|
|
1690
|
-
}
|
|
1691
|
-
registerOnValidatorChange(fn) {
|
|
1692
|
-
this.onValidatorChange = fn;
|
|
1693
|
-
}
|
|
1694
|
-
set dataMaxima(dataMaxima) {
|
|
1695
|
-
this._dataMaxima = moment(dataMaxima).toDate();
|
|
1696
|
-
this.onValidatorChange();
|
|
1697
|
-
}
|
|
1698
|
-
get dataMaxima() {
|
|
1699
|
-
const atual = (this.bgcDataMaxAtual || this.bgcDataMaxAtual === '') ? new Date() : undefined;
|
|
1700
|
-
if (atual && this._dataMaxima) {
|
|
1701
|
-
if (moment(atual).isBefore(this._dataMaxima, 'day')) {
|
|
1702
|
-
return atual;
|
|
1703
|
-
}
|
|
1704
|
-
else {
|
|
1705
|
-
return this._dataMaxima;
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
return atual || this._dataMaxima;
|
|
1709
|
-
}
|
|
1710
|
-
set dataMinima(dataMinima) {
|
|
1711
|
-
this._dataMinima = moment(dataMinima).toDate();
|
|
1712
|
-
this.onValidatorChange();
|
|
1713
|
-
}
|
|
1714
|
-
get dataMinima() {
|
|
1715
|
-
const atual = (this.bgcDataMinAtual || this.bgcDataMinAtual === '') ? new Date() : undefined;
|
|
1716
|
-
if (atual && this._dataMinima) {
|
|
1717
|
-
if (moment(atual).isAfter(this._dataMinima, 'day')) {
|
|
1718
|
-
return this._dataMinima;
|
|
1719
|
-
}
|
|
1720
|
-
else {
|
|
1721
|
-
return atual;
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
return atual || this._dataMinima;
|
|
1725
|
-
}
|
|
1726
|
-
validate(control) {
|
|
1727
|
-
if (!control.value) {
|
|
1728
|
-
return null;
|
|
1729
|
-
}
|
|
1730
|
-
if (control.value.toString() === 'Invalid Date' ||
|
|
1731
|
-
control.value.getUTCFullYear() < 1900) {
|
|
1732
|
-
return { date: true };
|
|
1733
|
-
}
|
|
1734
|
-
const dataMin = this.dataMinima;
|
|
1735
|
-
if (dataMin) {
|
|
1736
|
-
if (this.permiteDataIgual) {
|
|
1737
|
-
if (moment(control.value).isBefore(dataMin, 'day')) {
|
|
1738
|
-
return { dataMinIgual: { data: this.datePipe.transform(dataMin, 'dd/MM/yyyy') } };
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
else if (!moment(control.value).isAfter(dataMin, 'day')) {
|
|
1742
|
-
return { dataMin: { data: this.datePipe.transform(dataMin, 'dd/MM/yyyy') } };
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
const dataMax = this.dataMaxima;
|
|
1746
|
-
if (dataMax) {
|
|
1747
|
-
if (this.permiteDataIgual) {
|
|
1748
|
-
if (moment(control.value).isAfter(dataMax, 'day')) {
|
|
1749
|
-
return { dataMaxIgual: { data: this.datePipe.transform(dataMax, 'dd/MM/yyyy') } };
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
else if (!moment(control.value).isBefore(dataMax, 'day')) {
|
|
1753
|
-
return { dataMax: { data: this.datePipe.transform(dataMax, 'dd/MM/yyyy') } };
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
return null;
|
|
1757
|
-
}
|
|
1758
|
-
isFDS(data) {
|
|
1759
|
-
return data.getDay() === 0 || data.getDay() === 6;
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
DataValidadorDirective.decorators = [
|
|
1763
|
-
{ type: Directive, args: [{
|
|
1764
|
-
selector: '[mclDataMinAtual],[mclDataMaxAtual],[mclDataMax],[mclDataMin]',
|
|
1765
|
-
providers: [{ provide: NG_VALIDATORS, useExisting: DataValidadorDirective, multi: true }]
|
|
1766
|
-
},] }
|
|
1767
|
-
];
|
|
1768
|
-
DataValidadorDirective.ctorParameters = () => [];
|
|
1769
|
-
DataValidadorDirective.propDecorators = {
|
|
1770
|
-
bgcDataMinAtual: [{ type: Input }],
|
|
1771
|
-
bgcDataMaxAtual: [{ type: Input }],
|
|
1772
|
-
permiteDataIgual: [{ type: Input }],
|
|
1773
|
-
dataMaxima: [{ type: Input, args: ['bgcDataMax',] }],
|
|
1774
|
-
dataMinima: [{ type: Input, args: ['bgcDataMin',] }]
|
|
1775
|
-
};
|
|
1776
|
-
|
|
1777
|
-
class DateModule {
|
|
1778
|
-
}
|
|
1779
|
-
DateModule.decorators = [
|
|
1780
|
-
{ type: NgModule, args: [{
|
|
1781
|
-
declarations: [FuturoDirective, DataValidadorDirective],
|
|
1782
|
-
exports: [
|
|
1783
|
-
FuturoDirective,
|
|
1784
|
-
DataValidadorDirective
|
|
1785
|
-
],
|
|
1786
|
-
imports: [
|
|
1787
|
-
CommonModule
|
|
1788
|
-
]
|
|
1789
|
-
},] }
|
|
1790
|
-
];
|
|
1791
|
-
|
|
1792
|
-
// tslint:disable-next-line:component-class-suffix
|
|
1793
|
-
class AbstractMatFormFieldControl {
|
|
1794
|
-
constructor(errorStateMatcher, ngControl, parentForm, parentFormGroup) {
|
|
1795
|
-
this.errorStateMatcher = errorStateMatcher;
|
|
1796
|
-
this.ngControl = ngControl;
|
|
1797
|
-
this.parentForm = parentForm;
|
|
1798
|
-
this.parentFormGroup = parentFormGroup;
|
|
1799
|
-
this.$disabled = false;
|
|
1800
|
-
this.$required = false;
|
|
1801
|
-
this.focused = false;
|
|
1802
|
-
this.stateChanges = new Subject();
|
|
1803
|
-
this.id = `custom-input-${AbstractMatFormFieldControl.nextId++}`;
|
|
1804
|
-
this.describedBy = '';
|
|
1805
|
-
this.onChange = (val) => {
|
|
1806
|
-
};
|
|
1807
|
-
this.onTouched = () => {
|
|
1808
|
-
};
|
|
1809
|
-
if (this.ngControl != null) {
|
|
1810
|
-
this.ngControl.valueAccessor = this;
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
get value() {
|
|
1814
|
-
return this.$value;
|
|
1815
|
-
}
|
|
1816
|
-
set value(value) {
|
|
1817
|
-
this.$value = value;
|
|
1818
|
-
this.onChange(value);
|
|
1819
|
-
this.stateChanges.next();
|
|
1820
|
-
}
|
|
1821
|
-
get empty() {
|
|
1822
|
-
return !this.value;
|
|
1823
|
-
}
|
|
1824
|
-
onContainerClick(event) {
|
|
1825
|
-
}
|
|
1826
|
-
get shouldLabelFloat() {
|
|
1827
|
-
return !this.empty || (this.input && this.input.nativeElement.value) || this.focused;
|
|
1828
|
-
}
|
|
1829
|
-
get placeholder() {
|
|
1830
|
-
return this.$placeholder;
|
|
1831
|
-
}
|
|
1832
|
-
set placeholder(plh) {
|
|
1833
|
-
this.$placeholder = plh;
|
|
1834
|
-
this.stateChanges.next();
|
|
1835
|
-
}
|
|
1836
|
-
get required() {
|
|
1837
|
-
return this.$required;
|
|
1838
|
-
}
|
|
1839
|
-
set required(value) {
|
|
1840
|
-
this.$required = coerceBooleanProperty(value);
|
|
1841
|
-
this.stateChanges.next();
|
|
1842
|
-
}
|
|
1843
|
-
get disabled() {
|
|
1844
|
-
return this.$disabled;
|
|
1845
|
-
}
|
|
1846
|
-
set disabled(value) {
|
|
1847
|
-
this.$disabled = coerceBooleanProperty(value);
|
|
1848
|
-
this.stateChanges.next();
|
|
1849
|
-
}
|
|
1850
|
-
get errorState() {
|
|
1851
|
-
return this.errorStateMatcher.isErrorState(this.ngControl.control, this.parentFormGroup || this.parentForm);
|
|
1852
|
-
}
|
|
1853
|
-
get controlType() {
|
|
1854
|
-
return 'custom-input';
|
|
1855
|
-
}
|
|
1856
|
-
setDescribedByIds(ids) {
|
|
1857
|
-
this.describedBy = ids.join(' ');
|
|
1858
|
-
}
|
|
1859
|
-
ngOnDestroy() {
|
|
1860
|
-
this.stateChanges.complete();
|
|
1861
|
-
}
|
|
1862
|
-
registerOnTouched(fn) {
|
|
1863
|
-
this.onTouched = fn;
|
|
1864
|
-
}
|
|
1865
|
-
registerOnChange(fn) {
|
|
1866
|
-
this.onChange = fn;
|
|
1867
|
-
}
|
|
1868
|
-
setDisabledState(isDisabled) {
|
|
1869
|
-
this.disabled = isDisabled;
|
|
1870
|
-
}
|
|
1871
|
-
writeValue(value) {
|
|
1872
|
-
this.$value = value;
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
AbstractMatFormFieldControl.nextId = 0;
|
|
1876
|
-
AbstractMatFormFieldControl.decorators = [
|
|
1877
|
-
{ type: Component, args: [{
|
|
1878
|
-
template: ''
|
|
1879
|
-
},] }
|
|
1880
|
-
];
|
|
1881
|
-
AbstractMatFormFieldControl.ctorParameters = () => [
|
|
1882
|
-
{ type: ErrorStateMatcher },
|
|
1883
|
-
{ type: NgControl },
|
|
1884
|
-
{ type: NgForm },
|
|
1885
|
-
{ type: FormGroupDirective }
|
|
1886
|
-
];
|
|
1887
|
-
AbstractMatFormFieldControl.propDecorators = {
|
|
1888
|
-
input: [{ type: ViewChild, args: ['input',] }],
|
|
1889
|
-
id: [{ type: HostBinding }],
|
|
1890
|
-
describedBy: [{ type: HostBinding, args: ['attr.aria-describedby',] }],
|
|
1891
|
-
shouldLabelFloat: [{ type: HostBinding, args: ['class.floating',] }],
|
|
1892
|
-
placeholder: [{ type: Input }],
|
|
1893
|
-
required: [{ type: Input }],
|
|
1894
|
-
disabled: [{ type: Input }]
|
|
1895
|
-
};
|
|
1896
|
-
|
|
1897
|
-
class InputDatetimeComponent extends AbstractMatFormFieldControl {
|
|
1898
|
-
constructor(errorStateMatcher, ngControl, parentForm, parentFormGroup, adapter, formats) {
|
|
1899
|
-
super(errorStateMatcher, ngControl, parentForm, parentFormGroup);
|
|
1900
|
-
this.adapter = adapter;
|
|
1901
|
-
this.formats = formats;
|
|
1902
|
-
this.type = 'date';
|
|
1903
|
-
}
|
|
1904
|
-
get empty() {
|
|
1905
|
-
return !this.$maskedValue;
|
|
1906
|
-
}
|
|
1907
|
-
get maskedValue() {
|
|
1908
|
-
return this.$maskedValue;
|
|
1909
|
-
}
|
|
1910
|
-
set maskedValue(maskedValue) {
|
|
1911
|
-
if (this.$maskedValue !== maskedValue) {
|
|
1912
|
-
this.onTouched();
|
|
1913
|
-
this.$maskedValue = maskedValue;
|
|
1914
|
-
if (maskedValue) {
|
|
1915
|
-
if (maskedValue.match(new RegExp(`^${this.mask.replace(/#/g, '\\d')}$`))) {
|
|
1916
|
-
this.innerValue = this.adapter.parse(maskedValue, this.format).toDate();
|
|
1917
|
-
}
|
|
1918
|
-
else {
|
|
1919
|
-
this.innerValue = undefined;
|
|
1920
|
-
}
|
|
1921
|
-
}
|
|
1922
|
-
else {
|
|
1923
|
-
this.innerValue = undefined;
|
|
1924
|
-
}
|
|
1925
|
-
this.onChange(this.innerValue);
|
|
1926
|
-
this.stateChanges.next();
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
get mask() {
|
|
1930
|
-
switch (this.type) {
|
|
1931
|
-
case 'date':
|
|
1932
|
-
return '##/##/####';
|
|
1933
|
-
case 'time':
|
|
1934
|
-
return '##:##';
|
|
1935
|
-
}
|
|
1936
|
-
return '##/##/#### ##:##';
|
|
1937
|
-
}
|
|
1938
|
-
get format() {
|
|
1939
|
-
switch (this.type) {
|
|
1940
|
-
case 'date':
|
|
1941
|
-
return this.formats.display.dateInput;
|
|
1942
|
-
case 'time':
|
|
1943
|
-
return this.formats.display.timeInput;
|
|
1944
|
-
}
|
|
1945
|
-
return this.formats.display.datetimeInput;
|
|
1946
|
-
}
|
|
1947
|
-
get value() {
|
|
1948
|
-
return this.innerValue;
|
|
1949
|
-
}
|
|
1950
|
-
set value(value) {
|
|
1951
|
-
if (this.innerValue !== value) {
|
|
1952
|
-
this.onTouched();
|
|
1953
|
-
if (value) {
|
|
1954
|
-
this.innerValue = value instanceof Date ? value : value.toDate();
|
|
1955
|
-
this.$maskedValue = this.adapter.format(moment$1(this.innerValue), this.format);
|
|
1956
|
-
}
|
|
1957
|
-
else {
|
|
1958
|
-
this.innerValue = undefined;
|
|
1959
|
-
this.$maskedValue = '';
|
|
1960
|
-
}
|
|
1961
|
-
this.onChange(this.innerValue);
|
|
1962
|
-
this.stateChanges.next();
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
writeValue(value) {
|
|
1966
|
-
this.innerValue = value;
|
|
1967
|
-
if (value) {
|
|
1968
|
-
this.$maskedValue = this.adapter.format(moment$1(value), this.format);
|
|
1969
|
-
}
|
|
1970
|
-
else {
|
|
1971
|
-
this.$maskedValue = '';
|
|
1972
|
-
}
|
|
1973
|
-
this.stateChanges.next();
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
InputDatetimeComponent.decorators = [
|
|
1977
|
-
{ type: Component, args: [{
|
|
1978
|
-
selector: 'mcl-input-datetime',
|
|
1979
|
-
template: "<div class=\"dateinput\">\n <input matInput autocomplete=\"false\" [disabled]=\"disabled\" ngModel\n [readonly]=\"readonly\" [(mclModel)]=\"maskedValue\" [mask]=\"mask\"\n (focus)=\"focused = true\" (blur)=\"focused = false\" [keepMask]=\"true\"\n />\n <mat-datetimepicker [disabled]=\"disabled || readonly\"\n [type]=\"type\" #pickerData></mat-datetimepicker>\n <mat-datetimepicker-toggle [for]=\"pickerData\"></mat-datetimepicker-toggle>\n</div>\n<input class=\"hidden\" [(ngModel)]=\"value\" [matDatetimepicker]=\"pickerData\" />\n",
|
|
1980
|
-
providers: [
|
|
1981
|
-
{
|
|
1982
|
-
provide: MatFormFieldControl,
|
|
1983
|
-
useExisting: InputDatetimeComponent
|
|
1984
|
-
}
|
|
1985
|
-
],
|
|
1986
|
-
styles: [".dateinput{display:flex}.dateinput input{flex:1 1 auto}.dateinput mat-datetimepicker-toggle{margin:-16px 0 -6px}.hidden{display:none}"]
|
|
1987
|
-
},] }
|
|
1988
|
-
];
|
|
1989
|
-
InputDatetimeComponent.ctorParameters = () => [
|
|
1990
|
-
{ type: ErrorStateMatcher },
|
|
1991
|
-
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
|
|
1992
|
-
{ type: NgForm, decorators: [{ type: Optional }] },
|
|
1993
|
-
{ type: FormGroupDirective, decorators: [{ type: Optional }] },
|
|
1994
|
-
{ type: DatetimeAdapter, decorators: [{ type: Inject, args: [DatetimeAdapter,] }] },
|
|
1995
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DATETIME_FORMATS,] }] }
|
|
1996
|
-
];
|
|
1997
|
-
InputDatetimeComponent.propDecorators = {
|
|
1998
|
-
type: [{ type: Input }],
|
|
1999
|
-
readonly: [{ type: Input }],
|
|
2000
|
-
name: [{ type: Input }],
|
|
2001
|
-
picker: [{ type: ViewChild, args: ['pickerData',] }]
|
|
2002
|
-
};
|
|
2003
|
-
|
|
2004
|
-
const ɵ0$1 = {
|
|
2005
|
-
parse: {
|
|
2006
|
-
dateInput: 'L',
|
|
2007
|
-
monthInput: 'MMMM',
|
|
2008
|
-
timeInput: 'LT',
|
|
2009
|
-
datetimeInput: 'L LT'
|
|
2010
|
-
},
|
|
2011
|
-
display: {
|
|
2012
|
-
dateInput: 'L',
|
|
2013
|
-
monthInput: 'MMMM',
|
|
2014
|
-
datetimeInput: 'L LT',
|
|
2015
|
-
timeInput: 'LT',
|
|
2016
|
-
monthYearLabel: 'MMM YYYY',
|
|
2017
|
-
dateA11yLabel: 'LL',
|
|
2018
|
-
monthYearA11yLabel: 'MMMM YYYY',
|
|
2019
|
-
popupHeaderDateLabel: 'ddd, DD MMM'
|
|
2020
|
-
}
|
|
2021
|
-
};
|
|
2022
|
-
class InputDatetimeModule {
|
|
2023
|
-
}
|
|
2024
|
-
InputDatetimeModule.decorators = [
|
|
2025
|
-
{ type: NgModule, args: [{
|
|
2026
|
-
declarations: [InputDatetimeComponent],
|
|
2027
|
-
imports: [
|
|
2028
|
-
CommonModule,
|
|
2029
|
-
MatInputModule,
|
|
2030
|
-
FormsModule,
|
|
2031
|
-
MatDatepickerModule,
|
|
2032
|
-
MatDatetimepickerModule,
|
|
2033
|
-
MomentDatetimeModule,
|
|
2034
|
-
ComponentesModule
|
|
2035
|
-
],
|
|
2036
|
-
exports: [
|
|
2037
|
-
InputDatetimeComponent
|
|
2038
|
-
],
|
|
2039
|
-
providers: [
|
|
2040
|
-
{ provide: MAT_DATE_LOCALE, useExisting: LOCALE_ID },
|
|
2041
|
-
{
|
|
2042
|
-
provide: DatetimeAdapter,
|
|
2043
|
-
useClass: MomentDatetimeAdapter
|
|
2044
|
-
},
|
|
2045
|
-
{
|
|
2046
|
-
provide: MAT_DATETIME_FORMATS,
|
|
2047
|
-
useValue: ɵ0$1
|
|
2048
|
-
}
|
|
2049
|
-
]
|
|
2050
|
-
},] }
|
|
2051
|
-
];
|
|
2052
|
-
|
|
2053
|
-
class InputFileUploadComponent {
|
|
2054
|
-
constructor(errorStateMatcher, ngControl, parentForm, changeDetectorRef, parentFormGroup, arquivoService) {
|
|
2055
|
-
this.errorStateMatcher = errorStateMatcher;
|
|
2056
|
-
this.ngControl = ngControl;
|
|
2057
|
-
this.parentForm = parentForm;
|
|
2058
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
2059
|
-
this.parentFormGroup = parentFormGroup;
|
|
2060
|
-
this.arquivoService = arquivoService;
|
|
2061
|
-
this.$disabled = false;
|
|
2062
|
-
this.$required = false;
|
|
2063
|
-
this.template = 'preview';
|
|
2064
|
-
this.selectCancel = new EventEmitter();
|
|
2065
|
-
this.stateChanges = new Subject$1();
|
|
2066
|
-
this.change = new EventEmitter();
|
|
2067
|
-
this.id = `input-fileupload-${InputFileUploadComponent.nextId++}`;
|
|
2068
|
-
this.describedBy = '';
|
|
2069
|
-
this.onChange = (val) => {
|
|
2070
|
-
};
|
|
2071
|
-
this.onTouched = () => {
|
|
2072
|
-
};
|
|
2073
|
-
if (this.ngControl != null) {
|
|
2074
|
-
this.ngControl.valueAccessor = this;
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2077
|
-
get focused() {
|
|
2078
|
-
return this.value && (this.multiple ? this.value.find(a => a.loading) : this.value.loading);
|
|
2079
|
-
}
|
|
2080
|
-
get empty() {
|
|
2081
|
-
return !this.value;
|
|
2082
|
-
}
|
|
2083
|
-
onContainerClick(event) {
|
|
2084
|
-
// Não necessário
|
|
2085
|
-
}
|
|
2086
|
-
get shouldLabelFloat() {
|
|
2087
|
-
return true;
|
|
2088
|
-
}
|
|
2089
|
-
get placeholder() {
|
|
2090
|
-
return this.$placeholder;
|
|
2091
|
-
}
|
|
2092
|
-
set placeholder(plh) {
|
|
2093
|
-
this.$placeholder = plh;
|
|
2094
|
-
this.stateChanges.next();
|
|
2095
|
-
}
|
|
2096
|
-
get required() {
|
|
2097
|
-
return this.$required;
|
|
2098
|
-
}
|
|
2099
|
-
set required(value) {
|
|
2100
|
-
this.$required = coerceBooleanProperty(value);
|
|
2101
|
-
this.stateChanges.next();
|
|
2102
|
-
}
|
|
2103
|
-
get disabled() {
|
|
2104
|
-
return this.$disabled;
|
|
2105
|
-
}
|
|
2106
|
-
set disabled(value) {
|
|
2107
|
-
this.$disabled = coerceBooleanProperty(value);
|
|
2108
|
-
this.stateChanges.next();
|
|
2109
|
-
}
|
|
2110
|
-
get errorState() {
|
|
2111
|
-
return this.errorStateMatcher.isErrorState(this.ngControl.control, this.parentFormGroup || this.parentForm);
|
|
2112
|
-
}
|
|
2113
|
-
get controlType() {
|
|
2114
|
-
return 'input-fileupload';
|
|
2115
|
-
}
|
|
2116
|
-
setDescribedByIds(ids) {
|
|
2117
|
-
this.describedBy = ids.join(' ');
|
|
2118
|
-
}
|
|
2119
|
-
ngOnDestroy() {
|
|
2120
|
-
this.stateChanges.complete();
|
|
2121
|
-
}
|
|
2122
|
-
upload(arquivo) {
|
|
2123
|
-
return new Observable(observer => {
|
|
2124
|
-
if (!this.validaFormato(arquivo.nome)) {
|
|
2125
|
-
arquivo.error = { fileFormat: true };
|
|
2126
|
-
observer.error('Formato inválido');
|
|
2127
|
-
this.onChange(this.value);
|
|
2128
|
-
this.change.emit(this.value);
|
|
2129
|
-
this.stateChanges.next();
|
|
2130
|
-
return;
|
|
2131
|
-
}
|
|
2132
|
-
if (this.limite) {
|
|
2133
|
-
const total = this.parseLimite();
|
|
2134
|
-
if (arquivo.length > total) {
|
|
2135
|
-
arquivo.error = {
|
|
2136
|
-
fileSize: {
|
|
2137
|
-
limite: this.limite,
|
|
2138
|
-
}
|
|
2139
|
-
};
|
|
2140
|
-
observer.error('Tamanho inválido');
|
|
2141
|
-
this.onChange(this.value);
|
|
2142
|
-
this.change.emit(this.value);
|
|
2143
|
-
this.stateChanges.next();
|
|
2144
|
-
return;
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
this.arquivoService.upload(arquivo.file)
|
|
2148
|
-
.subscribe(event => {
|
|
2149
|
-
if (event.type === 'conclusao') {
|
|
2150
|
-
arquivo.progresso = undefined;
|
|
2151
|
-
if (this.multiple) {
|
|
2152
|
-
this.value = [
|
|
2153
|
-
...(this.value || []).map(a => a === arquivo ? event.attachment : a)
|
|
2154
|
-
];
|
|
2155
|
-
this.onChange(this.value);
|
|
2156
|
-
this.change.emit(this.value);
|
|
2157
|
-
this.stateChanges.next();
|
|
2158
|
-
}
|
|
2159
|
-
else {
|
|
2160
|
-
this.value = event.attachment;
|
|
2161
|
-
this.onChange(event.attachment);
|
|
2162
|
-
this.change.emit(event.attachment);
|
|
2163
|
-
this.stateChanges.next();
|
|
2164
|
-
}
|
|
2165
|
-
observer.next();
|
|
2166
|
-
observer.complete();
|
|
2167
|
-
}
|
|
2168
|
-
else if (event.type === 'progresso') {
|
|
2169
|
-
arquivo.progresso = event.progresso;
|
|
2170
|
-
this.stateChanges.next();
|
|
2171
|
-
}
|
|
2172
|
-
}, err => {
|
|
2173
|
-
arquivo.error = { fileError: true };
|
|
2174
|
-
this.onChange(this.value);
|
|
2175
|
-
this.change.emit(this.value);
|
|
2176
|
-
this.stateChanges.next();
|
|
2177
|
-
observer.error(err);
|
|
2178
|
-
});
|
|
2179
|
-
});
|
|
2180
|
-
}
|
|
2181
|
-
parseLimite() {
|
|
2182
|
-
let total = Number(this.limite.replace(/\D+/g, ''));
|
|
2183
|
-
if (this.limite.toUpperCase().indexOf('GB') >= 0) {
|
|
2184
|
-
total = total * 1024 * 1024 * 1024;
|
|
2185
|
-
}
|
|
2186
|
-
if (this.limite.toUpperCase().indexOf('MB') >= 0) {
|
|
2187
|
-
total = total * 1024 * 1024;
|
|
2188
|
-
}
|
|
2189
|
-
if (this.limite.toUpperCase().indexOf('KB') >= 0) {
|
|
2190
|
-
total = total * 1024;
|
|
2191
|
-
}
|
|
2192
|
-
return total;
|
|
2193
|
-
}
|
|
2194
|
-
validaFormato(filename) {
|
|
2195
|
-
if (this.accept) {
|
|
2196
|
-
let formats = [];
|
|
2197
|
-
if (typeof this.accept === 'string') {
|
|
2198
|
-
formats = [this.accept];
|
|
2199
|
-
}
|
|
2200
|
-
else {
|
|
2201
|
-
formats = this.accept;
|
|
2202
|
-
}
|
|
2203
|
-
for (const format of formats) {
|
|
2204
|
-
if (filename.toLowerCase().indexOf(format.toLowerCase()) === filename.length - format.length) {
|
|
2205
|
-
return true;
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
return false;
|
|
2209
|
-
}
|
|
2210
|
-
return true;
|
|
2211
|
-
}
|
|
2212
|
-
uploadNext() {
|
|
2213
|
-
if (this.multiple) {
|
|
2214
|
-
if (this.value) {
|
|
2215
|
-
for (const item of this.value) {
|
|
2216
|
-
if (item.loading && !item.error) {
|
|
2217
|
-
this.upload(item).subscribe(() => this.uploadNext(), err => this.uploadNext());
|
|
2218
|
-
break;
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
else if (this.value && this.value.loading && !this.value.error) {
|
|
2224
|
-
this.upload(this.value).subscribe(() => this.uploadNext(), err => this.uploadNext());
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
onFileChange(event) {
|
|
2228
|
-
this.onTouched();
|
|
2229
|
-
if (event.target.files && event.target.files.length) {
|
|
2230
|
-
if (this.multiple) {
|
|
2231
|
-
const arqs = [];
|
|
2232
|
-
for (const file of event.target.files) {
|
|
2233
|
-
arqs.push({
|
|
2234
|
-
file,
|
|
2235
|
-
loading: true,
|
|
2236
|
-
nome: file.name,
|
|
2237
|
-
length: file.size,
|
|
2238
|
-
});
|
|
2239
|
-
}
|
|
2240
|
-
this.value = [
|
|
2241
|
-
...(this.value || []),
|
|
2242
|
-
...arqs
|
|
2243
|
-
];
|
|
2244
|
-
this.onChange(this.value);
|
|
2245
|
-
this.change.emit(this.value);
|
|
2246
|
-
this.stateChanges.next();
|
|
2247
|
-
}
|
|
2248
|
-
else {
|
|
2249
|
-
this.value = {
|
|
2250
|
-
file: event.target.files[0],
|
|
2251
|
-
length: event.target.files[0].size,
|
|
2252
|
-
loading: true,
|
|
2253
|
-
nome: event.target.files[0].name
|
|
2254
|
-
};
|
|
2255
|
-
this.onChange(this.value);
|
|
2256
|
-
this.change.emit(this.value);
|
|
2257
|
-
this.stateChanges.next();
|
|
2258
|
-
}
|
|
2259
|
-
this.uploadNext();
|
|
2260
|
-
}
|
|
2261
|
-
else {
|
|
2262
|
-
this.selectCancel.emit();
|
|
2263
|
-
}
|
|
2264
|
-
event.target.value = '';
|
|
2265
|
-
}
|
|
2266
|
-
openFileChooser() {
|
|
2267
|
-
if (!this.disabled) {
|
|
2268
|
-
this.input.nativeElement.click();
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
remover(arquivo) {
|
|
2272
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2273
|
-
if (this.value) {
|
|
2274
|
-
if (this.multiple) {
|
|
2275
|
-
if (Array.isArray(this.value)) {
|
|
2276
|
-
this.value.splice(this.value.indexOf(arquivo), 1);
|
|
2277
|
-
if (this.value.length) {
|
|
2278
|
-
this.value = [...this.value];
|
|
2279
|
-
this.onChange(this.value);
|
|
2280
|
-
this.change.emit(this.value);
|
|
2281
|
-
this.stateChanges.next();
|
|
2282
|
-
}
|
|
2283
|
-
else {
|
|
2284
|
-
this.value = undefined;
|
|
2285
|
-
this.onChange(undefined);
|
|
2286
|
-
this.change.emit(undefined);
|
|
2287
|
-
this.stateChanges.next();
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
else {
|
|
2292
|
-
this.value = undefined;
|
|
2293
|
-
this.onChange(undefined);
|
|
2294
|
-
this.change.emit(undefined);
|
|
2295
|
-
this.stateChanges.next();
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
});
|
|
2299
|
-
}
|
|
2300
|
-
registerOnTouched(fn) {
|
|
2301
|
-
this.onTouched = fn;
|
|
2302
|
-
}
|
|
2303
|
-
registerOnChange(fn) {
|
|
2304
|
-
this.onChange = fn;
|
|
2305
|
-
}
|
|
2306
|
-
setDisabledState(isDisabled) {
|
|
2307
|
-
this.disabled = isDisabled;
|
|
2308
|
-
}
|
|
2309
|
-
writeValue(obj) {
|
|
2310
|
-
if (obj) {
|
|
2311
|
-
if (this.multiple) {
|
|
2312
|
-
this.value = obj.map(a => typeof a === 'string' ? { url: a } : a);
|
|
2313
|
-
this.stateChanges.next();
|
|
2314
|
-
}
|
|
2315
|
-
else if (typeof obj === 'string') {
|
|
2316
|
-
this.value = { url: obj };
|
|
2317
|
-
this.stateChanges.next();
|
|
2318
|
-
}
|
|
2319
|
-
else {
|
|
2320
|
-
this.value = obj;
|
|
2321
|
-
this.stateChanges.next();
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
else {
|
|
2325
|
-
this.value = obj;
|
|
2326
|
-
this.stateChanges.next();
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
InputFileUploadComponent.nextId = 0;
|
|
2331
|
-
InputFileUploadComponent.decorators = [
|
|
2332
|
-
{ type: Component, args: [{
|
|
2333
|
-
selector: 'mcl-input-fileupload',
|
|
2334
|
-
template: "<div *ngIf=\"multiple && template == 'chips'\" class=\"chips\">\r\n <mat-chip-list *ngIf=\"value?.length\">\r\n <mat-chip [ngClass]=\"{'error':arquivo.loading && arquivo.error,'success':!arquivo.loading}\"\r\n *ngFor=\"let arquivo of value\">\r\n <mat-spinner *ngIf=\"arquivo.loading && !arquivo.error\"\r\n [value]=\"arquivo.progresso\" [diameter]=\"24\"\r\n ></mat-spinner>\r\n <mat-icon *ngIf=\"arquivo.loading && arquivo.error\" class=\"error\">remove_circle_outline</mat-icon>\r\n <mat-icon *ngIf=\"!arquivo.loading\" class=\"success\">check_circle_outline</mat-icon>\r\n {{ arquivo.nome || arquivo.filename }}\r\n <a *ngIf=\"!disabled\" (click)=\"remover(arquivo)\" href=\"javascript:void(0)\">\r\n <mat-icon>close</mat-icon>\r\n </a>\r\n </mat-chip>\r\n </mat-chip-list>\r\n\r\n <hr *ngIf=\"value?.length && !disabled\"/>\r\n\r\n <input *ngIf=\"!disabled\" type=\"file\" (change)=\"onFileChange($event)\" #input [multiple]=\"multiple\"/>\r\n</div>\r\n\r\n<div *ngIf=\"multiple && template == 'preview'\" class=\"previews\">\r\n <div *ngIf=\"value?.length\" fxLayout=\"row wrap\" fxLayoutGap=\"20px\" fxFlexAlign=\"center\">\r\n <div *ngFor=\"let arquivo of value\">\r\n <div class=\"preview\" [ngClass]=\"{'error':arquivo.loading && arquivo.error,'success':!arquivo.loading}\">\r\n <mcl-preview-arquivo [group]=\"value\" [arquivo]=\"arquivo\"></mcl-preview-arquivo>\r\n\r\n <div class=\"footer\" *ngIf=\"!disabled\">\r\n <mat-spinner *ngIf=\"arquivo.loading && !arquivo.error\"\r\n [value]=\"arquivo.progresso\" [diameter]=\"24\"\r\n ></mat-spinner>\r\n <mat-icon *ngIf=\"arquivo.loading && arquivo.error\" class=\"error\">remove_circle_outline</mat-icon>\r\n <mat-icon *ngIf=\"!arquivo.loading\" class=\"success\">check_circle_outline</mat-icon>\r\n <span>{{ arquivo.nome || arquivo.filename }}</span>\r\n <a *ngIf=\"!disabled\" (click)=\"remover(arquivo)\" href=\"javascript:void(0)\">\r\n <mat-icon>close</mat-icon>\r\n </a>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n\r\n <hr *ngIf=\"value?.length && !disabled\"/>\r\n\r\n <input *ngIf=\"!disabled\" type=\"file\" (change)=\"onFileChange($event)\" #input [multiple]=\"multiple\"/>\r\n</div>\r\n\r\n\r\n<div *ngIf=\"template == 'manual'\">\r\n <input type=\"file\" [disabled]=\"disabled\" (change)=\"onFileChange($event)\" #input\r\n [multiple]=\"multiple\" style=\"display: none\"/>\r\n</div>\r\n\r\n<ng-container *ngIf=\"!multiple && template != 'manual'\">\r\n <input #input type=\"file\" style=\"display: none\"\r\n (change)=\"onFileChange($event)\"/>\r\n\r\n <div class=\"input\">\r\n <button mat-icon-button type=\"button\"\r\n (click)=\"openFileChooser()\"\r\n *ngIf=\"!value\"\r\n matPrefix>\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n <button mat-icon-button type=\"button\"\r\n [mclDownloadArquivo]=\"value\"\r\n *ngIf=\"value && !value.loading && !value.error\"\r\n matPrefix>\r\n <mat-icon>download</mat-icon>\r\n </button>\r\n <button mat-icon-button type=\"button\" matPrefix\r\n *ngIf=\"value?.error\" disabled>\r\n <mat-icon>warning</mat-icon>\r\n </button>\r\n <button mat-icon-button type=\"button\" matPrefix\r\n *ngIf=\"value?.loading && !value?.error\" disabled>\r\n <mat-spinner [value]=\"value.progresso\"\r\n [diameter]=\"24\"></mat-spinner>\r\n </button>\r\n <input matInput readonly (click)=\"openFileChooser()\" [required]=\"required\"\r\n *ngIf=\"!value\" value=\"Selecione um arquivo...\"/>\r\n <input matInput readonly [required]=\"required\"\r\n *ngIf=\"value && value.loading && !value.error\" value=\"Submetendo arquivo...\"/>\r\n <input matInput readonly [required]=\"required\"\r\n *ngIf=\"value && value.error\" [value]=\"value?.nome || value?.filename\"/>\r\n <input matInput readonly [mclDownloadArquivo]=\"value\" [required]=\"required\"\r\n *ngIf=\"value && !value.loading\" [value]=\"value?.nome || value?.filename\"/>\r\n <button mat-icon-button type=\"button\" matSuffix\r\n matTooltip=\"Remover\" (click)=\"remover(value)\"\r\n *ngIf=\"value && (!value.loading || value?.error) && !disabled\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n </div>\r\n</ng-container>\r\n",
|
|
2335
|
-
providers: [
|
|
2336
|
-
{
|
|
2337
|
-
provide: MatFormFieldControl,
|
|
2338
|
-
useExisting: InputFileUploadComponent
|
|
2339
|
-
}
|
|
2340
|
-
],
|
|
2341
|
-
styles: ["span{opacity:0;transition:opacity .2s}:host.floating span{opacity:1}.preview .footer>mat-icon,.preview .footer>mat-spinner,mat-chip>mat-icon,mat-chip>mat-spinner{margin-right:5px;vertical-align:middle}.preview .footer a,mat-chip a{padding:5px}.preview .footer a mat-icon,mat-chip a mat-icon{margin-left:10px;vertical-align:middle}.preview.error,mat-chip.error{color:red}.preview.success,mat-chip.success{color:green}.preview{text-align:center;width:200px;overflow:hidden;margin:0 auto 20px}.preview mcl-preview-arquivo{margin:auto;display:block}.preview .footer{display:flex;text-align:left}.preview .footer span{flex:1 1 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.preview .footer a,.preview .footer mat-icon{flex:1}.input{display:flex}.input input{flex:1 1 auto}"]
|
|
2342
|
-
},] }
|
|
2343
|
-
];
|
|
2344
|
-
InputFileUploadComponent.ctorParameters = () => [
|
|
2345
|
-
{ type: ErrorStateMatcher },
|
|
2346
|
-
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
|
|
2347
|
-
{ type: NgForm, decorators: [{ type: Optional }] },
|
|
2348
|
-
{ type: ChangeDetectorRef },
|
|
2349
|
-
{ type: FormGroupDirective, decorators: [{ type: Optional }] },
|
|
2350
|
-
{ type: undefined, decorators: [{ type: Inject, args: [ARQUIVO_MANAGER_SERVICE,] }] }
|
|
2351
|
-
];
|
|
2352
|
-
InputFileUploadComponent.propDecorators = {
|
|
2353
|
-
multiple: [{ type: Input }],
|
|
2354
|
-
limite: [{ type: Input }],
|
|
2355
|
-
accept: [{ type: Input }],
|
|
2356
|
-
template: [{ type: Input }],
|
|
2357
|
-
input: [{ type: ViewChild, args: ['input',] }],
|
|
2358
|
-
selectCancel: [{ type: Output }],
|
|
2359
|
-
stateChanges: [{ type: Output, args: ['change',] }],
|
|
2360
|
-
change: [{ type: Output }],
|
|
2361
|
-
id: [{ type: HostBinding }],
|
|
2362
|
-
describedBy: [{ type: HostBinding, args: ['attr.aria-describedby',] }],
|
|
2363
|
-
shouldLabelFloat: [{ type: HostBinding, args: ['class.floating',] }],
|
|
2364
|
-
placeholder: [{ type: Input }],
|
|
2365
|
-
required: [{ type: Input }],
|
|
2366
|
-
disabled: [{ type: Input }]
|
|
2367
|
-
};
|
|
2368
|
-
|
|
2369
|
-
class InputFileUploadValidatorDirective {
|
|
2370
|
-
validate(control) {
|
|
2371
|
-
if (control.value) {
|
|
2372
|
-
if (this.multiple && Array.isArray(control.value)) {
|
|
2373
|
-
const error = control.value.find(a => a.loading && a.error);
|
|
2374
|
-
if (error) {
|
|
2375
|
-
return error.error;
|
|
2376
|
-
}
|
|
2377
|
-
if (control.value.find(a => a.loading)) {
|
|
2378
|
-
return { fileUploading: true };
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
else if (control.value.loading && control.value.error) {
|
|
2382
|
-
return control.value.error;
|
|
2383
|
-
}
|
|
2384
|
-
else if (control.value.loading) {
|
|
2385
|
-
return { fileUploading: true };
|
|
2386
|
-
}
|
|
2387
|
-
}
|
|
2388
|
-
return undefined;
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
InputFileUploadValidatorDirective.decorators = [
|
|
2392
|
-
{ type: Directive, args: [{
|
|
2393
|
-
selector: 'mcl-input-fileupload,[mclFileupload]',
|
|
2394
|
-
providers: [{ provide: NG_VALIDATORS, useExisting: InputFileUploadValidatorDirective, multi: true }]
|
|
2395
|
-
},] }
|
|
2396
|
-
];
|
|
2397
|
-
InputFileUploadValidatorDirective.propDecorators = {
|
|
2398
|
-
multiple: [{ type: Input }]
|
|
2399
|
-
};
|
|
2400
|
-
|
|
2401
|
-
class InputFileuploadModule {
|
|
2402
|
-
}
|
|
2403
|
-
InputFileuploadModule.decorators = [
|
|
2404
|
-
{ type: NgModule, args: [{
|
|
2405
|
-
declarations: [InputFileUploadComponent, InputFileUploadValidatorDirective],
|
|
2406
|
-
exports: [InputFileUploadComponent, InputFileUploadValidatorDirective],
|
|
2407
|
-
imports: [
|
|
2408
|
-
CommonModule,
|
|
2409
|
-
FormsModule,
|
|
2410
|
-
MatChipsModule,
|
|
2411
|
-
MatProgressSpinnerModule,
|
|
2412
|
-
MatIconModule,
|
|
2413
|
-
FlexLayoutModule,
|
|
2414
|
-
ArquivoModule,
|
|
2415
|
-
MatButtonModule,
|
|
2416
|
-
MatInputModule,
|
|
2417
|
-
MatTooltipModule
|
|
2418
|
-
]
|
|
2419
|
-
},] }
|
|
2420
|
-
];
|
|
2421
|
-
|
|
2422
|
-
class OptionNode {
|
|
2423
|
-
constructor(pool, value, selected = false) {
|
|
2424
|
-
this.pool = pool;
|
|
2425
|
-
this.value = value;
|
|
2426
|
-
this.subject = new BehaviorSubject(selected);
|
|
2427
|
-
}
|
|
2428
|
-
get model() {
|
|
2429
|
-
return this.pool.model();
|
|
2430
|
-
}
|
|
2431
|
-
get observable() {
|
|
2432
|
-
return this.subject;
|
|
2433
|
-
}
|
|
2434
|
-
setSelected(selected) {
|
|
2435
|
-
this.subject.next(selected);
|
|
2436
|
-
}
|
|
2437
|
-
dispose() {
|
|
2438
|
-
this.subject.complete();
|
|
2439
|
-
}
|
|
2440
|
-
touched() {
|
|
2441
|
-
this.pool.touched();
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
class NodePool {
|
|
2446
|
-
constructor(name) {
|
|
2447
|
-
this.name = name;
|
|
2448
|
-
this._nodes = new BehaviorSubject([]);
|
|
2449
|
-
this._touch = new Subject();
|
|
2450
|
-
this._groups = [];
|
|
2451
|
-
this.lastValues = [];
|
|
2452
|
-
}
|
|
2453
|
-
model() {
|
|
2454
|
-
return this._nodes
|
|
2455
|
-
.pipe(switchMap(ns => combineLatest(ns
|
|
2456
|
-
.map(n => n.observable
|
|
2457
|
-
.pipe(map(selected => ({
|
|
2458
|
-
selected,
|
|
2459
|
-
value: n.value
|
|
2460
|
-
})))))))
|
|
2461
|
-
.pipe(map(ops => {
|
|
2462
|
-
const model = ops.filter(o => o.selected).map(o => o.value);
|
|
2463
|
-
return model.length ? model : undefined;
|
|
2464
|
-
}));
|
|
2465
|
-
}
|
|
2466
|
-
touch() {
|
|
2467
|
-
return this._touch;
|
|
2468
|
-
}
|
|
2469
|
-
all() {
|
|
2470
|
-
return this._nodes
|
|
2471
|
-
.pipe(switchMap(ns => combineLatest(ns
|
|
2472
|
-
.map(n => n.observable))))
|
|
2473
|
-
.pipe(map(ops => {
|
|
2474
|
-
if (ops.length) {
|
|
2475
|
-
const first = ops[0];
|
|
2476
|
-
for (const o of ops) {
|
|
2477
|
-
if (o !== first) {
|
|
2478
|
-
return undefined;
|
|
2479
|
-
}
|
|
2480
|
-
}
|
|
2481
|
-
return first;
|
|
2482
|
-
}
|
|
2483
|
-
return false;
|
|
2484
|
-
}));
|
|
2485
|
-
}
|
|
2486
|
-
get empty() {
|
|
2487
|
-
return !this._nodes.value.length && !this._groups.length;
|
|
2488
|
-
}
|
|
2489
|
-
dispose() {
|
|
2490
|
-
this._nodes.complete();
|
|
2491
|
-
this._touch.complete();
|
|
2492
|
-
}
|
|
2493
|
-
touched() {
|
|
2494
|
-
this._touch.next();
|
|
2495
|
-
}
|
|
2496
|
-
register(value) {
|
|
2497
|
-
const selected = !!this.lastValues && this.lastValues.indexOf(value) >= 0;
|
|
2498
|
-
const node = new OptionNode(this, value, selected);
|
|
2499
|
-
this._nodes.next([
|
|
2500
|
-
...this._nodes.value,
|
|
2501
|
-
node
|
|
2502
|
-
]);
|
|
2503
|
-
return node;
|
|
2504
|
-
}
|
|
2505
|
-
unregister(node) {
|
|
2506
|
-
this._nodes.next(this._nodes.value.filter(n => n !== node));
|
|
2507
|
-
node.dispose();
|
|
2508
|
-
}
|
|
2509
|
-
registerGroup(group) {
|
|
2510
|
-
this._groups.push(group);
|
|
2511
|
-
}
|
|
2512
|
-
unregisterGroup(group) {
|
|
2513
|
-
this._groups.splice(this._groups.indexOf(group), 1);
|
|
2514
|
-
}
|
|
2515
|
-
writeValue(values) {
|
|
2516
|
-
if (values !== this.lastValues) {
|
|
2517
|
-
this.lastValues = values || [];
|
|
2518
|
-
if (values) {
|
|
2519
|
-
this._nodes.value.forEach(n => {
|
|
2520
|
-
n.setSelected(values.indexOf(n.value) >= 0);
|
|
2521
|
-
});
|
|
2522
|
-
}
|
|
2523
|
-
else {
|
|
2524
|
-
this._nodes.value.forEach(n => {
|
|
2525
|
-
n.setSelected(false);
|
|
2526
|
-
});
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
}
|
|
2530
|
-
setAll(selected) {
|
|
2531
|
-
this._nodes.value.forEach(m => m.setSelected(selected));
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
class OptionCheckboxService {
|
|
2536
|
-
constructor() {
|
|
2537
|
-
this.nodes = {};
|
|
2538
|
-
}
|
|
2539
|
-
getPool(name) {
|
|
2540
|
-
if (!this.nodes[name]) {
|
|
2541
|
-
this.nodes[name] = new NodePool(name);
|
|
2542
|
-
}
|
|
2543
|
-
return this.nodes[name];
|
|
2544
|
-
}
|
|
2545
|
-
registerGroup(name, group) {
|
|
2546
|
-
const pool = this.getPool(name);
|
|
2547
|
-
pool.registerGroup(group);
|
|
2548
|
-
return pool;
|
|
2549
|
-
}
|
|
2550
|
-
unregisterGroup(name, group) {
|
|
2551
|
-
if (this.nodes[name]) {
|
|
2552
|
-
this.nodes[name].unregisterGroup(group);
|
|
2553
|
-
if (this.nodes[name].empty) {
|
|
2554
|
-
this.nodes[name].dispose();
|
|
2555
|
-
this.nodes[name] = undefined;
|
|
2556
|
-
}
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
unregister(name, node) {
|
|
2560
|
-
if (this.nodes[name]) {
|
|
2561
|
-
this.nodes[name].unregister(node);
|
|
2562
|
-
if (this.nodes[name].empty) {
|
|
2563
|
-
this.nodes[name].dispose();
|
|
2564
|
-
this.nodes[name] = undefined;
|
|
2565
|
-
}
|
|
2566
|
-
}
|
|
2567
|
-
}
|
|
2568
|
-
register(name, value) {
|
|
2569
|
-
return this.getPool(name).register(value);
|
|
2570
|
-
}
|
|
2571
|
-
setAll(name, selected) {
|
|
2572
|
-
if (this.nodes[name]) {
|
|
2573
|
-
this.nodes[name].setAll(selected);
|
|
2574
|
-
}
|
|
2575
|
-
}
|
|
2576
|
-
writeValue(name, model) {
|
|
2577
|
-
var _a;
|
|
2578
|
-
(_a = this.getPool(name)) === null || _a === void 0 ? void 0 : _a.writeValue(model);
|
|
2579
|
-
}
|
|
2580
|
-
}
|
|
2581
|
-
OptionCheckboxService.decorators = [
|
|
2582
|
-
{ type: Injectable }
|
|
2583
|
-
];
|
|
2584
|
-
|
|
2585
|
-
class AllOptionCheckboxComponent {
|
|
2586
|
-
constructor(fotonOptionCheckboxService) {
|
|
2587
|
-
this.fotonOptionCheckboxService = fotonOptionCheckboxService;
|
|
2588
|
-
this.change = new EventEmitter();
|
|
2589
|
-
}
|
|
2590
|
-
get name() {
|
|
2591
|
-
return this._name;
|
|
2592
|
-
}
|
|
2593
|
-
set name(name) {
|
|
2594
|
-
this._name = name;
|
|
2595
|
-
this.pool = this.fotonOptionCheckboxService.getPool(name);
|
|
2596
|
-
this.selected = this.pool.all();
|
|
2597
|
-
}
|
|
2598
|
-
setSelected(selected) {
|
|
2599
|
-
this.pool.touched();
|
|
2600
|
-
this.fotonOptionCheckboxService.setAll(this.name, selected);
|
|
2601
|
-
this.change.emit();
|
|
2602
|
-
}
|
|
2603
|
-
}
|
|
2604
|
-
AllOptionCheckboxComponent.decorators = [
|
|
2605
|
-
{ type: Component, args: [{
|
|
2606
|
-
selector: 'mcl-option-checkbox[select-all-option]',
|
|
2607
|
-
template: "<mat-checkbox [disabled]=\"disabled\"\n [ngModel]=\"selected | async\"\n (ngModelChange)=\"setSelected($event)\"\n [indeterminate]=\"(selected | async) === undefined\" >\n <ng-content></ng-content>\n</mat-checkbox>\n"
|
|
2608
|
-
},] }
|
|
2609
|
-
];
|
|
2610
|
-
AllOptionCheckboxComponent.ctorParameters = () => [
|
|
2611
|
-
{ type: OptionCheckboxService }
|
|
2612
|
-
];
|
|
2613
|
-
AllOptionCheckboxComponent.propDecorators = {
|
|
2614
|
-
disabled: [{ type: Input }],
|
|
2615
|
-
change: [{ type: Output }],
|
|
2616
|
-
name: [{ type: Input }]
|
|
2617
|
-
};
|
|
2618
|
-
|
|
2619
|
-
class OptionCheckboxComponent {
|
|
2620
|
-
constructor(fotonOptionCheckboxService) {
|
|
2621
|
-
this.fotonOptionCheckboxService = fotonOptionCheckboxService;
|
|
2622
|
-
this.change = new EventEmitter();
|
|
2623
|
-
}
|
|
2624
|
-
setSelected(selected) {
|
|
2625
|
-
if (this.node) {
|
|
2626
|
-
this.node.touched();
|
|
2627
|
-
this.node.setSelected(selected);
|
|
2628
|
-
this.change.emit();
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
get value() {
|
|
2632
|
-
return this.node ? this.node.value : undefined;
|
|
2633
|
-
}
|
|
2634
|
-
set value(v) {
|
|
2635
|
-
if (v != this.value) {
|
|
2636
|
-
if (this.node) {
|
|
2637
|
-
this.node.value = v;
|
|
2638
|
-
}
|
|
2639
|
-
else {
|
|
2640
|
-
this._value = v;
|
|
2641
|
-
}
|
|
2642
|
-
}
|
|
2643
|
-
}
|
|
2644
|
-
get name() {
|
|
2645
|
-
return this._name;
|
|
2646
|
-
}
|
|
2647
|
-
set name(n) {
|
|
2648
|
-
if (n !== this.name && !this.node) {
|
|
2649
|
-
this.node = this.fotonOptionCheckboxService.register(n, this._value);
|
|
2650
|
-
this.selected = this.node.observable;
|
|
2651
|
-
this._name = n;
|
|
2652
|
-
}
|
|
2653
|
-
}
|
|
2654
|
-
onBlur() {
|
|
2655
|
-
}
|
|
2656
|
-
ngOnDestroy() {
|
|
2657
|
-
this.fotonOptionCheckboxService.unregister(this.name, this.node);
|
|
2658
|
-
}
|
|
2659
|
-
}
|
|
2660
|
-
OptionCheckboxComponent.decorators = [
|
|
2661
|
-
{ type: Component, args: [{
|
|
2662
|
-
selector: 'mcl-option-checkbox:not([select-all-option])',
|
|
2663
|
-
template: "<mat-checkbox [disabled]=\"disabled\"\n [ngModel]=\"selected | async\"\n (ngModelChange)=\"setSelected($event)\"\n [indeterminate]=\"(selected | async) === undefined\" >\n <ng-content></ng-content>\n</mat-checkbox>\n"
|
|
2664
|
-
},] }
|
|
2665
|
-
];
|
|
2666
|
-
OptionCheckboxComponent.ctorParameters = () => [
|
|
2667
|
-
{ type: OptionCheckboxService }
|
|
2668
|
-
];
|
|
2669
|
-
OptionCheckboxComponent.propDecorators = {
|
|
2670
|
-
disabled: [{ type: Input }],
|
|
2671
|
-
change: [{ type: Output }],
|
|
2672
|
-
value: [{ type: Input }],
|
|
2673
|
-
name: [{ type: Input }]
|
|
2674
|
-
};
|
|
2675
|
-
|
|
2676
|
-
class OptionCheckboxGroupComponent {
|
|
2677
|
-
constructor(optionCheckboxService) {
|
|
2678
|
-
this.optionCheckboxService = optionCheckboxService;
|
|
2679
|
-
this.change = new EventEmitter();
|
|
2680
|
-
this.touched = new EventEmitter();
|
|
2681
|
-
this.onTouchedCallback = () => {
|
|
2682
|
-
};
|
|
2683
|
-
this.onChangeCallback = () => {
|
|
2684
|
-
};
|
|
2685
|
-
}
|
|
2686
|
-
get name() {
|
|
2687
|
-
return this._name;
|
|
2688
|
-
}
|
|
2689
|
-
set name(n) {
|
|
2690
|
-
if (n !== this.name && !this.pool) {
|
|
2691
|
-
this.pool = this.optionCheckboxService.registerGroup(n, this);
|
|
2692
|
-
this.pool.touch().subscribe(() => {
|
|
2693
|
-
this.onTouchedCallback();
|
|
2694
|
-
this.touched.emit();
|
|
2695
|
-
});
|
|
2696
|
-
this.pool.model().subscribe(model => {
|
|
2697
|
-
clearTimeout(this.callbackTimeout);
|
|
2698
|
-
this.callbackTimeout = setTimeout(() => {
|
|
2699
|
-
this.onChangeCallback(model);
|
|
2700
|
-
this.change.emit(model);
|
|
2701
|
-
});
|
|
2702
|
-
});
|
|
2703
|
-
this._name = n;
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
onBlur() {
|
|
2707
|
-
}
|
|
2708
|
-
ngOnDestroy() {
|
|
2709
|
-
this.optionCheckboxService.unregisterGroup(this.name, this);
|
|
2710
|
-
}
|
|
2711
|
-
writeValue(value) {
|
|
2712
|
-
this.optionCheckboxService.writeValue(this.name, value);
|
|
2713
|
-
}
|
|
2714
|
-
registerOnChange(fn) {
|
|
2715
|
-
this.onChangeCallback = fn;
|
|
2716
|
-
}
|
|
2717
|
-
registerOnTouched(fn) {
|
|
2718
|
-
this.onTouchedCallback = fn;
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2721
|
-
OptionCheckboxGroupComponent.decorators = [
|
|
2722
|
-
{ type: Component, args: [{
|
|
2723
|
-
selector: 'mcl-option-checkbox-group',
|
|
2724
|
-
template: '',
|
|
2725
|
-
providers: [
|
|
2726
|
-
{
|
|
2727
|
-
provide: NG_VALUE_ACCESSOR,
|
|
2728
|
-
useExisting: OptionCheckboxGroupComponent,
|
|
2729
|
-
multi: true
|
|
2730
|
-
}
|
|
2731
|
-
]
|
|
2732
|
-
},] }
|
|
2733
|
-
];
|
|
2734
|
-
OptionCheckboxGroupComponent.ctorParameters = () => [
|
|
2735
|
-
{ type: OptionCheckboxService }
|
|
2736
|
-
];
|
|
2737
|
-
OptionCheckboxGroupComponent.propDecorators = {
|
|
2738
|
-
disabled: [{ type: Input }],
|
|
2739
|
-
change: [{ type: Output }],
|
|
2740
|
-
touched: [{ type: Output }],
|
|
2741
|
-
name: [{ type: Input }]
|
|
2742
|
-
};
|
|
2743
|
-
|
|
2744
|
-
class OptionCheckboxModule {
|
|
2745
|
-
}
|
|
2746
|
-
OptionCheckboxModule.decorators = [
|
|
2747
|
-
{ type: NgModule, args: [{
|
|
2748
|
-
declarations: [OptionCheckboxComponent, AllOptionCheckboxComponent, OptionCheckboxGroupComponent],
|
|
2749
|
-
exports: [OptionCheckboxComponent, AllOptionCheckboxComponent, OptionCheckboxGroupComponent],
|
|
2750
|
-
providers: [OptionCheckboxService],
|
|
2751
|
-
imports: [
|
|
2752
|
-
CommonModule,
|
|
2753
|
-
FormsModule,
|
|
2754
|
-
MatCheckboxModule,
|
|
2755
|
-
]
|
|
2756
|
-
},] }
|
|
2757
|
-
];
|
|
2758
|
-
|
|
2759
|
-
class SelectItemComponent {
|
|
2760
|
-
constructor() {
|
|
2761
|
-
}
|
|
2762
|
-
ngOnInit() {
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
SelectItemComponent.decorators = [
|
|
2766
|
-
{ type: Component, args: [{
|
|
2767
|
-
selector: 'mcl-select-item',
|
|
2768
|
-
template: "",
|
|
2769
|
-
styles: [""]
|
|
2770
|
-
},] }
|
|
2771
|
-
];
|
|
2772
|
-
SelectItemComponent.ctorParameters = () => [];
|
|
2773
|
-
SelectItemComponent.propDecorators = {
|
|
2774
|
-
label: [{ type: Input }],
|
|
2775
|
-
value: [{ type: Input }]
|
|
2776
|
-
};
|
|
2777
|
-
|
|
2778
|
-
const TRANSLATE_RE = new RegExp('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝŸ', 'g');
|
|
2779
|
-
const TRANSLATE = 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUYY';
|
|
2780
|
-
class StringUtil {
|
|
2781
|
-
static normalize(val) {
|
|
2782
|
-
const replaceFunction = match => TRANSLATE.charAt(TRANSLATE_RE.source.indexOf(match) - 1);
|
|
2783
|
-
return String(val).trim().toLowerCase().replace(TRANSLATE_RE, replaceFunction);
|
|
2784
|
-
}
|
|
2785
|
-
static like(value, query) {
|
|
2786
|
-
return StringUtil.normalize(value).indexOf(StringUtil.normalize(query)) >= 0;
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
|
-
class SelectChipsComponent {
|
|
2791
|
-
constructor(errorStateMatcher, ngControl, parentForm, parentFormGroup) {
|
|
2792
|
-
this.errorStateMatcher = errorStateMatcher;
|
|
2793
|
-
this.ngControl = ngControl;
|
|
2794
|
-
this.parentForm = parentForm;
|
|
2795
|
-
this.parentFormGroup = parentFormGroup;
|
|
2796
|
-
this.onChange = (val) => {
|
|
2797
|
-
};
|
|
2798
|
-
this.onTouched = () => {
|
|
2799
|
-
};
|
|
2800
|
-
this.$disabled = false;
|
|
2801
|
-
this.$required = false;
|
|
2802
|
-
this.focused = false;
|
|
2803
|
-
this.filterCtrl = new FormControl();
|
|
2804
|
-
this.stateChanges = new Subject();
|
|
2805
|
-
this.id = `select-chips-${SelectChipsComponent.nextId++}`;
|
|
2806
|
-
this.describedBy = '';
|
|
2807
|
-
if (this.ngControl != null) {
|
|
2808
|
-
this.ngControl.valueAccessor = this;
|
|
2809
|
-
}
|
|
2810
|
-
this.opcoesFiltradas = this.filterCtrl.valueChanges.pipe(startWith(null), map((filtro) => this._filter(filtro)));
|
|
2811
|
-
}
|
|
2812
|
-
get value() {
|
|
2813
|
-
return this.$value;
|
|
2814
|
-
}
|
|
2815
|
-
set value(value) {
|
|
2816
|
-
this.$value = value;
|
|
2817
|
-
this.stateChanges.next();
|
|
2818
|
-
}
|
|
2819
|
-
get empty() {
|
|
2820
|
-
return !this.value;
|
|
2821
|
-
}
|
|
2822
|
-
onContainerClick(event) {
|
|
2823
|
-
}
|
|
2824
|
-
get shouldLabelFloat() {
|
|
2825
|
-
return !this.empty || (this.input && this.input.nativeElement.value) || this.focused;
|
|
2826
|
-
}
|
|
2827
|
-
get placeholder() {
|
|
2828
|
-
return this.$placeholder;
|
|
2829
|
-
}
|
|
2830
|
-
set placeholder(plh) {
|
|
2831
|
-
this.$placeholder = plh;
|
|
2832
|
-
this.stateChanges.next();
|
|
2833
|
-
}
|
|
2834
|
-
get required() {
|
|
2835
|
-
return this.$required;
|
|
2836
|
-
}
|
|
2837
|
-
set required(value) {
|
|
2838
|
-
this.$required = coerceBooleanProperty(value);
|
|
2839
|
-
this.stateChanges.next();
|
|
2840
|
-
}
|
|
2841
|
-
get disabled() {
|
|
2842
|
-
return this.$disabled;
|
|
2843
|
-
}
|
|
2844
|
-
set disabled(value) {
|
|
2845
|
-
this.$disabled = coerceBooleanProperty(value);
|
|
2846
|
-
this.stateChanges.next();
|
|
2847
|
-
}
|
|
2848
|
-
get errorState() {
|
|
2849
|
-
return this.errorStateMatcher.isErrorState(this.ngControl.control, this.parentFormGroup || this.parentForm);
|
|
2850
|
-
}
|
|
2851
|
-
get controlType() {
|
|
2852
|
-
return 'select-chips';
|
|
2853
|
-
}
|
|
2854
|
-
setDescribedByIds(ids) {
|
|
2855
|
-
this.describedBy = ids.join(' ');
|
|
2856
|
-
}
|
|
2857
|
-
ngOnDestroy() {
|
|
2858
|
-
this.stateChanges.complete();
|
|
2859
|
-
}
|
|
2860
|
-
registerOnTouched(fn) {
|
|
2861
|
-
this.onTouched = fn;
|
|
2862
|
-
}
|
|
2863
|
-
registerOnChange(fn) {
|
|
2864
|
-
this.onChange = fn;
|
|
2865
|
-
}
|
|
2866
|
-
setDisabledState(isDisabled) {
|
|
2867
|
-
this.disabled = isDisabled;
|
|
2868
|
-
}
|
|
2869
|
-
writeValue(value) {
|
|
2870
|
-
this.value = value;
|
|
2871
|
-
this.filterCtrl.setValue(this.filterCtrl.value);
|
|
2872
|
-
}
|
|
2873
|
-
add(event) {
|
|
2874
|
-
this.onTouched();
|
|
2875
|
-
const input = event.input;
|
|
2876
|
-
const value = event.value;
|
|
2877
|
-
const selected = StringUtil.normalize((value || ''));
|
|
2878
|
-
const opcao = this.opcoes.toArray().find(op => StringUtil.normalize(op.label) === selected);
|
|
2879
|
-
if (opcao) {
|
|
2880
|
-
if (!this.value || !this.value.find(v => v === opcao.value)) {
|
|
2881
|
-
this.value = [
|
|
2882
|
-
...(this.value || []),
|
|
2883
|
-
opcao.value
|
|
2884
|
-
];
|
|
2885
|
-
this.onChange(this.value);
|
|
2886
|
-
}
|
|
2887
|
-
if (input) {
|
|
2888
|
-
input.value = '';
|
|
2889
|
-
}
|
|
2890
|
-
this.filterCtrl.setValue(null);
|
|
2891
|
-
}
|
|
2892
|
-
}
|
|
2893
|
-
remove(item) {
|
|
2894
|
-
this.onTouched();
|
|
2895
|
-
if (this.value) {
|
|
2896
|
-
const index = this.value.indexOf(item);
|
|
2897
|
-
if (index >= 0) {
|
|
2898
|
-
this.value.splice(index, 1);
|
|
2899
|
-
}
|
|
2900
|
-
if (!this.value.length) {
|
|
2901
|
-
this.value = undefined;
|
|
2902
|
-
}
|
|
2903
|
-
this.onChange(this.value);
|
|
2904
|
-
}
|
|
2905
|
-
}
|
|
2906
|
-
selected(event) {
|
|
2907
|
-
this.onTouched();
|
|
2908
|
-
if (!this.value || !this.value.find(v => v === event.option.value)) {
|
|
2909
|
-
this.value = [
|
|
2910
|
-
...(this.value || []),
|
|
2911
|
-
event.option.value
|
|
2912
|
-
];
|
|
2913
|
-
this.onChange(this.value);
|
|
2914
|
-
}
|
|
2915
|
-
this.filterInput.nativeElement.value = '';
|
|
2916
|
-
this.filterCtrl.setValue(null);
|
|
2917
|
-
}
|
|
2918
|
-
_filter(filtro) {
|
|
2919
|
-
const filterValue = filtro && StringUtil.normalize(filtro);
|
|
2920
|
-
return this.opcoes.toArray()
|
|
2921
|
-
.filter(opcao => !this.value || this.value.indexOf(opcao.value) < 0)
|
|
2922
|
-
.filter(opcao => !filterValue || StringUtil.normalize(opcao.label).indexOf(filterValue) >= 0);
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
SelectChipsComponent.nextId = 0;
|
|
2926
|
-
SelectChipsComponent.decorators = [
|
|
2927
|
-
{ type: Component, args: [{
|
|
2928
|
-
selector: 'mcl-select-chips',
|
|
2929
|
-
template: "<mat-chip-list #chipList >\n <mat-chip\n *ngFor=\"let item of value\"\n [removable]=\"!disabled\"\n (removed)=\"remove(item)\">\n {{item}}\n <mat-icon matChipRemove *ngIf=\"!disabled\" >cancel</mat-icon>\n </mat-chip>\n <input\n [placeholder]=\"placeholder\"\n #filterInput required\n (focusin)=\"focused = true\"\n (focusout)=\"focused = false\"\n [formControl]=\"filterCtrl\"\n [matAutocomplete]=\"filterAutocomplete\"\n [matChipInputFor]=\"chipList\"\n (matChipInputTokenEnd)=\"add($event)\">\n</mat-chip-list>\n<mat-autocomplete #filterAutocomplete=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let opcao of opcoesFiltradas | async\" [value]=\"opcao.value\">\n {{opcao.label}}\n </mat-option>\n</mat-autocomplete>\n",
|
|
2930
|
-
providers: [
|
|
2931
|
-
{
|
|
2932
|
-
provide: MatFormFieldControl,
|
|
2933
|
-
useExisting: SelectChipsComponent
|
|
2934
|
-
}
|
|
2935
|
-
],
|
|
2936
|
-
styles: [""]
|
|
2937
|
-
},] }
|
|
2938
|
-
];
|
|
2939
|
-
SelectChipsComponent.ctorParameters = () => [
|
|
2940
|
-
{ type: ErrorStateMatcher },
|
|
2941
|
-
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
|
|
2942
|
-
{ type: NgForm, decorators: [{ type: Optional }] },
|
|
2943
|
-
{ type: FormGroupDirective, decorators: [{ type: Optional }] }
|
|
2944
|
-
];
|
|
2945
|
-
SelectChipsComponent.propDecorators = {
|
|
2946
|
-
input: [{ type: ViewChild, args: ['input',] }],
|
|
2947
|
-
id: [{ type: HostBinding }],
|
|
2948
|
-
describedBy: [{ type: HostBinding, args: ['attr.aria-describedby',] }],
|
|
2949
|
-
opcoes: [{ type: ContentChildren, args: [SelectItemComponent,] }],
|
|
2950
|
-
filterInput: [{ type: ViewChild, args: ['filterInput',] }],
|
|
2951
|
-
filterAutocomplete: [{ type: ViewChild, args: ['filterAutocomplete',] }],
|
|
2952
|
-
shouldLabelFloat: [{ type: HostBinding, args: ['class.floating',] }],
|
|
2953
|
-
placeholder: [{ type: Input }],
|
|
2954
|
-
required: [{ type: Input }],
|
|
2955
|
-
disabled: [{ type: Input }]
|
|
2956
|
-
};
|
|
2957
|
-
|
|
2958
|
-
class SelectItemModule {
|
|
2959
|
-
}
|
|
2960
|
-
SelectItemModule.decorators = [
|
|
2961
|
-
{ type: NgModule, args: [{
|
|
2962
|
-
declarations: [SelectItemComponent],
|
|
2963
|
-
exports: [SelectItemComponent],
|
|
2964
|
-
imports: [
|
|
2965
|
-
CommonModule,
|
|
2966
|
-
],
|
|
2967
|
-
},] }
|
|
2968
|
-
];
|
|
2969
|
-
|
|
2970
|
-
class SelectChipsModule {
|
|
2971
|
-
}
|
|
2972
|
-
SelectChipsModule.decorators = [
|
|
2973
|
-
{ type: NgModule, args: [{
|
|
2974
|
-
declarations: [SelectChipsComponent],
|
|
2975
|
-
exports: [SelectChipsComponent, SelectItemModule],
|
|
2976
|
-
imports: [
|
|
2977
|
-
CommonModule,
|
|
2978
|
-
MatChipsModule,
|
|
2979
|
-
MatIconModule,
|
|
2980
|
-
ReactiveFormsModule,
|
|
2981
|
-
MatAutocompleteModule,
|
|
2982
|
-
SelectItemModule
|
|
2983
|
-
],
|
|
2984
|
-
},] }
|
|
2985
|
-
];
|
|
2986
|
-
|
|
2987
|
-
class SelectManyCheckboxComponent {
|
|
2988
|
-
constructor(errorStateMatcher, ngControl, parentForm, parentFormGroup) {
|
|
2989
|
-
this.errorStateMatcher = errorStateMatcher;
|
|
2990
|
-
this.ngControl = ngControl;
|
|
2991
|
-
this.parentForm = parentForm;
|
|
2992
|
-
this.parentFormGroup = parentFormGroup;
|
|
2993
|
-
this.onChange = (val) => {
|
|
2994
|
-
};
|
|
2995
|
-
this.onTouched = () => {
|
|
2996
|
-
};
|
|
2997
|
-
this.$disabled = false;
|
|
2998
|
-
this.$required = false;
|
|
2999
|
-
this.layout = 'grid';
|
|
3000
|
-
this.layoutColumns = 3;
|
|
3001
|
-
this.stateChanges = new Subject();
|
|
3002
|
-
this.id = `select-radio-${SelectManyCheckboxComponent.nextId++}`;
|
|
3003
|
-
this.describedBy = '';
|
|
3004
|
-
if (this.ngControl != null) {
|
|
3005
|
-
this.ngControl.valueAccessor = this;
|
|
3006
|
-
}
|
|
3007
|
-
}
|
|
3008
|
-
ngAfterViewInit() {
|
|
3009
|
-
this.opcoes.changes.subscribe(() => {
|
|
3010
|
-
this.updateOpcoes();
|
|
3011
|
-
});
|
|
3012
|
-
}
|
|
3013
|
-
get value() {
|
|
3014
|
-
return this.$value;
|
|
3015
|
-
}
|
|
3016
|
-
set value(value) {
|
|
3017
|
-
this.$value = value;
|
|
3018
|
-
this.onChange(value);
|
|
3019
|
-
this.stateChanges.next();
|
|
3020
|
-
}
|
|
3021
|
-
get focused() {
|
|
3022
|
-
return false;
|
|
3023
|
-
}
|
|
3024
|
-
get empty() {
|
|
3025
|
-
return !this.value;
|
|
3026
|
-
}
|
|
3027
|
-
onContainerClick(event) {
|
|
3028
|
-
}
|
|
3029
|
-
get shouldLabelFloat() {
|
|
3030
|
-
return true;
|
|
3031
|
-
}
|
|
3032
|
-
get placeholder() {
|
|
3033
|
-
return this.$placeholder;
|
|
3034
|
-
}
|
|
3035
|
-
set placeholder(plh) {
|
|
3036
|
-
this.$placeholder = plh;
|
|
3037
|
-
this.stateChanges.next();
|
|
3038
|
-
}
|
|
3039
|
-
get required() {
|
|
3040
|
-
return this.$required;
|
|
3041
|
-
}
|
|
3042
|
-
set required(value) {
|
|
3043
|
-
this.$required = coerceBooleanProperty(value);
|
|
3044
|
-
this.stateChanges.next();
|
|
3045
|
-
}
|
|
3046
|
-
get disabled() {
|
|
3047
|
-
return this.$disabled;
|
|
3048
|
-
}
|
|
3049
|
-
set disabled(value) {
|
|
3050
|
-
this.$disabled = coerceBooleanProperty(value);
|
|
3051
|
-
this.stateChanges.next();
|
|
3052
|
-
}
|
|
3053
|
-
get errorState() {
|
|
3054
|
-
return this.errorStateMatcher.isErrorState(this.ngControl.control, this.parentFormGroup || this.parentForm);
|
|
3055
|
-
}
|
|
3056
|
-
get controlType() {
|
|
3057
|
-
return 'select-chips';
|
|
3058
|
-
}
|
|
3059
|
-
setDescribedByIds(ids) {
|
|
3060
|
-
this.describedBy = ids.join(' ');
|
|
3061
|
-
}
|
|
3062
|
-
ngOnDestroy() {
|
|
3063
|
-
this.stateChanges.complete();
|
|
3064
|
-
}
|
|
3065
|
-
registerOnTouched(fn) {
|
|
3066
|
-
this.onTouched = fn;
|
|
3067
|
-
}
|
|
3068
|
-
registerOnChange(fn) {
|
|
3069
|
-
this.onChange = fn;
|
|
3070
|
-
}
|
|
3071
|
-
setDisabledState(isDisabled) {
|
|
3072
|
-
this.disabled = isDisabled;
|
|
3073
|
-
}
|
|
3074
|
-
writeValue(value) {
|
|
3075
|
-
this.updateOpcoes(value);
|
|
3076
|
-
this.$value = value;
|
|
3077
|
-
}
|
|
3078
|
-
change(opcao, selected) {
|
|
3079
|
-
opcao._selected = selected;
|
|
3080
|
-
this.value = this.opcoesToValue();
|
|
3081
|
-
}
|
|
3082
|
-
updateOpcoes(value = this.value) {
|
|
3083
|
-
for (const opcao of this.opcoes) {
|
|
3084
|
-
opcao._selected = value && value.indexOf(opcao.value) >= 0;
|
|
3085
|
-
}
|
|
3086
|
-
}
|
|
3087
|
-
opcoesToValue() {
|
|
3088
|
-
const val = [];
|
|
3089
|
-
for (const opcao of this.opcoes) {
|
|
3090
|
-
if (opcao._selected) {
|
|
3091
|
-
val.push(opcao.value);
|
|
3092
|
-
}
|
|
3093
|
-
}
|
|
3094
|
-
return val.length ? val : undefined;
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
SelectManyCheckboxComponent.nextId = 0;
|
|
3098
|
-
SelectManyCheckboxComponent.decorators = [
|
|
3099
|
-
{ type: Component, args: [{
|
|
3100
|
-
selector: 'mcl-select-many-checkbox',
|
|
3101
|
-
template: "<div class=\"mat-checkbox-container\"\n [ngClass]=\"{'vertical':layout === 'vertical','horizontal':layout ==='horizontal','grid': layout === 'grid' }\"\n [ngStyle]=\"{'max-height': layout === 'grid' ? (((opcoes.length / layoutColumns) + 1) * 40) + 'px' : undefined}\">\n <mat-checkbox\n [required]=\"required\"\n [disabled]=\"disabled\"\n [checked]=\"opcao._selected\"\n (change)=\"change(opcao, $event.checked)\"\n *ngFor=\"let opcao of opcoes\">\n {{opcao.label}}\n </mat-checkbox>\n\n</div>\n",
|
|
3102
|
-
providers: [
|
|
3103
|
-
{
|
|
3104
|
-
provide: MatFormFieldControl,
|
|
3105
|
-
useExisting: SelectManyCheckboxComponent
|
|
3106
|
-
}
|
|
3107
|
-
],
|
|
3108
|
-
styles: [".mat-checkbox-container{display:flex;flex-wrap:wrap}.mat-checkbox-container.horizontal{flex-direction:row}.mat-checkbox-container.grid,.mat-checkbox-container.vertical{flex-direction:column}.mat-checkbox-container mat-checkbox{flex:1;padding:5px 5px 10px 0}@media (max-width:750px){.mat-checkbox-container{max-height:none!important}.mat-checkbox-container.grid,.mat-checkbox-container.horizontal,.mat-checkbox-container.vertical{flex-direction:column}}"]
|
|
3109
|
-
},] }
|
|
3110
|
-
];
|
|
3111
|
-
SelectManyCheckboxComponent.ctorParameters = () => [
|
|
3112
|
-
{ type: ErrorStateMatcher },
|
|
3113
|
-
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
|
|
3114
|
-
{ type: NgForm, decorators: [{ type: Optional }] },
|
|
3115
|
-
{ type: FormGroupDirective, decorators: [{ type: Optional }] }
|
|
3116
|
-
];
|
|
3117
|
-
SelectManyCheckboxComponent.propDecorators = {
|
|
3118
|
-
layout: [{ type: Input }],
|
|
3119
|
-
layoutColumns: [{ type: Input }],
|
|
3120
|
-
input: [{ type: ViewChild, args: ['input',] }],
|
|
3121
|
-
id: [{ type: HostBinding }],
|
|
3122
|
-
describedBy: [{ type: HostBinding, args: ['attr.aria-describedby',] }],
|
|
3123
|
-
opcoes: [{ type: ContentChildren, args: [SelectItemComponent,] }],
|
|
3124
|
-
shouldLabelFloat: [{ type: HostBinding, args: ['class.floating',] }],
|
|
3125
|
-
placeholder: [{ type: Input }],
|
|
3126
|
-
required: [{ type: Input }],
|
|
3127
|
-
disabled: [{ type: Input }]
|
|
3128
|
-
};
|
|
3129
|
-
|
|
3130
|
-
class SelectManyCheckboxModule {
|
|
3131
|
-
}
|
|
3132
|
-
SelectManyCheckboxModule.decorators = [
|
|
3133
|
-
{ type: NgModule, args: [{
|
|
3134
|
-
declarations: [SelectManyCheckboxComponent],
|
|
3135
|
-
exports: [SelectManyCheckboxComponent, SelectItemModule],
|
|
3136
|
-
imports: [
|
|
3137
|
-
CommonModule,
|
|
3138
|
-
FormsModule,
|
|
3139
|
-
SelectItemModule,
|
|
3140
|
-
MatCheckboxModule
|
|
3141
|
-
],
|
|
3142
|
-
},] }
|
|
3143
|
-
];
|
|
3144
|
-
|
|
3145
|
-
class SelectRadioComponent {
|
|
3146
|
-
constructor(errorStateMatcher, ngControl, parentForm, parentFormGroup) {
|
|
3147
|
-
this.errorStateMatcher = errorStateMatcher;
|
|
3148
|
-
this.ngControl = ngControl;
|
|
3149
|
-
this.parentForm = parentForm;
|
|
3150
|
-
this.parentFormGroup = parentFormGroup;
|
|
3151
|
-
this.onChange = (val) => {
|
|
3152
|
-
};
|
|
3153
|
-
this.onTouched = () => {
|
|
3154
|
-
};
|
|
3155
|
-
this.$disabled = false;
|
|
3156
|
-
this.$required = false;
|
|
3157
|
-
this.layout = 'vertical';
|
|
3158
|
-
this.stateChanges = new Subject();
|
|
3159
|
-
this.id = `select-radio-${SelectRadioComponent.nextId++}`;
|
|
3160
|
-
this.describedBy = '';
|
|
3161
|
-
if (this.ngControl != null) {
|
|
3162
|
-
this.ngControl.valueAccessor = this;
|
|
3163
|
-
}
|
|
3164
|
-
}
|
|
3165
|
-
get value() {
|
|
3166
|
-
return this.$value;
|
|
3167
|
-
}
|
|
3168
|
-
set value(value) {
|
|
3169
|
-
this.$value = value;
|
|
3170
|
-
this.onChange(value);
|
|
3171
|
-
this.stateChanges.next();
|
|
3172
|
-
}
|
|
3173
|
-
get focused() {
|
|
3174
|
-
return false;
|
|
3175
|
-
}
|
|
3176
|
-
get empty() {
|
|
3177
|
-
return !this.value;
|
|
3178
|
-
}
|
|
3179
|
-
onContainerClick(event) {
|
|
3180
|
-
}
|
|
3181
|
-
get shouldLabelFloat() {
|
|
3182
|
-
return true;
|
|
3183
|
-
}
|
|
3184
|
-
get placeholder() {
|
|
3185
|
-
return this.$placeholder;
|
|
3186
|
-
}
|
|
3187
|
-
set placeholder(plh) {
|
|
3188
|
-
this.$placeholder = plh;
|
|
3189
|
-
this.stateChanges.next();
|
|
3190
|
-
}
|
|
3191
|
-
get required() {
|
|
3192
|
-
return this.$required;
|
|
3193
|
-
}
|
|
3194
|
-
set required(value) {
|
|
3195
|
-
this.$required = coerceBooleanProperty(value);
|
|
3196
|
-
this.stateChanges.next();
|
|
3197
|
-
}
|
|
3198
|
-
get disabled() {
|
|
3199
|
-
return this.$disabled;
|
|
3200
|
-
}
|
|
3201
|
-
set disabled(value) {
|
|
3202
|
-
this.$disabled = coerceBooleanProperty(value);
|
|
3203
|
-
this.stateChanges.next();
|
|
3204
|
-
}
|
|
3205
|
-
get errorState() {
|
|
3206
|
-
return this.errorStateMatcher.isErrorState(this.ngControl.control, this.parentFormGroup || this.parentForm);
|
|
3207
|
-
}
|
|
3208
|
-
get controlType() {
|
|
3209
|
-
return 'select-chips';
|
|
3210
|
-
}
|
|
3211
|
-
setDescribedByIds(ids) {
|
|
3212
|
-
this.describedBy = ids.join(' ');
|
|
3213
|
-
}
|
|
3214
|
-
ngOnDestroy() {
|
|
3215
|
-
this.stateChanges.complete();
|
|
3216
|
-
}
|
|
3217
|
-
registerOnTouched(fn) {
|
|
3218
|
-
this.onTouched = fn;
|
|
3219
|
-
}
|
|
3220
|
-
registerOnChange(fn) {
|
|
3221
|
-
this.onChange = fn;
|
|
3222
|
-
}
|
|
3223
|
-
setDisabledState(isDisabled) {
|
|
3224
|
-
this.disabled = isDisabled;
|
|
3225
|
-
}
|
|
3226
|
-
writeValue(value) {
|
|
3227
|
-
this.value = value;
|
|
3228
|
-
}
|
|
3229
|
-
}
|
|
3230
|
-
SelectRadioComponent.nextId = 0;
|
|
3231
|
-
SelectRadioComponent.decorators = [
|
|
3232
|
-
{ type: Component, args: [{
|
|
3233
|
-
selector: 'mcl-select-radio',
|
|
3234
|
-
template: "<mat-radio-group\n [ngClass]=\"{'vertical':layout === 'vertical','horizontal':layout ==='horizontal'}\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"value\">\n <mat-radio-button *ngFor=\"let opcao of opcoes\"\n [value]=\"opcao.value\">{{opcao.label}}</mat-radio-button>\n</mat-radio-group>\n",
|
|
3235
|
-
providers: [
|
|
3236
|
-
{
|
|
3237
|
-
provide: MatFormFieldControl,
|
|
3238
|
-
useExisting: SelectRadioComponent
|
|
3239
|
-
}
|
|
3240
|
-
],
|
|
3241
|
-
styles: ["mat-radio-group{display:flex}mat-radio-group.horizontal{flex-direction:row}mat-radio-group.vertical{flex-direction:column}mat-radio-group mat-radio-button{flex:1}@media (max-width:750px){mat-radio-group.horizontal,mat-radio-group.vertical{flex-direction:column}mat-radio-group.horizontal mat-radio-button,mat-radio-group.vertical mat-radio-button{margin:10px 0}}"]
|
|
3242
|
-
},] }
|
|
3243
|
-
];
|
|
3244
|
-
SelectRadioComponent.ctorParameters = () => [
|
|
3245
|
-
{ type: ErrorStateMatcher },
|
|
3246
|
-
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
|
|
3247
|
-
{ type: NgForm, decorators: [{ type: Optional }] },
|
|
3248
|
-
{ type: FormGroupDirective, decorators: [{ type: Optional }] }
|
|
3249
|
-
];
|
|
3250
|
-
SelectRadioComponent.propDecorators = {
|
|
3251
|
-
layout: [{ type: Input }],
|
|
3252
|
-
input: [{ type: ViewChild, args: ['input',] }],
|
|
3253
|
-
id: [{ type: HostBinding }],
|
|
3254
|
-
describedBy: [{ type: HostBinding, args: ['attr.aria-describedby',] }],
|
|
3255
|
-
opcoes: [{ type: ContentChildren, args: [SelectItemComponent,] }],
|
|
3256
|
-
shouldLabelFloat: [{ type: HostBinding, args: ['class.floating',] }],
|
|
3257
|
-
placeholder: [{ type: Input }],
|
|
3258
|
-
required: [{ type: Input }],
|
|
3259
|
-
disabled: [{ type: Input }]
|
|
3260
|
-
};
|
|
3261
|
-
|
|
3262
|
-
class SelectRadioModule {
|
|
3263
|
-
}
|
|
3264
|
-
SelectRadioModule.decorators = [
|
|
3265
|
-
{ type: NgModule, args: [{
|
|
3266
|
-
declarations: [SelectRadioComponent],
|
|
3267
|
-
exports: [SelectRadioComponent, SelectItemModule],
|
|
3268
|
-
imports: [
|
|
3269
|
-
CommonModule,
|
|
3270
|
-
FormsModule,
|
|
3271
|
-
SelectItemModule,
|
|
3272
|
-
MatRadioModule
|
|
3273
|
-
],
|
|
3274
|
-
},] }
|
|
3275
|
-
];
|
|
3276
|
-
|
|
3277
|
-
class InputTelefoneInternacionalComponent extends AbstractMatFormFieldControl {
|
|
3278
|
-
constructor(errorStateMatcher, ngControl, parentForm, parentFormGroup) {
|
|
3279
|
-
super(errorStateMatcher, ngControl, parentForm, parentFormGroup);
|
|
3280
|
-
this.preferredContries = ['br'];
|
|
3281
|
-
this.blur = new EventEmitter();
|
|
3282
|
-
this.alwaysShowCountry = false;
|
|
3283
|
-
}
|
|
3284
|
-
get value() {
|
|
3285
|
-
return this.$innerValue;
|
|
3286
|
-
}
|
|
3287
|
-
set value(value) {
|
|
3288
|
-
this.$innerValue = value;
|
|
3289
|
-
this.stateChanges.next();
|
|
3290
|
-
this.onChange(value === null || value === void 0 ? void 0 : value.replace(/[^\d+]/g, ''));
|
|
3291
|
-
}
|
|
3292
|
-
get shouldLabelFloat() {
|
|
3293
|
-
return this.focused || !this.empty || this.alwaysShowCountry;
|
|
3294
|
-
}
|
|
3295
|
-
get empty() {
|
|
3296
|
-
return !this.value;
|
|
3297
|
-
}
|
|
3298
|
-
onFocus() {
|
|
3299
|
-
this.focused = true;
|
|
3300
|
-
this.stateChanges.next();
|
|
3301
|
-
}
|
|
3302
|
-
onBlur() {
|
|
3303
|
-
this.focused = false;
|
|
3304
|
-
this.stateChanges.next();
|
|
3305
|
-
this.blur.emit();
|
|
3306
|
-
}
|
|
3307
|
-
writeValue(value) {
|
|
3308
|
-
this.value = value;
|
|
3309
|
-
}
|
|
3310
|
-
}
|
|
3311
|
-
InputTelefoneInternacionalComponent.decorators = [
|
|
3312
|
-
{ type: Component, args: [{
|
|
3313
|
-
selector: 'mcl-input-telefone-intl',
|
|
3314
|
-
template: "<div class=\"input\">\n <lac-mat-country-selector\n [ngClass]=\"{'hidden': !focused && !value && !alwaysShowCountry}\"\n [preferredCountries]=\"preferredContries\"\n [selectorFor]=\"input\"\n searchPlaceholder=\"Filtrar paises...\"></lac-mat-country-selector>\n <lac-mat-tel-input #input\n [(ngModel)]=\"value\"\n (focusin)=\"onFocus()\" (focusout)=\"onBlur()\"></lac-mat-tel-input>\n</div>\n",
|
|
3315
|
-
providers: [
|
|
3316
|
-
{
|
|
3317
|
-
provide: MatFormFieldControl,
|
|
3318
|
-
useExisting: InputTelefoneInternacionalComponent
|
|
3319
|
-
},
|
|
3320
|
-
],
|
|
3321
|
-
styles: [".input{display:flex;align-items:center;margin:-8px 0;gap:8px}.input lac-mat-country-selector{transition:.3s}.input lac-mat-country-selector.hidden{opacity:0}.input lac-mat-tel-input{flex:1 1 auto}"]
|
|
3322
|
-
},] }
|
|
3323
|
-
];
|
|
3324
|
-
InputTelefoneInternacionalComponent.ctorParameters = () => [
|
|
3325
|
-
{ type: ErrorStateMatcher },
|
|
3326
|
-
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
|
|
3327
|
-
{ type: NgForm, decorators: [{ type: Optional }] },
|
|
3328
|
-
{ type: FormGroupDirective, decorators: [{ type: Optional }] }
|
|
3329
|
-
];
|
|
3330
|
-
InputTelefoneInternacionalComponent.propDecorators = {
|
|
3331
|
-
preferredContries: [{ type: Input }],
|
|
3332
|
-
readonly: [{ type: Input }],
|
|
3333
|
-
blur: [{ type: Output }],
|
|
3334
|
-
alwaysShowCountry: [{ type: Input }],
|
|
3335
|
-
telInput: [{ type: ViewChild, args: ['input',] }]
|
|
3336
|
-
};
|
|
3337
|
-
|
|
3338
|
-
class InputTelefoneInternacionalValidatorDirective {
|
|
3339
|
-
constructor() {
|
|
3340
|
-
}
|
|
3341
|
-
validate(control) {
|
|
3342
|
-
return phoneNumberValidator(control);
|
|
3343
|
-
}
|
|
3344
|
-
}
|
|
3345
|
-
InputTelefoneInternacionalValidatorDirective.decorators = [
|
|
3346
|
-
{ type: Directive, args: [{
|
|
3347
|
-
selector: 'mcl-input-telefone-intl,[mclInputTelefoneIntl]',
|
|
3348
|
-
providers: [{
|
|
3349
|
-
provide: NG_VALIDATORS,
|
|
3350
|
-
useExisting: InputTelefoneInternacionalValidatorDirective,
|
|
3351
|
-
multi: true,
|
|
3352
|
-
}]
|
|
3353
|
-
},] }
|
|
3354
|
-
];
|
|
3355
|
-
InputTelefoneInternacionalValidatorDirective.ctorParameters = () => [];
|
|
3356
|
-
|
|
3357
|
-
class InputTelefoneInternacionalModule {
|
|
3358
|
-
}
|
|
3359
|
-
InputTelefoneInternacionalModule.decorators = [
|
|
3360
|
-
{ type: NgModule, args: [{
|
|
3361
|
-
declarations: [InputTelefoneInternacionalComponent, InputTelefoneInternacionalValidatorDirective],
|
|
3362
|
-
exports: [
|
|
3363
|
-
InputTelefoneInternacionalComponent,
|
|
3364
|
-
InputTelefoneInternacionalValidatorDirective
|
|
3365
|
-
],
|
|
3366
|
-
imports: [
|
|
3367
|
-
CommonModule,
|
|
3368
|
-
FormsModule,
|
|
3369
|
-
LacMatTelInputModule,
|
|
3370
|
-
]
|
|
3371
|
-
},] }
|
|
3372
|
-
];
|
|
3373
|
-
|
|
3374
|
-
class CnpjModelDirective extends MaskedModelDirective {
|
|
3375
|
-
ngOnInit() {
|
|
3376
|
-
this.mask = '##.###.###/####-##';
|
|
3377
|
-
}
|
|
3378
|
-
}
|
|
3379
|
-
CnpjModelDirective.decorators = [
|
|
3380
|
-
{ type: Directive, args: [{
|
|
3381
|
-
selector: '[mclModel][ngModel][cnpj]:not([mask])',
|
|
3382
|
-
},] }
|
|
3383
|
-
];
|
|
3384
|
-
|
|
3385
|
-
class CnpjDirective {
|
|
3386
|
-
constructor(modulo11Service) {
|
|
3387
|
-
this.modulo11Service = modulo11Service;
|
|
3388
|
-
}
|
|
3389
|
-
validate(control) {
|
|
3390
|
-
if (control.value) {
|
|
3391
|
-
const unmasked = control.value.replace(/\D+/g, '');
|
|
3392
|
-
if (unmasked.length !== 14 || !this.modulo11Service.isValidCgc(unmasked)) {
|
|
3393
|
-
return { cnpj: true };
|
|
3394
|
-
}
|
|
3395
|
-
}
|
|
3396
|
-
return null;
|
|
3397
|
-
}
|
|
3398
|
-
}
|
|
3399
|
-
CnpjDirective.decorators = [
|
|
3400
|
-
{ type: Directive, args: [{
|
|
3401
|
-
selector: '[mclCnpj],[mclModel][cnpj]',
|
|
3402
|
-
providers: [{
|
|
3403
|
-
provide: NG_VALIDATORS,
|
|
3404
|
-
useExisting: CnpjDirective,
|
|
3405
|
-
multi: true
|
|
3406
|
-
}]
|
|
3407
|
-
},] }
|
|
3408
|
-
];
|
|
3409
|
-
CnpjDirective.ctorParameters = () => [
|
|
3410
|
-
{ type: ValidaModulo11Service }
|
|
3411
|
-
];
|
|
3412
|
-
|
|
3413
|
-
class CnpjsPipe {
|
|
3414
|
-
transform(value, ...args) {
|
|
3415
|
-
if (value) {
|
|
3416
|
-
return doApplyMask(value, '##.###.###/####-##');
|
|
3417
|
-
}
|
|
3418
|
-
}
|
|
3419
|
-
}
|
|
3420
|
-
CnpjsPipe.decorators = [
|
|
3421
|
-
{ type: Pipe, args: [{
|
|
3422
|
-
name: 'cnpj'
|
|
3423
|
-
},] }
|
|
3424
|
-
];
|
|
3425
|
-
|
|
3426
|
-
class CnpjModule {
|
|
3427
|
-
}
|
|
3428
|
-
CnpjModule.decorators = [
|
|
3429
|
-
{ type: NgModule, args: [{
|
|
3430
|
-
declarations: [CnpjDirective, CnpjModelDirective, CnpjsPipe],
|
|
3431
|
-
exports: [CnpjDirective, CnpjModelDirective, CnpjsPipe],
|
|
3432
|
-
imports: [
|
|
3433
|
-
CommonModule,
|
|
3434
|
-
ComponentesModule,
|
|
3435
|
-
]
|
|
3436
|
-
},] }
|
|
3437
|
-
];
|
|
3438
|
-
|
|
3439
|
-
class CpfModelDirective extends MaskedModelDirective {
|
|
3440
|
-
ngOnInit() {
|
|
3441
|
-
this.mask = '###.###.###-##';
|
|
3442
|
-
}
|
|
3443
|
-
}
|
|
3444
|
-
CpfModelDirective.decorators = [
|
|
3445
|
-
{ type: Directive, args: [{
|
|
3446
|
-
selector: '[mclModel][ngModel][cpf]:not([mask])',
|
|
3447
|
-
},] }
|
|
3448
|
-
];
|
|
3449
|
-
|
|
3450
|
-
class CpfDirective {
|
|
3451
|
-
constructor(modulo11Service) {
|
|
3452
|
-
this.modulo11Service = modulo11Service;
|
|
3453
|
-
}
|
|
3454
|
-
validate(control) {
|
|
3455
|
-
if (control.value) {
|
|
3456
|
-
const unmasked = control.value.replace(/\D+/g, '');
|
|
3457
|
-
if (unmasked.length !== 11 || !this.modulo11Service.isValidCpf(unmasked)) {
|
|
3458
|
-
return { cpf: true };
|
|
3459
|
-
}
|
|
3460
|
-
}
|
|
3461
|
-
return null;
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
CpfDirective.decorators = [
|
|
3465
|
-
{ type: Directive, args: [{
|
|
3466
|
-
selector: '[mclCpf],[mclModel][cpf]',
|
|
3467
|
-
providers: [{
|
|
3468
|
-
provide: NG_VALIDATORS,
|
|
3469
|
-
useExisting: CpfDirective,
|
|
3470
|
-
multi: true
|
|
3471
|
-
}]
|
|
3472
|
-
},] }
|
|
3473
|
-
];
|
|
3474
|
-
CpfDirective.ctorParameters = () => [
|
|
3475
|
-
{ type: ValidaModulo11Service }
|
|
3476
|
-
];
|
|
3477
|
-
|
|
3478
|
-
class CpfPipe {
|
|
3479
|
-
transform(value, ...args) {
|
|
3480
|
-
if (value) {
|
|
3481
|
-
return doApplyMask(value, '###.###.###-##');
|
|
3482
|
-
}
|
|
3483
|
-
}
|
|
3484
|
-
}
|
|
3485
|
-
CpfPipe.decorators = [
|
|
3486
|
-
{ type: Pipe, args: [{
|
|
3487
|
-
name: 'cpf'
|
|
3488
|
-
},] }
|
|
3489
|
-
];
|
|
3490
|
-
|
|
3491
|
-
class CpfModule {
|
|
3492
|
-
}
|
|
3493
|
-
CpfModule.decorators = [
|
|
3494
|
-
{ type: NgModule, args: [{
|
|
3495
|
-
declarations: [CpfModelDirective, CpfDirective, CpfPipe],
|
|
3496
|
-
exports: [
|
|
3497
|
-
CpfModelDirective, CpfDirective, CpfPipe
|
|
3498
|
-
],
|
|
3499
|
-
imports: [
|
|
3500
|
-
CommonModule
|
|
3501
|
-
]
|
|
3502
|
-
},] }
|
|
3503
|
-
];
|
|
3504
|
-
|
|
3505
|
-
class CpfCnpjModelDirective extends MaskedModelDirective {
|
|
3506
|
-
ngOnInit() {
|
|
3507
|
-
this.mask = '###.###.###-##';
|
|
3508
|
-
}
|
|
3509
|
-
applyMask(value) {
|
|
3510
|
-
if (value && value.replace(/\D/g, '').length > 11) {
|
|
3511
|
-
return doApplyMask(value, '##.###.###/####-##');
|
|
3512
|
-
}
|
|
3513
|
-
return doApplyMask(value, '###.###.###-##');
|
|
3514
|
-
}
|
|
3515
|
-
removeMask(value) {
|
|
3516
|
-
if (value && value.replace(/\D/g, '').length > 11) {
|
|
3517
|
-
return doRemoveMask(value, '##.###.###/####-##');
|
|
3518
|
-
}
|
|
3519
|
-
return doRemoveMask(value, '###.###.###-##');
|
|
3520
|
-
}
|
|
3521
|
-
}
|
|
3522
|
-
CpfCnpjModelDirective.decorators = [
|
|
3523
|
-
{ type: Directive, args: [{
|
|
3524
|
-
selector: '[mclModel][ngModel][cpfCnpj]:not([mask])',
|
|
3525
|
-
},] }
|
|
3526
|
-
];
|
|
3527
|
-
|
|
3528
|
-
class CpfCnpjDirective {
|
|
3529
|
-
constructor(modulo11Service) {
|
|
3530
|
-
this.modulo11Service = modulo11Service;
|
|
3531
|
-
}
|
|
3532
|
-
validate(control) {
|
|
3533
|
-
if (control.value) {
|
|
3534
|
-
const unmasked = control.value.replace(/\D+/g, '');
|
|
3535
|
-
if ((unmasked.length !== 11 || !this.modulo11Service.isValidCpf(unmasked)) &&
|
|
3536
|
-
(unmasked.length !== 14 || !this.modulo11Service.isValidCgc(unmasked))) {
|
|
3537
|
-
return { cpfCnpj: true };
|
|
3538
|
-
}
|
|
3539
|
-
}
|
|
3540
|
-
return null;
|
|
3541
|
-
}
|
|
3542
|
-
}
|
|
3543
|
-
CpfCnpjDirective.decorators = [
|
|
3544
|
-
{ type: Directive, args: [{
|
|
3545
|
-
selector: '[mclCpfCnpj],[mclModel][cpfCnpj]',
|
|
3546
|
-
providers: [{
|
|
3547
|
-
provide: NG_VALIDATORS,
|
|
3548
|
-
useExisting: CpfCnpjDirective,
|
|
3549
|
-
multi: true
|
|
3550
|
-
}]
|
|
3551
|
-
},] }
|
|
3552
|
-
];
|
|
3553
|
-
CpfCnpjDirective.ctorParameters = () => [
|
|
3554
|
-
{ type: ValidaModulo11Service }
|
|
3555
|
-
];
|
|
3556
|
-
|
|
3557
|
-
class CpfCnpjPipe {
|
|
3558
|
-
transform(value, ...args) {
|
|
3559
|
-
if (value) {
|
|
3560
|
-
if (value.length > 11) {
|
|
3561
|
-
return doApplyMask(value, '##.###.###/####-##');
|
|
3562
|
-
}
|
|
3563
|
-
return doApplyMask(value, '###.###.###-##');
|
|
3564
|
-
}
|
|
3565
|
-
}
|
|
3566
|
-
}
|
|
3567
|
-
CpfCnpjPipe.decorators = [
|
|
3568
|
-
{ type: Pipe, args: [{
|
|
3569
|
-
name: 'cpfCnpj'
|
|
3570
|
-
},] }
|
|
3571
|
-
];
|
|
3572
|
-
|
|
3573
|
-
class CpfCnpjModule {
|
|
3574
|
-
}
|
|
3575
|
-
CpfCnpjModule.decorators = [
|
|
3576
|
-
{ type: NgModule, args: [{
|
|
3577
|
-
declarations: [CpfCnpjModelDirective, CpfCnpjDirective, CpfCnpjPipe],
|
|
3578
|
-
exports: [
|
|
3579
|
-
CpfCnpjModelDirective, CpfCnpjDirective, CpfCnpjPipe
|
|
3580
|
-
],
|
|
3581
|
-
imports: [
|
|
3582
|
-
CommonModule
|
|
3583
|
-
]
|
|
3584
|
-
},] }
|
|
3585
|
-
];
|
|
3586
|
-
|
|
3587
|
-
class InfoComponent {
|
|
3588
|
-
constructor() {
|
|
3589
|
-
this.tipo = 'info';
|
|
3590
|
-
}
|
|
3591
|
-
ngOnInit() {
|
|
3592
|
-
}
|
|
3593
|
-
}
|
|
3594
|
-
InfoComponent.decorators = [
|
|
3595
|
-
{ type: Component, args: [{
|
|
3596
|
-
selector: 'mcl-info',
|
|
3597
|
-
template: "<div class=\"info\" [ngClass]=\"{'alert':tipo === 'alert'}\">\n <mat-icon *ngIf=\"tipo === 'info'\">info</mat-icon>\n <mat-icon *ngIf=\"tipo === 'alert'\">warning</mat-icon>\n <label>\n <ng-content select=\"[mcl-info-title]\"></ng-content>\n </label>\n <ng-content></ng-content>\n</div>\n",
|
|
3598
|
-
styles: [".info{background-color:#f3f3f3;color:#666;border-radius:5px;border:1px solid #ddd;padding:18px 15px 18px 50px;margin-bottom:20px;position:relative}.info mat-icon{position:absolute;top:15px;left:15px}.info label{font-weight:700}.info.alert{background-color:#ffd4cd;color:#994141;border:1px solid #ffa29e}"]
|
|
3599
|
-
},] }
|
|
3600
|
-
];
|
|
3601
|
-
InfoComponent.ctorParameters = () => [];
|
|
3602
|
-
InfoComponent.propDecorators = {
|
|
3603
|
-
tipo: [{ type: Input }]
|
|
3604
|
-
};
|
|
3605
|
-
|
|
3606
|
-
class InfoModule {
|
|
3607
|
-
}
|
|
3608
|
-
InfoModule.decorators = [
|
|
3609
|
-
{ type: NgModule, args: [{
|
|
3610
|
-
declarations: [InfoComponent],
|
|
3611
|
-
exports: [InfoComponent],
|
|
3612
|
-
imports: [
|
|
3613
|
-
CommonModule,
|
|
3614
|
-
MatIconModule
|
|
3615
|
-
]
|
|
3616
|
-
},] }
|
|
3617
|
-
];
|
|
3618
|
-
|
|
3619
|
-
const monetarioMask = (value, prefixo = 'R$', milhar = '.', fracional = ',', mascara = '###.###.###.###.###,##') => {
|
|
3620
|
-
if (!value) {
|
|
3621
|
-
return undefined;
|
|
3622
|
-
}
|
|
3623
|
-
let maskedValue = '';
|
|
3624
|
-
let valorRestante = value.replace(/\D/g, '').replace(/^0+/, '');
|
|
3625
|
-
while (valorRestante.length < (mascara.length - mascara.indexOf(','))) {
|
|
3626
|
-
valorRestante = '0' + valorRestante;
|
|
3627
|
-
}
|
|
3628
|
-
for (let i = mascara.length - 1; i >= 0 && valorRestante.length; i--) {
|
|
3629
|
-
if (mascara[i] === '.') {
|
|
3630
|
-
maskedValue = milhar + maskedValue;
|
|
3631
|
-
continue;
|
|
3632
|
-
}
|
|
3633
|
-
else if (mascara[i] === ',') {
|
|
3634
|
-
maskedValue = fracional + maskedValue;
|
|
3635
|
-
continue;
|
|
3636
|
-
}
|
|
3637
|
-
const ultimoRemovido = removerUltimo(valorRestante);
|
|
3638
|
-
valorRestante = ultimoRemovido.restante;
|
|
3639
|
-
maskedValue = ultimoRemovido.ultimo + maskedValue;
|
|
3640
|
-
}
|
|
3641
|
-
return prefixo + maskedValue;
|
|
3642
|
-
};
|
|
3643
|
-
const removerUltimo = (value) => {
|
|
3644
|
-
const tamanho = value.length;
|
|
3645
|
-
return {
|
|
3646
|
-
ultimo: value.charAt(tamanho - 1),
|
|
3647
|
-
restante: value.substring(0, tamanho - 1)
|
|
3648
|
-
};
|
|
3649
|
-
};
|
|
3650
|
-
const ɵ0$2 = removerUltimo;
|
|
3651
|
-
|
|
3652
|
-
class MonetarioModelDirective {
|
|
3653
|
-
constructor(ngControl) {
|
|
3654
|
-
this.ngControl = ngControl;
|
|
3655
|
-
this.$mascara = '###.###.###.###.###,##';
|
|
3656
|
-
this.$symbol = 'R$';
|
|
3657
|
-
this.$thousandDivider = '.';
|
|
3658
|
-
this.$fractionalDivider = ',';
|
|
3659
|
-
this.value = null;
|
|
3660
|
-
this.displayValue = null;
|
|
3661
|
-
this.mclModelChange = new EventEmitter();
|
|
3662
|
-
}
|
|
3663
|
-
delay(ms = 0) {
|
|
3664
|
-
return new Observable$1(observer => {
|
|
3665
|
-
const timeout = setTimeout(() => observer.next(), ms);
|
|
3666
|
-
return () => clearTimeout(timeout);
|
|
3667
|
-
});
|
|
3668
|
-
}
|
|
3669
|
-
processValue(displayValue) {
|
|
3670
|
-
return this.keepMask ? displayValue :
|
|
3671
|
-
monetarioMask(displayValue, '', '', '.', this.$mascara);
|
|
3672
|
-
}
|
|
3673
|
-
set symbol(symbol) {
|
|
3674
|
-
if (symbol !== this.$symbol) {
|
|
3675
|
-
this.$symbol = symbol;
|
|
3676
|
-
this.defineValue();
|
|
3677
|
-
}
|
|
3678
|
-
}
|
|
3679
|
-
set thousandDivider(thousandDivider) {
|
|
3680
|
-
if (thousandDivider !== this.$thousandDivider) {
|
|
3681
|
-
this.$thousandDivider = thousandDivider;
|
|
3682
|
-
this.defineValue();
|
|
3683
|
-
}
|
|
3684
|
-
}
|
|
3685
|
-
set fractionalDivider(fractionalDivider) {
|
|
3686
|
-
if (fractionalDivider !== this.$fractionalDivider) {
|
|
3687
|
-
this.$fractionalDivider = fractionalDivider;
|
|
3688
|
-
this.defineValue();
|
|
3689
|
-
}
|
|
3690
|
-
}
|
|
3691
|
-
set mascara(mascara) {
|
|
3692
|
-
if (mascara !== this.$mascara) {
|
|
3693
|
-
this.$mascara = mascara;
|
|
3694
|
-
this.defineValue();
|
|
3695
|
-
}
|
|
3696
|
-
}
|
|
3697
|
-
set maskValue(value) {
|
|
3698
|
-
if (value !== this.value) {
|
|
3699
|
-
this.value = value;
|
|
3700
|
-
this.defineValue();
|
|
3701
|
-
}
|
|
3702
|
-
}
|
|
3703
|
-
onInput(event) {
|
|
3704
|
-
const target = event.target;
|
|
3705
|
-
const value = target.value;
|
|
3706
|
-
this.onValueChange(value);
|
|
3707
|
-
}
|
|
3708
|
-
updateValue(value) {
|
|
3709
|
-
this.value = value;
|
|
3710
|
-
this.mclModelChange.emit(value);
|
|
3711
|
-
this.delay().subscribe(() => this.ngControl.control.updateValueAndValidity());
|
|
3712
|
-
}
|
|
3713
|
-
defineValue() {
|
|
3714
|
-
let value = this.value;
|
|
3715
|
-
let displayValue = null;
|
|
3716
|
-
if (value !== null && value !== undefined) {
|
|
3717
|
-
displayValue = monetarioMask(value, this.$symbol, this.$thousandDivider, this.$fractionalDivider, this.$mascara);
|
|
3718
|
-
value = this.processValue(displayValue);
|
|
3719
|
-
}
|
|
3720
|
-
this.delay().subscribe(() => {
|
|
3721
|
-
if (this.displayValue !== displayValue) {
|
|
3722
|
-
this.displayValue = displayValue;
|
|
3723
|
-
this.ngControl.control.setValue(displayValue);
|
|
3724
|
-
this.delay().subscribe(() => {
|
|
3725
|
-
if (value !== this.value) {
|
|
3726
|
-
return this.updateValue(value);
|
|
3727
|
-
}
|
|
3728
|
-
});
|
|
3729
|
-
}
|
|
3730
|
-
});
|
|
3731
|
-
}
|
|
3732
|
-
onValueChange(newValue) {
|
|
3733
|
-
if (newValue !== this.displayValue) {
|
|
3734
|
-
let displayValue = newValue;
|
|
3735
|
-
let value;
|
|
3736
|
-
if ((newValue == null) || (newValue.trim() === '')) {
|
|
3737
|
-
value = null;
|
|
3738
|
-
}
|
|
3739
|
-
else {
|
|
3740
|
-
displayValue = monetarioMask(newValue, this.$symbol, this.$thousandDivider, this.$fractionalDivider, this.$mascara);
|
|
3741
|
-
value = this.processValue(displayValue);
|
|
3742
|
-
}
|
|
3743
|
-
this.displayValue = displayValue;
|
|
3744
|
-
if (newValue !== displayValue) {
|
|
3745
|
-
this.ngControl.control.setValue(displayValue);
|
|
3746
|
-
}
|
|
3747
|
-
if (value !== this.value) {
|
|
3748
|
-
this.updateValue(value);
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
}
|
|
3752
|
-
}
|
|
3753
|
-
MonetarioModelDirective.decorators = [
|
|
3754
|
-
{ type: Directive, args: [{
|
|
3755
|
-
selector: '[mclModel][ngModel][monetario]',
|
|
3756
|
-
},] }
|
|
3757
|
-
];
|
|
3758
|
-
MonetarioModelDirective.ctorParameters = () => [
|
|
3759
|
-
{ type: NgControl }
|
|
3760
|
-
];
|
|
3761
|
-
MonetarioModelDirective.propDecorators = {
|
|
3762
|
-
keepMask: [{ type: Input }],
|
|
3763
|
-
mclModelChange: [{ type: Output }],
|
|
3764
|
-
symbol: [{ type: Input }],
|
|
3765
|
-
thousandDivider: [{ type: Input }],
|
|
3766
|
-
fractionalDivider: [{ type: Input }],
|
|
3767
|
-
mascara: [{ type: Input }],
|
|
3768
|
-
maskValue: [{ type: Input, args: ['mclModel',] }],
|
|
3769
|
-
onInput: [{ type: HostListener, args: ['input', ['$event'],] }]
|
|
3770
|
-
};
|
|
3771
|
-
|
|
3772
|
-
class MonetarioPipe {
|
|
3773
|
-
transform(value, symbol = 'R$', thousandDivider = '.', fractionalDivider = ',', mascara = '###.###.###.###.###,##') {
|
|
3774
|
-
return monetarioMask(value, symbol, thousandDivider, fractionalDivider, mascara);
|
|
3775
|
-
}
|
|
3776
|
-
}
|
|
3777
|
-
MonetarioPipe.decorators = [
|
|
3778
|
-
{ type: Pipe, args: [{
|
|
3779
|
-
name: 'mclMonetario'
|
|
3780
|
-
},] }
|
|
3781
|
-
];
|
|
3782
|
-
|
|
3783
|
-
class MonetarioModule {
|
|
3784
|
-
}
|
|
3785
|
-
MonetarioModule.decorators = [
|
|
3786
|
-
{ type: NgModule, args: [{
|
|
3787
|
-
declarations: [MonetarioModelDirective, MonetarioPipe],
|
|
3788
|
-
exports: [MonetarioModelDirective, MonetarioPipe],
|
|
3789
|
-
imports: [
|
|
3790
|
-
CommonModule
|
|
3791
|
-
]
|
|
3792
|
-
},] }
|
|
3793
|
-
];
|
|
3794
|
-
|
|
3795
|
-
const porcentagemMask = (value, sufixo = '%', milhar = '.', fracional = ',', mascara = '###.###.###.###.###,##') => {
|
|
3796
|
-
if (!value) {
|
|
3797
|
-
return undefined;
|
|
3798
|
-
}
|
|
3799
|
-
let maskedValue = '';
|
|
3800
|
-
let valorRestante = value.replace(/\D/g, '').replace(/^0+/, '');
|
|
3801
|
-
while (valorRestante.length < 3) {
|
|
3802
|
-
valorRestante = '0' + valorRestante;
|
|
3803
|
-
}
|
|
3804
|
-
for (let i = mascara.length - 1; i >= 0 && valorRestante.length; i--) {
|
|
3805
|
-
if (mascara[i] === '.') {
|
|
3806
|
-
maskedValue = milhar + maskedValue;
|
|
3807
|
-
continue;
|
|
3808
|
-
}
|
|
3809
|
-
else if (mascara[i] === ',') {
|
|
3810
|
-
maskedValue = fracional + maskedValue;
|
|
3811
|
-
continue;
|
|
3812
|
-
}
|
|
3813
|
-
const ultimoRemovido = removerUltimo$1(valorRestante);
|
|
3814
|
-
valorRestante = ultimoRemovido.restante;
|
|
3815
|
-
maskedValue = ultimoRemovido.ultimo + maskedValue;
|
|
3816
|
-
}
|
|
3817
|
-
return maskedValue + sufixo;
|
|
3818
|
-
};
|
|
3819
|
-
const removerUltimo$1 = (value) => {
|
|
3820
|
-
const tamanho = value.length;
|
|
3821
|
-
return {
|
|
3822
|
-
ultimo: value.charAt(tamanho - 1),
|
|
3823
|
-
restante: value.substring(0, tamanho - 1)
|
|
3824
|
-
};
|
|
3825
|
-
};
|
|
3826
|
-
const ɵ0$3 = removerUltimo$1;
|
|
3827
|
-
|
|
3828
|
-
class PorcentagemModelDirective {
|
|
3829
|
-
constructor(ngControl) {
|
|
3830
|
-
this.ngControl = ngControl;
|
|
3831
|
-
this.mascara = '###.###.###.###.###,##';
|
|
3832
|
-
this.symbol = '%';
|
|
3833
|
-
this.thousandDivider = '.';
|
|
3834
|
-
this.fractionalDivider = ',';
|
|
3835
|
-
this.displayValue = null;
|
|
3836
|
-
this.mclModelChange = new EventEmitter();
|
|
3837
|
-
}
|
|
3838
|
-
delay(ms = 0) {
|
|
3839
|
-
return new Observable$1(observer => {
|
|
3840
|
-
const timeout = setTimeout(() => observer.next(), ms);
|
|
3841
|
-
return () => clearTimeout(timeout);
|
|
3842
|
-
});
|
|
3843
|
-
}
|
|
3844
|
-
processValue(displayValue) {
|
|
3845
|
-
return this.keepMask ? displayValue :
|
|
3846
|
-
porcentagemMask(displayValue, '', '', '.', this.mascara);
|
|
3847
|
-
}
|
|
3848
|
-
set maskValue(value) {
|
|
3849
|
-
if (value !== this.value) {
|
|
3850
|
-
this.value = value;
|
|
3851
|
-
this.defineValue();
|
|
3852
|
-
}
|
|
3853
|
-
}
|
|
3854
|
-
onInput(event) {
|
|
3855
|
-
const target = event.target;
|
|
3856
|
-
const value = target.value;
|
|
3857
|
-
this.onValueChange(value);
|
|
3858
|
-
}
|
|
3859
|
-
updateValue(value) {
|
|
3860
|
-
this.value = value;
|
|
3861
|
-
this.mclModelChange.emit(value);
|
|
3862
|
-
this.delay().subscribe(() => this.ngControl.control.updateValueAndValidity());
|
|
3863
|
-
}
|
|
3864
|
-
defineValue() {
|
|
3865
|
-
let value = this.value;
|
|
3866
|
-
let displayValue = null;
|
|
3867
|
-
if (value !== null && value !== undefined) {
|
|
3868
|
-
displayValue = porcentagemMask(value, this.symbol, this.thousandDivider, this.fractionalDivider, this.mascara);
|
|
3869
|
-
value = this.processValue(displayValue);
|
|
3870
|
-
}
|
|
3871
|
-
this.delay().subscribe(() => {
|
|
3872
|
-
if (this.displayValue !== displayValue) {
|
|
3873
|
-
this.displayValue = displayValue;
|
|
3874
|
-
this.ngControl.control.setValue(displayValue);
|
|
3875
|
-
this.delay().subscribe(() => {
|
|
3876
|
-
if (value !== this.value) {
|
|
3877
|
-
return this.updateValue(value);
|
|
3878
|
-
}
|
|
3879
|
-
});
|
|
3880
|
-
}
|
|
3881
|
-
});
|
|
3882
|
-
}
|
|
3883
|
-
onValueChange(newValue) {
|
|
3884
|
-
if (newValue !== this.displayValue) {
|
|
3885
|
-
let displayValue = newValue;
|
|
3886
|
-
let value;
|
|
3887
|
-
if ((newValue == null) || (newValue.trim() === '')) {
|
|
3888
|
-
value = null;
|
|
3889
|
-
}
|
|
3890
|
-
else {
|
|
3891
|
-
displayValue = porcentagemMask(newValue);
|
|
3892
|
-
value = this.processValue(displayValue);
|
|
3893
|
-
}
|
|
3894
|
-
this.displayValue = displayValue;
|
|
3895
|
-
if (newValue !== displayValue) {
|
|
3896
|
-
this.ngControl.control.setValue(displayValue);
|
|
3897
|
-
}
|
|
3898
|
-
if (value !== this.value) {
|
|
3899
|
-
this.updateValue(value);
|
|
3900
|
-
}
|
|
3901
|
-
}
|
|
3902
|
-
}
|
|
3903
|
-
}
|
|
3904
|
-
PorcentagemModelDirective.decorators = [
|
|
3905
|
-
{ type: Directive, args: [{
|
|
3906
|
-
selector: '[mclModel][ngModel][porcentagem]',
|
|
3907
|
-
},] }
|
|
3908
|
-
];
|
|
3909
|
-
PorcentagemModelDirective.ctorParameters = () => [
|
|
3910
|
-
{ type: NgControl }
|
|
3911
|
-
];
|
|
3912
|
-
PorcentagemModelDirective.propDecorators = {
|
|
3913
|
-
mascara: [{ type: Input }],
|
|
3914
|
-
symbol: [{ type: Input }],
|
|
3915
|
-
thousandDivider: [{ type: Input }],
|
|
3916
|
-
fractionalDivider: [{ type: Input }],
|
|
3917
|
-
keepMask: [{ type: Input }],
|
|
3918
|
-
mclModelChange: [{ type: Output }],
|
|
3919
|
-
maskValue: [{ type: Input, args: ['mclModel',] }],
|
|
3920
|
-
onInput: [{ type: HostListener, args: ['input', ['$event'],] }]
|
|
3921
|
-
};
|
|
3922
|
-
|
|
3923
|
-
class PorcentagemPipe {
|
|
3924
|
-
transform(value, symbol = '%', thousandDivider = '.', fractionalDivider = ',', mascara = '###.###.###.###.###,##') {
|
|
3925
|
-
return porcentagemMask(value, symbol, thousandDivider, fractionalDivider, mascara);
|
|
3926
|
-
}
|
|
3927
|
-
}
|
|
3928
|
-
PorcentagemPipe.decorators = [
|
|
3929
|
-
{ type: Pipe, args: [{
|
|
3930
|
-
name: 'mclPorcentagem'
|
|
3931
|
-
},] }
|
|
3932
|
-
];
|
|
3933
|
-
|
|
3934
|
-
class PorcentagemModule {
|
|
3935
|
-
}
|
|
3936
|
-
PorcentagemModule.decorators = [
|
|
3937
|
-
{ type: NgModule, args: [{
|
|
3938
|
-
declarations: [PorcentagemModelDirective, PorcentagemPipe],
|
|
3939
|
-
exports: [PorcentagemModelDirective, PorcentagemPipe],
|
|
3940
|
-
imports: [
|
|
3941
|
-
CommonModule
|
|
3942
|
-
]
|
|
3943
|
-
},] }
|
|
3944
|
-
];
|
|
3945
|
-
|
|
3946
|
-
class TelefoneModelDirective extends MaskedModelDirective {
|
|
3947
|
-
ngOnInit() {
|
|
3948
|
-
this.mask = '(##) #### ####';
|
|
3949
|
-
}
|
|
3950
|
-
applyMask(value) {
|
|
3951
|
-
if (value.length > 10) {
|
|
3952
|
-
return doApplyMask(value, '(##) ##### ####');
|
|
3953
|
-
}
|
|
3954
|
-
return doApplyMask(value, '(##) #### ####');
|
|
3955
|
-
}
|
|
3956
|
-
removeMask(value) {
|
|
3957
|
-
if (value.length > 10) {
|
|
3958
|
-
return doRemoveMask(value, '(##) ##### ####');
|
|
3959
|
-
}
|
|
3960
|
-
return doRemoveMask(value, '(##) #### ####');
|
|
3961
|
-
}
|
|
3962
|
-
}
|
|
3963
|
-
TelefoneModelDirective.decorators = [
|
|
3964
|
-
{ type: Directive, args: [{
|
|
3965
|
-
selector: '[mclModel][ngModel][telefone]:not([mask])',
|
|
3966
|
-
},] }
|
|
3967
|
-
];
|
|
3968
|
-
|
|
3969
|
-
class TelefonePipe {
|
|
3970
|
-
transform(value, ...args) {
|
|
3971
|
-
if (!value) {
|
|
3972
|
-
return '-';
|
|
3973
|
-
}
|
|
3974
|
-
value = value.replace(/\D/g, '');
|
|
3975
|
-
if (!value || value.length > 11 || value === '0') {
|
|
3976
|
-
return '-';
|
|
3977
|
-
}
|
|
3978
|
-
switch (value.length) {
|
|
3979
|
-
case 11:
|
|
3980
|
-
return '(' + value.substring(0, 2) + ') ' + value.substring(2, 7) + '-' + value.substring(7);
|
|
3981
|
-
case 10:
|
|
3982
|
-
return '(' + value.substring(0, 2) + ') ' + value.substring(2, 6) + '-' + value.substring(6);
|
|
3983
|
-
case 9:
|
|
3984
|
-
return value.substring(0, 5) + '-' + value.substring(5);
|
|
3985
|
-
case 8:
|
|
3986
|
-
return value.substring(0, 4) + '-' + value.substring(4);
|
|
3987
|
-
case 2:
|
|
3988
|
-
case 3:
|
|
3989
|
-
return '(' + value + ')';
|
|
3990
|
-
default:
|
|
3991
|
-
return value;
|
|
3992
|
-
}
|
|
3993
|
-
}
|
|
3994
|
-
}
|
|
3995
|
-
TelefonePipe.decorators = [
|
|
3996
|
-
{ type: Pipe, args: [{
|
|
3997
|
-
name: 'telefone'
|
|
3998
|
-
},] }
|
|
3999
|
-
];
|
|
4000
|
-
|
|
4001
|
-
class TelefoneModule {
|
|
4002
|
-
}
|
|
4003
|
-
TelefoneModule.decorators = [
|
|
4004
|
-
{ type: NgModule, args: [{
|
|
4005
|
-
declarations: [TelefonePipe, TelefoneModelDirective],
|
|
4006
|
-
exports: [TelefonePipe, TelefoneModelDirective],
|
|
4007
|
-
imports: [
|
|
4008
|
-
CommonModule,
|
|
4009
|
-
ComponentesModule
|
|
4010
|
-
]
|
|
4011
|
-
},] }
|
|
4012
|
-
];
|
|
4013
|
-
|
|
4014
|
-
class UnsafeInnerHtmlDirective {
|
|
4015
|
-
constructor(sanitizer, element) {
|
|
4016
|
-
this.sanitizer = sanitizer;
|
|
4017
|
-
this.element = element;
|
|
4018
|
-
}
|
|
4019
|
-
set unsafeInnerHtml(value) {
|
|
4020
|
-
this.element.nativeElement.innerHTML = value || '';
|
|
4021
|
-
}
|
|
4022
|
-
}
|
|
4023
|
-
UnsafeInnerHtmlDirective.decorators = [
|
|
4024
|
-
{ type: Directive, args: [{
|
|
4025
|
-
selector: '[mclUnsafeInnerHtml]'
|
|
4026
|
-
},] }
|
|
4027
|
-
];
|
|
4028
|
-
UnsafeInnerHtmlDirective.ctorParameters = () => [
|
|
4029
|
-
{ type: Sanitizer },
|
|
4030
|
-
{ type: ElementRef, decorators: [{ type: Self }] }
|
|
4031
|
-
];
|
|
4032
|
-
UnsafeInnerHtmlDirective.propDecorators = {
|
|
4033
|
-
unsafeInnerHtml: [{ type: Input, args: ['mclUnsafeInnerHtml',] }]
|
|
4034
|
-
};
|
|
4035
|
-
|
|
4036
|
-
class UnsafeInnerHtmlModule {
|
|
4037
|
-
}
|
|
4038
|
-
UnsafeInnerHtmlModule.decorators = [
|
|
4039
|
-
{ type: NgModule, args: [{
|
|
4040
|
-
declarations: [UnsafeInnerHtmlDirective],
|
|
4041
|
-
exports: [UnsafeInnerHtmlDirective],
|
|
4042
|
-
imports: [
|
|
4043
|
-
CommonModule
|
|
4044
|
-
]
|
|
4045
|
-
},] }
|
|
4046
|
-
];
|
|
4047
|
-
|
|
4048
|
-
var ScrollDirection;
|
|
4049
|
-
(function (ScrollDirection) {
|
|
4050
|
-
ScrollDirection["UP"] = "up";
|
|
4051
|
-
ScrollDirection["DOWN"] = "down";
|
|
4052
|
-
})(ScrollDirection || (ScrollDirection = {}));
|
|
4053
|
-
var ScrollListener;
|
|
4054
|
-
(function (ScrollListener) {
|
|
4055
|
-
ScrollListener["HOST"] = "scroll";
|
|
4056
|
-
ScrollListener["WINDOW"] = "window:scroll";
|
|
4057
|
-
})(ScrollListener || (ScrollListener = {}));
|
|
4058
|
-
class ScrollContainerComponent {
|
|
4059
|
-
constructor(elRef) {
|
|
4060
|
-
this.elRef = elRef;
|
|
4061
|
-
this.scrollTop = 0;
|
|
4062
|
-
this.more = true;
|
|
4063
|
-
this.scrollDelay = 500;
|
|
4064
|
-
this.scrollOffset = 200;
|
|
4065
|
-
this.scrolled = new EventEmitter();
|
|
4066
|
-
this.getListener = () => this.elRef.nativeElement.clientHeight === this.elRef.nativeElement.scrollHeight
|
|
4067
|
-
? ScrollListener.WINDOW
|
|
4068
|
-
: ScrollListener.HOST;
|
|
4069
|
-
this.roundTo = (from, to = this.scrollOffset) => Math.floor(from / to) * to;
|
|
4070
|
-
this.getScrollDirection = (st) => this.scrollTop <= st ? ScrollDirection.DOWN : ScrollDirection.UP;
|
|
4071
|
-
this.handleScroll = () => this.getListener() === ScrollListener.HOST
|
|
4072
|
-
? this.scrolled.emit(this.canScroll(this.$element))
|
|
4073
|
-
: this.scrolled.emit(this.canScroll(this.$window));
|
|
4074
|
-
this.$element = this.elRef.nativeElement;
|
|
4075
|
-
this.$window = document.documentElement;
|
|
4076
|
-
}
|
|
4077
|
-
ngOnInit() {
|
|
4078
|
-
this.setThrottle();
|
|
4079
|
-
}
|
|
4080
|
-
ngOnChanges(changes) {
|
|
4081
|
-
if (changes.scrollDelay) {
|
|
4082
|
-
this.setThrottle();
|
|
4083
|
-
}
|
|
4084
|
-
}
|
|
4085
|
-
setThrottle() {
|
|
4086
|
-
this.$scroll = this.$windowScroll = throttle(this.handleScroll, this.scrollDelay);
|
|
4087
|
-
}
|
|
4088
|
-
canScroll(e) {
|
|
4089
|
-
const scrolled = this.more
|
|
4090
|
-
&& this.getScrollDirection(e.scrollTop) === ScrollDirection.DOWN
|
|
4091
|
-
&& this.roundTo(e.clientHeight) === this.roundTo(e.scrollHeight - e.scrollTop);
|
|
4092
|
-
this.scrollTop = e.scrollTop;
|
|
4093
|
-
return scrolled;
|
|
4094
|
-
}
|
|
4095
|
-
}
|
|
4096
|
-
ScrollContainerComponent.decorators = [
|
|
4097
|
-
{ type: Component, args: [{
|
|
4098
|
-
selector: 'mcl-scroll-container',
|
|
4099
|
-
template: "<ng-content></ng-content>\n",
|
|
4100
|
-
styles: [":host{overflow-y:auto}"]
|
|
4101
|
-
},] }
|
|
4102
|
-
];
|
|
4103
|
-
ScrollContainerComponent.ctorParameters = () => [
|
|
4104
|
-
{ type: ElementRef }
|
|
4105
|
-
];
|
|
4106
|
-
ScrollContainerComponent.propDecorators = {
|
|
4107
|
-
more: [{ type: Input }],
|
|
4108
|
-
scrollDelay: [{ type: Input }],
|
|
4109
|
-
scrollOffset: [{ type: Input }],
|
|
4110
|
-
scrolled: [{ type: Output }],
|
|
4111
|
-
$scroll: [{ type: HostListener, args: ['scroll',] }],
|
|
4112
|
-
$windowScroll: [{ type: HostListener, args: ['window:scroll',] }]
|
|
4113
|
-
};
|
|
4114
|
-
|
|
4115
|
-
class ScrollModule {
|
|
4116
|
-
}
|
|
4117
|
-
ScrollModule.decorators = [
|
|
4118
|
-
{ type: NgModule, args: [{
|
|
4119
|
-
declarations: [ScrollContainerComponent],
|
|
4120
|
-
exports: [
|
|
4121
|
-
ScrollContainerComponent
|
|
4122
|
-
],
|
|
4123
|
-
imports: [
|
|
4124
|
-
CommonModule
|
|
4125
|
-
]
|
|
4126
|
-
},] }
|
|
4127
|
-
];
|
|
4128
|
-
|
|
4129
|
-
class FormComponent {
|
|
4130
|
-
constructor() {
|
|
4131
|
-
this.submitted = new EventEmitter();
|
|
4132
|
-
this.throttleMillis = 500;
|
|
4133
|
-
this.eventSubject = new Subject();
|
|
4134
|
-
this.currentModels = [];
|
|
4135
|
-
}
|
|
4136
|
-
ngOnInit() {
|
|
4137
|
-
this.subscription = this.eventSubject
|
|
4138
|
-
.pipe(throttleTime(this.throttleMillis))
|
|
4139
|
-
.subscribe((v) => {
|
|
4140
|
-
this.submitted.emit(v);
|
|
4141
|
-
});
|
|
4142
|
-
}
|
|
4143
|
-
ngOnDestroy() {
|
|
4144
|
-
var _a;
|
|
4145
|
-
this.eventSubject.complete();
|
|
4146
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
4147
|
-
this.submitted.unsubscribe();
|
|
4148
|
-
}
|
|
4149
|
-
ngAfterViewInit() {
|
|
4150
|
-
this.models.changes.subscribe(() => {
|
|
4151
|
-
this.atualizaModels();
|
|
4152
|
-
});
|
|
4153
|
-
this.atualizaModels();
|
|
4154
|
-
}
|
|
4155
|
-
atualizaModels() {
|
|
4156
|
-
const ngContentModels = this.models.toArray();
|
|
4157
|
-
for (let i = 0; i < this.currentModels.length;) {
|
|
4158
|
-
const model = this.currentModels[i];
|
|
4159
|
-
if (ngContentModels.indexOf(model) < 0) {
|
|
4160
|
-
this.form.removeControl(model);
|
|
4161
|
-
model.control.setParent(undefined);
|
|
4162
|
-
this.currentModels.splice(i, 1);
|
|
4163
|
-
}
|
|
4164
|
-
else {
|
|
4165
|
-
i++;
|
|
4166
|
-
}
|
|
4167
|
-
}
|
|
4168
|
-
ngContentModels.forEach(model => {
|
|
4169
|
-
if (this.currentModels.indexOf(model) < 0) {
|
|
4170
|
-
this.currentModels.push(model);
|
|
4171
|
-
this.form.addControl(model);
|
|
4172
|
-
model.control.setParent(this.form.form);
|
|
4173
|
-
}
|
|
4174
|
-
});
|
|
4175
|
-
}
|
|
4176
|
-
touched() {
|
|
4177
|
-
this.models.toArray().forEach((model) => {
|
|
4178
|
-
model.control.markAsTouched();
|
|
4179
|
-
model.control.markAsDirty();
|
|
4180
|
-
model.control.updateValueAndValidity();
|
|
4181
|
-
});
|
|
4182
|
-
}
|
|
4183
|
-
untouched() {
|
|
4184
|
-
this.models.toArray().forEach((model) => {
|
|
4185
|
-
model.control.markAsPristine();
|
|
4186
|
-
model.control.markAsUntouched();
|
|
4187
|
-
model.control.updateValueAndValidity();
|
|
4188
|
-
});
|
|
4189
|
-
}
|
|
4190
|
-
reset() {
|
|
4191
|
-
this.form.resetForm();
|
|
4192
|
-
this.form.control.markAsPending();
|
|
4193
|
-
this.models.toArray().forEach((model) => {
|
|
4194
|
-
model.control.reset();
|
|
4195
|
-
model.control.setErrors(null);
|
|
4196
|
-
model.control.updateValueAndValidity();
|
|
4197
|
-
});
|
|
4198
|
-
return new Observable$1(observer => {
|
|
4199
|
-
setTimeout(() => {
|
|
4200
|
-
observer.next();
|
|
4201
|
-
observer.complete();
|
|
4202
|
-
}, 300);
|
|
4203
|
-
});
|
|
4204
|
-
}
|
|
4205
|
-
submit(form) {
|
|
4206
|
-
if (!form.valid) {
|
|
4207
|
-
this.touched();
|
|
4208
|
-
return;
|
|
4209
|
-
}
|
|
4210
|
-
this.eventSubject.next(form);
|
|
4211
|
-
}
|
|
4212
|
-
}
|
|
4213
|
-
FormComponent.decorators = [
|
|
4214
|
-
{ type: Component, args: [{
|
|
4215
|
-
selector: 'mcl-form',
|
|
4216
|
-
template: "<form #form=\"ngForm\" (ngSubmit)=\"submit(form)\">\n <ng-content></ng-content>\n</form>\n",
|
|
4217
|
-
styles: [""]
|
|
4218
|
-
},] }
|
|
4219
|
-
];
|
|
4220
|
-
FormComponent.ctorParameters = () => [];
|
|
4221
|
-
FormComponent.propDecorators = {
|
|
4222
|
-
submitted: [{ type: Output }],
|
|
4223
|
-
throttleMillis: [{ type: Input }],
|
|
4224
|
-
models: [{ type: ContentChildren, args: [NgModel, { descendants: true },] }],
|
|
4225
|
-
form: [{ type: ViewChild, args: [NgForm,] }]
|
|
4226
|
-
};
|
|
4227
|
-
|
|
4228
|
-
class SingleClickDirective {
|
|
4229
|
-
constructor(elementRef) {
|
|
4230
|
-
this.elementRef = elementRef;
|
|
4231
|
-
this.throttleMillis = 500;
|
|
4232
|
-
this.singleClick = new EventEmitter();
|
|
4233
|
-
}
|
|
4234
|
-
ngOnInit() {
|
|
4235
|
-
this.subscription = fromEvent(this.elementRef.nativeElement, 'click')
|
|
4236
|
-
.pipe(throttleTime(this.throttleMillis))
|
|
4237
|
-
.subscribe((v) => {
|
|
4238
|
-
this.singleClick.emit(v);
|
|
4239
|
-
});
|
|
4240
|
-
}
|
|
4241
|
-
ngOnDestroy() {
|
|
4242
|
-
var _a;
|
|
4243
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
4244
|
-
this.singleClick.unsubscribe();
|
|
4245
|
-
}
|
|
4246
|
-
}
|
|
4247
|
-
SingleClickDirective.decorators = [
|
|
4248
|
-
{ type: Directive, args: [{
|
|
4249
|
-
selector: '[mclSingleClick],[singleClick]'
|
|
4250
|
-
},] }
|
|
4251
|
-
];
|
|
4252
|
-
SingleClickDirective.ctorParameters = () => [
|
|
4253
|
-
{ type: ElementRef }
|
|
4254
|
-
];
|
|
4255
|
-
SingleClickDirective.propDecorators = {
|
|
4256
|
-
throttleMillis: [{ type: Input }],
|
|
4257
|
-
singleClick: [{ type: Output }]
|
|
4258
|
-
};
|
|
4259
|
-
|
|
4260
|
-
class MensagensErroComponent {
|
|
4261
|
-
constructor(form) {
|
|
4262
|
-
this.form = form;
|
|
4263
|
-
}
|
|
4264
|
-
ngOnInit() {
|
|
4265
|
-
}
|
|
4266
|
-
get errors() {
|
|
4267
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4268
|
-
if (((_b = (_a = this.form) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _b.controls) && ((_d = (_c = this.form) === null || _c === void 0 ? void 0 : _c.form) === null || _d === void 0 ? void 0 : _d.controls[this.name]) && ((_f = (_e = this.form) === null || _e === void 0 ? void 0 : _e.form) === null || _f === void 0 ? void 0 : _f.controls[this.name].errors)) {
|
|
4269
|
-
return Object.keys(this.form.form.controls[this.name].errors);
|
|
4270
|
-
}
|
|
4271
|
-
return undefined;
|
|
4272
|
-
}
|
|
4273
|
-
}
|
|
4274
|
-
MensagensErroComponent.decorators = [
|
|
4275
|
-
{ type: Component, args: [{
|
|
4276
|
-
selector: 'mcl-mensagens-erro,mat-error[name],[mat-error][name]',
|
|
4277
|
-
template: "<span *ngFor=\"let error of errors\">\n {{'validation.' + error | translate:form.form.controls[name].errors[error]}}\n</span>\n",
|
|
4278
|
-
styles: [""]
|
|
4279
|
-
},] }
|
|
4280
|
-
];
|
|
4281
|
-
MensagensErroComponent.ctorParameters = () => [
|
|
4282
|
-
{ type: FormComponent, decorators: [{ type: Host }, { type: Optional }] }
|
|
4283
|
-
];
|
|
4284
|
-
MensagensErroComponent.propDecorators = {
|
|
4285
|
-
name: [{ type: Input }],
|
|
4286
|
-
form: [{ type: Input }]
|
|
4287
|
-
};
|
|
4288
|
-
|
|
4289
|
-
class FormModule {
|
|
4290
|
-
}
|
|
4291
|
-
FormModule.decorators = [
|
|
4292
|
-
{ type: NgModule, args: [{
|
|
4293
|
-
declarations: [FormComponent, SingleClickDirective, MensagensErroComponent],
|
|
4294
|
-
exports: [
|
|
4295
|
-
FormComponent,
|
|
4296
|
-
SingleClickDirective,
|
|
4297
|
-
MensagensErroComponent,
|
|
4298
|
-
],
|
|
4299
|
-
imports: [
|
|
4300
|
-
CommonModule,
|
|
4301
|
-
FormsModule,
|
|
4302
|
-
TranslateModule
|
|
4303
|
-
]
|
|
4304
|
-
},] }
|
|
4305
|
-
];
|
|
4306
|
-
|
|
4307
1
|
/*
|
|
4308
2
|
* Public API Surface of componentes
|
|
4309
3
|
*/
|
|
4
|
+
var publicApi = {};
|
|
4310
5
|
|
|
4311
6
|
/**
|
|
4312
7
|
* Generated bundle index. Do not edit.
|
|
4313
8
|
*/
|
|
4314
|
-
|
|
4315
|
-
export { ARQUIVO_MANAGER_SERVICE, AbstractConsultaComponent, AbstractConsultaPaginadaComponent, AbstractEdicaoComponent, AbstractEdicaoModalComponent, AbstractMatFormFieldControl, AllOptionCheckboxComponent, ArquivoModule, CnpjDirective, CnpjModelDirective, CnpjModule, CnpjsPipe, ColumnCellDirective, ColumnDirective, ColumnFooterDirective, ColumnHeaderDirective, ComponentesModule, CpfCnpjDirective, CpfCnpjModelDirective, CpfCnpjModule, CpfCnpjPipe, CpfDirective, CpfModelDirective, CpfModule, CpfPipe, CriptografiaService, CrudModule, DataValidadorDirective, DateModule, DialogConfirmacaoComponent, DialogIframeComponent, DialogPreviewArquivoComponent, DialogService, DownloadArquivoDirective, FormComponent, FormModule, FuturoDirective, ImagemDirective, InfiniteTableComponent, InfoComponent, InfoModule, InputDatetimeComponent, InputDatetimeModule, InputFileUploadComponent, InputFileUploadValidatorDirective, InputFileuploadModule, InputTelefoneInternacionalComponent, InputTelefoneInternacionalModule, InputTelefoneInternacionalValidatorDirective, LoaderComponent, LoaderService, MCL_IMAGE_PADRAO, MaskedModelDirective, MensagensErroComponent, MensageriaService, MobileService, MonetarioModelDirective, MonetarioModule, MonetarioPipe, NomeResumidoPipe, OptionCheckboxComponent, OptionCheckboxGroupComponent, OptionCheckboxModule, PAGINATION_CONFIGURATION, PaginatedTableComponent, PaginatorComponent, PaginatorIntlFactory, PorcentagemModelDirective, PorcentagemModule, PorcentagemPipe, PreviewArquivoComponent, ScrollContainerComponent, ScrollModule, SelectChipsComponent, SelectChipsModule, SelectItemComponent, SelectItemModule, SelectManyCheckboxComponent, SelectManyCheckboxModule, SelectRadioComponent, SelectRadioModule, SingleClickDirective, StringUtil, TableComponent, TableModule, TdComponent, TelefoneModelDirective, TelefoneModule, TelefonePipe, ThComponent, UnsafeInnerHtmlDirective, UnsafeInnerHtmlModule, ValidaModulo11Service, closeDialogIframe, doApplyMask, doRemoveMask, monetarioMask, ɵ0$1 as ɵ0 };
|
|
4316
9
|
//# sourceMappingURL=main-class-componentes.js.map
|