@sapphire-ion/framework 1.2.63 → 1.3.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/build.ps1 +39 -0
- package/ng-package.json +10 -0
- package/package.json +43 -47
- package/src/lib/classes/comparison/comparison-operator.ts +17 -0
- package/src/lib/classes/comparison/comparison-value-type.ts +34 -0
- package/src/lib/classes/comparison/comparison.ts +45 -0
- package/src/lib/classes/comparison/properties/bool-property.ts +16 -0
- package/src/lib/classes/comparison/properties/date-property.ts +28 -0
- package/src/lib/classes/comparison/properties/datetime-property.ts +28 -0
- package/src/lib/classes/comparison/properties/decimal-property.ts +28 -0
- package/src/lib/classes/comparison/properties/enum-property.ts +28 -0
- package/src/lib/classes/comparison/properties/implicit-property.ts +13 -0
- package/src/lib/classes/comparison/properties/int-property.ts +28 -0
- package/src/lib/classes/comparison/properties/long-property.ts +28 -0
- package/src/lib/classes/comparison/properties/string-property.ts +16 -0
- package/src/lib/classes/comparison/properties/time-property.ts +28 -0
- package/{lib/classes/credentials.d.ts → src/lib/classes/credentials.ts} +5 -5
- package/src/lib/classes/environment.ts +37 -0
- package/src/lib/classes/filters/view-filtros.ts +18 -0
- package/src/lib/classes/infinite-scroll.ts +112 -0
- package/src/lib/classes/inputs/table-field-form-builder.ts +12 -0
- package/src/lib/classes/inputs/table-field.ts +62 -0
- package/src/lib/classes/page-option.ts +8 -0
- package/src/lib/classes/routes/default-routing-factory.ts +24 -0
- package/src/lib/classes/routes/id-preloader-configuration.ts +21 -0
- package/src/lib/classes/routes/route-data.ts +9 -0
- package/src/lib/components/carousel/carousel-image/carousel-image.component.html +4 -0
- package/src/lib/components/carousel/carousel-image/carousel-image.component.ts +15 -0
- package/src/lib/components/carousel/carousel-item/carousel-item.component.html +3 -0
- package/src/lib/components/carousel/carousel-item/carousel-item.component.ts +14 -0
- package/src/lib/components/carousel/carousel.component.html +22 -0
- package/src/lib/components/carousel/carousel.component.ts +83 -0
- package/src/lib/components/carousel/carousel.module.ts +20 -0
- package/src/lib/components/carousel/i-carousel-item.component.ts +8 -0
- package/src/lib/components/content-block/content-block.component.html +6 -0
- package/src/lib/components/content-block/content-block.component.ts +25 -0
- package/src/lib/components/default/default-list/abstract-list.ts +56 -0
- package/src/lib/components/default/default-list/default-list.component.html +60 -0
- package/src/lib/components/default/default-list/default-list.component.ts +72 -0
- package/src/lib/components/default/default-list/header-list/header-list.component.html +32 -0
- package/src/lib/components/default/default-list/header-list/header-list.component.ts +85 -0
- package/src/lib/components/default/default-list/list.ts +127 -0
- package/src/lib/components/default/default-pagination/default-pagination.component.html +52 -0
- package/src/lib/components/default/default-pagination/default-pagination.component.ts +118 -0
- package/src/lib/components/default/default-table/default-table.component.html +104 -0
- package/src/lib/components/default/default-table/default-table.component.ts +255 -0
- package/src/lib/components/default/default-table/th-filter/th-filter.component.html +69 -0
- package/src/lib/components/default/default-table/th-filter/th-filter.component.ts +205 -0
- package/src/lib/components/default/default-view/abstract-view.ts +25 -0
- package/src/lib/components/default/default-view/default-view.component.html +111 -0
- package/src/lib/components/default/default-view/default-view.component.ts +56 -0
- package/src/lib/components/default/default-view/header-view/header-view.component.html +64 -0
- package/src/lib/components/default/default-view/header-view/header-view.component.ts +62 -0
- package/src/lib/components/default/default-view/view.ts +195 -0
- package/src/lib/components/default/default.module.ts +61 -0
- package/src/lib/components/default-page/default.page.html +63 -0
- package/src/lib/components/default-page/default.page.ts +84 -0
- package/src/lib/components/drag-drop-file/drag-drop-file.directive.ts +44 -0
- package/src/lib/components/drag-drop-file/drag-drop-file.module.ts +21 -0
- package/src/lib/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.html +5 -0
- package/src/lib/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.ts +17 -0
- package/src/lib/components/drawer/default-drawer-end/default-drawer-end.component.html +12 -0
- package/src/lib/components/drawer/default-drawer-end/default-drawer-end.component.ts +35 -0
- package/src/lib/components/drawer/drawer-group/drawer-group.component.html +79 -0
- package/src/lib/components/drawer/drawer-group/drawer-group.component.ts +49 -0
- package/src/lib/components/drawer/drawer.component.html +120 -0
- package/src/lib/components/drawer/drawer.component.ts +157 -0
- package/src/lib/components/drawer/menu.ts +20 -0
- package/src/lib/components/filter/filter.component.html +43 -0
- package/src/lib/components/filter/filter.component.ts +141 -0
- package/src/lib/components/http-responses-pages/forbidden-403/forbidden-403.component.html +35 -0
- package/src/lib/components/http-responses-pages/forbidden-403/forbidden-403.component.ts +19 -0
- package/src/lib/components/image/image.component.html +17 -0
- package/src/lib/components/image/image.component.ts +95 -0
- package/src/lib/components/info-popover/info-popover.component.html +23 -0
- package/src/lib/components/info-popover/info-popover.component.ts +75 -0
- package/src/lib/components/inputs/custom-input.ts +94 -0
- package/src/lib/components/inputs/input-bool/input-bool.component.html +26 -0
- package/src/lib/components/inputs/input-bool/input-bool.component.ts +39 -0
- package/src/lib/components/inputs/input-bool/input-bool.configuration.ts +14 -0
- package/src/lib/components/inputs/input-cep/input-cep.component.html +27 -0
- package/src/lib/components/inputs/input-cep/input-cep.component.ts +41 -0
- package/src/lib/components/inputs/input-cep/input-cep.configuration.ts +4 -0
- package/src/lib/components/inputs/input-color/input-color.component.html +79 -0
- package/src/lib/components/inputs/input-color/input-color.component.ts +544 -0
- package/{lib/components/inputs/input-configuration.d.ts → src/lib/components/inputs/input-configuration.ts} +23 -10
- package/src/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.html +28 -0
- package/src/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.ts +99 -0
- package/src/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.configuration.ts +4 -0
- package/src/lib/components/inputs/input-date/input-date.component.html +89 -0
- package/src/lib/components/inputs/input-date/input-date.component.ts +269 -0
- package/src/lib/components/inputs/input-date/input-date.configuration.ts +8 -0
- package/src/lib/components/inputs/input-decimal/input-decimal.component.html +32 -0
- package/src/lib/components/inputs/input-decimal/input-decimal.component.ts +283 -0
- package/src/lib/components/inputs/input-decimal/input-decimal.configuration.ts +47 -0
- package/src/lib/components/inputs/input-default-configurations.ts +15 -0
- package/src/lib/components/inputs/input-file/download-button/download-button.component.html +56 -0
- package/src/lib/components/inputs/input-file/download-button/download-button.component.ts +91 -0
- package/src/lib/components/inputs/input-file/input-file.component.html +56 -0
- package/src/lib/components/inputs/input-file/input-file.component.ts +97 -0
- package/src/lib/components/inputs/input-file/input-file.configuration.ts +25 -0
- package/src/lib/components/inputs/input-icon/fluenticons.ts +3733 -0
- package/src/lib/components/inputs/input-icon/input-icon.component.html +8 -0
- package/src/lib/components/inputs/input-icon/input-icon.component.ts +52 -0
- package/src/lib/components/inputs/input-icon/ionicons.ts +1359 -0
- package/src/lib/components/inputs/input-provider-factory.ts +12 -0
- package/src/lib/components/inputs/input-select/directives/sion-label-template.directive.ts +19 -0
- package/src/lib/components/inputs/input-select/directives/sion-option-template.directive.ts +16 -0
- package/src/lib/components/inputs/input-select/directives/sion-placeholder-template.directive.ts +19 -0
- package/src/lib/components/inputs/input-select/input-select.component.html +176 -0
- package/src/lib/components/inputs/input-select/input-select.component.ts +366 -0
- package/src/lib/components/inputs/input-select/input.select.configuration.ts +300 -0
- package/src/lib/components/inputs/input-string/input-string.component.html +27 -0
- package/src/lib/components/inputs/input-string/input-string.component.ts +31 -0
- package/src/lib/components/inputs/input-string/input-string.configuration.ts +20 -0
- package/src/lib/components/inputs/input-telefone/input-telefone.component.html +29 -0
- package/src/lib/components/inputs/input-telefone/input-telefone.component.ts +63 -0
- package/src/lib/components/inputs/input-telefone/input-telefone.configuration.ts +8 -0
- package/src/lib/components/inputs/input-textarea/input-textarea.component.html +27 -0
- package/src/lib/components/inputs/input-textarea/input-textarea.component.ts +75 -0
- package/src/lib/components/inputs/input-textarea/input-textarea.configuration.ts +7 -0
- package/src/lib/components/inputs/input-type.ts +22 -0
- package/src/lib/components/inputs/input-validators.ts +111 -0
- package/src/lib/components/inputs/inputs.module.ts +74 -0
- package/src/lib/components/loading/loading.component.html +28 -0
- package/src/lib/components/loading/loading.component.ts +29 -0
- package/src/lib/components/login/login-admin/login-admin.component.html +28 -0
- package/src/lib/components/login/login-admin/login-admin.component.ts +51 -0
- package/src/lib/components/login/login.component.html +104 -0
- package/src/lib/components/login/login.component.ts +96 -0
- package/src/lib/components/main-content/main-content.component.html +145 -0
- package/src/lib/components/main-content/main-content.component.ts +93 -0
- package/src/lib/components/popover/sion-popover/sion-popover.component.html +21 -0
- package/src/lib/components/popover/sion-popover/sion-popover.component.ts +182 -0
- package/src/lib/components/popover/sion-popover.module.ts +12 -0
- package/src/lib/components/sion-card/sion-card.component.html +12 -0
- package/src/lib/components/sion-card/sion-card.component.ts +23 -0
- package/src/lib/components/stepper/step/step.component.html +11 -0
- package/src/lib/components/stepper/step/step.component.ts +44 -0
- package/src/lib/components/stepper/stepper.component.html +3 -0
- package/src/lib/components/stepper/stepper.component.ts +37 -0
- package/src/lib/components/stepper/stepper.module.ts +15 -0
- package/src/lib/components/tabs/tab/tab.component.html +8 -0
- package/src/lib/components/tabs/tab/tab.component.ts +28 -0
- package/src/lib/components/tabs/tabs/tabs.component.html +14 -0
- package/src/lib/components/tabs/tabs/tabs.component.ts +42 -0
- package/src/lib/components/tabs/tabs.module.ts +15 -0
- package/src/lib/components/text-tooltip/text-tooltip.component.html +8 -0
- package/src/lib/components/text-tooltip/text-tooltip.component.scss +0 -0
- package/src/lib/components/text-tooltip/text-tooltip.component.ts +45 -0
- package/src/lib/components/tooltip/tooltip.component.html +53 -0
- package/src/lib/components/tooltip/tooltip.component.ts +16 -0
- package/src/lib/core.module.ts +29 -0
- package/src/lib/directives/ng-var.directive.ts +26 -0
- package/src/lib/guards/auth.guard.ts +19 -0
- package/src/lib/guards/error.interceptor.ts +108 -0
- package/src/lib/guards/token.interceptor.ts +28 -0
- package/src/lib/index.ts +191 -0
- package/src/lib/pipes/secure.pipe.ts +39 -0
- package/src/lib/services/auth.service.ts +150 -0
- package/src/lib/services/crypto.service.ts +164 -0
- package/src/lib/services/environment.service.ts +17 -0
- package/src/lib/services/generic.service.ts +85 -0
- package/src/lib/services/modal-focus-trap.service.ts +65 -0
- package/src/lib/services/navigation-context.service.ts +121 -0
- package/src/lib/services/popover-focus-trap.service.ts +65 -0
- package/src/lib/services/route/route.cache.service.ts +17 -0
- package/src/lib/services/route/route.provider.service.ts +49 -0
- package/src/lib/services/usuario.service.ts +44 -0
- package/src/lib/services/utils.service.ts +216 -0
- package/src/lib/services/web/api-url-provider.service.ts +48 -0
- package/src/lib/services/web/http.ativo.service.ts +37 -0
- package/src/lib/services/web/http.service.ts +206 -0
- package/src/lib/services/web/storage.service.ts +210 -0
- package/src/public-api.ts +5 -0
- package/tailwind.config.js +27 -0
- package/tsconfig.lib.json +29 -0
- package/tsconfig.lib.prod.json +23 -0
- package/tsconfig.spec.json +27 -0
- package/esm2022/lib/classes/comparison/comparison-operator.mjs +0 -18
- package/esm2022/lib/classes/comparison/comparison-value-type.mjs +0 -25
- package/esm2022/lib/classes/comparison/comparison.mjs +0 -41
- package/esm2022/lib/classes/comparison/properties/bool-property.mjs +0 -15
- package/esm2022/lib/classes/comparison/properties/date-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/datetime-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/decimal-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/enum-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/implicit-property.mjs +0 -12
- package/esm2022/lib/classes/comparison/properties/int-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/long-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/string-property.mjs +0 -15
- package/esm2022/lib/classes/comparison/properties/time-property.mjs +0 -27
- package/esm2022/lib/classes/credentials.mjs +0 -2
- package/esm2022/lib/classes/environment.mjs +0 -34
- package/esm2022/lib/classes/filters/view-filtros.mjs +0 -18
- package/esm2022/lib/classes/infinite-scroll.mjs +0 -90
- package/esm2022/lib/classes/inputs/table-field-form-builder.mjs +0 -10
- package/esm2022/lib/classes/inputs/table-field.mjs +0 -79
- package/esm2022/lib/classes/page-option.mjs +0 -2
- package/esm2022/lib/classes/routes/default-routing-factory.mjs +0 -23
- package/esm2022/lib/classes/routes/id-preloader-configuration.mjs +0 -22
- package/esm2022/lib/classes/routes/route-data.mjs +0 -9
- package/esm2022/lib/components/carousel/carousel-image/carousel-image.component.mjs +0 -18
- package/esm2022/lib/components/carousel/carousel-item/carousel-item.component.mjs +0 -15
- package/esm2022/lib/components/carousel/carousel.component.mjs +0 -79
- package/esm2022/lib/components/carousel/carousel.module.mjs +0 -31
- package/esm2022/lib/components/carousel/i-carousel-item.component.mjs +0 -16
- package/esm2022/lib/components/content-block/content-block.component.mjs +0 -27
- package/esm2022/lib/components/default/default-list/abstract-list.mjs +0 -49
- package/esm2022/lib/components/default/default-list/default-list.component.mjs +0 -95
- package/esm2022/lib/components/default/default-list/header-list/header-list.component.mjs +0 -98
- package/esm2022/lib/components/default/default-list/list.mjs +0 -120
- package/esm2022/lib/components/default/default-pagination/default-pagination.component.mjs +0 -123
- package/esm2022/lib/components/default/default-table/default-table.component.mjs +0 -216
- package/esm2022/lib/components/default/default-table/th-filter/th-filter.component.mjs +0 -212
- package/esm2022/lib/components/default/default-view/abstract-view.mjs +0 -22
- package/esm2022/lib/components/default/default-view/default-view.component.mjs +0 -76
- package/esm2022/lib/components/default/default-view/header-view/header-view.component.mjs +0 -81
- package/esm2022/lib/components/default/default-view/view.mjs +0 -198
- package/esm2022/lib/components/default/default.module.mjs +0 -98
- package/esm2022/lib/components/default-page/default.page.mjs +0 -75
- package/esm2022/lib/components/drag-drop-file/drag-drop-file.directive.mjs +0 -60
- package/esm2022/lib/components/drag-drop-file/drag-drop-file.module.mjs +0 -31
- package/esm2022/lib/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.mjs +0 -15
- package/esm2022/lib/components/drawer/default-drawer-end/default-drawer-end.component.mjs +0 -34
- package/esm2022/lib/components/drawer/drawer-group/drawer-group.component.mjs +0 -52
- package/esm2022/lib/components/drawer/drawer.component.mjs +0 -156
- package/esm2022/lib/components/drawer/menu.mjs +0 -15
- package/esm2022/lib/components/filter/filter.component.mjs +0 -145
- package/esm2022/lib/components/http-responses-pages/forbidden-403/forbidden-403.component.mjs +0 -17
- package/esm2022/lib/components/image/image.component.mjs +0 -91
- package/esm2022/lib/components/info-popover/info-popover.component.mjs +0 -91
- package/esm2022/lib/components/inputs/custom-input.mjs +0 -85
- package/esm2022/lib/components/inputs/input-bool/input-bool.component.mjs +0 -46
- package/esm2022/lib/components/inputs/input-bool/input-bool.configuration.mjs +0 -16
- package/esm2022/lib/components/inputs/input-cep/input-cep.component.mjs +0 -50
- package/esm2022/lib/components/inputs/input-cep/input-cep.configuration.mjs +0 -4
- package/esm2022/lib/components/inputs/input-color/input-color.component.mjs +0 -481
- package/esm2022/lib/components/inputs/input-configuration.mjs +0 -2
- package/esm2022/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.mjs +0 -116
- package/esm2022/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.configuration.mjs +0 -6
- package/esm2022/lib/components/inputs/input-date/input-date.component.mjs +0 -263
- package/esm2022/lib/components/inputs/input-date/input-date.configuration.mjs +0 -11
- package/esm2022/lib/components/inputs/input-decimal/input-decimal.component.mjs +0 -276
- package/esm2022/lib/components/inputs/input-decimal/input-decimal.configuration.mjs +0 -50
- package/esm2022/lib/components/inputs/input-default-configurations.mjs +0 -14
- package/esm2022/lib/components/inputs/input-file/download-button/download-button.component.mjs +0 -102
- package/esm2022/lib/components/inputs/input-file/input-file.component.mjs +0 -100
- package/esm2022/lib/components/inputs/input-file/input-file.configuration.mjs +0 -24
- package/esm2022/lib/components/inputs/input-icon/fluenticons.mjs +0 -3734
- package/esm2022/lib/components/inputs/input-icon/input-icon.component.mjs +0 -60
- package/esm2022/lib/components/inputs/input-icon/ionicons.mjs +0 -1360
- package/esm2022/lib/components/inputs/input-provider-factory.mjs +0 -12
- package/esm2022/lib/components/inputs/input-select/directives/sion-label-template.directive.mjs +0 -16
- package/esm2022/lib/components/inputs/input-select/directives/sion-option-template.directive.mjs +0 -16
- package/esm2022/lib/components/inputs/input-select/directives/sion-placeholder-template.directive.mjs +0 -16
- package/esm2022/lib/components/inputs/input-select/input-select.component.mjs +0 -376
- package/esm2022/lib/components/inputs/input-select/input.select.configuration.mjs +0 -233
- package/esm2022/lib/components/inputs/input-string/input-string.component.mjs +0 -41
- package/esm2022/lib/components/inputs/input-string/input-string.configuration.mjs +0 -20
- package/esm2022/lib/components/inputs/input-telefone/input-telefone.component.mjs +0 -74
- package/esm2022/lib/components/inputs/input-telefone/input-telefone.configuration.mjs +0 -12
- package/esm2022/lib/components/inputs/input-textarea/input-textarea.component.mjs +0 -82
- package/esm2022/lib/components/inputs/input-textarea/input-textarea.configuration.mjs +0 -7
- package/esm2022/lib/components/inputs/input-type.mjs +0 -24
- package/esm2022/lib/components/inputs/input-validators.mjs +0 -121
- package/esm2022/lib/components/inputs/inputs.module.mjs +0 -133
- package/esm2022/lib/components/loading/loading.component.mjs +0 -34
- package/esm2022/lib/components/login/login-admin/login-admin.component.mjs +0 -52
- package/esm2022/lib/components/login/login.component.mjs +0 -99
- package/esm2022/lib/components/main-content/main-content.component.mjs +0 -100
- package/esm2022/lib/components/popover/sion-popover/sion-popover.component.mjs +0 -182
- package/esm2022/lib/components/popover/sion-popover.module.mjs +0 -21
- package/esm2022/lib/components/sion-card/sion-card.component.mjs +0 -26
- package/esm2022/lib/components/stepper/step/step.component.mjs +0 -43
- package/esm2022/lib/components/stepper/stepper.component.mjs +0 -36
- package/esm2022/lib/components/stepper/stepper.module.mjs +0 -25
- package/esm2022/lib/components/tabs/tab/tab.component.mjs +0 -41
- package/esm2022/lib/components/tabs/tabs/tabs.component.mjs +0 -56
- package/esm2022/lib/components/tabs/tabs.module.mjs +0 -22
- package/esm2022/lib/components/text-tooltip/text-tooltip.component.mjs +0 -51
- package/esm2022/lib/components/tooltip/tooltip.component.mjs +0 -21
- package/esm2022/lib/core.module.mjs +0 -38
- package/esm2022/lib/directives/ng-var.directive.mjs +0 -29
- package/esm2022/lib/guards/auth.guard.mjs +0 -26
- package/esm2022/lib/guards/error.interceptor.mjs +0 -107
- package/esm2022/lib/guards/token.interceptor.mjs +0 -25
- package/esm2022/lib/index.mjs +0 -188
- package/esm2022/lib/pipes/secure.pipe.mjs +0 -42
- package/esm2022/lib/services/auth.service.mjs +0 -146
- package/esm2022/lib/services/environment.service.mjs +0 -26
- package/esm2022/lib/services/generic.service.mjs +0 -84
- package/esm2022/lib/services/modal-focus-trap.service.mjs +0 -62
- package/esm2022/lib/services/navigation-context.service.mjs +0 -111
- package/esm2022/lib/services/popover-focus-trap.service.mjs +0 -62
- package/esm2022/lib/services/route/route.cache.service.mjs +0 -15
- package/esm2022/lib/services/route/route.provider.service.mjs +0 -42
- package/esm2022/lib/services/usuario.service.mjs +0 -49
- package/esm2022/lib/services/utils.service.mjs +0 -190
- package/esm2022/lib/services/web/api-url-provider.service.mjs +0 -29
- package/esm2022/lib/services/web/http.ativo.service.mjs +0 -37
- package/esm2022/lib/services/web/http.service.mjs +0 -184
- package/esm2022/lib/services/web/storage.service.mjs +0 -186
- package/esm2022/public-api.mjs +0 -5
- package/esm2022/sapphire-ion-framework.mjs +0 -5
- package/fesm2022/sapphire-ion-framework.mjs +0 -12491
- package/fesm2022/sapphire-ion-framework.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/classes/comparison/comparison-operator.d.ts +0 -9
- package/lib/classes/comparison/comparison-value-type.d.ts +0 -23
- package/lib/classes/comparison/comparison.d.ts +0 -25
- package/lib/classes/comparison/properties/bool-property.d.ts +0 -7
- package/lib/classes/comparison/properties/date-property.d.ts +0 -11
- package/lib/classes/comparison/properties/datetime-property.d.ts +0 -11
- package/lib/classes/comparison/properties/decimal-property.d.ts +0 -11
- package/lib/classes/comparison/properties/enum-property.d.ts +0 -11
- package/lib/classes/comparison/properties/implicit-property.d.ts +0 -6
- package/lib/classes/comparison/properties/int-property.d.ts +0 -11
- package/lib/classes/comparison/properties/long-property.d.ts +0 -11
- package/lib/classes/comparison/properties/string-property.d.ts +0 -7
- package/lib/classes/comparison/properties/time-property.d.ts +0 -11
- package/lib/classes/environment.d.ts +0 -14
- package/lib/classes/filters/view-filtros.d.ts +0 -10
- package/lib/classes/infinite-scroll.d.ts +0 -26
- package/lib/classes/inputs/table-field-form-builder.d.ts +0 -5
- package/lib/classes/inputs/table-field.d.ts +0 -20
- package/lib/classes/page-option.d.ts +0 -7
- package/lib/classes/routes/default-routing-factory.d.ts +0 -8
- package/lib/classes/routes/id-preloader-configuration.d.ts +0 -28
- package/lib/classes/routes/route-data.d.ts +0 -5
- package/lib/components/carousel/carousel-image/carousel-image.component.d.ts +0 -10
- package/lib/components/carousel/carousel-item/carousel-item.component.d.ts +0 -9
- package/lib/components/carousel/carousel.component.d.ts +0 -32
- package/lib/components/carousel/carousel.module.d.ts +0 -12
- package/lib/components/carousel/i-carousel-item.component.d.ts +0 -9
- package/lib/components/content-block/content-block.component.d.ts +0 -15
- package/lib/components/default/default-list/abstract-list.d.ts +0 -21
- package/lib/components/default/default-list/default-list.component.d.ts +0 -47
- package/lib/components/default/default-list/header-list/header-list.component.d.ts +0 -45
- package/lib/components/default/default-list/list.d.ts +0 -40
- package/lib/components/default/default-pagination/default-pagination.component.d.ts +0 -36
- package/lib/components/default/default-table/default-table.component.d.ts +0 -90
- package/lib/components/default/default-table/th-filter/th-filter.component.d.ts +0 -23
- package/lib/components/default/default-view/abstract-view.d.ts +0 -18
- package/lib/components/default/default-view/default-view.component.d.ts +0 -40
- package/lib/components/default/default-view/header-view/header-view.component.d.ts +0 -36
- package/lib/components/default/default-view/view.d.ts +0 -67
- package/lib/components/default/default.module.d.ts +0 -31
- package/lib/components/default-page/default.page.d.ts +0 -35
- package/lib/components/drag-drop-file/drag-drop-file.directive.d.ts +0 -14
- package/lib/components/drag-drop-file/drag-drop-file.module.d.ts +0 -10
- package/lib/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.d.ts +0 -9
- package/lib/components/drawer/default-drawer-end/default-drawer-end.component.d.ts +0 -13
- package/lib/components/drawer/drawer-group/drawer-group.component.d.ts +0 -22
- package/lib/components/drawer/drawer.component.d.ts +0 -31
- package/lib/components/drawer/menu.d.ts +0 -9
- package/lib/components/filter/filter.component.d.ts +0 -29
- package/lib/components/http-responses-pages/forbidden-403/forbidden-403.component.d.ts +0 -8
- package/lib/components/image/image.component.d.ts +0 -23
- package/lib/components/info-popover/info-popover.component.d.ts +0 -15
- package/lib/components/inputs/custom-input.d.ts +0 -40
- package/lib/components/inputs/input-bool/input-bool.component.d.ts +0 -16
- package/lib/components/inputs/input-bool/input-bool.configuration.d.ts +0 -17
- package/lib/components/inputs/input-cep/input-cep.component.d.ts +0 -18
- package/lib/components/inputs/input-cep/input-cep.configuration.d.ts +0 -3
- package/lib/components/inputs/input-color/input-color.component.d.ts +0 -77
- package/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.d.ts +0 -19
- package/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.configuration.d.ts +0 -5
- package/lib/components/inputs/input-date/input-date.component.d.ts +0 -61
- package/lib/components/inputs/input-date/input-date.configuration.d.ts +0 -11
- package/lib/components/inputs/input-decimal/input-decimal.component.d.ts +0 -27
- package/lib/components/inputs/input-decimal/input-decimal.configuration.d.ts +0 -28
- package/lib/components/inputs/input-default-configurations.d.ts +0 -13
- package/lib/components/inputs/input-file/download-button/download-button.component.d.ts +0 -40
- package/lib/components/inputs/input-file/input-file.component.d.ts +0 -28
- package/lib/components/inputs/input-file/input-file.configuration.d.ts +0 -8
- package/lib/components/inputs/input-icon/fluenticons.d.ts +0 -1
- package/lib/components/inputs/input-icon/input-icon.component.d.ts +0 -20
- package/lib/components/inputs/input-icon/ionicons.d.ts +0 -1
- package/lib/components/inputs/input-provider-factory.d.ts +0 -4
- package/lib/components/inputs/input-select/directives/sion-label-template.directive.d.ts +0 -18
- package/lib/components/inputs/input-select/directives/sion-option-template.directive.d.ts +0 -14
- package/lib/components/inputs/input-select/directives/sion-placeholder-template.directive.d.ts +0 -18
- package/lib/components/inputs/input-select/input-select.component.d.ts +0 -83
- package/lib/components/inputs/input-select/input.select.configuration.d.ts +0 -127
- package/lib/components/inputs/input-string/input-string.component.d.ts +0 -14
- package/lib/components/inputs/input-string/input-string.configuration.d.ts +0 -15
- package/lib/components/inputs/input-telefone/input-telefone.component.d.ts +0 -19
- package/lib/components/inputs/input-telefone/input-telefone.configuration.d.ts +0 -9
- package/lib/components/inputs/input-textarea/input-textarea.component.d.ts +0 -17
- package/lib/components/inputs/input-textarea/input-textarea.configuration.d.ts +0 -4
- package/lib/components/inputs/input-type.d.ts +0 -22
- package/lib/components/inputs/input-validators.d.ts +0 -25
- package/lib/components/inputs/inputs.module.d.ts +0 -33
- package/lib/components/loading/loading.component.d.ts +0 -18
- package/lib/components/login/login-admin/login-admin.component.d.ts +0 -20
- package/lib/components/login/login.component.d.ts +0 -29
- package/lib/components/main-content/main-content.component.d.ts +0 -27
- package/lib/components/popover/sion-popover/sion-popover.component.d.ts +0 -43
- package/lib/components/popover/sion-popover.module.d.ts +0 -9
- package/lib/components/sion-card/sion-card.component.d.ts +0 -11
- package/lib/components/stepper/step/step.component.d.ts +0 -15
- package/lib/components/stepper/stepper.component.d.ts +0 -14
- package/lib/components/stepper/stepper.module.d.ts +0 -10
- package/lib/components/tabs/tab/tab.component.d.ts +0 -19
- package/lib/components/tabs/tabs/tabs.component.d.ts +0 -18
- package/lib/components/tabs/tabs.module.d.ts +0 -12
- package/lib/components/text-tooltip/text-tooltip.component.d.ts +0 -16
- package/lib/components/tooltip/tooltip.component.d.ts +0 -7
- package/lib/core.module.d.ts +0 -16
- package/lib/directives/ng-var.directive.d.ts +0 -12
- package/lib/guards/auth.guard.d.ts +0 -11
- package/lib/guards/error.interceptor.d.ts +0 -32
- package/lib/guards/token.interceptor.d.ts +0 -11
- package/lib/index.d.ts +0 -118
- package/lib/pipes/secure.pipe.d.ts +0 -15
- package/lib/services/auth.service.d.ts +0 -47
- package/lib/services/environment.service.d.ts +0 -10
- package/lib/services/generic.service.d.ts +0 -22
- package/lib/services/modal-focus-trap.service.d.ts +0 -13
- package/lib/services/navigation-context.service.d.ts +0 -14
- package/lib/services/popover-focus-trap.service.d.ts +0 -13
- package/lib/services/route/route.cache.service.d.ts +0 -7
- package/lib/services/route/route.provider.service.d.ts +0 -13
- package/lib/services/usuario.service.d.ts +0 -21
- package/lib/services/utils.service.d.ts +0 -53
- package/lib/services/web/api-url-provider.service.d.ts +0 -13
- package/lib/services/web/http.ativo.service.d.ts +0 -20
- package/lib/services/web/http.service.d.ts +0 -59
- package/lib/services/web/storage.service.d.ts +0 -46
- package/public-api.d.ts +0 -1
- /package/{themes → src/lib}/compiled-styles.scss +0 -0
- /package/{themes → src/lib}/components/carousel/carousel-image/carousel-image.component.scss +0 -0
- /package/{themes → src/lib}/components/carousel/carousel-item/carousel-item.component.scss +0 -0
- /package/{themes → src/lib}/components/carousel/carousel.component.scss +0 -0
- /package/{themes → src/lib}/components/content-block/content-block.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-list/default-list.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-list/header-list/header-list.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-pagination/default-pagination.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-table/default-table.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-table/th-filter/th-filter.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-view/default-view.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-view/header-view/header-view.component.scss +0 -0
- /package/{themes → src/lib}/components/default-page/default.page.scss +0 -0
- /package/{themes → src/lib}/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.scss +0 -0
- /package/{themes → src/lib}/components/drawer/default-drawer-end/default-drawer-end.component.scss +0 -0
- /package/{themes → src/lib}/components/drawer/drawer-group/drawer-group.component.scss +0 -0
- /package/{themes → src/lib}/components/drawer/drawer.component.scss +0 -0
- /package/{themes → src/lib}/components/filter/filter.component.scss +0 -0
- /package/{themes → src/lib}/components/http-responses-pages/forbidden-403/forbidden-403.component.scss +0 -0
- /package/{themes → src/lib}/components/image/image.component.scss +0 -0
- /package/{themes → src/lib}/components/info-popover/info-popover.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-bool/input-bool.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-cep/input-cep.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-color/input-color.component.scss +0 -0
- /package/{themes/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.scss → src/lib/components/inputs/input-color/input-color.configuration.ts} +0 -0
- /package/{themes/components/inputs/input-icon/input-icon.component.scss → src/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.scss} +0 -0
- /package/{themes → src/lib}/components/inputs/input-date/input-date.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-decimal/input-decimal.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-file/download-button/download-button.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-file/input-file.component.scss +0 -0
- /package/{themes/components/inputs/input-string/input-string.component.scss → src/lib/components/inputs/input-icon/input-icon.component.scss} +0 -0
- /package/{themes → src/lib}/components/inputs/input-select/input-select.component.scss +0 -0
- /package/{themes/components/inputs/input-telefone/input-telefone.component.scss → src/lib/components/inputs/input-string/input-string.component.scss} +0 -0
- /package/{themes/components/loading/loading.component.scss → src/lib/components/inputs/input-telefone/input-telefone.component.scss} +0 -0
- /package/{themes → src/lib}/components/inputs/input-textarea/input-textarea.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/inputs.scss +0 -0
- /package/{themes/components/sion-card/sion-card.component.scss → src/lib/components/loading/loading.component.scss} +0 -0
- /package/{themes → src/lib}/components/login/login-admin/login-admin.component.scss +0 -0
- /package/{themes → src/lib}/components/login/login.component.scss +0 -0
- /package/{themes → src/lib}/components/main-content/main-content.component.scss +0 -0
- /package/{themes → src/lib}/components/popover/sion-popover/sion-popover.component.scss +0 -0
- /package/{themes/components/stepper/stepper.component.scss → src/lib/components/sion-card/sion-card.component.scss} +0 -0
- /package/{themes → src/lib}/components/stepper/step/step.component.scss +0 -0
- /package/{themes/components/tabs/tab/tab.component.scss → src/lib/components/stepper/stepper.component.scss} +0 -0
- /package/{themes/components/text-tooltip/text-tooltip.component.scss → src/lib/components/tabs/tab/tab.component.scss} +0 -0
- /package/{themes → src/lib}/components/tabs/tabs/tabs.component.scss +0 -0
- /package/{themes → src/lib}/components/tooltip/tooltip.component.scss +0 -0
- /package/{themes → src/lib}/styles/components.scss +0 -0
- /package/{themes → src/lib}/styles/core.styles.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-action-sheet.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-alert.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-button.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-card.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-content.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-datetime.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-item.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-list.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-modal.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-popover.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-progress-bar.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-searchbar.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-toast.scss +0 -0
- /package/{themes → src/lib}/styles/ionic.scss +0 -0
- /package/{themes → src/lib}/styles/login-default.scss +0 -0
- /package/{themes → src/lib}/styles/mixins.scss +0 -0
- /package/{themes → src/lib}/styles/styles.scss +0 -0
- /package/{themes → src/lib}/styles/translucid.scss +0 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Component, computed, ElementRef, forwardRef, HostListener, model, ModelSignal, Signal, ViewChild } from '@angular/core';
|
|
2
|
+
import { formatNumber } from '@angular/common';
|
|
3
|
+
import { InputCurrencyConfiguration, InputDecimalConfiguration, InputNumberConfiguration, InputPercentageConfiguration } from './input-decimal.configuration';
|
|
4
|
+
import { InputProviderFactory } from '../input-provider-factory';
|
|
5
|
+
import { CustomInput } from '../custom-input';
|
|
6
|
+
import { Timeout } from '../../../services/utils.service';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'input-decimal, input-number, input-currency, input-percentage',
|
|
10
|
+
templateUrl: './input-decimal.component.html',
|
|
11
|
+
styleUrls: ['./input-decimal.component.scss', '../inputs.scss'],
|
|
12
|
+
providers: [
|
|
13
|
+
...InputProviderFactory.GetProviders(InputDecimalComponent),
|
|
14
|
+
{ provide: CustomInput, useExisting: forwardRef(() => InputDecimalComponent) },
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
export class InputDecimalComponent extends CustomInput<number | null> {
|
|
18
|
+
|
|
19
|
+
configuration: ModelSignal<InputDecimalConfiguration> = model<InputDecimalConfiguration>();
|
|
20
|
+
digitsInfo: Signal<string> = computed(() => `1.${this.configuration().precision}-${this.configuration().precision}`);
|
|
21
|
+
divider: Signal<number> = computed(() => Math.pow(10, this.configuration().precision));
|
|
22
|
+
|
|
23
|
+
placeholder: Signal<string> = computed(() => {
|
|
24
|
+
const selector: string = this.elementRef.nativeElement.tagName.toLowerCase().split('-').at(-1);
|
|
25
|
+
if(selector == "number"){
|
|
26
|
+
return `0`;
|
|
27
|
+
}else{
|
|
28
|
+
const zeros = '0'.repeat(this.configuration().precision);
|
|
29
|
+
return `0,${zeros}`;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
@ViewChild('input') input: ElementRef<HTMLInputElement>;
|
|
34
|
+
@ViewChild('inputContainer') inputContainer: ElementRef<HTMLDivElement>;
|
|
35
|
+
override setFocus(event: MouseEvent | null): void {
|
|
36
|
+
if(this.input && event.target == this.inputContainer.nativeElement) {
|
|
37
|
+
this.input.nativeElement.focus();
|
|
38
|
+
this.input.nativeElement.setSelectionRange(this.valueString.length, this.valueString.length);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
constructor(
|
|
42
|
+
override elementRef: ElementRef
|
|
43
|
+
) {
|
|
44
|
+
super();
|
|
45
|
+
this.value.set(null);
|
|
46
|
+
this.valueString = '';
|
|
47
|
+
const selector: string = this.elementRef.nativeElement.tagName.toLowerCase().split('-').at(-1);
|
|
48
|
+
if(selector == "number" && !this.configuration()){ this.configuration.set(new InputNumberConfiguration()); } else
|
|
49
|
+
if(selector == "decimal" && !this.configuration()){ this.configuration.set(new InputDecimalConfiguration()); } else
|
|
50
|
+
if(selector == "currency" && !this.configuration()){ this.configuration.set(new InputCurrencyConfiguration()); } else
|
|
51
|
+
if(selector == "percentage" && !this.configuration()){ this.configuration.set(new InputPercentageConfiguration()); }
|
|
52
|
+
this.SetValueString();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
override writeValue(obj: number | null): void {
|
|
56
|
+
this.value.set(obj);
|
|
57
|
+
|
|
58
|
+
if (!obj) {
|
|
59
|
+
this.valueString = '';
|
|
60
|
+
} else {
|
|
61
|
+
this.SetValueString();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.runValidation();
|
|
65
|
+
}
|
|
66
|
+
override SetValue(obj: number | null): void {
|
|
67
|
+
this.value.set(obj);
|
|
68
|
+
|
|
69
|
+
if (!obj) {
|
|
70
|
+
this.valueString = '';
|
|
71
|
+
} else {
|
|
72
|
+
this.SetValueString();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.runValidation();
|
|
76
|
+
this.propagateChange(obj);
|
|
77
|
+
}
|
|
78
|
+
SetValueString(): void {
|
|
79
|
+
this.valueString = formatNumber(this.value(), "pt-BR", this.digitsInfo());
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
valueString: string;
|
|
83
|
+
|
|
84
|
+
@HostListener('paste', ['$event'])
|
|
85
|
+
onPaste(event: ClipboardEvent): void {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
|
|
88
|
+
let clipboardData = event.clipboardData || window['clipboardData'];
|
|
89
|
+
let pastedText = clipboardData.getData('text');
|
|
90
|
+
|
|
91
|
+
const s = pastedText.replaceAll('.', '').replaceAll(',', '.');
|
|
92
|
+
const n = Number(s);
|
|
93
|
+
|
|
94
|
+
if(Number(s) && isFinite(n)){
|
|
95
|
+
this.SetValue(n);
|
|
96
|
+
}
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async onKeyDown(event: KeyboardEvent): Promise<void>{
|
|
101
|
+
const value: string = this.input.nativeElement.value;
|
|
102
|
+
|
|
103
|
+
const selectionStart: number = this.input.nativeElement.selectionStart;
|
|
104
|
+
const selectionEnd : number = this.input.nativeElement.selectionEnd;
|
|
105
|
+
|
|
106
|
+
const atLeft = value.slice(0, selectionStart);
|
|
107
|
+
const atRight = value.slice(selectionEnd, value.length);
|
|
108
|
+
if(["-"].includes(event.key)){
|
|
109
|
+
return await this.HandleNegative(event, selectionStart, selectionEnd, value, atLeft, atRight);
|
|
110
|
+
}else
|
|
111
|
+
if(lstNumbers.includes(event.key)){
|
|
112
|
+
return await this.HandleNumber(event, selectionStart, selectionEnd, value, atLeft, atRight);
|
|
113
|
+
}else
|
|
114
|
+
if(lstEspecialCases.includes(event.key)){
|
|
115
|
+
return await this.HandleEspecial(event, selectionStart, selectionEnd, value, atLeft, atRight);
|
|
116
|
+
}else
|
|
117
|
+
if(["A", "a"].includes(event.key) && event.ctrlKey){
|
|
118
|
+
return;
|
|
119
|
+
}else
|
|
120
|
+
if(["C", "c"].includes(event.key) && event.ctrlKey){
|
|
121
|
+
return;
|
|
122
|
+
}else
|
|
123
|
+
if(["V", "v"].includes(event.key) && event.ctrlKey){
|
|
124
|
+
return;
|
|
125
|
+
}else
|
|
126
|
+
if(lstIgnoreNotPrevent.includes(event.key)){
|
|
127
|
+
return;
|
|
128
|
+
}else{
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async HandleNegative(event: KeyboardEvent, selectionStart: number, selectionEnd: number, value: string, atLeft: string, atRight: string): Promise<void>{
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
|
|
136
|
+
let focusEnd = (selectionStart == 0 && selectionEnd == this.valueString.length);
|
|
137
|
+
/** [ Remove decimalSeparator & thousandSeparator ] */
|
|
138
|
+
let f;
|
|
139
|
+
if(!atLeft.includes('-')){
|
|
140
|
+
f = event.key + atLeft + atRight;
|
|
141
|
+
}else{
|
|
142
|
+
f = (atLeft + atRight).replace('-', '')
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if(f == "-"){
|
|
146
|
+
if(value.includes('-')){
|
|
147
|
+
f = value.replace('-', '');
|
|
148
|
+
}
|
|
149
|
+
else{
|
|
150
|
+
f = `-${value}`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const CurrentValue: number = this.SanitizeValue(f);
|
|
155
|
+
if(CurrentValue == this.value()){ return; }
|
|
156
|
+
|
|
157
|
+
//[ Handle Set Cursor Position]
|
|
158
|
+
this.SetValue(CurrentValue);
|
|
159
|
+
const newPos = selectionStart + 1 + this.valueString.split('.').length - value.split('.').length;
|
|
160
|
+
|
|
161
|
+
//Horrivel, mas nao tem uma alternativa boa, https://stackoverflow.com/questions/511088/use-javascript-to-place-cursor-at-end-of-text-in-text-input-element
|
|
162
|
+
await Timeout(0);
|
|
163
|
+
this.input.nativeElement.setSelectionRange(newPos, newPos);
|
|
164
|
+
if(focusEnd){
|
|
165
|
+
this.input.nativeElement.setSelectionRange(this.valueString.length, this.valueString.length);
|
|
166
|
+
}
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async HandleNumber(event: KeyboardEvent, selectionStart: number, selectionEnd: number, value: string, atLeft: string, atRight: string): Promise<void> {
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
|
|
173
|
+
let focusEnd = (selectionStart == 0 && selectionEnd == this.valueString.length);
|
|
174
|
+
/** [ Remove decimalSeparator & thousandSeparator ] */
|
|
175
|
+
const f = atLeft + event.key + atRight;
|
|
176
|
+
const CurrentValue: number = this.SanitizeValue(f);
|
|
177
|
+
if(CurrentValue == this.value()){ return; }
|
|
178
|
+
if(CurrentValue > decimalMaxValue){ return; }
|
|
179
|
+
|
|
180
|
+
//[ Handle Set Cursor Position]
|
|
181
|
+
this.SetValue(CurrentValue);
|
|
182
|
+
const newPosition = selectionStart + 1 + this.valueString.split('.').length - value.split('.').length;
|
|
183
|
+
|
|
184
|
+
//Horrivel, mas nao sem uma alternativa boa, https://stackoverflow.com/questions/511088/use-javascript-to-place-cursor-at-end-of-text-in-text-input-element
|
|
185
|
+
await Timeout(0);
|
|
186
|
+
this.input.nativeElement.setSelectionRange(newPosition, newPosition);
|
|
187
|
+
if(focusEnd){
|
|
188
|
+
this.input.nativeElement.setSelectionRange(this.valueString.length, this.valueString.length);
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
SanitizeValue(f: string): number{
|
|
194
|
+
var CurrentValue: number = Number(Sanitize(f)) / this.divider();
|
|
195
|
+
if(CurrentValue >= decimalMaxValue){
|
|
196
|
+
return this.value();
|
|
197
|
+
}
|
|
198
|
+
return CurrentValue;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async HandleEspecial(event: KeyboardEvent, selectionStart: number, selectionEnd: number, value: string, atLeft: string, atRight: string): Promise<void> {
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
if(selectionStart == selectionEnd){
|
|
204
|
+
if(event.key == "Backspace"){
|
|
205
|
+
if(selectionStart == selectionEnd && selectionStart == 0){
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const previousChar: string = atLeft.at(-1);
|
|
210
|
+
const isNumber = lstNumbers.includes(previousChar);
|
|
211
|
+
const f = atLeft.slice(0, atLeft.length - (isNumber ? 1 : 2)) + atRight;
|
|
212
|
+
const CurrentValue = this.SanitizeValue(f);
|
|
213
|
+
if (f === '' || Sanitize(f) === '') {
|
|
214
|
+
this.SetValue(null);
|
|
215
|
+
await Timeout(0);
|
|
216
|
+
this.input.nativeElement.setSelectionRange(0, 0);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
//[ Handle Set Cursor Position]
|
|
221
|
+
this.SetValue(CurrentValue);
|
|
222
|
+
await Timeout(0);
|
|
223
|
+
let pos = isNumber ? selectionStart - 1 : selectionStart - 2;
|
|
224
|
+
|
|
225
|
+
if (selectionEnd == this.valueString.length) {
|
|
226
|
+
pos++;
|
|
227
|
+
}
|
|
228
|
+
this.input.nativeElement.setSelectionRange(pos, pos);
|
|
229
|
+
return;
|
|
230
|
+
}else
|
|
231
|
+
if(event.key == "Delete"){
|
|
232
|
+
const nextChar: string = atRight[0];
|
|
233
|
+
const isNumber = lstNumbers.includes(nextChar);
|
|
234
|
+
const f = atLeft + atRight.slice(isNumber ? 1 : 2);
|
|
235
|
+
const CurrentValue = this.SanitizeValue(f);
|
|
236
|
+
if (f === '' || Sanitize(f) === '') {
|
|
237
|
+
this.SetValue(null);
|
|
238
|
+
await Timeout(0);
|
|
239
|
+
this.input.nativeElement.setSelectionRange(0, 0);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
//[ Handle Set Cursor Position]
|
|
243
|
+
this.SetValue(CurrentValue);
|
|
244
|
+
var pos: number = selectionStart;
|
|
245
|
+
if(pos <= -1){ pos = 0; }
|
|
246
|
+
if(CurrentValue < 1){
|
|
247
|
+
pos++;
|
|
248
|
+
}
|
|
249
|
+
if(!isNumber){
|
|
250
|
+
pos++;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
await Timeout(0);
|
|
254
|
+
this.input.nativeElement.setSelectionRange(pos, pos);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
}else{
|
|
258
|
+
const f = atLeft + atRight;
|
|
259
|
+
const CurrentValue = this.SanitizeValue(f);
|
|
260
|
+
this.SetValue(CurrentValue);
|
|
261
|
+
|
|
262
|
+
await Timeout(0);
|
|
263
|
+
this.input.nativeElement.setSelectionRange(this.valueString.length, this.valueString.length);
|
|
264
|
+
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
const decimalMaxValue = 9_000_000_000_000.00
|
|
272
|
+
|
|
273
|
+
const decimalSeparator : string = ",";
|
|
274
|
+
const thousandSeparator: string = ".";
|
|
275
|
+
|
|
276
|
+
const Sanitize: Function = ((v: string): string => {
|
|
277
|
+
return v.replaceAll(thousandSeparator, '')
|
|
278
|
+
.replace (decimalSeparator , '')
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
const lstNumbers = [ "0","1","2","3","4","5","6","7","8","9" ];
|
|
282
|
+
const lstIgnoreNotPrevent = [ "Tab", "CapsLock", "Shift", "Control", "Alt", "ArrowRight", "ArrowUp", "ArrowDown", "ArrowLeft"];
|
|
283
|
+
const lstEspecialCases = [ "Backspace", "Delete" ];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export class InputDecimalConfiguration{
|
|
2
|
+
prefix : string;
|
|
3
|
+
sufix : string;
|
|
4
|
+
placeholder : string;
|
|
5
|
+
|
|
6
|
+
constructor(
|
|
7
|
+
/** Declara a quantidade de numeros apos o ponto */
|
|
8
|
+
public precision: number = 2,
|
|
9
|
+
/** Texto no inicio do input */
|
|
10
|
+
prefix: string | null = null,
|
|
11
|
+
/** Texto no fim do input */
|
|
12
|
+
sufix: string | null = null,
|
|
13
|
+
/** Se = false não aplica virgulas no lugar do separador a cada 3 unidades */
|
|
14
|
+
public thousandSeparator: string = '.',
|
|
15
|
+
public decimalSeparator : string = ','
|
|
16
|
+
){
|
|
17
|
+
if(!prefix){ this.prefix = ''; }else{ this.prefix = prefix; }
|
|
18
|
+
if(!sufix ){ this.sufix = ''; }else{ this.sufix = sufix; }
|
|
19
|
+
|
|
20
|
+
this.placeholder = "-";
|
|
21
|
+
if(precision > 0){
|
|
22
|
+
this.placeholder += this.decimalSeparator;
|
|
23
|
+
for(let i = precision; i > 0; i--){
|
|
24
|
+
this.placeholder += "-";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class InputNumberConfiguration extends InputDecimalConfiguration {
|
|
30
|
+
constructor(
|
|
31
|
+
prefix: string = "",
|
|
32
|
+
sufix : string = "",
|
|
33
|
+
thousandSeparator: string = '.'
|
|
34
|
+
){
|
|
35
|
+
super(0, prefix, sufix, thousandSeparator);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export class InputCurrencyConfiguration extends InputDecimalConfiguration {
|
|
39
|
+
constructor(prefix: string = "R$", sufix: string = "", thousandSeparator: string = '.'){
|
|
40
|
+
super(2, prefix, sufix, thousandSeparator);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export class InputPercentageConfiguration extends InputDecimalConfiguration {
|
|
44
|
+
constructor(prefix: string = "", sufix: string = "%", thousandSeparator: string = '.'){
|
|
45
|
+
super(2, prefix, sufix, thousandSeparator);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InputDecimalConfiguration, InputNumberConfiguration } from "./input-decimal/input-decimal.configuration";
|
|
2
|
+
|
|
3
|
+
export class InputsDefaultConfigurations {
|
|
4
|
+
static readonly configurationDecimalPercentage: InputDecimalConfiguration = new InputDecimalConfiguration(2, null, '%');
|
|
5
|
+
static readonly configurationDecimalDegree : InputDecimalConfiguration = new InputDecimalConfiguration(2, null, "°C");
|
|
6
|
+
static readonly configurationDecimalM3H : InputDecimalConfiguration = new InputDecimalConfiguration(2, null, "m³/h");
|
|
7
|
+
static readonly configurationDecimalMeters : InputDecimalConfiguration = new InputDecimalConfiguration(2, null, "m");
|
|
8
|
+
static readonly configurationDecimalMilimeters: InputDecimalConfiguration = new InputDecimalConfiguration(2, null, "mm");
|
|
9
|
+
|
|
10
|
+
static readonly configurationNumberPercentage: InputNumberConfiguration = new InputNumberConfiguration(null, '%');
|
|
11
|
+
static readonly configurationNumberDegree : InputNumberConfiguration = new InputNumberConfiguration(null, "°C");
|
|
12
|
+
static readonly configurationNumberM3H : InputNumberConfiguration = new InputNumberConfiguration(null, "m³/h");
|
|
13
|
+
static readonly configurationNumberMeters : InputNumberConfiguration = new InputNumberConfiguration(null, "m");
|
|
14
|
+
static readonly configurationNumberMilimeters: InputNumberConfiguration = new InputNumberConfiguration(null, "mm");
|
|
15
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@if(lstFiles().length == 0){
|
|
2
|
+
<ion-button [color]="color" fill="outline" [disabled]="true" [size]="size">
|
|
3
|
+
<ion-icon name="close-circle" slot="start"></ion-icon>
|
|
4
|
+
<ion-label> Sem arquivos... </ion-label>
|
|
5
|
+
</ion-button>
|
|
6
|
+
}
|
|
7
|
+
@else if(lstFiles().length == 1){
|
|
8
|
+
<ion-button [color]="color" *ngVar="storageService.GetProgress(lstFiles()[0]) as val" class="relative block {{expand == 'block' ? 'size-full' : ''}}" [disabled]="val != 0 || disabled" (click)="Download(lstFiles()[0])" fill="outline" [size]="size">
|
|
9
|
+
<ion-icon name="download" slot="start"></ion-icon>
|
|
10
|
+
<ion-label> {{customLabel ? label : Sanitize(lstFiles()[0])}} </ion-label>
|
|
11
|
+
<div class="absolute size-full h-[calc(100%+var(--padding-top)+var(--padding-bottom))] w-[calc(100%+var(--padding-end)+var(--padding-start))]">
|
|
12
|
+
<loading [type]="3" [loading]="val != 0"></loading>
|
|
13
|
+
<div class="size-full flex flex-row-reverse relative">
|
|
14
|
+
<ion-progress-bar class="absolute bottom-0 left-0 w-full h-1 default-transition" [ngClass]="{'-translate-y-4 opacity-0': (!val || val == 0)}" [value]="val"></ion-progress-bar>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</ion-button>
|
|
18
|
+
}
|
|
19
|
+
@else{
|
|
20
|
+
<ion-button [color]="color" [id]="guid" fill="outline" [size]="size">
|
|
21
|
+
<ion-icon name="download" slot="start"></ion-icon>
|
|
22
|
+
<ion-label> {{lstFiles().length}} Arquivos </ion-label>
|
|
23
|
+
</ion-button>
|
|
24
|
+
|
|
25
|
+
<ion-popover [trigger]="guid" [keepContentsMounted]="true" triggerAction="click">
|
|
26
|
+
<ng-template>
|
|
27
|
+
<ion-content class="p-0 bg-transparent">
|
|
28
|
+
<ion-list>
|
|
29
|
+
@for (item of lstFiles(); track item; let i = $index; let l = $last) {
|
|
30
|
+
<section *ngVar="storageService.GetProgress(item) as val">
|
|
31
|
+
<ion-item style="--background: transparent" lines="{{l ? 'none' : 'full'}}" button [detail]="false">
|
|
32
|
+
|
|
33
|
+
<ion-icon name="download" (click)="Download(item)" slot="start"></ion-icon>
|
|
34
|
+
@if (ExtensionIsImage(item)) {
|
|
35
|
+
<ion-icon [id]="guid + '-' + i + '-nested-popover'" name="image" slot="start"></ion-icon>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
<ion-label>{{Sanitize(item)}}</ion-label>
|
|
39
|
+
<ion-text *ngIf="val != 0" slot="end" class="text-sm"><b>{{val * 100 | number : '1.2-2'}}%</b></ion-text>
|
|
40
|
+
</ion-item>
|
|
41
|
+
<ion-progress-bar class="h-0 default-transition" [ngClass]="{'h-1': val != 0 }" [value]="val"></ion-progress-bar>
|
|
42
|
+
<ion-popover *ngIf="ExtensionIsImage(item)" side="end" alignment="center" [trigger]="guid + '-' + i + '-nested-popover'" [dismissOnSelect]="true" triggerAction="click">
|
|
43
|
+
<ng-template>
|
|
44
|
+
<ion-content *ngVar="isLoading(item) as isLoading">
|
|
45
|
+
<loading [hidden]="!isLoading"></loading>
|
|
46
|
+
<ion-img [hidden]="isLoading" [src]="apiUrl + item" (ionImgWillLoad)="SetLoading(item)" (ionImgDidLoad)="SetNotLoading(item)"></ion-img>
|
|
47
|
+
</ion-content>
|
|
48
|
+
</ng-template>
|
|
49
|
+
</ion-popover>
|
|
50
|
+
</section>
|
|
51
|
+
}
|
|
52
|
+
</ion-list>
|
|
53
|
+
</ion-content>
|
|
54
|
+
</ng-template>
|
|
55
|
+
</ion-popover>
|
|
56
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Component, computed, ElementRef, Input, model, ModelSignal, Signal } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
import { InputFileConfiguration } from '../input-file.configuration';
|
|
5
|
+
import { ApiUrlProviderService } from '../../../../services/web/api-url-provider.service';
|
|
6
|
+
import { InputProviderFactory } from '../../input-provider-factory';
|
|
7
|
+
import { StorageService } from '../../../../services/web/storage.service';
|
|
8
|
+
import { lstImageTypes } from '../input-file.configuration';
|
|
9
|
+
import { Utils } from '../../../../services/utils.service';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'download-button',
|
|
13
|
+
templateUrl: './download-button.component.html',
|
|
14
|
+
styleUrls: ['./download-button.component.scss'],
|
|
15
|
+
providers: InputProviderFactory.GetProviders(DownloadButtonComponent)
|
|
16
|
+
})
|
|
17
|
+
export class DownloadButtonComponent implements ControlValueAccessor {
|
|
18
|
+
|
|
19
|
+
@Input() expand: string = "";
|
|
20
|
+
value: ModelSignal<string> = model<string>();
|
|
21
|
+
@Input() size: string = "small";
|
|
22
|
+
@Input() color: string = "primary";
|
|
23
|
+
@Input() params: any;
|
|
24
|
+
@Input() disabled: boolean;
|
|
25
|
+
@Input() post: boolean = false;
|
|
26
|
+
@Input() configuration: InputFileConfiguration = new InputFileConfiguration();
|
|
27
|
+
|
|
28
|
+
@Input() customLabel: boolean = false;
|
|
29
|
+
|
|
30
|
+
@Input() label : string = "";
|
|
31
|
+
|
|
32
|
+
@Input() fileName : string = null;
|
|
33
|
+
constructor(
|
|
34
|
+
public storageService: StorageService,
|
|
35
|
+
private elementRef: ElementRef,
|
|
36
|
+
private apiUrlProviderService: ApiUrlProviderService
|
|
37
|
+
) { }
|
|
38
|
+
|
|
39
|
+
registerOnChange(fn: any): void {
|
|
40
|
+
//throw new Error('Method not implemented.');
|
|
41
|
+
}
|
|
42
|
+
registerOnTouched(fn: any): void {
|
|
43
|
+
//throw new Error('Method not implemented.');
|
|
44
|
+
}
|
|
45
|
+
setDisabledState?(isDisabled: boolean): void {
|
|
46
|
+
//throw new Error('Method not implemented.');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
guid : string = "";
|
|
50
|
+
apiUrl: string;
|
|
51
|
+
|
|
52
|
+
ngOnInit() {
|
|
53
|
+
this.apiUrl = this.apiUrlProviderService.apiUrl;
|
|
54
|
+
this.guid = `${Utils.GenerateGUID()}${this.elementRef.nativeElement.tagName.toLowerCase()}`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
lstFiles: Signal<string[]> = computed(() => {
|
|
58
|
+
if(typeof(this.value()) == "string"){
|
|
59
|
+
return this.value().split(';');
|
|
60
|
+
}else{
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
writeValue(value: string): void { this.value.set(value); }
|
|
66
|
+
|
|
67
|
+
Download(value: string): void{
|
|
68
|
+
this.storageService.StartDownload(value, this.params, this.post, this.fileName);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Sanitize(v): string {
|
|
72
|
+
return StorageService.SanitizeFileName(v);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
ExtensionIsImage(v){
|
|
76
|
+
try{
|
|
77
|
+
return lstImageTypes.includes(v.split('.')[v.split('.').length - 1])
|
|
78
|
+
}catch{}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
lstLoading: string[] = [];
|
|
82
|
+
SetLoading(path: string){
|
|
83
|
+
this.lstLoading.push(path);
|
|
84
|
+
}
|
|
85
|
+
SetNotLoading(path: string){
|
|
86
|
+
this.lstLoading.splice(this.lstLoading.indexOf(path), 1);
|
|
87
|
+
}
|
|
88
|
+
isLoading(path: string){
|
|
89
|
+
return this.lstLoading.indexOf(path) != -1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<div
|
|
2
|
+
#inputContainer
|
|
3
|
+
class="input-container"
|
|
4
|
+
|
|
5
|
+
[class.required]="required()"
|
|
6
|
+
[class.submitted]="submitted()"
|
|
7
|
+
[class.invalid]="invalid"
|
|
8
|
+
[class.disabled]="disabled()"
|
|
9
|
+
[class.loading]="loading()"
|
|
10
|
+
>
|
|
11
|
+
<div class="input-label">
|
|
12
|
+
<span class="truncate">
|
|
13
|
+
{{label()}}
|
|
14
|
+
</span>
|
|
15
|
+
</div>
|
|
16
|
+
<div tabindex="0" class="file-label-container text-dark !pb-1">
|
|
17
|
+
<ion-icon class="shrink-0" color="dark" name="document"></ion-icon>
|
|
18
|
+
<span
|
|
19
|
+
class="block flex-1 min-w-0 truncate"
|
|
20
|
+
[title]="valueString"
|
|
21
|
+
>
|
|
22
|
+
{{ valueString }}
|
|
23
|
+
</span>
|
|
24
|
+
|
|
25
|
+
<div class="size-full flex justify-center items-center gap-1 shrink-0 w-fit">
|
|
26
|
+
@if(value()){
|
|
27
|
+
<ion-button class="rounded-full" fill="outline" color="danger" size="small" (click)="Clear($event)">
|
|
28
|
+
<ion-icon name="trash" slot="icon-only"></ion-icon>
|
|
29
|
+
</ion-button>
|
|
30
|
+
}
|
|
31
|
+
@if(isString) {
|
|
32
|
+
<ion-button class="rounded-full allow-click !opacity-100" fill="outline" color="dark" size="small" (click)="Download()">
|
|
33
|
+
<ion-icon class="!opacity-100" name="cloud-download" slot="icon-only"></ion-icon>
|
|
34
|
+
</ion-button>
|
|
35
|
+
}
|
|
36
|
+
<ion-button class="rounded-full" fill="outline" color="dark" size="small" (click)="Upload()">
|
|
37
|
+
<ion-icon slot="icon-only" name="cloud-upload"></ion-icon>
|
|
38
|
+
</ion-button>
|
|
39
|
+
<!-- @if(isString){
|
|
40
|
+
@if(storageService.GetProgress(this.value().toString())){
|
|
41
|
+
<ion-progress-bar [value]="storageService.GetProgress(this.value().toString())"></ion-progress-bar>
|
|
42
|
+
}
|
|
43
|
+
@if(isImage){
|
|
44
|
+
<image fill="clear" [src]="value().toString()"></image>
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
@else if(isImage){
|
|
48
|
+
<ion-img [src]="objectURL" class="w-full h-32"></ion-img>
|
|
49
|
+
} -->
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="loading-container" [class.loading]="loading()">
|
|
54
|
+
<ion-spinner></ion-spinner>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Component, ElementRef, forwardRef, input, InputSignal, OnInit, ViewChild } from '@angular/core';
|
|
2
|
+
import { CustomInput } from '../custom-input';
|
|
3
|
+
import { InputFileConfiguration } from './input-file.configuration';
|
|
4
|
+
import { InputProviderFactory } from '../input-provider-factory';
|
|
5
|
+
import { UtilsService } from '../../../services/utils.service';
|
|
6
|
+
import { StorageService } from '../../../services/web/storage.service';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'input-file',
|
|
10
|
+
templateUrl: './input-file.component.html',
|
|
11
|
+
styleUrls: ['./input-file.component.scss', '../inputs.scss'],
|
|
12
|
+
providers: [
|
|
13
|
+
...InputProviderFactory.GetProviders(InputFileComponent),
|
|
14
|
+
{ provide: CustomInput, useExisting: forwardRef(() => InputFileComponent) },
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
})
|
|
18
|
+
export class InputFileComponent extends CustomInput<File | string> {
|
|
19
|
+
|
|
20
|
+
configuration: InputSignal<InputFileConfiguration> = input<InputFileConfiguration>(new InputFileConfiguration());
|
|
21
|
+
|
|
22
|
+
@ViewChild('inputContainer') inputContainer: ElementRef<HTMLDivElement>;
|
|
23
|
+
override setFocus(event: MouseEvent | null): void {
|
|
24
|
+
if(event){
|
|
25
|
+
this.Upload();
|
|
26
|
+
}
|
|
27
|
+
this.inputContainer.nativeElement.focus();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
constructor(
|
|
31
|
+
private utilsService: UtilsService,
|
|
32
|
+
public storageService: StorageService
|
|
33
|
+
) { super(); }
|
|
34
|
+
|
|
35
|
+
valueString: string = "";
|
|
36
|
+
isString: boolean = false;
|
|
37
|
+
isImage: boolean = false;
|
|
38
|
+
objectURL: string | null = null;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
override writeValue(obj: File | string): void | Promise<void> {
|
|
42
|
+
this.value.set(obj);
|
|
43
|
+
this.SetValueString();
|
|
44
|
+
this.runValidation();
|
|
45
|
+
}
|
|
46
|
+
override SetValue(value: File | string): void {
|
|
47
|
+
this.value.set(value);
|
|
48
|
+
this.SetValueString();
|
|
49
|
+
this.runValidation();
|
|
50
|
+
this.propagateChange(this.value());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
SetValueString(): void {
|
|
54
|
+
this.objectURL = null;
|
|
55
|
+
this.isString = typeof this.value() == "string";
|
|
56
|
+
if(!this.value()) { this.valueString = "..."; return; }
|
|
57
|
+
this.valueString = typeof this.value() == "string" ? StorageService.SanitizeFileName(this.value().toString()) : (this.value() as File).name;
|
|
58
|
+
|
|
59
|
+
this.isImage = lstImage.includes(this.valueString.split('.').at(-1).toLowerCase());
|
|
60
|
+
if(this.isImage && !this.isString){
|
|
61
|
+
this.objectURL = URL.createObjectURL(this.value() as File);
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async Upload(): Promise<void>{
|
|
67
|
+
try{
|
|
68
|
+
const res = await this.utilsService.SelectFile(this.configuration());
|
|
69
|
+
if(res){ this.SetValue(res); }
|
|
70
|
+
}catch{}
|
|
71
|
+
}
|
|
72
|
+
''
|
|
73
|
+
Clear(event: MouseEvent): void {
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
this.SetValue(null);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
Download(): void{
|
|
79
|
+
this.storageService.StartDownload(this.value() as string);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export const lstImage: string[] = [
|
|
83
|
+
'jpe',
|
|
84
|
+
'jpg',
|
|
85
|
+
'jpeg',
|
|
86
|
+
'gif',
|
|
87
|
+
'png',
|
|
88
|
+
'bmp',
|
|
89
|
+
'ico',
|
|
90
|
+
'svg',
|
|
91
|
+
'svgz',
|
|
92
|
+
'tif',
|
|
93
|
+
'tiff',
|
|
94
|
+
'webp',
|
|
95
|
+
'jfif',
|
|
96
|
+
'avif',
|
|
97
|
+
]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class InputFileConfiguration{
|
|
2
|
+
constructor(
|
|
3
|
+
/** Tipos de arquivos que podem ser selecionados */
|
|
4
|
+
public types: any | [] = ['image/*'],
|
|
5
|
+
// /** Declara se mais do que um arquivo pode ser selecionado */
|
|
6
|
+
// public multiple: boolean = false
|
|
7
|
+
){}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const lstImageTypes: string[] = [
|
|
11
|
+
'jpe',
|
|
12
|
+
'jpg',
|
|
13
|
+
'jpeg',
|
|
14
|
+
'gif',
|
|
15
|
+
'png',
|
|
16
|
+
'bmp',
|
|
17
|
+
'ico',
|
|
18
|
+
'svg',
|
|
19
|
+
'svgz',
|
|
20
|
+
'tif',
|
|
21
|
+
'tiff',
|
|
22
|
+
'webp',
|
|
23
|
+
'jfif',
|
|
24
|
+
'avif',
|
|
25
|
+
]
|