@koalarx/ui 12.4.1 → 12.4.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/alert/README.md +24 -0
- package/alert/bundles/koalarx-ui-alert.umd.js +153 -0
- package/alert/bundles/koalarx-ui-alert.umd.js.map +1 -0
- package/alert/esm2015/index.js +7 -0
- package/alert/esm2015/koalarx-ui-alert.js +5 -0
- package/alert/esm2015/lib/dialog-alert.component.js +43 -0
- package/alert/esm2015/lib/koala.alert-config.interface.js +2 -0
- package/alert/esm2015/lib/koala.alert.enum.js +9 -0
- package/alert/esm2015/lib/koala.alert.module.js +31 -0
- package/alert/esm2015/lib/koala.alert.service.js +21 -0
- package/alert/esm2015/lib/koala.request-code-to-alert-enum.translate.js +18 -0
- package/alert/fesm2015/koalarx-ui-alert.js +121 -0
- package/alert/fesm2015/koalarx-ui-alert.js.map +1 -0
- package/alert/index.d.ts +6 -6
- package/alert/koalarx-ui-alert.d.ts +4 -0
- package/alert/koalarx-ui-alert.metadata.json +1 -0
- package/alert/lib/dialog-alert.component.d.ts +7 -0
- package/alert/{koala.alert-config.interface.d.ts → lib/koala.alert-config.interface.d.ts} +1 -1
- package/alert/{koala.alert.enum.d.ts → lib/koala.alert.enum.d.ts} +0 -0
- package/alert/lib/koala.alert.module.d.ts +2 -0
- package/alert/{koala.alert.service.d.ts → lib/koala.alert.service.d.ts} +1 -4
- package/alert/{koala.request-code-to-alert-enum.translate.d.ts → lib/koala.request-code-to-alert-enum.translate.d.ts} +0 -0
- package/alert/package.json +19 -0
- package/button/bundles/koalarx-ui-button.umd.js +71 -0
- package/button/bundles/koalarx-ui-button.umd.js.map +1 -0
- package/button/esm2015/index.js +3 -0
- package/button/esm2015/koalarx-ui-button.js +5 -0
- package/button/esm2015/lib/button.component.js +31 -0
- package/button/esm2015/lib/koala.button.module.js +27 -0
- package/button/fesm2015/koalarx-ui-button.js +63 -0
- package/button/fesm2015/koalarx-ui-button.js.map +1 -0
- package/button/index.d.ts +2 -2
- package/button/koalarx-ui-button.d.ts +4 -0
- package/button/koalarx-ui-button.metadata.json +1 -0
- package/button/lib/button.component.d.ts +13 -0
- package/button/lib/koala.button.module.d.ts +2 -0
- package/button/package.json +19 -0
- package/core/README.md +24 -0
- package/core/bundles/koalarx-ui-core.umd.js +1821 -0
- package/core/bundles/koalarx-ui-core.umd.js.map +1 -0
- package/core/esm2015/index.js +51 -0
- package/core/esm2015/koalarx-ui-core.js +7 -0
- package/core/esm2015/lib/environments/koalaEnvironment.js +4 -0
- package/core/esm2015/lib/loader/loader-bar-page.component.js +22 -0
- package/core/esm2015/lib/loader/loader-bar-page.interface.js +2 -0
- package/core/esm2015/lib/loader/loader-config.interface.js +2 -0
- package/core/esm2015/lib/mask-options.js +4 -0
- package/core/esm2015/lib/ngx-koala.module.js +35 -0
- package/core/esm2015/lib/page/koala-language.helper.js +114 -0
- package/core/esm2015/lib/page/koala-oauth2-config.interface.js +2 -0
- package/core/esm2015/lib/page/koala-page-pallet-colors.interface.js +2 -0
- package/core/esm2015/lib/page/koala.page.module.js +46 -0
- package/core/esm2015/lib/page/koala.user-menu-options.interface.js +2 -0
- package/core/esm2015/lib/page/notifications/koala.notification.interface.js +2 -0
- package/core/esm2015/lib/page/notifications/notification.component.js +43 -0
- package/core/esm2015/lib/page/page.component.js +396 -0
- package/core/esm2015/lib/router/koala.parameter-hash-location-stategy.js +16 -0
- package/core/esm2015/lib/services/api-requester/factory/koala.response.factory.js +48 -0
- package/core/esm2015/lib/services/api-requester/helpers/error/koala.client.error.js +3 -0
- package/core/esm2015/lib/services/api-requester/helpers/error/koala.errors.helper.js +46 -0
- package/core/esm2015/lib/services/api-requester/helpers/error/koala.not-found.error.js +3 -0
- package/core/esm2015/lib/services/api-requester/helpers/error/koala.success.error.js +3 -0
- package/core/esm2015/lib/services/api-requester/helpers/error/koala.unhautorized.error.js +3 -0
- package/core/esm2015/lib/services/api-requester/helpers/service/koala.request-header.helper.js +15 -0
- package/core/esm2015/lib/services/api-requester/koala.api-requester.base.js +70 -0
- package/{esm2015/core → core/esm2015/lib}/services/api-requester/koala.api-requester.service.js +11 -8
- package/core/esm2015/lib/services/csv/koala.csv.service.js +38 -0
- package/core/esm2015/lib/services/loader/koala.loader.service.js +32 -0
- package/core/esm2015/lib/services/openid/koala.oauth.config.js +33 -0
- package/core/esm2015/lib/services/openid/koala.oauth2.service.js +196 -0
- package/core/esm2015/lib/services/request/koala.request.service.js +53 -0
- package/core/esm2015/lib/services/token/koala.token.service.js +52 -0
- package/core/esm2015/lib/services/token/token.factory.js +31 -0
- package/core/esm2015/lib/services/xlsx/koala.xlsx-config.interface.js +2 -0
- package/core/esm2015/lib/services/xlsx/koala.xlsx.service.js +61 -0
- package/core/fesm2015/koalarx-ui-core.js +1434 -0
- package/core/fesm2015/koalarx-ui-core.js.map +1 -0
- package/core/index.d.ts +24 -27
- package/core/koalarx-ui-core.d.ts +6 -0
- package/core/koalarx-ui-core.metadata.json +1 -0
- package/core/{environments → lib/environments}/koalaEnvironment.d.ts +0 -0
- package/core/lib/loader/loader-bar-page.component.d.ts +5 -0
- package/core/{loader → lib/loader}/loader-bar-page.interface.d.ts +0 -0
- package/core/{loader → lib/loader}/loader-config.interface.d.ts +0 -0
- package/core/{mask-options.d.ts → lib/mask-options.d.ts} +0 -0
- package/core/lib/ngx-koala.module.d.ts +5 -0
- package/core/{page → lib/page}/koala-language.helper.d.ts +0 -0
- package/core/{page → lib/page}/koala-oauth2-config.interface.d.ts +0 -0
- package/core/{page → lib/page}/koala-page-pallet-colors.interface.d.ts +0 -0
- package/core/lib/page/koala.page.module.d.ts +2 -0
- package/core/{page → lib/page}/koala.user-menu-options.interface.d.ts +0 -0
- package/core/{page → lib/page}/notifications/koala.notification.interface.d.ts +0 -0
- package/core/{page → lib/page}/notifications/notification.component.d.ts +0 -3
- package/core/{page → lib/page}/page.component.d.ts +1 -4
- package/core/lib/router/koala.parameter-hash-location-stategy.d.ts +4 -0
- package/core/{services → lib/services}/api-requester/factory/koala.response.factory.d.ts +0 -0
- package/core/{services → lib/services}/api-requester/helpers/error/koala.client.error.d.ts +0 -0
- package/core/{services → lib/services}/api-requester/helpers/error/koala.errors.helper.d.ts +1 -1
- package/core/{services → lib/services}/api-requester/helpers/error/koala.not-found.error.d.ts +0 -0
- package/core/{services → lib/services}/api-requester/helpers/error/koala.success.error.d.ts +0 -0
- package/core/{services → lib/services}/api-requester/helpers/error/koala.unhautorized.error.d.ts +0 -0
- package/core/{services → lib/services}/api-requester/helpers/service/koala.request-header.helper.d.ts +0 -0
- package/core/{services → lib/services}/api-requester/koala.api-requester.base.d.ts +2 -8
- package/core/{services → lib/services}/api-requester/koala.api-requester.service.d.ts +0 -3
- package/core/{services → lib/services}/csv/koala.csv.service.d.ts +0 -3
- package/core/{services → lib/services}/loader/koala.loader.service.d.ts +0 -3
- package/core/{services → lib/services}/openid/koala.oauth.config.d.ts +0 -0
- package/core/{services → lib/services}/openid/koala.oauth2.service.d.ts +0 -3
- package/core/{services → lib/services}/request/koala.request.service.d.ts +1 -4
- package/core/{services → lib/services}/token/koala.token.service.d.ts +0 -3
- package/core/{services → lib/services}/token/token.factory.d.ts +0 -0
- package/core/{services → lib/services}/xlsx/koala.xlsx-config.interface.d.ts +0 -0
- package/core/{services → lib/services}/xlsx/koala.xlsx.service.d.ts +0 -3
- package/core/package.json +19 -0
- package/{theme → core/theme}/koala.theme.css +0 -0
- package/dialog/README.md +24 -0
- package/dialog/bundles/koalarx-ui-dialog.umd.js +139 -0
- package/dialog/bundles/koalarx-ui-dialog.umd.js.map +1 -0
- package/dialog/esm2015/index.js +4 -0
- package/dialog/esm2015/koalarx-ui-dialog.js +5 -0
- package/dialog/esm2015/lib/dialog.component.js +18 -0
- package/dialog/esm2015/lib/koala.dialog-template.interface.js +2 -0
- package/dialog/esm2015/lib/koala.dialog.module.js +25 -0
- package/dialog/esm2015/lib/koala.dialog.service.js +61 -0
- package/dialog/fesm2015/koalarx-ui-dialog.js +107 -0
- package/dialog/fesm2015/koalarx-ui-dialog.js.map +1 -0
- package/dialog/index.d.ts +3 -3
- package/dialog/koalarx-ui-dialog.d.ts +4 -0
- package/dialog/koalarx-ui-dialog.metadata.json +1 -0
- package/dialog/lib/dialog.component.d.ts +8 -0
- package/dialog/{koala.dialog-template.interface.d.ts → lib/koala.dialog-template.interface.d.ts} +0 -0
- package/dialog/lib/koala.dialog.module.d.ts +2 -0
- package/dialog/{koala.dialog.service.d.ts → lib/koala.dialog.service.d.ts} +0 -3
- package/dialog/package.json +19 -0
- package/dynamic-component/README.md +24 -0
- package/dynamic-component/bundles/koalarx-ui-dynamic-component.umd.js +95 -0
- package/dynamic-component/bundles/koalarx-ui-dynamic-component.umd.js.map +1 -0
- package/dynamic-component/esm2015/index.js +6 -0
- package/dynamic-component/esm2015/koalarx-ui-dynamic-component.js +5 -0
- package/dynamic-component/esm2015/lib/koala-dynamic-component.component.js +2 -0
- package/dynamic-component/esm2015/lib/koala-dynamic-component.directive.js +15 -0
- package/dynamic-component/esm2015/lib/koala-dynamic-component.factory.js +38 -0
- package/dynamic-component/esm2015/lib/koala-dynamic-component.js +7 -0
- package/dynamic-component/esm2015/lib/koala-dynamic-component.module.js +17 -0
- package/dynamic-component/fesm2015/koalarx-ui-dynamic-component.js +79 -0
- package/dynamic-component/fesm2015/koalarx-ui-dynamic-component.js.map +1 -0
- package/dynamic-component/index.d.ts +5 -5
- package/dynamic-component/koalarx-ui-dynamic-component.d.ts +4 -0
- package/dynamic-component/koalarx-ui-dynamic-component.metadata.json +1 -0
- package/dynamic-component/{koala-dynamic-component.component.d.ts → lib/koala-dynamic-component.component.d.ts} +0 -0
- package/dynamic-component/{koala-dynamic-component.d.ts → lib/koala-dynamic-component.d.ts} +0 -0
- package/dynamic-component/lib/koala-dynamic-component.directive.d.ts +5 -0
- package/dynamic-component/{koala-dynamic-component.factory.d.ts → lib/koala-dynamic-component.factory.d.ts} +2 -5
- package/dynamic-component/lib/koala-dynamic-component.module.d.ts +2 -0
- package/dynamic-component/package.json +19 -0
- package/file-button/README.md +24 -0
- package/file-button/bundles/koalarx-ui-file-button.umd.js +553 -0
- package/file-button/bundles/koalarx-ui-file-button.umd.js.map +1 -0
- package/file-button/esm2015/index.js +5 -0
- package/file-button/esm2015/koalarx-ui-file-button.js +5 -0
- package/file-button/esm2015/lib/file-button.component.js +118 -0
- package/file-button/esm2015/lib/koala.btn-file.service.js +26 -0
- package/file-button/esm2015/lib/koala.file-button.module.js +25 -0
- package/file-button/esm2015/lib/koala.file.interface.js +2 -0
- package/file-button/fesm2015/koalarx-ui-file-button.js +171 -0
- package/file-button/fesm2015/koalarx-ui-file-button.js.map +1 -0
- package/file-button/index.d.ts +4 -4
- package/file-button/koalarx-ui-file-button.d.ts +4 -0
- package/file-button/koalarx-ui-file-button.metadata.json +1 -0
- package/file-button/lib/file-button.component.d.ts +26 -0
- package/file-button/{koala.btn-file.service.d.ts → lib/koala.btn-file.service.d.ts} +1 -4
- package/file-button/lib/koala.file-button.module.d.ts +2 -0
- package/file-button/{koala.file.interface.d.ts → lib/koala.file.interface.d.ts} +0 -0
- package/file-button/package.json +19 -0
- package/folder-page/README.md +24 -0
- package/folder-page/bundles/koalarx-ui-folder-page.umd.js +97 -0
- package/folder-page/bundles/koalarx-ui-folder-page.umd.js.map +1 -0
- package/folder-page/esm2015/index.js +4 -0
- package/folder-page/esm2015/koalarx-ui-folder-page.js +5 -0
- package/folder-page/esm2015/lib/folder.component.js +56 -0
- package/folder-page/esm2015/lib/koala-navigate-history.interface.js +2 -0
- package/folder-page/esm2015/lib/koala.folder-page.module.js +27 -0
- package/folder-page/fesm2015/koalarx-ui-folder-page.js +88 -0
- package/folder-page/fesm2015/koalarx-ui-folder-page.js.map +1 -0
- package/folder-page/index.d.ts +3 -2
- package/folder-page/koalarx-ui-folder-page.d.ts +4 -0
- package/folder-page/koalarx-ui-folder-page.metadata.json +1 -0
- package/folder-page/lib/folder.component.d.ts +17 -0
- package/folder-page/{koala-navigate-history.interface.d.ts → lib/koala-navigate-history.interface.d.ts} +0 -0
- package/folder-page/lib/koala.folder-page.module.d.ts +2 -0
- package/folder-page/package.json +19 -0
- package/form/README.md +24 -0
- package/form/bundles/koalarx-ui-form.umd.js +1949 -0
- package/form/bundles/koalarx-ui-form.umd.js.map +1 -0
- package/form/esm2015/index.js +20 -0
- package/form/esm2015/koalarx-ui-form.js +5 -0
- package/form/esm2015/lib/btn-submit/btn-submit.component.js +39 -0
- package/form/esm2015/lib/directives/koala-autofocus.directive.js +25 -0
- package/form/esm2015/lib/dynamic-form/builder/dynamic-form.builder.js +138 -0
- package/form/esm2015/lib/dynamic-form/builder/fields/autocomplete.builder.js +34 -0
- package/form/esm2015/lib/dynamic-form/builder/fields/field.base.js +147 -0
- package/form/esm2015/lib/dynamic-form/builder/fields/field.builder.js +7 -0
- package/form/esm2015/lib/dynamic-form/builder/fields/more-items.builder.js +57 -0
- package/form/esm2015/lib/dynamic-form/dynamic-form.component.js +551 -0
- package/{esm2015/form → form/esm2015/lib}/dynamic-form/enums/dynamic-form-type-field.enum.js +1 -1
- package/form/esm2015/lib/dynamic-form/interfaces/koala-custom-validator-fn.interface.js +2 -0
- package/form/esm2015/lib/dynamic-form/interfaces/koala.dynamic-autocomplete-options.interface.js +2 -0
- package/form/esm2015/lib/dynamic-form/interfaces/koala.dynamic-form-autocomplete-multiple-config.interface.js +2 -0
- package/form/esm2015/lib/dynamic-form/interfaces/koala.dynamic-form-config.interface.js +2 -0
- package/form/esm2015/lib/dynamic-form/interfaces/koala.dynamic-form-field.interface.js +2 -0
- package/form/esm2015/lib/dynamic-form/interfaces/koala.dynamic-form-more-itens-show-field-config.interface.js +2 -0
- package/form/esm2015/lib/dynamic-form/interfaces/koala.dynamic-form-show-field.interface.js +2 -0
- package/form/esm2015/lib/dynamic-form/interfaces/koala.dynamic-set-value.interface.js +2 -0
- package/{esm2015/form → form/esm2015/lib}/dynamic-form/koala.dynamic-form.service.js +11 -8
- package/form/esm2015/lib/dynamic-form/validators/autocomplete-selected.validator.js +10 -0
- package/form/esm2015/lib/dynamic-form/validators/cnpj.validator.js +10 -0
- package/form/esm2015/lib/dynamic-form/validators/cpf.validator.js +10 -0
- package/form/esm2015/lib/dynamic-form/validators/date-max.validator.js +11 -0
- package/form/esm2015/lib/dynamic-form/validators/date-min.validator.js +11 -0
- package/form/esm2015/lib/dynamic-form/validators/koala-dynamic-form-validator-result.helper.js +10 -0
- package/form/esm2015/lib/dynamic-form/validators/validation.helper.js +86 -0
- package/form/esm2015/lib/form.abstract.js +42 -0
- package/form/esm2015/lib/koala.form.module.js +69 -0
- package/form/esm2015/lib/show-invalid-fields/show-invalid-fields.js +9 -0
- package/form/fesm2015/koalarx-ui-form.js +1465 -0
- package/form/fesm2015/koalarx-ui-form.js.map +1 -0
- package/form/index.d.ts +19 -17
- package/form/koalarx-ui-form.d.ts +4 -0
- package/form/koalarx-ui-form.metadata.json +1 -0
- package/form/{btn-submit → lib/btn-submit}/btn-submit.component.d.ts +1 -4
- package/form/lib/directives/koala-autofocus.directive.d.ts +7 -0
- package/form/{dynamic-form → lib/dynamic-form}/builder/dynamic-form.builder.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/builder/fields/autocomplete.builder.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/builder/fields/field.base.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/builder/fields/field.builder.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/builder/fields/more-items.builder.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/dynamic-form.component.d.ts +2 -5
- package/form/{dynamic-form → lib/dynamic-form}/enums/dynamic-form-type-field.enum.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/interfaces/koala-custom-validator-fn.interface.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/interfaces/koala.dynamic-autocomplete-options.interface.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/interfaces/koala.dynamic-form-autocomplete-multiple-config.interface.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/interfaces/koala.dynamic-form-config.interface.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/interfaces/koala.dynamic-form-field.interface.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/interfaces/koala.dynamic-form-more-itens-show-field-config.interface.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/interfaces/koala.dynamic-form-show-field.interface.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/interfaces/koala.dynamic-set-value.interface.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/koala.dynamic-form.service.d.ts +0 -3
- package/form/{dynamic-form → lib/dynamic-form}/validators/autocomplete-selected.validator.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/validators/cnpj.validator.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/validators/cpf.validator.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/validators/date-max.validator.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/validators/date-min.validator.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/validators/koala-dynamic-form-validator-result.helper.d.ts +0 -0
- package/form/{dynamic-form → lib/dynamic-form}/validators/validation.helper.d.ts +0 -0
- package/{core → form/lib}/form.abstract.d.ts +1 -1
- package/form/lib/koala.form.module.d.ts +2 -0
- package/form/{show-invalid-fields → lib/show-invalid-fields}/show-invalid-fields.d.ts +0 -0
- package/form/package.json +19 -0
- package/icon/bundles/koalarx-ui-icon.umd.js +76 -0
- package/icon/bundles/koalarx-ui-icon.umd.js.map +1 -0
- package/icon/esm2015/index.js +3 -0
- package/icon/esm2015/koalarx-ui-icon.js +5 -0
- package/icon/esm2015/lib/icon.component.js +45 -0
- package/icon/esm2015/lib/koala.icon.module.js +19 -0
- package/icon/fesm2015/koalarx-ui-icon.js +69 -0
- package/icon/fesm2015/koalarx-ui-icon.js.map +1 -0
- package/icon/index.d.ts +2 -2
- package/icon/koalarx-ui-icon.d.ts +4 -0
- package/icon/koalarx-ui-icon.metadata.json +1 -0
- package/icon/{icon.component.d.ts → lib/icon.component.d.ts} +3 -6
- package/icon/lib/koala.icon.module.d.ts +2 -0
- package/icon/package.json +19 -0
- package/icons-animated/README.md +24 -0
- package/icons-animated/bundles/koalarx-ui-icons-animated.umd.js +138 -0
- package/icons-animated/bundles/koalarx-ui-icons-animated.umd.js.map +1 -0
- package/icons-animated/esm2015/index.js +5 -0
- package/icons-animated/esm2015/koalarx-ui-icons-animated.js +6 -0
- package/icons-animated/esm2015/lib/icons/downloading/downloading-icon-animated.component.js +28 -0
- package/icons-animated/esm2015/lib/icons/loading/loading-icon-animated.component.js +28 -0
- package/icons-animated/esm2015/lib/icons-animated.component.js +15 -0
- package/icons-animated/esm2015/lib/icons-animated.service.js +29 -0
- package/icons-animated/esm2015/lib/koala-icons-animated.module.js +23 -0
- package/icons-animated/fesm2015/koalarx-ui-icons-animated.js +121 -0
- package/icons-animated/fesm2015/koalarx-ui-icons-animated.js.map +1 -0
- package/icons-animated/index.d.ts +4 -4
- package/icons-animated/koalarx-ui-icons-animated.d.ts +5 -0
- package/icons-animated/koalarx-ui-icons-animated.metadata.json +1 -0
- package/icons-animated/{icons → lib/icons}/downloading/downloading-icon-animated.component.d.ts +0 -3
- package/icons-animated/{icons → lib/icons}/loading/loading-icon-animated.component.d.ts +0 -3
- package/icons-animated/lib/icons-animated.component.d.ts +5 -0
- package/icons-animated/lib/icons-animated.service.d.ts +6 -0
- package/icons-animated/lib/koala-icons-animated.module.d.ts +2 -0
- package/icons-animated/package.json +19 -0
- package/list/README.md +24 -0
- package/list/bundles/koalarx-ui-list.umd.js +882 -0
- package/list/bundles/koalarx-ui-list.umd.js.map +1 -0
- package/list/esm2015/index.js +11 -0
- package/list/esm2015/koalarx-ui-list.js +5 -0
- package/list/esm2015/lib/koala-list-filter.interface.js +2 -0
- package/list/esm2015/lib/koala-list-form-filter.interface.js +2 -0
- package/list/esm2015/lib/koala-list-item-menu-option.interface.js +2 -0
- package/list/esm2015/lib/koala-list-item.interface.js +2 -0
- package/list/esm2015/lib/koala.list-config.interface.js +2 -0
- package/list/esm2015/lib/koala.list.module.js +40 -0
- package/list/esm2015/lib/koala.list.service.js +13 -0
- package/list/esm2015/lib/list-builder/list.builder.js +85 -0
- package/list/esm2015/lib/list.abstract.js +174 -0
- package/list/esm2015/lib/list.component.js +151 -0
- package/list/esm2015/lib/providers/pagination/pagination.provider.js +30 -0
- package/list/fesm2015/koalarx-ui-list.js +481 -0
- package/list/fesm2015/koalarx-ui-list.js.map +1 -0
- package/list/index.d.ts +10 -9
- package/list/koalarx-ui-list.d.ts +4 -0
- package/list/koalarx-ui-list.metadata.json +1 -0
- package/list/{koala-list-filter.interface.d.ts → lib/koala-list-filter.interface.d.ts} +1 -1
- package/list/{koala-list-form-filter.interface.d.ts → lib/koala-list-form-filter.interface.d.ts} +0 -0
- package/list/{koala-list-item-menu-option.interface.d.ts → lib/koala-list-item-menu-option.interface.d.ts} +0 -0
- package/list/{koala-list-item.interface.d.ts → lib/koala-list-item.interface.d.ts} +1 -1
- package/list/{koala.list-config.interface.d.ts → lib/koala.list-config.interface.d.ts} +2 -2
- package/list/lib/koala.list.module.d.ts +2 -0
- package/list/lib/koala.list.service.d.ts +4 -0
- package/list/{list-builder → lib/list-builder}/list.builder.d.ts +1 -1
- package/list/{list.abstract.d.ts → lib/list.abstract.d.ts} +7 -7
- package/list/{list.component.d.ts → lib/list.component.d.ts} +12 -15
- package/{core → list/lib}/providers/pagination/pagination.provider.d.ts +0 -3
- package/list/package.json +19 -0
- package/menu/README.md +24 -0
- package/menu/bundles/koalarx-ui-menu.umd.js +511 -0
- package/menu/bundles/koalarx-ui-menu.umd.js.map +1 -0
- package/menu/esm2015/index.js +6 -0
- package/menu/esm2015/koalarx-ui-menu.js +5 -0
- package/menu/esm2015/lib/koala.menu-module.interface.js +2 -0
- package/menu/esm2015/lib/koala.menu-tool.interface.js +2 -0
- package/menu/esm2015/lib/koala.menu.module.js +25 -0
- package/menu/esm2015/lib/koala.menu.service.js +22 -0
- package/menu/esm2015/lib/menu.component.js +104 -0
- package/menu/fesm2015/koalarx-ui-menu.js +153 -0
- package/menu/fesm2015/koalarx-ui-menu.js.map +1 -0
- package/menu/index.d.ts +5 -5
- package/menu/koalarx-ui-menu.d.ts +4 -0
- package/menu/koalarx-ui-menu.metadata.json +1 -0
- package/menu/{koala.menu-module.interface.d.ts → lib/koala.menu-module.interface.d.ts} +0 -0
- package/menu/{koala.menu-tool.interface.d.ts → lib/koala.menu-tool.interface.d.ts} +0 -0
- package/menu/lib/koala.menu.module.d.ts +2 -0
- package/menu/lib/koala.menu.service.d.ts +7 -0
- package/menu/{menu.component.d.ts → lib/menu.component.d.ts} +4 -6
- package/menu/package.json +19 -0
- package/package.json +3 -12
- package/question/README.md +24 -0
- package/question/bundles/koalarx-ui-question.umd.js +104 -0
- package/question/bundles/koalarx-ui-question.umd.js.map +1 -0
- package/question/esm2015/index.js +5 -0
- package/question/esm2015/koalarx-ui-question.js +5 -0
- package/question/esm2015/lib/dialog-question.component.js +20 -0
- package/question/esm2015/lib/koala-question-config.interface.js +2 -0
- package/question/esm2015/lib/koala.question.module.js +27 -0
- package/question/esm2015/lib/koala.question.service.js +28 -0
- package/question/fesm2015/koalarx-ui-question.js +77 -0
- package/question/fesm2015/koalarx-ui-question.js.map +1 -0
- package/question/index.d.ts +4 -4
- package/question/koalarx-ui-question.d.ts +4 -0
- package/question/koalarx-ui-question.metadata.json +1 -0
- package/question/lib/dialog-question.component.d.ts +7 -0
- package/question/{koala-question-config.interface.d.ts → lib/koala-question-config.interface.d.ts} +1 -1
- package/question/lib/koala.question.module.d.ts +2 -0
- package/question/{koala.question.service.d.ts → lib/koala.question.service.d.ts} +1 -4
- package/question/package.json +19 -0
- package/snackbar/README.md +24 -0
- package/snackbar/bundles/koalarx-ui-snackbar.umd.js +93 -0
- package/snackbar/bundles/koalarx-ui-snackbar.umd.js.map +1 -0
- package/snackbar/esm2015/index.js +5 -0
- package/snackbar/esm2015/koalarx-ui-snackbar.js +5 -0
- package/snackbar/esm2015/lib/koala.snackbar.component.js +20 -0
- package/snackbar/esm2015/lib/koala.snackbar.interface.js +2 -0
- package/snackbar/esm2015/lib/koala.snackbar.module.js +26 -0
- package/snackbar/esm2015/lib/koala.snackbar.service.js +35 -0
- package/snackbar/fesm2015/koalarx-ui-snackbar.js +81 -0
- package/snackbar/fesm2015/koalarx-ui-snackbar.js.map +1 -0
- package/snackbar/index.d.ts +4 -4
- package/snackbar/koalarx-ui-snackbar.d.ts +4 -0
- package/snackbar/koalarx-ui-snackbar.metadata.json +1 -0
- package/snackbar/{koala.snackbar.component.d.ts → lib/koala.snackbar.component.d.ts} +0 -3
- package/snackbar/{koala.snackbar.interface.d.ts → lib/koala.snackbar.interface.d.ts} +0 -0
- package/snackbar/lib/koala.snackbar.module.d.ts +2 -0
- package/snackbar/{koala.snackbar.service.d.ts → lib/koala.snackbar.service.d.ts} +0 -3
- package/snackbar/package.json +19 -0
- package/README.md +0 -9
- package/alert/dialog-alert.component.d.ts +0 -10
- package/alert/koala.alert.module.d.ts +0 -12
- package/bundles/koalarx-ui.umd.js +0 -9165
- package/bundles/koalarx-ui.umd.js.map +0 -1
- package/button/button.component.d.ts +0 -16
- package/button/koala.button.module.d.ts +0 -12
- package/core/directives/koala-autofocus.directive.d.ts +0 -10
- package/core/loader/loader-bar-page.component.d.ts +0 -8
- package/core/ngx-koala.module.d.ts +0 -12
- package/core/page/koala.page.module.d.ts +0 -21
- package/core/router/koala.parameter-hash-location-stategy.d.ts +0 -7
- package/dialog/dialog.component.d.ts +0 -11
- package/dialog/koala.dialog.module.d.ts +0 -11
- package/dynamic-component/koala-dynamic-component.directive.d.ts +0 -8
- package/dynamic-component/koala-dynamic-component.module.d.ts +0 -8
- package/esm2015/alert/dialog-alert.component.js +0 -109
- package/esm2015/alert/index.js +0 -10
- package/esm2015/alert/koala.alert-config.interface.js +0 -2
- package/esm2015/alert/koala.alert.enum.js +0 -9
- package/esm2015/alert/koala.alert.module.js +0 -49
- package/esm2015/alert/koala.alert.service.js +0 -19
- package/esm2015/alert/koala.request-code-to-alert-enum.translate.js +0 -18
- package/esm2015/button/button.component.js +0 -113
- package/esm2015/button/index.js +0 -6
- package/esm2015/button/koala.button.module.js +0 -43
- package/esm2015/core/directives/koala-autofocus.directive.js +0 -25
- package/esm2015/core/environments/koalaEnvironment.js +0 -4
- package/esm2015/core/form.abstract.js +0 -42
- package/esm2015/core/index.js +0 -61
- package/esm2015/core/loader/loader-bar-page.component.js +0 -38
- package/esm2015/core/loader/loader-bar-page.interface.js +0 -2
- package/esm2015/core/loader/loader-config.interface.js +0 -2
- package/esm2015/core/mask-options.js +0 -4
- package/esm2015/core/ngx-koala.module.js +0 -51
- package/esm2015/core/page/koala-language.helper.js +0 -114
- package/esm2015/core/page/koala-oauth2-config.interface.js +0 -2
- package/esm2015/core/page/koala-page-pallet-colors.interface.js +0 -2
- package/esm2015/core/page/koala.page.module.js +0 -79
- package/esm2015/core/page/koala.user-menu-options.interface.js +0 -2
- package/esm2015/core/page/notifications/koala.notification.interface.js +0 -2
- package/esm2015/core/page/notifications/notification.component.js +0 -127
- package/esm2015/core/page/page.component.js +0 -627
- package/esm2015/core/providers/pagination/pagination.provider.js +0 -32
- package/esm2015/core/router/koala.parameter-hash-location-stategy.js +0 -19
- package/esm2015/core/services/api-requester/factory/koala.response.factory.js +0 -48
- package/esm2015/core/services/api-requester/helpers/error/koala.client.error.js +0 -3
- package/esm2015/core/services/api-requester/helpers/error/koala.errors.helper.js +0 -46
- package/esm2015/core/services/api-requester/helpers/error/koala.not-found.error.js +0 -3
- package/esm2015/core/services/api-requester/helpers/error/koala.success.error.js +0 -3
- package/esm2015/core/services/api-requester/helpers/error/koala.unhautorized.error.js +0 -3
- package/esm2015/core/services/api-requester/helpers/service/koala.request-header.helper.js +0 -15
- package/esm2015/core/services/api-requester/koala.api-requester.base.js +0 -70
- package/esm2015/core/services/csv/koala.csv.service.js +0 -36
- package/esm2015/core/services/loader/koala.loader.service.js +0 -34
- package/esm2015/core/services/openid/koala.oauth.config.js +0 -33
- package/esm2015/core/services/openid/koala.oauth2.service.js +0 -194
- package/esm2015/core/services/request/koala.request.service.js +0 -53
- package/esm2015/core/services/token/koala.token.service.js +0 -53
- package/esm2015/core/services/token/token.factory.js +0 -31
- package/esm2015/core/services/xlsx/koala.xlsx-config.interface.js +0 -2
- package/esm2015/core/services/xlsx/koala.xlsx.service.js +0 -63
- package/esm2015/dialog/dialog.component.js +0 -72
- package/esm2015/dialog/index.js +0 -7
- package/esm2015/dialog/koala.dialog-template.interface.js +0 -2
- package/esm2015/dialog/koala.dialog.module.js +0 -39
- package/esm2015/dialog/koala.dialog.service.js +0 -57
- package/esm2015/dynamic-component/index.js +0 -9
- package/esm2015/dynamic-component/koala-dynamic-component.component.js +0 -2
- package/esm2015/dynamic-component/koala-dynamic-component.directive.js +0 -16
- package/esm2015/dynamic-component/koala-dynamic-component.factory.js +0 -44
- package/esm2015/dynamic-component/koala-dynamic-component.js +0 -7
- package/esm2015/dynamic-component/koala-dynamic-component.module.js +0 -24
- package/esm2015/file-button/file-button.component.js +0 -183
- package/esm2015/file-button/index.js +0 -8
- package/esm2015/file-button/koala.btn-file.service.js +0 -28
- package/esm2015/file-button/koala.file-button.module.js +0 -39
- package/esm2015/file-button/koala.file.interface.js +0 -2
- package/esm2015/folder-page/folder.component.js +0 -157
- package/esm2015/folder-page/index.js +0 -6
- package/esm2015/folder-page/koala-navigate-history.interface.js +0 -2
- package/esm2015/folder-page/koala.folder-page.module.js +0 -43
- package/esm2015/form/btn-submit/btn-submit.component.js +0 -110
- package/esm2015/form/dynamic-form/builder/dynamic-form.builder.js +0 -138
- package/esm2015/form/dynamic-form/builder/fields/autocomplete.builder.js +0 -34
- package/esm2015/form/dynamic-form/builder/fields/field.base.js +0 -147
- package/esm2015/form/dynamic-form/builder/fields/field.builder.js +0 -7
- package/esm2015/form/dynamic-form/builder/fields/more-items.builder.js +0 -57
- package/esm2015/form/dynamic-form/dynamic-form.component.js +0 -1861
- package/esm2015/form/dynamic-form/interfaces/koala-custom-validator-fn.interface.js +0 -2
- package/esm2015/form/dynamic-form/interfaces/koala.dynamic-autocomplete-options.interface.js +0 -2
- package/esm2015/form/dynamic-form/interfaces/koala.dynamic-form-autocomplete-multiple-config.interface.js +0 -2
- package/esm2015/form/dynamic-form/interfaces/koala.dynamic-form-config.interface.js +0 -2
- package/esm2015/form/dynamic-form/interfaces/koala.dynamic-form-field.interface.js +0 -2
- package/esm2015/form/dynamic-form/interfaces/koala.dynamic-form-more-itens-show-field-config.interface.js +0 -2
- package/esm2015/form/dynamic-form/interfaces/koala.dynamic-form-show-field.interface.js +0 -2
- package/esm2015/form/dynamic-form/interfaces/koala.dynamic-set-value.interface.js +0 -2
- package/esm2015/form/dynamic-form/validators/autocomplete-selected.validator.js +0 -10
- package/esm2015/form/dynamic-form/validators/cnpj.validator.js +0 -10
- package/esm2015/form/dynamic-form/validators/cpf.validator.js +0 -10
- package/esm2015/form/dynamic-form/validators/date-max.validator.js +0 -11
- package/esm2015/form/dynamic-form/validators/date-min.validator.js +0 -11
- package/esm2015/form/dynamic-form/validators/koala-dynamic-form-validator-result.helper.js +0 -10
- package/esm2015/form/dynamic-form/validators/validation.helper.js +0 -86
- package/esm2015/form/index.js +0 -21
- package/esm2015/form/koala.form.module.js +0 -135
- package/esm2015/form/show-invalid-fields/show-invalid-fields.js +0 -9
- package/esm2015/icon/icon.component.js +0 -458
- package/esm2015/icon/index.js +0 -6
- package/esm2015/icon/koala.icon.module.js +0 -27
- package/esm2015/icons-animated/icons/downloading/downloading-icon-animated.component.js +0 -40
- package/esm2015/icons-animated/icons/loading/loading-icon-animated.component.js +0 -58
- package/esm2015/icons-animated/icons-animated.component.js +0 -48
- package/esm2015/icons-animated/icons-animated.service.js +0 -32
- package/esm2015/icons-animated/index.js +0 -8
- package/esm2015/icons-animated/koala-icons-animated.module.js +0 -33
- package/esm2015/koalarx-ui.js +0 -5
- package/esm2015/list/index.js +0 -13
- package/esm2015/list/koala-list-filter.interface.js +0 -2
- package/esm2015/list/koala-list-form-filter.interface.js +0 -2
- package/esm2015/list/koala-list-item-menu-option.interface.js +0 -2
- package/esm2015/list/koala-list-item.interface.js +0 -2
- package/esm2015/list/koala.list-config.interface.js +0 -2
- package/esm2015/list/koala.list.module.js +0 -67
- package/esm2015/list/koala.list.service.js +0 -15
- package/esm2015/list/list-builder/list.builder.js +0 -85
- package/esm2015/list/list.abstract.js +0 -161
- package/esm2015/list/list.component.js +0 -498
- package/esm2015/menu/index.js +0 -9
- package/esm2015/menu/koala.menu-module.interface.js +0 -2
- package/esm2015/menu/koala.menu-tool.interface.js +0 -2
- package/esm2015/menu/koala.menu.module.js +0 -39
- package/esm2015/menu/koala.menu.service.js +0 -24
- package/esm2015/menu/menu.component.js +0 -289
- package/esm2015/public-api.js +0 -18
- package/esm2015/question/dialog-question.component.js +0 -72
- package/esm2015/question/index.js +0 -8
- package/esm2015/question/koala-question-config.interface.js +0 -2
- package/esm2015/question/koala.question.module.js +0 -43
- package/esm2015/question/koala.question.service.js +0 -26
- package/esm2015/snackbar/index.js +0 -8
- package/esm2015/snackbar/koala.snackbar.component.js +0 -48
- package/esm2015/snackbar/koala.snackbar.interface.js +0 -2
- package/esm2015/snackbar/koala.snackbar.module.js +0 -39
- package/esm2015/snackbar/koala.snackbar.service.js +0 -35
- package/fesm2015/koalarx-ui.js +0 -7726
- package/fesm2015/koalarx-ui.js.map +0 -1
- package/file-button/file-button.component.d.ts +0 -29
- package/file-button/koala.file-button.module.d.ts +0 -11
- package/folder-page/folder.component.d.ts +0 -20
- package/folder-page/koala.folder-page.module.d.ts +0 -12
- package/form/koala.form.module.d.ts +0 -25
- package/icon/koala.icon.module.d.ts +0 -8
- package/icons-animated/icons-animated.component.d.ts +0 -8
- package/icons-animated/icons-animated.service.d.ts +0 -9
- package/icons-animated/koala-icons-animated.module.d.ts +0 -10
- package/koalarx-ui.d.ts +0 -5
- package/list/koala.list.module.d.ts +0 -16
- package/list/koala.list.service.d.ts +0 -7
- package/menu/koala.menu.module.d.ts +0 -11
- package/menu/koala.menu.service.d.ts +0 -9
- package/public-api.d.ts +0 -14
- package/question/dialog-question.component.d.ts +0 -10
- package/question/koala.question.module.d.ts +0 -12
- package/snackbar/koala.snackbar.module.d.ts +0 -10
|
@@ -0,0 +1,1465 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, Input, Injectable, ChangeDetectionStrategy, ViewChild, Directive, ElementRef, NgModule } from '@angular/core';
|
|
3
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
4
|
+
import { KoalaLanguageHelper, maskOptions } from '@koalarx/ui/core';
|
|
5
|
+
import * as i1 from '@angular/forms';
|
|
6
|
+
import { Validators, FormBuilder, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
7
|
+
import { koala } from '@koalarx/utils';
|
|
8
|
+
import * as i2 from 'ngx-device-detector';
|
|
9
|
+
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
10
|
+
import { __awaiter } from 'tslib';
|
|
11
|
+
import { debounceTime } from 'rxjs/operators';
|
|
12
|
+
import { KlDelay } from '@koalarx/utils/dist/utils/KlDelay';
|
|
13
|
+
import { CommonModule } from '@angular/common';
|
|
14
|
+
import { MatInputModule } from '@angular/material/input';
|
|
15
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
16
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
17
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
18
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
19
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
20
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
21
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
22
|
+
import { NgxMaskModule } from 'ngx-mask';
|
|
23
|
+
import { CurrencyMaskModule } from 'ng2-currency-mask';
|
|
24
|
+
import { KoalaButtonModule } from '@koalarx/ui/button';
|
|
25
|
+
import { MatExpansionModule } from '@angular/material/expansion';
|
|
26
|
+
import { KoalaFileButtonModule } from '@koalarx/ui/file-button';
|
|
27
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
28
|
+
|
|
29
|
+
class BtnSubmitComponent {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.color = 'primary';
|
|
32
|
+
this.btnLabel = KoalaLanguageHelper.getBtnLabel();
|
|
33
|
+
this.btnSubmitDisabled = false;
|
|
34
|
+
this.disabled = new BehaviorSubject(false);
|
|
35
|
+
}
|
|
36
|
+
ngOnInit() {
|
|
37
|
+
if (!this.btnLabel) {
|
|
38
|
+
this.btnLabel = KoalaLanguageHelper.getBtnLabel();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
ngOnChanges(changes) {
|
|
42
|
+
if (changes.btnSubmitDisabled) {
|
|
43
|
+
this.disabled.next(changes.btnSubmitDisabled.currentValue);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
BtnSubmitComponent.decorators = [
|
|
48
|
+
{ type: Component, args: [{
|
|
49
|
+
selector: 'koala-submit',
|
|
50
|
+
template: "<button\n\t*ngIf=\"!iconButton else btnIcon\"\n\t[color]=\"color\"\n\t[disabled]=\"(disabled | async) || fg.invalid || fg.pending\"\n\tmat-raised-button\n\ttype=\"submit\">\n <span>{{btnLabel}}</span>\n <mat-spinner *ngIf=\"loader | async\" diameter=\"20\"></mat-spinner>\n</button>\n<ng-template #btnIcon>\n <button\n\t [color]=\"color\"\n\t [disabled]=\"(disabled | async) || fg.invalid || fg.pending\"\n\t class=\"koala-icon-button\"\n\t mat-icon-button\n\t type=\"submit\">\n <mat-spinner *ngIf=\"loader | async\" [color]=\"color\" diameter=\"20\"></mat-spinner>\n <mat-icon *ngIf=\"!(loader | async)\">{{icon}}</mat-icon>\n </button>\n</ng-template>\n",
|
|
51
|
+
styles: [".mat-spinner{display:inline-block;margin-left:8px}.koala-button{padding:2px 8px}.koala-icon-button mat-spinner{position:relative;display:inline-flex;margin:0}\n"]
|
|
52
|
+
},] }
|
|
53
|
+
];
|
|
54
|
+
BtnSubmitComponent.propDecorators = {
|
|
55
|
+
fg: [{ type: Input }],
|
|
56
|
+
color: [{ type: Input }],
|
|
57
|
+
btnLabel: [{ type: Input }],
|
|
58
|
+
btnSubmitDisabled: [{ type: Input }],
|
|
59
|
+
loader: [{ type: Input }],
|
|
60
|
+
iconButton: [{ type: Input }],
|
|
61
|
+
icon: [{ type: Input }],
|
|
62
|
+
iconColor: [{ type: Input }]
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var DynamicFormTypeFieldEnum;
|
|
66
|
+
(function (DynamicFormTypeFieldEnum) {
|
|
67
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["text"] = 1] = "text";
|
|
68
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["password"] = 2] = "password";
|
|
69
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["cpf"] = 3] = "cpf";
|
|
70
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["cnpj"] = 4] = "cnpj";
|
|
71
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["datetime"] = 5] = "datetime";
|
|
72
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["email"] = 6] = "email";
|
|
73
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["phone"] = 7] = "phone";
|
|
74
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["number"] = 8] = "number";
|
|
75
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["valueList"] = 9] = "valueList";
|
|
76
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["textarea"] = 10] = "textarea";
|
|
77
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["time"] = 11] = "time";
|
|
78
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["hoursAndMinutes"] = 12] = "hoursAndMinutes";
|
|
79
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["checkbox"] = 13] = "checkbox";
|
|
80
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["select"] = 14] = "select";
|
|
81
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["coin"] = 15] = "coin";
|
|
82
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["percent"] = 16] = "percent";
|
|
83
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["moreItems"] = 17] = "moreItems";
|
|
84
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["id"] = 18] = "id";
|
|
85
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["textLogs"] = 19] = "textLogs";
|
|
86
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["file"] = 20] = "file";
|
|
87
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["autocomplete"] = 21] = "autocomplete";
|
|
88
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["color"] = 22] = "color";
|
|
89
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["dynamicForm"] = 23] = "dynamicForm";
|
|
90
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["date"] = 24] = "date";
|
|
91
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["radio"] = 25] = "radio";
|
|
92
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["float"] = 26] = "float";
|
|
93
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["stringNumber"] = 27] = "stringNumber";
|
|
94
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["selectMultipleNative"] = 28] = "selectMultipleNative";
|
|
95
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["month"] = 29] = "month";
|
|
96
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["competenceDate"] = 30] = "competenceDate";
|
|
97
|
+
DynamicFormTypeFieldEnum[DynamicFormTypeFieldEnum["stringWithCustomMasc"] = 31] = "stringWithCustomMasc";
|
|
98
|
+
})(DynamicFormTypeFieldEnum || (DynamicFormTypeFieldEnum = {}));
|
|
99
|
+
|
|
100
|
+
class FieldBase {
|
|
101
|
+
constructor(label, name, type, formConfig, fb, deviceService) {
|
|
102
|
+
this.formConfig = formConfig;
|
|
103
|
+
this.fb = fb;
|
|
104
|
+
this.deviceService = deviceService;
|
|
105
|
+
this.fieldConfig = {
|
|
106
|
+
label,
|
|
107
|
+
name,
|
|
108
|
+
type
|
|
109
|
+
};
|
|
110
|
+
this.appearance().grid();
|
|
111
|
+
}
|
|
112
|
+
hide(hide = true) {
|
|
113
|
+
this.fieldConfig.show = !hide;
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
focus() {
|
|
117
|
+
this.fieldConfig.focus = true;
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
syncValidator(validators) {
|
|
121
|
+
this.fieldConfig.syncValidators = validators;
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
asyncValidator(validators) {
|
|
125
|
+
this.fieldConfig.asyncValidators = validators;
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
disabled(disabled = true) {
|
|
129
|
+
this.fieldConfig.disabled = disabled;
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
132
|
+
required(required = true) {
|
|
133
|
+
this.fieldConfig.required = required;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
textHint(hint) {
|
|
137
|
+
this.fieldConfig.textHint = hint;
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
min(min) {
|
|
141
|
+
this.fieldConfig.min = min;
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
max(max) {
|
|
145
|
+
this.fieldConfig.max = max;
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
minLength(min) {
|
|
149
|
+
this.fieldConfig.minLength = min;
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
maxLength(max) {
|
|
153
|
+
this.fieldConfig.maxLength = max;
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
multiple(multiple = true) {
|
|
157
|
+
this.fieldConfig.multiple = multiple;
|
|
158
|
+
}
|
|
159
|
+
valueChanges(fn) {
|
|
160
|
+
this.fieldConfig.valueChanges = fn;
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
setValue(value) {
|
|
164
|
+
this.fieldConfig.value = value;
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
appearance(type = "outline", floatLabel = "always") {
|
|
168
|
+
this.fieldConfig.appearance = type;
|
|
169
|
+
this.fieldConfig.floatLabel = floatLabel;
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
grid(size = 12, width = 100) {
|
|
173
|
+
var _a;
|
|
174
|
+
if (this.deviceService.isMobile()) {
|
|
175
|
+
size = 12;
|
|
176
|
+
}
|
|
177
|
+
for (let colSize = 12; colSize >= 1; colSize--) {
|
|
178
|
+
this.fieldConfig.class = (_a = this.fieldConfig.class) === null || _a === void 0 ? void 0 : _a.replace('col-' + colSize, '');
|
|
179
|
+
}
|
|
180
|
+
this.addClass('col-' + size);
|
|
181
|
+
this.addFieldClass('w-' + width);
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
setOptions(options) {
|
|
185
|
+
this.fieldConfig.opcoesSelect = options;
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
addClass(className) {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
if (this.deviceService.isMobile() &&
|
|
191
|
+
className.indexOf('col-') >= 0 &&
|
|
192
|
+
className.indexOf('col-12') === 0) {
|
|
193
|
+
className = className.replace('col-1', 'col-12')
|
|
194
|
+
.replace('col-2', 'col-12')
|
|
195
|
+
.replace('col-3', 'col-12')
|
|
196
|
+
.replace('col-4', 'col-12')
|
|
197
|
+
.replace('col-5', 'col-12')
|
|
198
|
+
.replace('col-6', 'col-12')
|
|
199
|
+
.replace('col-7', 'col-12')
|
|
200
|
+
.replace('col-8', 'col-12')
|
|
201
|
+
.replace('col-9', 'col-12')
|
|
202
|
+
.replace('col-10', 'col-12')
|
|
203
|
+
.replace('col-11', 'col-12');
|
|
204
|
+
}
|
|
205
|
+
this.fieldConfig.class = koala(`${(_b = (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.class) !== null && _b !== void 0 ? _b : ''} ${className}`)
|
|
206
|
+
.string()
|
|
207
|
+
.split(' ')
|
|
208
|
+
.clearEmptyValues()
|
|
209
|
+
.toString(' ')
|
|
210
|
+
.getValue();
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
addFieldClass(className) {
|
|
214
|
+
var _a, _b;
|
|
215
|
+
this.fieldConfig.fieldClass = koala(`${(_b = (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.fieldClass) !== null && _b !== void 0 ? _b : ''} ${className}`)
|
|
216
|
+
.string()
|
|
217
|
+
.split(' ')
|
|
218
|
+
.clearEmptyValues()
|
|
219
|
+
.toString(' ')
|
|
220
|
+
.getValue();
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
setCustomMasc(mask) {
|
|
224
|
+
this.fieldConfig.customMasc = mask;
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
generate() {
|
|
228
|
+
let getLastConfig = (this.formConfig.formConfig.length > 0) ?
|
|
229
|
+
this.formConfig.formConfig[this.formConfig.formConfig.length - 1] :
|
|
230
|
+
null;
|
|
231
|
+
if ((getLastConfig === null || getLastConfig === void 0 ? void 0 : getLastConfig.type) === DynamicFormTypeFieldEnum.moreItems && (getLastConfig === null || getLastConfig === void 0 ? void 0 : getLastConfig.name) !== 'endMoreItems') {
|
|
232
|
+
this.formConfig.formConfig[this.formConfig.formConfig.length - 1].moreItemsConfig.formConfig.push(this.fieldConfig);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
if ((getLastConfig === null || getLastConfig === void 0 ? void 0 : getLastConfig.name) === 'endMoreItems') {
|
|
236
|
+
this.formConfig.formConfig.splice(this.formConfig.formConfig.length - 1, 1);
|
|
237
|
+
}
|
|
238
|
+
this.formConfig.formConfig.push(this.fieldConfig);
|
|
239
|
+
}
|
|
240
|
+
return new DynamicFormBuilder(this.fb, this.deviceService, this.formConfig.formConfig);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
class AutocompleteBuilder extends FieldBase {
|
|
245
|
+
constructor(label, name, formConfig, fb, deviceService) {
|
|
246
|
+
super(label, name, DynamicFormTypeFieldEnum.autocomplete, formConfig, fb, deviceService);
|
|
247
|
+
}
|
|
248
|
+
service(service) {
|
|
249
|
+
this.service$ = service;
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
defaultValueOnClean(value) {
|
|
253
|
+
this.fieldConfig.autocompleteDefaultValueOnClear = value;
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
loadOptions(type, onDemandFilter) {
|
|
257
|
+
this.fieldConfig.autocompleteType = type;
|
|
258
|
+
if (type === "all") {
|
|
259
|
+
const options$ = new BehaviorSubject([]);
|
|
260
|
+
this.service$.subscribe(options => options$.next(options));
|
|
261
|
+
this.fieldConfig.autocompleteOptions = options$;
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
this.fieldConfig.autocompleteFilter = onDemandFilter;
|
|
265
|
+
}
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
colorChipConfig(fn) {
|
|
269
|
+
this.fieldConfig.autocompleteMultipleConfig = new BehaviorSubject(null);
|
|
270
|
+
fn(this.fieldConfig.autocompleteMultipleConfig);
|
|
271
|
+
return this;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
class FieldBuilder extends FieldBase {
|
|
276
|
+
constructor(label, name, type, formConfig, fb, deviceService) {
|
|
277
|
+
super(label, name, type, formConfig, fb, deviceService);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
class MoreItemsBuilder {
|
|
282
|
+
constructor(label, name, btnAddLabel, min, max, formConfig, fb, deviceService) {
|
|
283
|
+
this.label = label;
|
|
284
|
+
this.name = name;
|
|
285
|
+
this.btnAddLabel = btnAddLabel;
|
|
286
|
+
this.min = min;
|
|
287
|
+
this.max = max;
|
|
288
|
+
this.formConfig = formConfig;
|
|
289
|
+
this.fb = fb;
|
|
290
|
+
this.deviceService = deviceService;
|
|
291
|
+
}
|
|
292
|
+
build() {
|
|
293
|
+
let getLastConfig = (this.formConfig.formConfig.length > 0) ?
|
|
294
|
+
this.formConfig.formConfig[this.formConfig.formConfig.length - 1] :
|
|
295
|
+
null;
|
|
296
|
+
this.fieldConfig = {
|
|
297
|
+
label: this.label,
|
|
298
|
+
name: this.name,
|
|
299
|
+
type: DynamicFormTypeFieldEnum.moreItems,
|
|
300
|
+
moreItemsIconBackgroundColor: '#fff',
|
|
301
|
+
moreItemsIconFontColor: '#212121',
|
|
302
|
+
moreItemsMinItems: this.min,
|
|
303
|
+
moreItemsMaxItems: this.max,
|
|
304
|
+
moreItemsButtonIconAddlabel: this.btnAddLabel,
|
|
305
|
+
moreItemsConfig: {
|
|
306
|
+
form: this.fb.group({}),
|
|
307
|
+
formConfig: [],
|
|
308
|
+
setValues: new BehaviorSubject([])
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
if ((getLastConfig === null || getLastConfig === void 0 ? void 0 : getLastConfig.type) === DynamicFormTypeFieldEnum.moreItems && (getLastConfig === null || getLastConfig === void 0 ? void 0 : getLastConfig.name) !== 'endMoreItems') {
|
|
312
|
+
let formConfigMoreItems = getLastConfig.moreItemsConfig.formConfig;
|
|
313
|
+
if (formConfigMoreItems.length > 0) {
|
|
314
|
+
let lastIndexMoreItems = 0;
|
|
315
|
+
formConfigMoreItems.forEach((item, index) => {
|
|
316
|
+
if (item.type === DynamicFormTypeFieldEnum.moreItems)
|
|
317
|
+
lastIndexMoreItems = index;
|
|
318
|
+
});
|
|
319
|
+
formConfigMoreItems[lastIndexMoreItems].moreItemsConfig.formConfig.push(this.fieldConfig);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
this.formConfig.formConfig[this.formConfig.formConfig.length - 1].moreItemsConfig.formConfig.push(this.fieldConfig);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
if ((getLastConfig === null || getLastConfig === void 0 ? void 0 : getLastConfig.name) === 'endMoreItems') {
|
|
327
|
+
this.formConfig.formConfig.splice(this.formConfig.formConfig.length - 1, 1);
|
|
328
|
+
}
|
|
329
|
+
this.formConfig.formConfig.push(this.fieldConfig);
|
|
330
|
+
}
|
|
331
|
+
return new DynamicFormBuilder(this.fb, this.deviceService, this.formConfig.formConfig);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
class DynamicFormBuilder {
|
|
336
|
+
constructor(fb, deviceService, configInMemory) {
|
|
337
|
+
this.fb = fb;
|
|
338
|
+
this.deviceService = deviceService;
|
|
339
|
+
this.config = {
|
|
340
|
+
form: fb.group({}),
|
|
341
|
+
formConfig: configInMemory !== null && configInMemory !== void 0 ? configInMemory : [],
|
|
342
|
+
setValues: new BehaviorSubject(null),
|
|
343
|
+
showFields: new BehaviorSubject(null)
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
field(label, name, type) {
|
|
347
|
+
switch (type) {
|
|
348
|
+
case "id":
|
|
349
|
+
case "text":
|
|
350
|
+
case "textarea":
|
|
351
|
+
case "number":
|
|
352
|
+
case "stringNumber":
|
|
353
|
+
case "cnpj":
|
|
354
|
+
case "cpf":
|
|
355
|
+
case "coin":
|
|
356
|
+
case "color":
|
|
357
|
+
case "date":
|
|
358
|
+
case "datetime":
|
|
359
|
+
case "email":
|
|
360
|
+
case "float":
|
|
361
|
+
case "password":
|
|
362
|
+
case "percent":
|
|
363
|
+
case "phone":
|
|
364
|
+
case "time":
|
|
365
|
+
case "hoursAndMinutes":
|
|
366
|
+
case "textLogs":
|
|
367
|
+
case "valueList":
|
|
368
|
+
case "checkbox":
|
|
369
|
+
case "radio":
|
|
370
|
+
case "select":
|
|
371
|
+
case "selectMultipleNative":
|
|
372
|
+
case "month":
|
|
373
|
+
case "competenceDate":
|
|
374
|
+
case "stringWithCustomMasc":
|
|
375
|
+
return new FieldBuilder(label, name, DynamicFormTypeFieldEnum[type], this.config, this.fb, this.deviceService);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
autocomplete(label, name) {
|
|
379
|
+
return new AutocompleteBuilder(label, name, this.config, this.fb, this.deviceService);
|
|
380
|
+
}
|
|
381
|
+
simpleMoreItems(label, name, btnAddLabel, min, max) {
|
|
382
|
+
return new MoreItemsBuilder(label, name, btnAddLabel, min, max, this.config, this.fb, this.deviceService);
|
|
383
|
+
}
|
|
384
|
+
autofill(object) {
|
|
385
|
+
if (object) {
|
|
386
|
+
const setValues = [];
|
|
387
|
+
Object.keys(object).forEach(indexName => {
|
|
388
|
+
var _a;
|
|
389
|
+
const arrField = koala(this.config.formConfig).array().filter(indexName, 'name').getValue();
|
|
390
|
+
const field = (_a = arrField[0]) !== null && _a !== void 0 ? _a : null;
|
|
391
|
+
if (typeof object[indexName] !== "object" ||
|
|
392
|
+
field.type === DynamicFormTypeFieldEnum.autocomplete ||
|
|
393
|
+
field.type === DynamicFormTypeFieldEnum.selectMultipleNative) {
|
|
394
|
+
if ((field === null || field === void 0 ? void 0 : field.type) === DynamicFormTypeFieldEnum.textLogs) {
|
|
395
|
+
field.textObs = object[indexName];
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
setValues.push({
|
|
399
|
+
name: indexName,
|
|
400
|
+
value: object[indexName]
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
if (field.type === DynamicFormTypeFieldEnum.moreItems) {
|
|
406
|
+
const setValuesMoreItems = [];
|
|
407
|
+
const objectMoreItems = object[indexName];
|
|
408
|
+
objectMoreItems.forEach(objectItem => {
|
|
409
|
+
const moreItemValues = [];
|
|
410
|
+
Object.keys(objectItem).forEach(objectIndexName => {
|
|
411
|
+
moreItemValues.push({
|
|
412
|
+
name: objectIndexName,
|
|
413
|
+
value: objectItem[objectIndexName]
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
setValuesMoreItems.push(new BehaviorSubject(moreItemValues));
|
|
417
|
+
});
|
|
418
|
+
field.moreItemsConfig.setValues.next(setValuesMoreItems);
|
|
419
|
+
}
|
|
420
|
+
else if (field.type === DynamicFormTypeFieldEnum.dynamicForm) {
|
|
421
|
+
const dynamicFormObject = object[indexName];
|
|
422
|
+
const dynamicFormSetValues = [];
|
|
423
|
+
Object.keys(dynamicFormObject).forEach(dynamicFormIndexName => {
|
|
424
|
+
var _a;
|
|
425
|
+
const arrDynamicField = koala(field.dynamicFormConfig.formConfig).array().filter(indexName, 'name').getValue();
|
|
426
|
+
const dynamicField = (_a = arrDynamicField[0]) !== null && _a !== void 0 ? _a : null;
|
|
427
|
+
if ((dynamicField === null || dynamicField === void 0 ? void 0 : dynamicField.type) === DynamicFormTypeFieldEnum.textLogs) {
|
|
428
|
+
dynamicField.textObs = object[indexName];
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
dynamicFormSetValues.push({
|
|
432
|
+
name: dynamicFormIndexName,
|
|
433
|
+
value: dynamicFormObject[dynamicFormIndexName]
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
field.dynamicFormConfig.setValues.next(dynamicFormSetValues);
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
this.autofill(object[indexName]);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
this.config.setValues.next(setValues);
|
|
445
|
+
}
|
|
446
|
+
return this;
|
|
447
|
+
}
|
|
448
|
+
literalConfig(config) {
|
|
449
|
+
this.config.formConfig.push(config);
|
|
450
|
+
if (config.type === DynamicFormTypeFieldEnum.moreItems)
|
|
451
|
+
this.generateMoreItems();
|
|
452
|
+
return this;
|
|
453
|
+
}
|
|
454
|
+
generate() {
|
|
455
|
+
this.config.formConfig = this.config.formConfig.filter(config => config.name !== 'endMoreItems');
|
|
456
|
+
return this.config;
|
|
457
|
+
}
|
|
458
|
+
generateMoreItems() {
|
|
459
|
+
this.config.formConfig.push({
|
|
460
|
+
name: 'endMoreItems',
|
|
461
|
+
type: DynamicFormTypeFieldEnum.moreItems
|
|
462
|
+
});
|
|
463
|
+
return new DynamicFormBuilder(this.fb, this.deviceService, this.config.formConfig);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function DateMinValidator(min) {
|
|
468
|
+
return (control) => {
|
|
469
|
+
if (control.value && typeof min === 'string') {
|
|
470
|
+
if (new Date(control.value) < new Date(min)) {
|
|
471
|
+
return { dateMin: true };
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return null;
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function DateMaxValidator(max) {
|
|
479
|
+
return (control) => {
|
|
480
|
+
if (control.value && typeof max === 'string') {
|
|
481
|
+
if (new Date(control.value) > new Date(max)) {
|
|
482
|
+
return { dateMax: true };
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
return null;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
class KoalaDynamicFormService {
|
|
490
|
+
constructor(fb, deviceService) {
|
|
491
|
+
this.fb = fb;
|
|
492
|
+
this.deviceService = deviceService;
|
|
493
|
+
}
|
|
494
|
+
build() {
|
|
495
|
+
return new DynamicFormBuilder(this.fb, this.deviceService);
|
|
496
|
+
}
|
|
497
|
+
updateValidator(formGroup, name, type, value) {
|
|
498
|
+
if (type === 'required' && typeof value !== 'boolean') {
|
|
499
|
+
throw new Error(`Type required cannot be a ${typeof value}`);
|
|
500
|
+
}
|
|
501
|
+
else if ((type === 'min' || type === 'max') && typeof value === "boolean") {
|
|
502
|
+
throw new Error(`Type ${type} cannot be a boolean`);
|
|
503
|
+
}
|
|
504
|
+
const formArray = formGroup.get('formData');
|
|
505
|
+
const control = formArray.controls.find(control => control.get('name').value === name);
|
|
506
|
+
if (control) {
|
|
507
|
+
const currentRequired = control.get('required').value;
|
|
508
|
+
const currentMin = control.get('min').value;
|
|
509
|
+
const currentMax = control.get('max').value;
|
|
510
|
+
const validators = [];
|
|
511
|
+
control.get('value').clearValidators();
|
|
512
|
+
control.get('value').setErrors(null);
|
|
513
|
+
if ((type === "required" && value) || currentRequired) {
|
|
514
|
+
validators.push(Validators.required);
|
|
515
|
+
control.get('value').setErrors({ required: true });
|
|
516
|
+
}
|
|
517
|
+
if ((type === "min" || currentMin)) {
|
|
518
|
+
if (typeof value === "number") {
|
|
519
|
+
validators.push(Validators.min((type === "min" ? value : currentMin)));
|
|
520
|
+
control.get('value').setErrors({ min: true });
|
|
521
|
+
}
|
|
522
|
+
else if (typeof value === "string") {
|
|
523
|
+
validators.push(DateMinValidator((type === "min" ? value : currentMin)));
|
|
524
|
+
control.get('value').setErrors({ dateMin: true });
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if ((type === "max" || currentMax)) {
|
|
528
|
+
if (typeof value === "number") {
|
|
529
|
+
validators.push(Validators.max((type === "max" ? value : currentMax)));
|
|
530
|
+
control.get('value').setErrors({ max: true });
|
|
531
|
+
}
|
|
532
|
+
else if (typeof value === "string") {
|
|
533
|
+
validators.push(DateMaxValidator((type === "max" ? value : currentMax)));
|
|
534
|
+
control.get('value').setErrors({ dateMax: true });
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (type === "required") {
|
|
538
|
+
control.get('required').setValue(value);
|
|
539
|
+
}
|
|
540
|
+
else if (type === "min") {
|
|
541
|
+
control.get('min').setValue(value);
|
|
542
|
+
}
|
|
543
|
+
else if (type === "max") {
|
|
544
|
+
control.get('max').setValue(value);
|
|
545
|
+
}
|
|
546
|
+
control.get('value').setValidators(validators);
|
|
547
|
+
control.get('value').updateValueAndValidity();
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
emitData(form) {
|
|
551
|
+
const data = {};
|
|
552
|
+
const formArray = form.get('formData');
|
|
553
|
+
formArray === null || formArray === void 0 ? void 0 : formArray.controls.forEach(control => {
|
|
554
|
+
var _a;
|
|
555
|
+
if (control.get('show').value.getValue() !== false) {
|
|
556
|
+
let value = control.get('value').value;
|
|
557
|
+
if (control.get('type').value === DynamicFormTypeFieldEnum.valueList) {
|
|
558
|
+
if (value === null || value === undefined) {
|
|
559
|
+
value = '';
|
|
560
|
+
}
|
|
561
|
+
value = koala(value).string().split().getValue();
|
|
562
|
+
}
|
|
563
|
+
else if (control.get('type').value === DynamicFormTypeFieldEnum.moreItems) {
|
|
564
|
+
const moreItems = control.get('moreItemsConfig').value;
|
|
565
|
+
value = [];
|
|
566
|
+
moreItems.forEach(item => {
|
|
567
|
+
value.push(this.emitData(item.form));
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
else if (control.get('type').value === DynamicFormTypeFieldEnum.autocomplete) {
|
|
571
|
+
if (control.get('multiple').value) {
|
|
572
|
+
const options = control.get('autocompleteSelectedValue').value;
|
|
573
|
+
value = options === null || options === void 0 ? void 0 : options.map(item => item === null || item === void 0 ? void 0 : item.value);
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
value = (((_a = control.get('autocompleteSelectedValue').value) === null || _a === void 0 ? void 0 : _a.value) ?
|
|
577
|
+
control.get('autocompleteSelectedValue').value.value :
|
|
578
|
+
control.get('autocompleteSelectedValue').value);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
else if (control.get('type').value === DynamicFormTypeFieldEnum.dynamicForm) {
|
|
582
|
+
const dynamicFormConfig = control.get('dynamicFormConfig').value;
|
|
583
|
+
value = this.emitData(dynamicFormConfig.getValue().form);
|
|
584
|
+
}
|
|
585
|
+
else if (control.get('type').value === DynamicFormTypeFieldEnum.number) {
|
|
586
|
+
value = parseInt(value);
|
|
587
|
+
}
|
|
588
|
+
else if ((control.get('type').value === DynamicFormTypeFieldEnum.float ||
|
|
589
|
+
control.get('type').value === DynamicFormTypeFieldEnum.percent) && typeof value === "string") {
|
|
590
|
+
value = parseFloat(value.replace(/,/g, '.'));
|
|
591
|
+
}
|
|
592
|
+
else if (control.get('type').value === DynamicFormTypeFieldEnum.coin &&
|
|
593
|
+
typeof value === "string") {
|
|
594
|
+
value = koala(value).string().unmaskCoin().getValue();
|
|
595
|
+
}
|
|
596
|
+
data[control.get('name').value] = value;
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
return data;
|
|
600
|
+
}
|
|
601
|
+
resetForm(form) {
|
|
602
|
+
const formArray = form.get('formData');
|
|
603
|
+
formArray.controls.forEach(control => {
|
|
604
|
+
if (control.get('type').value === DynamicFormTypeFieldEnum.moreItems) {
|
|
605
|
+
control.get('moreItemsConfig').setValue([]);
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
control.get('value').reset();
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
setValuesInMoreItemsForm(subject, values) {
|
|
613
|
+
const valuesMoreItems = [];
|
|
614
|
+
values.forEach(itemValue => {
|
|
615
|
+
valuesMoreItems.push(new BehaviorSubject(itemValue));
|
|
616
|
+
});
|
|
617
|
+
subject.next(valuesMoreItems);
|
|
618
|
+
}
|
|
619
|
+
autocompleteFilterOnServer(request, nameConfig, indexNameByValue) {
|
|
620
|
+
return new Observable(observe => {
|
|
621
|
+
request().then(response => {
|
|
622
|
+
const options = [];
|
|
623
|
+
response.forEach(item => {
|
|
624
|
+
var _a;
|
|
625
|
+
let value = '';
|
|
626
|
+
if ((indexNameByValue === null || indexNameByValue === void 0 ? void 0 : indexNameByValue.indexOf(' > ')) >= 0) {
|
|
627
|
+
value = this.getValueByStringPath(indexNameByValue, item);
|
|
628
|
+
}
|
|
629
|
+
else if (indexNameByValue) {
|
|
630
|
+
value = item[indexNameByValue];
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
value = item;
|
|
634
|
+
}
|
|
635
|
+
options.push({
|
|
636
|
+
name: koala(item).object().toString(nameConfig.propsByName, ((_a = nameConfig.delimiter) !== null && _a !== void 0 ? _a : ' ')).getValue(),
|
|
637
|
+
value
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
observe.next(options);
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
showFields(subject, names, show, clearCurrentValue = false) {
|
|
645
|
+
const fields = [];
|
|
646
|
+
names.forEach(name => {
|
|
647
|
+
fields.push({
|
|
648
|
+
name,
|
|
649
|
+
show,
|
|
650
|
+
clearCurrentValue
|
|
651
|
+
});
|
|
652
|
+
});
|
|
653
|
+
subject.next(fields);
|
|
654
|
+
}
|
|
655
|
+
getValueByStringPath(indexNameByValue, item) {
|
|
656
|
+
let value;
|
|
657
|
+
const partsIndex = indexNameByValue.split(' > ');
|
|
658
|
+
let partIndex = 0;
|
|
659
|
+
do {
|
|
660
|
+
if (!value) {
|
|
661
|
+
value = item[partsIndex[partIndex]];
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
value = value[partsIndex[partIndex]];
|
|
665
|
+
}
|
|
666
|
+
partIndex++;
|
|
667
|
+
} while (partIndex < partsIndex.length);
|
|
668
|
+
return value;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
KoalaDynamicFormService.ɵprov = i0.ɵɵdefineInjectable({ factory: function KoalaDynamicFormService_Factory() { return new KoalaDynamicFormService(i0.ɵɵinject(i1.FormBuilder), i0.ɵɵinject(i2.DeviceDetectorService)); }, token: KoalaDynamicFormService, providedIn: "any" });
|
|
672
|
+
KoalaDynamicFormService.decorators = [
|
|
673
|
+
{ type: Injectable, args: [{ providedIn: "any" },] }
|
|
674
|
+
];
|
|
675
|
+
KoalaDynamicFormService.ctorParameters = () => [
|
|
676
|
+
{ type: FormBuilder },
|
|
677
|
+
{ type: DeviceDetectorService }
|
|
678
|
+
];
|
|
679
|
+
|
|
680
|
+
class ValidationHelper {
|
|
681
|
+
static validateCpf(value) {
|
|
682
|
+
function calcChecker1(digits) {
|
|
683
|
+
let sum = null;
|
|
684
|
+
for (let j = 0; j < 9; ++j) {
|
|
685
|
+
sum += digits.toString().charAt(j) * (10 - j);
|
|
686
|
+
}
|
|
687
|
+
const lastSumChecker1 = sum % 11;
|
|
688
|
+
return lastSumChecker1 < 2 ? 0 : 11 - lastSumChecker1;
|
|
689
|
+
}
|
|
690
|
+
function calcChecker2(cpfWithChecker1) {
|
|
691
|
+
let sum = null;
|
|
692
|
+
for (let k = 0; k < 10; ++k) {
|
|
693
|
+
sum += cpfWithChecker1.toString().charAt(k) * (11 - k);
|
|
694
|
+
}
|
|
695
|
+
const lastSumChecker2 = sum % 11;
|
|
696
|
+
return lastSumChecker2 < 2 ? 0 : 11 - lastSumChecker2;
|
|
697
|
+
}
|
|
698
|
+
const cleanCPF = value.replace(/\.|\-|\s/g, '');
|
|
699
|
+
const firstNineDigits = cleanCPF.substring(0, 9);
|
|
700
|
+
const checker = cleanCPF.substring(9, 11);
|
|
701
|
+
if (cleanCPF.length !== 11) {
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
// Checking if all digits are equal
|
|
705
|
+
for (let i = 0; i < 10; i++) {
|
|
706
|
+
if ('' + firstNineDigits + checker === Array(12).join(`${i}`)) {
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
const checker1 = calcChecker1(firstNineDigits);
|
|
711
|
+
const checker2 = calcChecker2(firstNineDigits + '' + checker1);
|
|
712
|
+
return checker.toString() === checker1.toString() + checker2.toString();
|
|
713
|
+
}
|
|
714
|
+
static validateCnpj(value) {
|
|
715
|
+
value = value.replace(/[^\d]+/g, '');
|
|
716
|
+
if (value === '') {
|
|
717
|
+
return false;
|
|
718
|
+
}
|
|
719
|
+
if (value.length !== 14) {
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
// Elimina CNPJs invalidos conhecidos
|
|
723
|
+
if (value === '00000000000000' ||
|
|
724
|
+
value === '11111111111111' ||
|
|
725
|
+
value === '22222222222222' ||
|
|
726
|
+
value === '33333333333333' ||
|
|
727
|
+
value === '44444444444444' ||
|
|
728
|
+
value === '55555555555555' ||
|
|
729
|
+
value === '66666666666666' ||
|
|
730
|
+
value === '77777777777777' ||
|
|
731
|
+
value === '88888888888888' ||
|
|
732
|
+
value === '99999999999999') {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
// Valida DVs
|
|
736
|
+
let tamanho = value.length - 2;
|
|
737
|
+
let numeros = value.substring(0, tamanho);
|
|
738
|
+
const digitos = value.substring(tamanho);
|
|
739
|
+
let soma = 0;
|
|
740
|
+
let pos = tamanho - 7;
|
|
741
|
+
for (let i = tamanho; i >= 1; i--) {
|
|
742
|
+
soma += parseInt(numeros.charAt(tamanho - i), 10) * pos--;
|
|
743
|
+
if (pos < 2) {
|
|
744
|
+
pos = 9;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
let resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
|
|
748
|
+
if (resultado !== parseInt(digitos.charAt(0), 10)) {
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
tamanho = tamanho + 1;
|
|
752
|
+
numeros = value.substring(0, tamanho);
|
|
753
|
+
soma = 0;
|
|
754
|
+
pos = tamanho - 7;
|
|
755
|
+
for (let i = tamanho; i >= 1; i--) {
|
|
756
|
+
soma += parseInt(numeros.charAt(tamanho - i), 10) * pos--;
|
|
757
|
+
if (pos < 2) {
|
|
758
|
+
pos = 9;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
|
|
762
|
+
return !(resultado !== parseInt(digitos.charAt(1), 10));
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
function CpfValidator(control) {
|
|
767
|
+
if (control.value) {
|
|
768
|
+
if (control.value.length <= 14 && !ValidationHelper.validateCpf(control.value)) {
|
|
769
|
+
return { cpfInvalid: true };
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
return null;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
function CnpjValidator(control) {
|
|
776
|
+
if (control.value) {
|
|
777
|
+
if (control.value.length > 14 && !ValidationHelper.validateCnpj(control.value)) {
|
|
778
|
+
return { cnpjInvalid: true };
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
return null;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
function AutocompleteSelectedValidator(control) {
|
|
785
|
+
if (control.value &&
|
|
786
|
+
control.value.hasOwnProperty('value') &&
|
|
787
|
+
control.value.hasOwnProperty('name') &&
|
|
788
|
+
Object.keys(control.value).length === 2) {
|
|
789
|
+
return null;
|
|
790
|
+
}
|
|
791
|
+
return { autocompleteSelected: true };
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
class KoalaDynamicFormValidatorResultHelper {
|
|
795
|
+
static generate(errorMessage) {
|
|
796
|
+
return {
|
|
797
|
+
customError: {
|
|
798
|
+
message: errorMessage
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
class ShowInvalidFields {
|
|
805
|
+
constructor() {
|
|
806
|
+
}
|
|
807
|
+
isErrorState(control, form) {
|
|
808
|
+
const isSubmitted = form && form.submitted;
|
|
809
|
+
return !!(control && control.invalid && (control.errors || control.dirty || control.touched || isSubmitted));
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
class FormAbstract {
|
|
814
|
+
constructor(formAbstract) {
|
|
815
|
+
this.formAbstract = formAbstract;
|
|
816
|
+
this.loader = new BehaviorSubject(false);
|
|
817
|
+
this.btnSubmitDisabled = false;
|
|
818
|
+
this.getData = new BehaviorSubject(false);
|
|
819
|
+
}
|
|
820
|
+
selecionarAutocomplete(controlName, obj, indexName) {
|
|
821
|
+
if (obj) {
|
|
822
|
+
let value = indexName ? obj[indexName] : obj;
|
|
823
|
+
if (Array.isArray(obj)) {
|
|
824
|
+
value = [];
|
|
825
|
+
obj.forEach(item => {
|
|
826
|
+
value.push(indexName ? item[indexName] : item);
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
this.formAbstract().get(controlName).setValue(value);
|
|
830
|
+
}
|
|
831
|
+
else {
|
|
832
|
+
this.formAbstract().get(controlName).setValue('');
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
btnClickGetData() {
|
|
836
|
+
this.getData.next(true);
|
|
837
|
+
}
|
|
838
|
+
enableShowInvalidFields() {
|
|
839
|
+
this.showInvalidFields = new ShowInvalidFields();
|
|
840
|
+
}
|
|
841
|
+
loading(show = true, btnLabel) {
|
|
842
|
+
this.btnSubmitDisabled = show;
|
|
843
|
+
this.loader.next(show);
|
|
844
|
+
if (show) {
|
|
845
|
+
this.btnLabel = btnLabel ? btnLabel : 'Enviando Dados...';
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
this.btnLabel = btnLabel ? btnLabel : 'Enviar';
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
class DynamicFormComponent extends FormAbstract {
|
|
854
|
+
constructor(fb, dynamicFormService) {
|
|
855
|
+
super(() => this.form);
|
|
856
|
+
this.fb = fb;
|
|
857
|
+
this.dynamicFormService = dynamicFormService;
|
|
858
|
+
this.tabIndexStart = 1;
|
|
859
|
+
this.typeField = DynamicFormTypeFieldEnum;
|
|
860
|
+
this.hoursAndMinutesMask = '00:000';
|
|
861
|
+
this.errorMessage = KoalaLanguageHelper;
|
|
862
|
+
}
|
|
863
|
+
ngOnInit() {
|
|
864
|
+
var _a;
|
|
865
|
+
if (!this.form.get('formData')) {
|
|
866
|
+
this.form.addControl('formData', this.fb.array([]));
|
|
867
|
+
}
|
|
868
|
+
this.controls = this.form.get('formData');
|
|
869
|
+
(_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.forEach((config, indexConfig) => {
|
|
870
|
+
const newFormGroup = this.newControl(config);
|
|
871
|
+
if (config.asyncValidators) {
|
|
872
|
+
newFormGroup.get('value').setAsyncValidators(config.asyncValidators);
|
|
873
|
+
}
|
|
874
|
+
newFormGroup.get('value').updateValueAndValidity();
|
|
875
|
+
if (config.type === DynamicFormTypeFieldEnum.dynamicForm) {
|
|
876
|
+
const formGroupDynamicFormsSubject = newFormGroup.get('dynamicFormConfig').value;
|
|
877
|
+
formGroupDynamicFormsSubject.subscribe(formGroupConfig => {
|
|
878
|
+
if (formGroupConfig) {
|
|
879
|
+
formGroupConfig.form.valueChanges.subscribe(() => {
|
|
880
|
+
if (formGroupConfig.form.valid && (config.valueChanges || this.showFieldsMoreItensConfig)) {
|
|
881
|
+
const value = this.dynamicFormService.emitData(formGroupConfig.form);
|
|
882
|
+
newFormGroup.get('value').setValue(value);
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
if (config.valueChanges ||
|
|
889
|
+
config.type === DynamicFormTypeFieldEnum.autocomplete ||
|
|
890
|
+
config.type === DynamicFormTypeFieldEnum.dynamicForm ||
|
|
891
|
+
this.showFieldsMoreItensConfig) {
|
|
892
|
+
if (config.type === DynamicFormTypeFieldEnum.autocomplete) {
|
|
893
|
+
const autocompleteOptionsSubject = newFormGroup.get('autocompleteOptions').value;
|
|
894
|
+
if (autocompleteOptionsSubject) {
|
|
895
|
+
autocompleteOptionsSubject.subscribe(options => newFormGroup.get('autocompleteOptionsFiltered').value.next(options));
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
newFormGroup.get('value')
|
|
899
|
+
.valueChanges
|
|
900
|
+
.pipe(debounceTime(300))
|
|
901
|
+
.subscribe((value) => __awaiter(this, void 0, void 0, function* () {
|
|
902
|
+
var _a, _b, _c, _d;
|
|
903
|
+
yield this.setConfigDynamicForm(newFormGroup);
|
|
904
|
+
if (config.type === DynamicFormTypeFieldEnum.autocomplete) {
|
|
905
|
+
if (value && (value.hasOwnProperty('value') &&
|
|
906
|
+
value.hasOwnProperty('name') &&
|
|
907
|
+
Object.keys(value).length === 2) || (Array.isArray(value) &&
|
|
908
|
+
value.length > 0 &&
|
|
909
|
+
newFormGroup.get('multiple').value)) {
|
|
910
|
+
if (newFormGroup.get('multiple').value) {
|
|
911
|
+
if (Array.isArray(value)) {
|
|
912
|
+
for (const itemValue of value.values()) {
|
|
913
|
+
newFormGroup.get('autocompleteSelectedValue').value.push(itemValue);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
else {
|
|
917
|
+
newFormGroup.get('autocompleteSelectedValue').value.push(value);
|
|
918
|
+
}
|
|
919
|
+
if ((_a = this.autocompleteInput) === null || _a === void 0 ? void 0 : _a.nativeElement) {
|
|
920
|
+
this.autocompleteInput.nativeElement.value = '';
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
newFormGroup.get('autocompleteSelectedValue').setValue(value);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
else if (!newFormGroup.get('multiple').value) {
|
|
928
|
+
newFormGroup.get('autocompleteSelectedValue').setValue((_c = (_b = koala(this.formConfig)
|
|
929
|
+
.array()
|
|
930
|
+
.filter(newFormGroup.get('name').value, 'name')
|
|
931
|
+
.getValue()[0]) === null || _b === void 0 ? void 0 : _b.autocompleteDefaultValueOnClear) !== null && _c !== void 0 ? _c : null);
|
|
932
|
+
}
|
|
933
|
+
if (config.type === DynamicFormTypeFieldEnum.autocomplete) {
|
|
934
|
+
if (config.autocompleteType === 'all') {
|
|
935
|
+
const autocompleteOptionsSubject = newFormGroup.get('autocompleteOptions').value;
|
|
936
|
+
newFormGroup.get('autocompleteOptionsFiltered').value.next(this.autocompleteFilter(autocompleteOptionsSubject.value, value));
|
|
937
|
+
}
|
|
938
|
+
else if (config.autocompleteType === 'onDemand' && typeof value !== "object") {
|
|
939
|
+
const loader = newFormGroup.get('autocompleteLoading').value;
|
|
940
|
+
loader.next(true);
|
|
941
|
+
config.autocompleteFilter(value).subscribe(options => {
|
|
942
|
+
newFormGroup.get('autocompleteOptionsFiltered').value.next(options);
|
|
943
|
+
loader.next(false);
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (config.valueChanges) {
|
|
949
|
+
if (config.type === DynamicFormTypeFieldEnum.autocomplete) {
|
|
950
|
+
config.valueChanges((newFormGroup.get('multiple').value ?
|
|
951
|
+
newFormGroup.get('autocompleteSelectedValue').value.map(item => item.value) :
|
|
952
|
+
(_d = newFormGroup.get('autocompleteSelectedValue').value) === null || _d === void 0 ? void 0 : _d.value));
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
config.valueChanges(value);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}));
|
|
959
|
+
}
|
|
960
|
+
this.controls.push(newFormGroup);
|
|
961
|
+
if (config.moreItemsConfig) {
|
|
962
|
+
if (config.moreItemsMinItems > 0) {
|
|
963
|
+
for (let min = 0; min < config.moreItemsMinItems; min++) {
|
|
964
|
+
if (min <= config.moreItemsMaxItems) {
|
|
965
|
+
this.addMoreItem(indexConfig);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
if (config.moreItemsConfig.setValues) {
|
|
970
|
+
config.moreItemsConfig
|
|
971
|
+
.setValues
|
|
972
|
+
.subscribe((values) => __awaiter(this, void 0, void 0, function* () {
|
|
973
|
+
if (values.length > 0) {
|
|
974
|
+
values.forEach((itemValue, indexValue) => {
|
|
975
|
+
if (!this.controls.controls[indexConfig].get('moreItemsConfig').value[indexValue]) {
|
|
976
|
+
this.addMoreItem(indexConfig);
|
|
977
|
+
}
|
|
978
|
+
setTimeout(() => {
|
|
979
|
+
this.setValuesOnFields(itemValue, this.controls.controls[indexConfig].get('moreItemsConfig').value[indexValue].form);
|
|
980
|
+
}, 300);
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
}));
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
if (this.showFields) {
|
|
988
|
+
this.changeVisibilityFields(this.showFields, this.form);
|
|
989
|
+
}
|
|
990
|
+
if (this.setValues) {
|
|
991
|
+
this.setValuesOnFields(this.setValues, this.form);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
hoursAndMinutesApplyMask(index, event) {
|
|
995
|
+
var _a;
|
|
996
|
+
const control = (_a = this.controls) === null || _a === void 0 ? void 0 : _a.controls[index];
|
|
997
|
+
const type = control === null || control === void 0 ? void 0 : control.get('type').value;
|
|
998
|
+
if (type === DynamicFormTypeFieldEnum.hoursAndMinutes) {
|
|
999
|
+
const value = control === null || control === void 0 ? void 0 : control.get('value').value;
|
|
1000
|
+
if (event.key == 'Backspace' && value.length < 6) {
|
|
1001
|
+
this.hoursAndMinutesMask = '00:000';
|
|
1002
|
+
}
|
|
1003
|
+
else if (event.key != 'Backspace' && value.length >= 6) {
|
|
1004
|
+
this.hoursAndMinutesMask = '000:00';
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
passwordView(index) {
|
|
1009
|
+
var _a;
|
|
1010
|
+
const control = (_a = this.controls) === null || _a === void 0 ? void 0 : _a.controls[index];
|
|
1011
|
+
const hidePassword = !(control === null || control === void 0 ? void 0 : control.get('hidePassword').value);
|
|
1012
|
+
control === null || control === void 0 ? void 0 : control.get('hidePassword').setValue(hidePassword);
|
|
1013
|
+
control === null || control === void 0 ? void 0 : control.get('type').setValue(hidePassword ?
|
|
1014
|
+
DynamicFormTypeFieldEnum.password :
|
|
1015
|
+
DynamicFormTypeFieldEnum.text);
|
|
1016
|
+
}
|
|
1017
|
+
addMoreItem(propIndex) {
|
|
1018
|
+
if (this.controls.controls[propIndex].get('moreItemsConfig').value.length < this.controls.controls[propIndex].get('moreItemsMaxItems').value) {
|
|
1019
|
+
const formGroup = this.fb.group({});
|
|
1020
|
+
this.controls.controls[propIndex].get('moreItemsConfig').value.push({
|
|
1021
|
+
form: formGroup,
|
|
1022
|
+
formConfig: this.formConfig[propIndex].moreItemsConfig.formConfig,
|
|
1023
|
+
showFields: new BehaviorSubject([]),
|
|
1024
|
+
showFieldsMoreItensConfig: this.formConfig[propIndex].moreItemsConfig.showFieldsConfig
|
|
1025
|
+
});
|
|
1026
|
+
this.controls.controls[propIndex].get('moreItemsExpanded').setValue(this.controls.controls[propIndex].get('moreItemsConfig').value.length - 1);
|
|
1027
|
+
const formArrayMoreItems = this.controls.controls[propIndex].get('moreItemsFormGroup');
|
|
1028
|
+
formArrayMoreItems.push(formGroup);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
removeMoreItem(propIndex, removeIndex) {
|
|
1032
|
+
const expandedItemIndex = removeIndex - 1;
|
|
1033
|
+
this.controls.controls[propIndex].get('moreItemsConfig').value.splice(removeIndex, 1);
|
|
1034
|
+
setTimeout(() => {
|
|
1035
|
+
this.controls.controls[propIndex].get('moreItemsExpanded').setValue((expandedItemIndex < 0) ? 0 : expandedItemIndex);
|
|
1036
|
+
}, 50);
|
|
1037
|
+
}
|
|
1038
|
+
clearAutocomplete(propIndex) {
|
|
1039
|
+
var _a, _b;
|
|
1040
|
+
if (this.controls.controls[propIndex].get('multiple').value) {
|
|
1041
|
+
this.controls.controls[propIndex].get('autocompleteSelectedValue').setValue([]);
|
|
1042
|
+
this.controls.controls[propIndex].get('value').setValue(null);
|
|
1043
|
+
}
|
|
1044
|
+
else {
|
|
1045
|
+
this.controls.controls[propIndex].get('autocompleteSelectedValue').setValue((_a = this.formConfig[propIndex].autocompleteDefaultValueOnClear) !== null && _a !== void 0 ? _a : null);
|
|
1046
|
+
this.controls.controls[propIndex].get('value').setValue((_b = this.formConfig[propIndex].autocompleteDefaultValueOnClear) !== null && _b !== void 0 ? _b : null);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
display(option) {
|
|
1050
|
+
return option ? option.name : undefined;
|
|
1051
|
+
}
|
|
1052
|
+
removeOptionOnAutocomplete(propIndex, option) {
|
|
1053
|
+
const value = this.controls.controls[propIndex].get('autocompleteSelectedValue').value.filter(item => item !== option);
|
|
1054
|
+
this.controls.controls[propIndex].get('autocompleteSelectedValue').setValue(value);
|
|
1055
|
+
if (value.length === 0) {
|
|
1056
|
+
this.controls.controls[propIndex].get('autocompleteSelectedValue').setValue([]);
|
|
1057
|
+
this.controls.controls[propIndex].get('value').setValue(null);
|
|
1058
|
+
}
|
|
1059
|
+
else if (this.formConfig[propIndex].valueChanges) {
|
|
1060
|
+
this.formConfig[propIndex].valueChanges(value.map(item => item.value));
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
getColorChip(config) {
|
|
1064
|
+
return config.color;
|
|
1065
|
+
}
|
|
1066
|
+
newControl(config) {
|
|
1067
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
1068
|
+
let validators = (_a = config.syncValidators) !== null && _a !== void 0 ? _a : [];
|
|
1069
|
+
let value = (_b = config.value) !== null && _b !== void 0 ? _b : '';
|
|
1070
|
+
let valueSelectedAutocomplete = (config.multiple ? [] : ((_c = config.autocompleteDefaultValueOnClear) !== null && _c !== void 0 ? _c : null));
|
|
1071
|
+
if (config.required === true)
|
|
1072
|
+
validators.push(Validators.required);
|
|
1073
|
+
if (config.min && typeof config.min === "number")
|
|
1074
|
+
validators.push(Validators.min(config.min));
|
|
1075
|
+
if (config.max && typeof config.max === "number")
|
|
1076
|
+
validators.push(Validators.max(config.max));
|
|
1077
|
+
if (config.type === DynamicFormTypeFieldEnum.date ||
|
|
1078
|
+
config.type === DynamicFormTypeFieldEnum.datetime ||
|
|
1079
|
+
config.type === DynamicFormTypeFieldEnum.time) {
|
|
1080
|
+
if (config.min && typeof config.min === "string") {
|
|
1081
|
+
validators.push(DateMinValidator(config.min));
|
|
1082
|
+
}
|
|
1083
|
+
if (config.max && typeof config.max === "string") {
|
|
1084
|
+
validators.push(DateMaxValidator(config.max));
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
if (config.minLength)
|
|
1088
|
+
validators.push(Validators.minLength(config.minLength));
|
|
1089
|
+
if (config.maxLength)
|
|
1090
|
+
validators.push(Validators.maxLength(config.maxLength));
|
|
1091
|
+
if (config.type === DynamicFormTypeFieldEnum.cpf) {
|
|
1092
|
+
validators.push(CpfValidator);
|
|
1093
|
+
}
|
|
1094
|
+
else if (config.type === DynamicFormTypeFieldEnum.cnpj) {
|
|
1095
|
+
validators.push(CnpjValidator);
|
|
1096
|
+
}
|
|
1097
|
+
else if (config.type === DynamicFormTypeFieldEnum.email) {
|
|
1098
|
+
validators.push(Validators.email);
|
|
1099
|
+
}
|
|
1100
|
+
else if (config.type === DynamicFormTypeFieldEnum.autocomplete) {
|
|
1101
|
+
if (value) {
|
|
1102
|
+
valueSelectedAutocomplete = value;
|
|
1103
|
+
value = (config.multiple ? valueSelectedAutocomplete[0] : value);
|
|
1104
|
+
}
|
|
1105
|
+
if (config.required === true) {
|
|
1106
|
+
validators.push(AutocompleteSelectedValidator);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
else if (config.type === DynamicFormTypeFieldEnum.checkbox) {
|
|
1110
|
+
value = (_d = config.value) !== null && _d !== void 0 ? _d : false;
|
|
1111
|
+
}
|
|
1112
|
+
if (config.type === DynamicFormTypeFieldEnum.hoursAndMinutes &&
|
|
1113
|
+
value.length >= 6) {
|
|
1114
|
+
this.hoursAndMinutesMask = '000:00';
|
|
1115
|
+
}
|
|
1116
|
+
if (config.dynamicFormConfig) {
|
|
1117
|
+
const cloneDynamicFormConfig = {};
|
|
1118
|
+
Object.assign(cloneDynamicFormConfig, config.dynamicFormConfig);
|
|
1119
|
+
cloneDynamicFormConfig.form = config.dynamicFormConfig.form;
|
|
1120
|
+
config.dynamicFormConfig = cloneDynamicFormConfig;
|
|
1121
|
+
}
|
|
1122
|
+
if (config.show === false) {
|
|
1123
|
+
validators = [];
|
|
1124
|
+
}
|
|
1125
|
+
const field = this.fb.group({
|
|
1126
|
+
show: [new BehaviorSubject((_e = config.show) !== null && _e !== void 0 ? _e : true)],
|
|
1127
|
+
label: [config.label],
|
|
1128
|
+
name: [config.name],
|
|
1129
|
+
type: [config.type],
|
|
1130
|
+
fileButtonConfig: [{
|
|
1131
|
+
icon: (_g = (_f = config === null || config === void 0 ? void 0 : config.fileButtonConfig) === null || _f === void 0 ? void 0 : _f.icon) !== null && _g !== void 0 ? _g : 'attach_file',
|
|
1132
|
+
text: (_j = (_h = config === null || config === void 0 ? void 0 : config.fileButtonConfig) === null || _h === void 0 ? void 0 : _h.text) !== null && _j !== void 0 ? _j : 'Clique para anexar arquivos',
|
|
1133
|
+
backgroundColor: (_l = (_k = config === null || config === void 0 ? void 0 : config.fileButtonConfig) === null || _k === void 0 ? void 0 : _k.backgroundColor) !== null && _l !== void 0 ? _l : 'white',
|
|
1134
|
+
color: (_o = (_m = config === null || config === void 0 ? void 0 : config.fileButtonConfig) === null || _m === void 0 ? void 0 : _m.color) !== null && _o !== void 0 ? _o : 'blue',
|
|
1135
|
+
accept: (_q = (_p = config === null || config === void 0 ? void 0 : config.fileButtonConfig) === null || _p === void 0 ? void 0 : _p.accept) !== null && _q !== void 0 ? _q : '*'
|
|
1136
|
+
}],
|
|
1137
|
+
dynamicFormConfig: [new BehaviorSubject(config.dynamicFormConfig)],
|
|
1138
|
+
dynamicFormGroup: this.fb.array([]),
|
|
1139
|
+
appearance: [config.appearance],
|
|
1140
|
+
floatLabel: [config.floatLabel],
|
|
1141
|
+
placeholder: [config.placeholder],
|
|
1142
|
+
class: [config.class],
|
|
1143
|
+
fieldClass: [config.fieldClass],
|
|
1144
|
+
textHint: [config.textHint],
|
|
1145
|
+
required: [(_r = config.required) !== null && _r !== void 0 ? _r : false],
|
|
1146
|
+
min: [(_s = config.min) !== null && _s !== void 0 ? _s : 0],
|
|
1147
|
+
max: [(_t = config.max) !== null && _t !== void 0 ? _t : 99999999999],
|
|
1148
|
+
minLength: [(_u = config.minLength) !== null && _u !== void 0 ? _u : 0],
|
|
1149
|
+
maxLength: [(_v = config.maxLength) !== null && _v !== void 0 ? _v : 255],
|
|
1150
|
+
disabled: [(_w = config.disabled) !== null && _w !== void 0 ? _w : false],
|
|
1151
|
+
focus: [(_x = config.focus) !== null && _x !== void 0 ? _x : false],
|
|
1152
|
+
multiple: [(_y = config.multiple) !== null && _y !== void 0 ? _y : false],
|
|
1153
|
+
opcoesSelect: [(_z = config.opcoesSelect) !== null && _z !== void 0 ? _z : []],
|
|
1154
|
+
hidePassword: config.type === DynamicFormTypeFieldEnum.password ? true : null,
|
|
1155
|
+
moreItemsButtonIconAddlabel: [config.moreItemsButtonIconAddlabel],
|
|
1156
|
+
moreItemsMinItems: [(_0 = config.moreItemsMinItems) !== null && _0 !== void 0 ? _0 : 0],
|
|
1157
|
+
moreItemsMaxItems: [(_1 = config.moreItemsMaxItems) !== null && _1 !== void 0 ? _1 : 100],
|
|
1158
|
+
moreItemsIcon: [config.moreItemsIcon],
|
|
1159
|
+
moreItemsIconFontColor: [config.moreItemsIconFontColor],
|
|
1160
|
+
moreItemsIconBackgroundColor: [config.moreItemsIconBackgroundColor],
|
|
1161
|
+
moreItemsExpanded: [''],
|
|
1162
|
+
moreItemsConfig: [[]],
|
|
1163
|
+
moreItemsFormGroup: this.fb.array([]),
|
|
1164
|
+
autocompleteLoading: [new BehaviorSubject(false)],
|
|
1165
|
+
autocompleteOptions: [config.autocompleteOptions],
|
|
1166
|
+
autocompleteMultipleConfig: [config.autocompleteMultipleConfig],
|
|
1167
|
+
autocompleteOptionsFiltered: [new BehaviorSubject([])],
|
|
1168
|
+
autocompleteSelectedValue: [valueSelectedAutocomplete],
|
|
1169
|
+
textLogs: [config === null || config === void 0 ? void 0 : config.textObs],
|
|
1170
|
+
customMasc: [config === null || config === void 0 ? void 0 : config.customMasc],
|
|
1171
|
+
value: [{ value, disabled: config.disabled }, validators, config.asyncValidators]
|
|
1172
|
+
});
|
|
1173
|
+
if (config.autocompleteType === "onDemand") {
|
|
1174
|
+
const loader = field.get('autocompleteLoading').value;
|
|
1175
|
+
loader.next(true);
|
|
1176
|
+
config.autocompleteFilter('').subscribe(options => {
|
|
1177
|
+
field.get('autocompleteOptionsFiltered').value.next(options);
|
|
1178
|
+
loader.next(false);
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
return field;
|
|
1182
|
+
}
|
|
1183
|
+
setValuesOnFields(subject, form) {
|
|
1184
|
+
subject.subscribe(item => {
|
|
1185
|
+
if (item) {
|
|
1186
|
+
const formArray = form.get('formData');
|
|
1187
|
+
for (const prop of item.values()) {
|
|
1188
|
+
this.setValueByProp(formArray, prop);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
changeVisibilityFields(subject, form) {
|
|
1194
|
+
subject.pipe(debounceTime(5)).subscribe(item => {
|
|
1195
|
+
var _a, _b, _c;
|
|
1196
|
+
if (item) {
|
|
1197
|
+
const formArray = form.get('formData');
|
|
1198
|
+
for (const prop of item.values()) {
|
|
1199
|
+
for (const [indexControl, control] of formArray.controls.entries()) {
|
|
1200
|
+
if (control.get('name').value === prop.name) {
|
|
1201
|
+
control.get('show').value.next(prop.show);
|
|
1202
|
+
const config = (_a = this.formConfig[indexControl]) !== null && _a !== void 0 ? _a : null;
|
|
1203
|
+
if (prop.show) {
|
|
1204
|
+
let validators = [];
|
|
1205
|
+
if (config) {
|
|
1206
|
+
if (config.type === DynamicFormTypeFieldEnum.dynamicForm) {
|
|
1207
|
+
const formArrayMoreItems = control.get('dynamicFormGroup');
|
|
1208
|
+
formArrayMoreItems.push((_b = config === null || config === void 0 ? void 0 : config.dynamicFormConfig) === null || _b === void 0 ? void 0 : _b.form);
|
|
1209
|
+
}
|
|
1210
|
+
else {
|
|
1211
|
+
validators = (_c = config.syncValidators) !== null && _c !== void 0 ? _c : [];
|
|
1212
|
+
if (config.required === true) {
|
|
1213
|
+
validators.push(Validators.required);
|
|
1214
|
+
}
|
|
1215
|
+
if (config.type === DynamicFormTypeFieldEnum.cpf) {
|
|
1216
|
+
validators.push(CpfValidator);
|
|
1217
|
+
}
|
|
1218
|
+
else if (config.type === DynamicFormTypeFieldEnum.cnpj) {
|
|
1219
|
+
validators.push(CnpjValidator);
|
|
1220
|
+
}
|
|
1221
|
+
else if (config.type === DynamicFormTypeFieldEnum.email) {
|
|
1222
|
+
validators.push(Validators.email);
|
|
1223
|
+
}
|
|
1224
|
+
else if (config.required === true &&
|
|
1225
|
+
config.type === DynamicFormTypeFieldEnum.autocomplete) {
|
|
1226
|
+
validators.push(AutocompleteSelectedValidator);
|
|
1227
|
+
}
|
|
1228
|
+
if (config.min && typeof config.min === "number")
|
|
1229
|
+
validators.push(Validators.min(config.min));
|
|
1230
|
+
if (config.max && typeof config.max === "number")
|
|
1231
|
+
validators.push(Validators.max(config.max));
|
|
1232
|
+
if (config.type === DynamicFormTypeFieldEnum.date ||
|
|
1233
|
+
config.type === DynamicFormTypeFieldEnum.datetime ||
|
|
1234
|
+
config.type === DynamicFormTypeFieldEnum.time) {
|
|
1235
|
+
if (config.min && typeof config.min === "string") {
|
|
1236
|
+
validators.push(DateMinValidator(config.min));
|
|
1237
|
+
}
|
|
1238
|
+
if (config.max && typeof config.max === "string") {
|
|
1239
|
+
validators.push(DateMaxValidator(config.max));
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
if (config.minLength)
|
|
1243
|
+
validators.push(Validators.minLength(config.minLength));
|
|
1244
|
+
if (config.maxLength)
|
|
1245
|
+
validators.push(Validators.maxLength(config.maxLength));
|
|
1246
|
+
control.get('value').setValidators(validators);
|
|
1247
|
+
if (config.asyncValidators) {
|
|
1248
|
+
control.get('value').setAsyncValidators(config.asyncValidators);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
control.get('value').updateValueAndValidity();
|
|
1252
|
+
if (prop.clearCurrentValue) {
|
|
1253
|
+
control.get('value').setValue(null);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
else {
|
|
1258
|
+
control.get('value').clearValidators();
|
|
1259
|
+
control.get('value').clearAsyncValidators();
|
|
1260
|
+
control.setErrors(null);
|
|
1261
|
+
control.get('value').setValue(null);
|
|
1262
|
+
control.get('value').updateValueAndValidity();
|
|
1263
|
+
if (config.type === DynamicFormTypeFieldEnum.dynamicForm) {
|
|
1264
|
+
const formGroup = control;
|
|
1265
|
+
formGroup.removeControl('dynamicFormGroup');
|
|
1266
|
+
formGroup.addControl('dynamicFormGroup', this.fb.array([]));
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
break;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
autocompleteFilter(arr, value) {
|
|
1277
|
+
return arr.filter(filter => {
|
|
1278
|
+
if (typeof value === 'string') {
|
|
1279
|
+
if (filter) {
|
|
1280
|
+
let find = true;
|
|
1281
|
+
value.toLowerCase()
|
|
1282
|
+
.split(' ')
|
|
1283
|
+
.forEach(part => {
|
|
1284
|
+
if (filter.name.toLowerCase().indexOf(part) < 0) {
|
|
1285
|
+
find = false;
|
|
1286
|
+
return false;
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
return find;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
else {
|
|
1293
|
+
return true;
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
setValueByProp(formArray, prop) {
|
|
1298
|
+
if (formArray) {
|
|
1299
|
+
if (prop.name.indexOf(' > ') >= 0) {
|
|
1300
|
+
let dynamicFormSubject;
|
|
1301
|
+
const arrPropName = prop.name.split(' > ');
|
|
1302
|
+
let indexPropName = 0;
|
|
1303
|
+
do {
|
|
1304
|
+
const control = formArray.controls.find(control => control.get('name').value === arrPropName[indexPropName]);
|
|
1305
|
+
if (indexPropName === arrPropName.length - 2) {
|
|
1306
|
+
dynamicFormSubject = control.get('dynamicFormConfig').value;
|
|
1307
|
+
const dynamicForm = dynamicFormSubject.getValue();
|
|
1308
|
+
if (dynamicForm.formConfig.find(fc => fc.name === arrPropName[arrPropName.length - 1])) {
|
|
1309
|
+
if (dynamicForm.setValues) {
|
|
1310
|
+
dynamicForm.setValues.next(koala(dynamicForm.setValues.getValue()).array().merge([{
|
|
1311
|
+
name: arrPropName[arrPropName.length - 1],
|
|
1312
|
+
value: prop.value
|
|
1313
|
+
}]).getValue());
|
|
1314
|
+
}
|
|
1315
|
+
else {
|
|
1316
|
+
dynamicForm.setValues = new BehaviorSubject([{
|
|
1317
|
+
name: arrPropName[arrPropName.length - 1],
|
|
1318
|
+
value: prop.value
|
|
1319
|
+
}]);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
indexPropName++;
|
|
1324
|
+
} while (indexPropName < arrPropName.length - 1);
|
|
1325
|
+
}
|
|
1326
|
+
else {
|
|
1327
|
+
for (const control of formArray.controls.values()) {
|
|
1328
|
+
if (control.get('name').value === prop.name) {
|
|
1329
|
+
control.get('value').setValue(prop.value);
|
|
1330
|
+
break;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
setConfigDynamicForm(newFormGroup) {
|
|
1337
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1338
|
+
if (this.showFieldsMoreItensConfig) {
|
|
1339
|
+
const value = newFormGroup.get('value').value;
|
|
1340
|
+
const configs = this.showFieldsMoreItensConfig
|
|
1341
|
+
.filter(config => config.nameField === newFormGroup.get('name').value)
|
|
1342
|
+
.sort(config => {
|
|
1343
|
+
if (config.fnShow(value)) {
|
|
1344
|
+
return 1;
|
|
1345
|
+
}
|
|
1346
|
+
return -1;
|
|
1347
|
+
});
|
|
1348
|
+
for (const config of configs) {
|
|
1349
|
+
if (config) {
|
|
1350
|
+
if (config.dynamicFormConfig && config.fnShow(value)) {
|
|
1351
|
+
const controlDynamicFormConfig = this.controls
|
|
1352
|
+
.controls
|
|
1353
|
+
.find(control => config.fieldsToShow.indexOf(control.get('name').value) >= 0);
|
|
1354
|
+
const dynamicFormConfigSubject = controlDynamicFormConfig.get('dynamicFormConfig').value;
|
|
1355
|
+
dynamicFormConfigSubject.next(null);
|
|
1356
|
+
yield KlDelay.waitFor(1);
|
|
1357
|
+
dynamicFormConfigSubject.next(config.dynamicFormConfig(value));
|
|
1358
|
+
}
|
|
1359
|
+
this.dynamicFormService.showFields(this.showFields, config.fieldsToShow, config.fnShow(value), config.clearCurrentValue);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
DynamicFormComponent.decorators = [
|
|
1367
|
+
{ type: Component, args: [{
|
|
1368
|
+
selector: 'koala-dynamic-form',
|
|
1369
|
+
template: "<div [formGroup]=\"form\" class=\"p-relative w-100\">\n <div *ngFor=\"let propriedade of controls?.controls; let i = index;\"\n [ngClass]=\"(propriedade.get('show').value | async) ? propriedade.get('class').value : 'd-none'\"\n formArrayName=\"formData\">\n\t <div *ngIf=\"propriedade.get('show').value | async\">\n\t <mat-form-field\n\t\t *ngIf=\"propriedade.get('type').value == typeField.text ||\n\t propriedade.get('type').value == typeField.password ||\n\t propriedade.get('type').value == typeField.cpf ||\n\t propriedade.get('type').value == typeField.cnpj ||\n\t propriedade.get('type').value == typeField.datetime ||\n\t propriedade.get('type').value == typeField.email ||\n\t propriedade.get('type').value == typeField.number ||\n\t propriedade.get('type').value == typeField.stringNumber ||\n\t propriedade.get('type').value == typeField.time ||\n\t propriedade.get('type').value == typeField.date ||\n\t propriedade.get('type').value == typeField.hoursAndMinutes ||\n\t propriedade.get('type').value == typeField.phone ||\n\t propriedade.get('type').value == typeField.percent ||\n\t propriedade.get('type').value == typeField.color ||\n\t propriedade.get('type').value == typeField.month ||\n\t propriedade.get('type').value == typeField.competenceDate ||\n propriedade.get('type').value == typeField.stringWithCustomMasc\"\n\t\t [appearance]=\"propriedade.get('appearance').value\"\n\t\t [floatLabel]=\"propriedade.get('floatLabel').value\"\n\t\t [formGroupName]=\"i\"\n\t\t [ngClass]=\"propriedade.get('fieldClass').value\">\n\t <mat-label>{{propriedade.get('label').value}}</mat-label>\n\t <input\n\t\t [dropSpecialCharacters]=\"false\"\n\t\t [koalaAutoFocus]=\"propriedade.get('focus').value\"\n\t\t (keyup)=\"hoursAndMinutesApplyMask(i, $event)\"\n\t\t [required]=\"propriedade.get('required').value\"\n\t\t [tabIndex]=\"tabIndexStart + i\"\n\t\t [mask]=\"((propriedade.get('type').value == typeField.competenceDate) ? '00/0000' : null) ||\n\t\t ((propriedade.get('type').value == typeField.phone) ? '(00)0000-0000?0' : null) ||\n\t\t ((propriedade.get('type').value == typeField.stringNumber) ? '0{'+propriedade.get('maxLength').value+'}' : null) ||\n ((propriedade.get('type').value == typeField.cpf) ? '000.000.000-00' : null) ||\n ((propriedade.get('type').value == typeField.cnpj) ? '00.000.000/0000-00' : null) ||\n ((propriedade.get('type').value == typeField.percent) ? 'percent' : null) ||\n\t\t\t\t\t\t\t\t\t((propriedade.get('type').value == typeField.hoursAndMinutes) ? hoursAndMinutesMask : null) ||\n\t\t\t\t\t\t\t\t\t((propriedade.get('type').value == typeField.stringWithCustomMasc) ? propriedade.get('customMasc').value : null)\"\n\t\t [validation]=\"\n\t (propriedade.get('type').value == typeField.cpf && propriedade.get('value').errors?.cpfInvalid) ||\n\t (propriedade.get('type').value == typeField.cnpj && propriedade.get('value').errors?.cnpjInvalid)\"\n\t\t [type]=\"((propriedade.get('type').value == typeField.cpf ||\n propriedade.get('type').value == typeField.cnpj ||\n propriedade.get('type').value == typeField.phone ||\n propriedade.get('type').value == typeField.percent\n )) ? 'tel' : (\n propriedade.get('type').value == typeField.month ?\n 'month' : (\n propriedade.get('type').value == typeField.date ?\n 'date' : (\n propriedade.get('type').value == typeField.datetime ?\n 'datetime-local' : (\n propriedade.get('type').value == typeField.email ?\n 'email' : (\n propriedade.get('type').value == typeField.number ?\n 'number' : (\n propriedade.get('type').value == typeField.time ?\n 'time' : (\n propriedade.get('type').value == typeField.password ?\n 'password' : (\n propriedade.get('type').value == typeField.color ?\n 'color' : 'text'))))))))\"\n [min]=\"propriedade.get('min').value\"\n [max]=\"propriedade.get('max').value\"\n [minLength]=\"propriedade.get('minLength').value\"\n [maxLength]=\"propriedade.get('maxLength').value\"\n separatorLimit=\"0\"\n\t\t showMaskTyped\n autocomplete=\"off\"\n\t\t formControlName=\"value\"\n\t\t matInput/>\n\t <button\n\t\t (click)=\"passwordView(i)\"\n\t\t *ngIf=\"propriedade.get('hidePassword').value !== null\"\n\t\t [attr.aria-label]=\"'Hide password'\"\n\t\t [attr.aria-pressed]=\"propriedade.get('hidePassword').value\"\n\t\t mat-icon-button matSuffix tabindex=\"-1\" type=\"button\">\n\t <mat-icon>{{propriedade.get('hidePassword').value ? 'visibility_off' : 'visibility'}}</mat-icon>\n\t </button>\n\t <mat-hint *ngIf=\"propriedade.get('textHint').value\">\n\t <mat-icon>info</mat-icon>\n\t\t {{propriedade.get('textHint').value}}\n\t </mat-hint>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.required\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getRequiredMessage(propriedade.get('label').value)}}\n\t </mat-error>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.cpfInvalid\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getInvalidMessage(propriedade.get('label').value)}}\n\t </mat-error>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.cnpjInvalid\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getInvalidMessage(propriedade.get('label').value)}}\n\t </mat-error>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.email\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getInvalidMessage(propriedade.get('label').value)}}\n\t </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.min\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMinMessage(propriedade.get('min').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.max\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMaxMessage(propriedade.get('max').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.minLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMinLengthMessage(propriedade.get('minLength').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.maxLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMaxLengthMessage(propriedade.get('maxLength').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.dateMin\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getDateMinMessage()}}\n {{propriedade.get('min').value | date:\"shortDate\"}}.\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.dateMax\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getDateMaxMessage()}}\n {{propriedade.get('max').value | date:\"shortDate\"}}.\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.customError\">\n <mat-icon>error</mat-icon>\n {{propriedade.get('value').errors?.customError.message}}.\n </mat-error>\n\t </mat-form-field>\n\t <mat-form-field\n\t\t *ngIf=\"propriedade.get('type').value == typeField.coin\"\n\t\t [appearance]=\"propriedade.get('appearance').value\"\n\t\t [floatLabel]=\"propriedade.get('floatLabel').value\"\n\t\t [formGroupName]=\"i\"\n\t\t [ngClass]=\"propriedade.get('fieldClass').value\">\n\t <mat-label>{{propriedade.get('label').value}}</mat-label>\n\t <input\n\t\t [koalaAutoFocus]=\"propriedade.get('focus').value\"\n\t\t [required]=\"propriedade.get('required').value\"\n [tabIndex]=\"tabIndexStart + i\"\n [min]=\"propriedade.get('min').value\"\n [max]=\"propriedade.get('max').value\"\n [minLength]=\"propriedade.get('minLength').value\"\n [maxLength]=\"propriedade.get('maxLength').value\"\n autocomplete=\"off\"\n\t\t currencyMask\n\t\t formControlName=\"value\"\n\t\t matInput\n\t\t type=\"tel\"/>\n\t <mat-hint *ngIf=\"propriedade.get('textHint').value\">\n\t <mat-icon>info</mat-icon>\n\t\t {{propriedade.get('textHint').value}}\n\t </mat-hint>\n <mat-error *ngIf=\"propriedade.get('value').errors?.min\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMinMessage(propriedade.get('min').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.max\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMaxMessage(propriedade.get('max').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.minLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMinLengthMessage(propriedade.get('minLength').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.maxLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMaxLengthMessage(propriedade.get('maxLength').value)}}\n </mat-error>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.required\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getRequiredMessage(propriedade.get('label').value)}}\n\t </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.customError\">\n <mat-icon>error</mat-icon>\n {{propriedade.get('value').errors?.customError.message}}.\n </mat-error>\n\t </mat-form-field>\n <mat-form-field\n *ngIf=\"propriedade.get('type').value == typeField.float\"\n [appearance]=\"propriedade.get('appearance').value\"\n [floatLabel]=\"propriedade.get('floatLabel').value\"\n [formGroupName]=\"i\"\n [ngClass]=\"propriedade.get('fieldClass').value\">\n <mat-label>{{propriedade.get('label').value}}</mat-label>\n <input\n [koalaAutoFocus]=\"propriedade.get('focus').value\"\n [required]=\"propriedade.get('required').value\"\n [tabIndex]=\"tabIndexStart + i\"\n [min]=\"propriedade.get('min').value\"\n [max]=\"propriedade.get('max').value\"\n [minLength]=\"propriedade.get('minLength').value\"\n [maxLength]=\"propriedade.get('maxLength').value\"\n autocomplete=\"off\"\n currencyMask\n [options]=\"{prefix: ''}\"\n formControlName=\"value\"\n matInput\n type=\"tel\"/>\n <mat-hint *ngIf=\"propriedade.get('textHint').value\">\n <mat-icon>info</mat-icon>\n {{propriedade.get('textHint').value}}\n </mat-hint>\n <mat-error *ngIf=\"propriedade.get('value').errors?.min\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMinMessage(propriedade.get('min').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.max\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMaxMessage(propriedade.get('max').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.minLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMinLengthMessage(propriedade.get('minLength').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.maxLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMaxLengthMessage(propriedade.get('maxLength').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.required\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getRequiredMessage(propriedade.get('label').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.customError\">\n <mat-icon>error</mat-icon>\n {{propriedade.get('value').errors?.customError.message}}.\n </mat-error>\n </mat-form-field>\n\t <mat-form-field\n\t\t *ngIf=\"propriedade.get('type').value == typeField.valueList ||\n\t propriedade.get('type').value == typeField.textarea\"\n\t\t [appearance]=\"propriedade.get('appearance').value\"\n\t\t [floatLabel]=\"propriedade.get('floatLabel').value\"\n\t\t [formGroupName]=\"i\"\n\t\t [ngClass]=\"propriedade.get('fieldClass').value\">\n\t <mat-label>{{propriedade.get('label').value}}</mat-label>\n\t <textarea\n #textarea\n\t\t [koalaAutoFocus]=\"propriedade.get('focus').value\"\n\t\t [mat-autosize]=\"true\"\n\t\t [matAutosizeMaxRows]=\"8\"\n\t\t [matAutosizeMinRows]=\"3\"\n\t\t [required]=\"propriedade.get('required').value\"\n [tabIndex]=\"tabIndexStart + i\"\n [minLength]=\"propriedade.get('minLength').value\"\n [maxLength]=\"propriedade.get('maxLength').value\"\n\t\t formControlName=\"value\"\n\t\t matInput>\n </textarea>\n\t <mat-hint *ngIf=\"propriedade.get('textHint').value\">\n\t <mat-icon>info</mat-icon>\n\t\t {{propriedade.get('textHint').value}}\n\t </mat-hint>\n <mat-hint align=\"end\" *ngIf=\"propriedade.get('maxLength').value\">\n {{textarea.value.length}}/{{propriedade.get('maxLength').value}}\n </mat-hint>\n <mat-error *ngIf=\"propriedade.get('value').errors?.minLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMinLengthMessage(propriedade.get('minLength').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.maxLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMaxLengthMessage(propriedade.get('maxLength').value)}}\n </mat-error>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.required\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getRequiredMessage(propriedade.get('label').value)}}\n\t </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.customError\">\n <mat-icon>error</mat-icon>\n {{propriedade.get('value').errors?.customError.message}}.\n </mat-error>\n\t </mat-form-field>\n\t\t <mat-form-field\n\t\t\t *ngIf=\"propriedade.get('type').value == typeField.textLogs\"\n\t\t\t [appearance]=\"propriedade.get('appearance').value\"\n\t\t\t [floatLabel]=\"propriedade.get('floatLabel').value\"\n\t\t\t [formGroupName]=\"i\"\n\t\t\t [ngClass]=\"propriedade.get('fieldClass').value\">\n\t <mat-label>{{propriedade.get('label').value}}</mat-label>\n\t <div [innerHTML]=\"propriedade.get('textLogs').value\" class=\"text-obs\"></div>\n\t <textarea\n #textarea\n\t\t [koalaAutoFocus]=\"propriedade.get('focus').value\"\n\t\t [mat-autosize]=\"true\"\n\t\t [matAutosizeMaxRows]=\"8\"\n\t\t [matAutosizeMinRows]=\"3\"\n\t\t [required]=\"propriedade.get('required').value\"\n [tabIndex]=\"tabIndexStart + i\"\n [minLength]=\"propriedade.get('minLength').value\"\n [maxLength]=\"propriedade.get('maxLength').value\"\n\t\t formControlName=\"value\"\n\t\t matInput>\n\t </textarea>\n\t <mat-hint *ngIf=\"propriedade.get('textHint').value\">\n\t <mat-icon>info</mat-icon>\n\t\t {{propriedade.get('textHint').value}}\n\t </mat-hint>\n <mat-hint align=\"end\" *ngIf=\"propriedade.get('maxLength').value\">\n {{textarea.value.length}}/{{propriedade.get('maxLength').value}}\n </mat-hint>\n <mat-error *ngIf=\"propriedade.get('value').errors?.minLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMinLengthMessage(propriedade.get('minLength').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.maxLength\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getMaxLengthMessage(propriedade.get('maxLength').value)}}\n </mat-error>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.required\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getRequiredMessage(propriedade.get('label').value)}}\n\t </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.customError\">\n <mat-icon>error</mat-icon>\n {{propriedade.get('value').errors?.customError.message}}.\n </mat-error>\n\t </mat-form-field>\n\t <mat-form-field\n\t\t *ngIf=\"propriedade.get('type').value == typeField.select\"\n\t\t [appearance]=\"propriedade.get('appearance').value\"\n\t\t [floatLabel]=\"propriedade.get('floatLabel').value\"\n\t\t [formGroupName]=\"i\"\n\t\t [ngClass]=\"propriedade.get('fieldClass').value\">\n\t <mat-label>{{propriedade.get('label').value}}</mat-label>\n\t <mat-select [multiple]=\"propriedade.get('multiple').value\" [required]=\"propriedade.get('required').value\"\n [tabIndex]=\"tabIndexStart + i\" formControlName=\"value\">\n\t <mat-option *ngFor=\"let options of propriedade.get('opcoesSelect').value\" [value]=\"options.value\">\n\t {{options.name}}\n\t </mat-option>\n\t </mat-select>\n\t <mat-hint *ngIf=\"propriedade.get('textHint').value\">\n\t <mat-icon>info</mat-icon>\n\t\t {{propriedade.get('textHint').value}}\n\t </mat-hint>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.required\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getRequiredMessage(propriedade.get('label').value)}}\n\t </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.customError\">\n <mat-icon>error</mat-icon>\n {{propriedade.get('value').errors?.customError.message}}.\n </mat-error>\n\t </mat-form-field>\n <mat-form-field\n class=\"select-multiple-native\"\n *ngIf=\"propriedade.get('type').value == typeField.selectMultipleNative\"\n [appearance]=\"propriedade.get('appearance').value\"\n [floatLabel]=\"propriedade.get('floatLabel').value\"\n [formGroupName]=\"i\"\n [ngClass]=\"propriedade.get('fieldClass').value\">\n <mat-label>{{propriedade.get('label').value}}</mat-label>\n <select\n matNativeControl\n formControlName=\"value\"\n multiple\n [tabIndex]=\"tabIndexStart + i\"\n [required]=\"propriedade.get('required').value\">\n <option *ngFor=\"let options of propriedade.get('opcoesSelect').value\" [value]=\"options.value\">\n {{options.name}}\n </option>\n </select>\n <mat-hint *ngIf=\"propriedade.get('textHint').value\">\n <mat-icon>info</mat-icon>\n {{propriedade.get('textHint').value}}\n </mat-hint>\n <mat-error *ngIf=\"propriedade.get('value').errors?.required\">\n <mat-icon>error</mat-icon>\n {{errorMessage.getRequiredMessage(propriedade.get('label').value)}}\n </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.customError\">\n <mat-icon>error</mat-icon>\n {{propriedade.get('value').errors?.customError.message}}.\n </mat-error>\n </mat-form-field>\n\t <div\n\t\t *ngIf=\"propriedade.get('type').value == typeField.checkbox\"\n\t\t [formGroupName]=\"i\"\n\t\t [ngClass]=\"propriedade.get('fieldClass').value\">\n\t <mat-checkbox\n [tabIndex]=\"tabIndexStart + i\"\n\t\t formControlName=\"value\"\n\t\t value=\"true\">\n\t {{propriedade.get('label').value}}\n\t </mat-checkbox>\n\t </div>\n\t\t <div\n\t\t\t *ngIf=\"propriedade.get('type').value == typeField.moreItems\"\n\t\t\t [formGroupName]=\"i\"\n\t\t\t [ngClass]=\"propriedade.get('fieldClass').value\"\n\t\t\t class=\"more-items-content\">\n\t\t\t <fieldset>\n\t\t\t\t <legend>\n\t\t\t\t\t <koala-button\n\t\t\t\t\t\t (click)=\"addMoreItem(i)\"\n\t\t\t\t\t\t [disabled]=\"propriedade.get('moreItemsConfig').value.length === propriedade.get('moreItemsMaxItems').value\"\n\t\t\t\t\t\t [tooltip]=\"propriedade.get('moreItemsButtonIconAddlabel').value\"\n\t\t\t\t\t\t [backgroundColor]=\"propriedade.get('moreItemsIconBackgroundColor').value\"\n [color]=\"propriedade.get('moreItemsIconFontColor').value\"\n\t\t\t\t\t\t class=\"btn-add-more-items\"\n\t\t\t\t\t\t icon=\"add\">\n\t\t\t\t\t </koala-button>\n\t\t\t\t\t {{propriedade.get('label').value}} (Min.: {{propriedade.get('moreItemsMinItems').value}}\n\t\t\t\t\t | M\u00E1x.: {{propriedade.get('moreItemsMaxItems').value}})\n\t\t\t\t </legend>\n\t\t\t\t <mat-accordion class=\"items\" multi>\n\t\t\t\t\t <mat-expansion-panel\n\t\t\t\t\t\t *ngFor=\"let item of propriedade.get('moreItemsConfig').value.slice().reverse(); index as indexMoreItems\"\n\t\t\t\t\t\t expanded>\n\t\t\t\t\t\t <mat-expansion-panel-header>\n\t\t\t\t\t\t\t\t<mat-panel-title class=\"titleForm\">#\n\t\t\t\t\t\t\t\t\t{{propriedade.get('moreItemsConfig').value.length - 1 - indexMoreItems + 1}}</mat-panel-title>\n\t\t\t\t\t\t\t\t<mat-panel-description class=\"titleForm\">\n\t\t\t\t\t\t\t\t\t{{propriedade.get('label').value}}\n\t\t\t\t\t\t\t\t\t<mat-icon>{{propriedade.get('moreItemsIcon').value}}</mat-icon>\n\t\t\t\t\t\t\t\t</mat-panel-description>\n\t\t\t\t\t\t\t</mat-expansion-panel-header>\n\t\t\t\t\t\t <koala-dynamic-form\n\t\t\t\t\t\t\t [showFieldsMoreItensConfig]=\"item.showFieldsMoreItensConfig\"\n\t\t\t\t\t\t\t [showFields]=\"item.showFields\"\n\t\t\t\t\t\t\t [formConfig]=\"item.formConfig\"\n\t\t\t\t\t\t\t [form]=\"item.form\"\n [tabIndexStart]=\"tabIndexStart + i\">\n\t\t\t\t\t\t </koala-dynamic-form>\n\t\t\t\t\t <mat-action-row\n\t\t\t\t\t\t *ngIf=\"propriedade.get('moreItemsConfig').value.length > propriedade.get('moreItemsMinItems').value\">\n\t\t\t\t\t <button\n\t\t\t\t\t\t (click)=\"removeMoreItem(i, propriedade.get('moreItemsConfig').value.length - 1 - indexMoreItems)\"\n\t\t\t\t\t\t mat-icon-button>\n\t\t\t\t\t\t <mat-icon>delete</mat-icon>\n\t\t\t\t\t </button>\n\t\t\t\t\t </mat-action-row>\n\t\t\t\t\t </mat-expansion-panel>\n\t\t\t\t </mat-accordion>\n\t\t\t </fieldset>\n\t\t </div>\n\t\t <mat-form-field\n\t\t\t *ngIf=\"propriedade.get('type').value == typeField.autocomplete\"\n\t\t\t [appearance]=\"propriedade.get('appearance').value\"\n\t\t\t [floatLabel]=\"propriedade.get('floatLabel').value\"\n\t\t\t [formGroupName]=\"i\"\n\t\t\t [ngClass]=\"propriedade.get('fieldClass').value\">\n\t <mat-label>{{propriedade.get('label').value}} {{propriedade.get('multiple').value &&\n\t propriedade.get('required').value ? '*' : ''}}</mat-label>\n\t\t\t <div *ngIf=\"propriedade.get('multiple').value else single\">\n\t <mat-chip-list #chipList>\n\t <mat-chip\n\t\t (removed)=\"removeOptionOnAutocomplete(i, option)\"\n\t\t *ngFor=\"let option of propriedade.get('autocompleteSelectedValue').value\"\n\t\t [color]=\"getColorChip(propriedade.get('autocompleteMultipleConfig').value | async)\"\n\t\t [removable]=\"true\"\n\t\t [selectable]=\"true\">\n\t {{display(option)}}\n\t\t <mat-icon matChipRemove>cancel</mat-icon>\n\t </mat-chip>\n\t <input\n\t\t #autocompleteInput\n [koalaAutoFocus]=\"propriedade.get('focus').value\"\n\t\t [required]=\"propriedade.get('required').value\"\n\t\t [matAutocomplete]=\"auto\"\n\t\t [matChipInputFor]=\"chipList\"\n [tabIndex]=\"tabIndexStart + i\"\n\t\t formControlName=\"value\"\n\t\t matInput\n\t\t type=\"text\"\n\t\t placeholder=\"Selecione um ou mais op\u00E7\u00F5es...\">\n\t </mat-chip-list>\n\t </div>\n\t <ng-template #single>\n\t\t <input\n\t\t\t [matAutocomplete]=\"auto\"\n [koalaAutoFocus]=\"propriedade.get('focus').value\"\n\t\t\t [required]=\"propriedade.get('required').value\"\n [tabIndex]=\"tabIndexStart + i\"\n\t\t\t formControlName=\"value\"\n\t\t\t matInput\n\t\t\t placeholder=\"Selecione uma op\u00E7\u00E3o...\"\n\t\t\t type=\"text\">\n\t </ng-template>\n\t <mat-spinner *ngIf=\"propriedade.get('autocompleteLoading').value | async\" color=\"primary\"\n\t matSuffix></mat-spinner>\n\t <button\n\t\t (click)=\"clearAutocomplete(i)\"\n\t\t *ngIf=\"\n\t !(propriedade.get('autocompleteLoading').value | async) &&\n\t !propriedade.get('disabled').value\"\n\t\t color=\"warn\"\n\t\t mat-icon-button\n\t\t matSuffix\n\t\t type=\"button\">\n\t <mat-icon>close</mat-icon>\n\t </button>\n\t <mat-hint *ngIf=\"propriedade.get('textHint').value\">\n\t <mat-icon>info</mat-icon>\n\t\t {{propriedade.get('textHint').value}}\n\t </mat-hint>\n\t <mat-error *ngIf=\"propriedade.get('value').errors?.required || propriedade.get('value').errors?.autocompleteSelected\">\n\t <mat-icon>error</mat-icon>\n {{errorMessage.getAutocompleteMessage(propriedade.get('label').value)}}\n\t </mat-error>\n <mat-error *ngIf=\"propriedade.get('value').errors?.customError\">\n <mat-icon>error</mat-icon>\n {{propriedade.get('value').errors?.customError.message}}.\n </mat-error>\n\t <mat-autocomplete\n\t\t #auto=\"matAutocomplete\"\n\t\t [displayWith]=\"display\" autoActiveFirstOption>\n\t\t <div *ngIf=\"(propriedade.get('autocompleteOptionsFiltered').value | async) as options\">\n\t\t <mat-option *ngFor=\"let option of options\" [value]=\"option\">\n\t\t {{option.name}}\n\t\t </mat-option>\n\t\t </div>\n\t </mat-autocomplete>\n\t </mat-form-field>\n\t\t <div *ngIf=\"propriedade.get('type').value == typeField.file\">\n\t\t\t <koala-file-button\n\t\t\t\t (getFiles)=\"propriedade.get('value').setValue($event)\"\n\t\t\t\t [accept]=\"propriedade.get('fileButtonConfig').value.accept\"\n\t\t\t\t [backgroundColor]=\"propriedade.get('fileButtonConfig').value.backgroundColor\"\n\t\t\t\t [color]=\"propriedade.get('fileButtonConfig').value.color\"\n\t\t\t\t [disabled]=\"propriedade.get('disabled').value\"\n\t\t\t\t [icon]=\"propriedade.get('fileButtonConfig').value.icon\"\n\t\t\t\t [multiple]=\"propriedade.get('multiple').value\"\n\t\t\t\t [text]=\"propriedade.get('fileButtonConfig').value.text\">\n\t\t\t </koala-file-button>\n\t\t </div>\n\t\t <div *ngIf=\"\n\t\t propriedade.get('type').value == typeField.dynamicForm &&\n\t\t\t\t(propriedade.get('dynamicFormConfig').value | async) as dynamicFormConfig\">\n\t\t\t <fieldset *ngIf=\"propriedade.get('label').value else dynamicFormWithoutLabel\">\n\t\t\t\t <legend>{{propriedade.get('label').value}}</legend>\n\t\t\t\t <koala-dynamic-form\n\t\t\t\t\t [formConfig]=\"dynamicFormConfig.formConfig\"\n\t\t\t\t\t [form]=\"dynamicFormConfig.form\"\n\t\t\t\t\t [setValues]=\"dynamicFormConfig.setValues\"\n\t\t\t\t\t [showFields]=\"dynamicFormConfig.showFields\"\n [tabIndexStart]=\"tabIndexStart + i\">\n\t\t\t\t </koala-dynamic-form>\n\t\t\t </fieldset>\n\t\t\t <ng-template #dynamicFormWithoutLabel>\n\t\t\t\t <koala-dynamic-form\n\t\t\t\t\t [formConfig]=\"dynamicFormConfig.formConfig\"\n\t\t\t\t\t [form]=\"dynamicFormConfig.form\"\n\t\t\t\t\t [setValues]=\"dynamicFormConfig.setValues\"\n\t\t\t\t\t [showFields]=\"dynamicFormConfig.showFields\"\n [tabIndexStart]=\"tabIndexStart + i\">\n\t\t\t\t </koala-dynamic-form>\n\t\t\t </ng-template>\n\t\t </div>\n <div\n class=\"radio-btn-group\"\n *ngIf=\"propriedade.get('type').value == typeField.radio\"\n [formGroupName]=\"i\"\n [ngClass]=\"propriedade.get('fieldClass').value\">\n <mat-radio-group formControlName=\"value\">\n <label *ngIf=\"propriedade.get('label').value\">{{propriedade.get('label').value}}</label>\n <mat-radio-button\n [tabIndex]=\"tabIndexStart + i\"\n *ngFor=\"let options of propriedade.get('opcoesSelect').value\"\n [value]=\"options.value\">\n {{options.name}}\n </mat-radio-button>\n </mat-radio-group>\n </div>\n\t </div>\n </div>\n <ng-content select=\"[btn-submit]\"></ng-content>\n</div>\n",
|
|
1370
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1371
|
+
styles: [".more-items-content fieldset{border:1px solid #cccccc;padding:16px}.more-items-content fieldset legend{font-family:\"Josefin Sans\",sans-serif;font-size:11px;font-weight:bold;padding:0 8px}.more-items-content .items .titleForm{color:#616161}.more-items-content .items .mat-expansion-panel-header-title,.more-items-content .items .mat-expansion-panel-header-description{flex-basis:0}.more-items-content .items .mat-expansion-panel-header-description{align-items:center;justify-content:space-between}.more-items-content .items .mat-form-field+.mat-form-field{margin-left:8px}.radio-btn-group label{position:relative;display:block;padding:10px 0}.text-obs{background:#eeeeee;border-radius:5px;color:#212121;font-family:OpenSansLight,sans-serif;height:150px;margin:0 auto 10px;overflow-y:auto;padding:10px;position:relative;width:calc(100% - 27px)}.select-multiple-native{margin-bottom:15px}.select-multiple-native select{width:100%;height:150px;background:transparent;border:none}.select-multiple-native select:focus,.select-multiple-native select:active{outline:none}.select-multiple-native select option{padding:5px 10px;font-family:JosefinSans,sans-serif}.select-multiple-native select option:checked{background:#f1f1f1!important}\n"]
|
|
1372
|
+
},] }
|
|
1373
|
+
];
|
|
1374
|
+
DynamicFormComponent.ctorParameters = () => [
|
|
1375
|
+
{ type: FormBuilder },
|
|
1376
|
+
{ type: KoalaDynamicFormService }
|
|
1377
|
+
];
|
|
1378
|
+
DynamicFormComponent.propDecorators = {
|
|
1379
|
+
form: [{ type: Input }],
|
|
1380
|
+
formConfig: [{ type: Input }],
|
|
1381
|
+
showFields: [{ type: Input }],
|
|
1382
|
+
showFieldsMoreItensConfig: [{ type: Input }],
|
|
1383
|
+
setValues: [{ type: Input }],
|
|
1384
|
+
tabIndexStart: [{ type: Input }],
|
|
1385
|
+
autocompleteInput: [{ type: ViewChild, args: ['autocompleteInput',] }]
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
class KoalaAutofocusDirective {
|
|
1389
|
+
constructor(el) {
|
|
1390
|
+
this.el = el;
|
|
1391
|
+
}
|
|
1392
|
+
ngAfterContentInit() {
|
|
1393
|
+
if (this.koalaAutoFocus) {
|
|
1394
|
+
setTimeout(() => {
|
|
1395
|
+
this.el.nativeElement.focus();
|
|
1396
|
+
}, 500);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
KoalaAutofocusDirective.decorators = [
|
|
1401
|
+
{ type: Directive, args: [{
|
|
1402
|
+
selector: '[koalaAutoFocus]'
|
|
1403
|
+
},] }
|
|
1404
|
+
];
|
|
1405
|
+
KoalaAutofocusDirective.ctorParameters = () => [
|
|
1406
|
+
{ type: ElementRef }
|
|
1407
|
+
];
|
|
1408
|
+
KoalaAutofocusDirective.propDecorators = {
|
|
1409
|
+
koalaAutoFocus: [{ type: Input }]
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
class KoalaFormModule {
|
|
1413
|
+
}
|
|
1414
|
+
KoalaFormModule.decorators = [
|
|
1415
|
+
{ type: NgModule, args: [{
|
|
1416
|
+
declarations: [
|
|
1417
|
+
BtnSubmitComponent,
|
|
1418
|
+
DynamicFormComponent,
|
|
1419
|
+
KoalaAutofocusDirective
|
|
1420
|
+
],
|
|
1421
|
+
imports: [
|
|
1422
|
+
CommonModule,
|
|
1423
|
+
ReactiveFormsModule,
|
|
1424
|
+
FormsModule,
|
|
1425
|
+
CurrencyMaskModule,
|
|
1426
|
+
NgxMaskModule.forRoot(maskOptions),
|
|
1427
|
+
KoalaFileButtonModule,
|
|
1428
|
+
MatInputModule,
|
|
1429
|
+
MatSelectModule,
|
|
1430
|
+
MatRadioModule,
|
|
1431
|
+
MatCheckboxModule,
|
|
1432
|
+
MatAutocompleteModule,
|
|
1433
|
+
MatButtonModule,
|
|
1434
|
+
MatIconModule,
|
|
1435
|
+
MatExpansionModule,
|
|
1436
|
+
MatChipsModule,
|
|
1437
|
+
KoalaButtonModule,
|
|
1438
|
+
MatProgressSpinnerModule
|
|
1439
|
+
],
|
|
1440
|
+
exports: [
|
|
1441
|
+
ReactiveFormsModule,
|
|
1442
|
+
FormsModule,
|
|
1443
|
+
KoalaAutofocusDirective,
|
|
1444
|
+
NgxMaskModule,
|
|
1445
|
+
KoalaFileButtonModule,
|
|
1446
|
+
MatInputModule,
|
|
1447
|
+
MatSelectModule,
|
|
1448
|
+
MatRadioModule,
|
|
1449
|
+
MatCheckboxModule,
|
|
1450
|
+
MatAutocompleteModule,
|
|
1451
|
+
MatButtonModule,
|
|
1452
|
+
MatIconModule,
|
|
1453
|
+
MatProgressSpinnerModule,
|
|
1454
|
+
BtnSubmitComponent,
|
|
1455
|
+
DynamicFormComponent
|
|
1456
|
+
]
|
|
1457
|
+
},] }
|
|
1458
|
+
];
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Generated bundle index. Do not edit.
|
|
1462
|
+
*/
|
|
1463
|
+
|
|
1464
|
+
export { AutocompleteSelectedValidator, BtnSubmitComponent, CnpjValidator, CpfValidator, DynamicFormComponent, DynamicFormTypeFieldEnum, FormAbstract, KoalaAutofocusDirective, KoalaDynamicFormService, KoalaDynamicFormValidatorResultHelper, KoalaFormModule, ShowInvalidFields, ValidationHelper };
|
|
1465
|
+
//# sourceMappingURL=koalarx-ui-form.js.map
|