keevo-components 1.5.189 → 1.5.191
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/README.md +24 -24
- package/ng-package.json +7 -0
- package/package.json +3 -22
- package/src/assets/.gitkeep +0 -0
- package/src/assets/images/LogoEvo.png +0 -0
- package/src/assets/images/LogoPequenaEvo.png +0 -0
- package/src/assets/images/background.png +0 -0
- package/src/assets/images/keepass-logo.png +0 -0
- package/src/assets/images/keepass-logo.svg +74 -0
- package/src/assets/images/keevo-logo.png +0 -0
- package/src/assets/images/logokeevo_2.png +0 -0
- package/src/index.ts +1 -0
- package/src/lib/api/base-components/base-component-button.ts +27 -0
- package/src/lib/api/base-components/base-component-chart.ts +105 -0
- package/src/lib/api/base-components/base-component-crud-form.ts +328 -0
- package/src/lib/api/base-components/base-component-crud-list.ts +111 -0
- package/src/lib/api/base-components/base-component-crud.ts +70 -0
- package/src/lib/api/base-components/base-component-dropdown-new.ts +112 -0
- package/src/lib/api/base-components/base-component-dropdown.ts +164 -0
- package/src/lib/api/base-components/base-component-input.ts +107 -0
- package/src/lib/api/base-components/base-component-multi-select.ts +136 -0
- package/src/lib/api/base-components/base-component.ts +46 -0
- package/src/lib/api/components/chart/chart.config.ts +12 -0
- package/src/lib/api/components/chart/chart.model.ts +9 -0
- package/src/lib/api/components/chart/orchart.config.ts +41 -0
- package/src/lib/api/components/chart/orchart.item.ts +33 -0
- package/src/lib/api/components/dropdown/filtro.combo.ts +4 -0
- package/src/lib/api/components/error/error.component.html +3 -0
- package/src/lib/api/components/error/error.component.scss +5 -0
- package/src/lib/api/components/error/error.component.ts +22 -0
- package/src/lib/api/components/error/kverror.module.ts +23 -0
- package/src/lib/api/components/table/action-item.ts +5 -0
- package/src/lib/api/components/table/kv-menuitem.ts +10 -0
- package/src/lib/api/components/table/table.config.column.ts +21 -0
- package/src/lib/api/components/table/table.config.ts +20 -0
- package/src/lib/api/components/table/table.paginate.ts +6 -0
- package/src/lib/api/helpers/component-providers.ts +16 -0
- package/src/lib/api/helpers/keevo-validators.ts +77 -0
- package/src/lib/api/helpers/translate-primeng.ts +25 -0
- package/src/lib/api/models/menu/menu.model.ts +10 -0
- package/{lib/api/models/menu/menucompleto.model.d.ts → src/lib/api/models/menu/menucompleto.model.ts} +7 -6
- package/src/lib/api/models/menu/sistemamenu.model.ts +8 -0
- package/src/lib/api/modules/primeng.module.ts +125 -0
- package/src/lib/api/services/base.api.service.ts +115 -0
- package/src/lib/api/services/component.service.ts +22 -0
- package/src/lib/api/services/form.service.ts +105 -0
- package/src/lib/api/services/imagens.service.ts +20 -0
- package/src/lib/api/services/notification.service.ts +82 -0
- package/src/lib/api/services/object.service.ts +20 -0
- package/src/lib/buttons/button-personalize/button-personalize.component.html +11 -0
- package/src/lib/buttons/button-personalize/button-personalize.component.scss +3 -0
- package/src/lib/buttons/button-personalize/button-personalize.component.ts +13 -0
- package/src/lib/buttons/button-popup/button-popup.component.html +12 -0
- package/src/lib/buttons/button-popup/button-popup.component.scss +13 -0
- package/src/lib/buttons/button-popup/button-popup.component.ts +30 -0
- package/src/lib/buttons/button-secondary/button-secondary.component.html +12 -0
- package/src/lib/buttons/button-secondary/button-secondary.component.scss +14 -0
- package/src/lib/buttons/button-secondary/button-secondary.component.ts +13 -0
- package/src/lib/buttons/button-success/button-success.component.html +11 -0
- package/src/lib/buttons/button-success/button-success.component.scss +13 -0
- package/src/lib/buttons/button-success/button-success.component.ts +13 -0
- package/src/lib/buttons/kvbutton.module.ts +25 -0
- package/src/lib/chart/chart.component.html +38 -0
- package/src/lib/chart/chart.component.scss +0 -0
- package/src/lib/chart/chart.component.spec.ts +28 -0
- package/src/lib/chart/chart.component.ts +141 -0
- package/src/lib/chart/kvchart.module.ts +20 -0
- package/src/lib/directives/template.directive.ts +15 -0
- package/src/lib/inputs/check/check.component.html +11 -0
- package/src/lib/inputs/check/check.component.scss +13 -0
- package/src/lib/inputs/check/check.component.ts +24 -0
- package/src/lib/inputs/dropdown/dropdown.component.html +91 -0
- package/src/lib/inputs/dropdown/dropdown.component.scss +0 -0
- package/src/lib/inputs/dropdown/dropdown.component.ts +28 -0
- package/src/lib/inputs/editor/editor.component.html +90 -0
- package/src/lib/inputs/editor/editor.component.scss +4 -0
- package/src/lib/inputs/editor/editor.component.ts +80 -0
- package/src/lib/inputs/input-calendar/input-calendar.component.html +30 -0
- package/src/lib/inputs/input-calendar/input-calendar.component.scss +0 -0
- package/src/lib/inputs/input-calendar/input-calendar.component.ts +81 -0
- package/src/lib/inputs/input-mask/input-mask.component.html +20 -0
- package/src/lib/inputs/input-mask/input-mask.component.scss +0 -0
- package/src/lib/inputs/input-mask/input-mask.component.ts +20 -0
- package/src/lib/inputs/input-number/input-number.component.html +22 -0
- package/src/lib/inputs/input-number/input-number.component.scss +0 -0
- package/src/lib/inputs/input-number/input-number.component.ts +52 -0
- package/src/lib/inputs/input-password/input-password.component.html +23 -0
- package/src/lib/inputs/input-password/input-password.component.scss +0 -0
- package/src/lib/inputs/input-password/input-password.component.ts +23 -0
- package/src/lib/inputs/input-text/input-text.component.html +20 -0
- package/src/lib/inputs/input-text/input-text.component.scss +18 -0
- package/src/lib/inputs/input-text/input-text.component.ts +17 -0
- package/src/lib/inputs/input-text-checkbox/input-text-checkbox.component.html +32 -0
- package/src/lib/inputs/input-text-checkbox/input-text-checkbox.component.scss +0 -0
- package/src/lib/inputs/input-text-checkbox/input-text-checkbox.component.spec.ts +23 -0
- package/src/lib/inputs/input-text-checkbox/input-text-checkbox.component.ts +36 -0
- package/src/lib/inputs/input-textarea/input-textarea.component.html +22 -0
- package/src/lib/inputs/input-textarea/input-textarea.component.scss +0 -0
- package/src/lib/inputs/input-textarea/input-textarea.component.ts +33 -0
- package/src/lib/inputs/input-time/input-time.component.html +23 -0
- package/src/lib/inputs/input-time/input-time.component.scss +0 -0
- package/src/lib/inputs/input-time/input-time.component.ts +20 -0
- package/src/lib/inputs/kvinputs.module.ts +64 -0
- package/src/lib/inputs/multi-select/multi-select.component.html +28 -0
- package/src/lib/inputs/multi-select/multi-select.component.scss +8 -0
- package/src/lib/inputs/multi-select/multi-select.component.ts +31 -0
- package/src/lib/inputs/radio-group/radio-group.component.html +19 -0
- package/src/lib/inputs/radio-group/radio-group.component.scss +15 -0
- package/src/lib/inputs/radio-group/radio-group.component.ts +50 -0
- package/src/lib/inputs/switch/switch.component.html +12 -0
- package/src/lib/inputs/switch/switch.component.scss +3 -0
- package/src/lib/inputs/switch/switch.component.ts +30 -0
- package/src/lib/keevo-components.module.ts +50 -0
- package/src/lib/label/label.component.html +6 -0
- package/src/lib/label/label.component.scss +9 -0
- package/src/lib/label/label.component.spec.ts +23 -0
- package/src/lib/label/label.component.ts +13 -0
- package/src/lib/label/label.module.ts +18 -0
- package/src/lib/loader/kvloader.module.ts +17 -0
- package/src/lib/loader/loader.component.html +1 -0
- package/src/lib/loader/loader.component.ts +14 -0
- package/src/lib/loader/loader.service.ts +26 -0
- package/src/lib/login/kvlogin.module.ts +28 -0
- package/src/lib/login/login.component.html +108 -0
- package/src/lib/login/login.component.scss +48 -0
- package/src/lib/login/login.component.spec.ts +23 -0
- package/src/lib/login/login.component.ts +65 -0
- package/src/lib/menu/kvmenu.module.ts +27 -0
- package/src/lib/menu/menu.component.html +342 -0
- package/src/lib/menu/menu.component.scss +210 -0
- package/src/lib/menu/menu.component.spec.ts +23 -0
- package/src/lib/menu/menu.component.ts +246 -0
- package/src/lib/orgchart/orgchart.component.html +58 -0
- package/src/lib/orgchart/orgchart.component.scss +21 -0
- package/src/lib/orgchart/orgchart.component.ts +118 -0
- package/src/lib/orgchart/orgchart.module.ts +14 -0
- package/src/lib/page-form/kv-page-form.module.ts +22 -0
- package/src/lib/page-form/page-form.component.html +57 -0
- package/src/lib/page-form/page-form.component.scss +72 -0
- package/src/lib/page-form/page-form.component.spec.ts +28 -0
- package/src/lib/page-form/page-form.component.ts +121 -0
- package/src/lib/picklist/kvpicklist.module.ts +20 -0
- package/src/lib/picklist/picklist.component.html +17 -0
- package/src/lib/picklist/picklist.component.scss +0 -0
- package/src/lib/picklist/picklist.component.spec.ts +26 -0
- package/src/lib/picklist/picklist.component.ts +27 -0
- package/src/lib/pipes/codigofile.pipe.ts +15 -0
- package/src/lib/pipes/cpfcnpj.pipe.ts +21 -0
- package/src/lib/pipes/pipes.module.ts +22 -0
- package/src/lib/pipes/telefone.pipe.ts +38 -0
- package/src/lib/styles-components.scss +11 -0
- package/src/lib/table/kvtable.module.ts +22 -0
- package/src/lib/table/table.component.html +473 -0
- package/src/lib/table/table.component.scss +240 -0
- package/src/lib/table/table.component.spec.ts +28 -0
- package/src/lib/table/table.component.ts +546 -0
- package/src/lib/tree-table/kv-treetable.component.html +649 -0
- package/src/lib/tree-table/kv-treetable.component.scss +315 -0
- package/src/lib/tree-table/kv-treetable.component.ts +390 -0
- package/src/lib/tree-table/kv-treetable.module.ts +18 -0
- package/src/lib/tree-view/kvtree-view.module.ts +19 -0
- package/src/lib/tree-view/tree-view.component.html +9 -0
- package/src/lib/tree-view/tree-view.component.scss +0 -0
- package/src/lib/tree-view/tree-view.component.spec.ts +23 -0
- package/src/lib/tree-view/tree-view.component.ts +29 -0
- package/src/lib/workspace/kvworkspace.module.ts +29 -0
- package/src/lib/workspace/workspace.component.html +108 -0
- package/src/lib/workspace/workspace.component.scss +83 -0
- package/src/lib/workspace/workspace.component.ts +75 -0
- package/{public-api.d.ts → src/public-api.ts} +156 -133
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/esm2020/keevo-components.mjs +0 -5
- package/esm2020/lib/api/base-components/base-component-button.mjs +0 -36
- package/esm2020/lib/api/base-components/base-component-chart.mjs +0 -92
- package/esm2020/lib/api/base-components/base-component-crud-form.mjs +0 -269
- package/esm2020/lib/api/base-components/base-component-crud-list.mjs +0 -67
- package/esm2020/lib/api/base-components/base-component-crud.mjs +0 -65
- package/esm2020/lib/api/base-components/base-component-dropdown-new.mjs +0 -211
- package/esm2020/lib/api/base-components/base-component-dropdown.mjs +0 -161
- package/esm2020/lib/api/base-components/base-component-input.mjs +0 -94
- package/esm2020/lib/api/base-components/base-component-multi-select.mjs +0 -128
- package/esm2020/lib/api/base-components/base-component.mjs +0 -49
- package/esm2020/lib/api/components/chart/chart.config.mjs +0 -2
- package/esm2020/lib/api/components/chart/chart.model.mjs +0 -2
- package/esm2020/lib/api/components/chart/orchart.config.mjs +0 -2
- package/esm2020/lib/api/components/chart/orchart.item.mjs +0 -2
- package/esm2020/lib/api/components/dropdown/filtro.combo.mjs +0 -2
- package/esm2020/lib/api/components/error/error.component.mjs +0 -26
- package/esm2020/lib/api/components/error/kverror.module.mjs +0 -35
- package/esm2020/lib/api/components/table/action-item.mjs +0 -2
- package/esm2020/lib/api/components/table/kv-menuitem.mjs +0 -3
- package/esm2020/lib/api/components/table/table.config.column.mjs +0 -2
- package/esm2020/lib/api/components/table/table.config.mjs +0 -2
- package/esm2020/lib/api/components/table/table.paginate.mjs +0 -9
- package/esm2020/lib/api/helpers/component-providers.mjs +0 -16
- package/esm2020/lib/api/helpers/keevo-validators.mjs +0 -64
- package/esm2020/lib/api/helpers/translate-primeng.mjs +0 -23
- package/esm2020/lib/api/models/menu/menu.model.mjs +0 -2
- package/esm2020/lib/api/models/menu/menucompleto.model.mjs +0 -2
- package/esm2020/lib/api/models/menu/sistemamenu.model.mjs +0 -2
- package/esm2020/lib/api/modules/primeng.module.mjs +0 -247
- package/esm2020/lib/api/services/base.api.service.mjs +0 -74
- package/esm2020/lib/api/services/component.service.mjs +0 -27
- package/esm2020/lib/api/services/form.service.mjs +0 -84
- package/esm2020/lib/api/services/imagens.service.mjs +0 -22
- package/esm2020/lib/api/services/notification.service.mjs +0 -67
- package/esm2020/lib/api/services/object.service.mjs +0 -26
- package/esm2020/lib/buttons/button-personalize/button-personalize.component.mjs +0 -17
- package/esm2020/lib/buttons/button-popup/button-popup.component.mjs +0 -31
- package/esm2020/lib/buttons/button-secondary/button-secondary.component.mjs +0 -17
- package/esm2020/lib/buttons/button-success/button-success.component.mjs +0 -17
- package/esm2020/lib/buttons/kvbutton.module.mjs +0 -39
- package/esm2020/lib/chart/chart.component.mjs +0 -145
- package/esm2020/lib/chart/kvchart.module.mjs +0 -32
- package/esm2020/lib/directives/template.directive.mjs +0 -24
- package/esm2020/lib/inputs/check/check.component.mjs +0 -26
- package/esm2020/lib/inputs/dropdown/dropdown.component.mjs +0 -37
- package/esm2020/lib/inputs/editor/editor.component.mjs +0 -70
- package/esm2020/lib/inputs/input-calendar/input-calendar.component.mjs +0 -89
- package/esm2020/lib/inputs/input-mask/input-mask.component.mjs +0 -23
- package/esm2020/lib/inputs/input-number/input-number.component.mjs +0 -59
- package/esm2020/lib/inputs/input-password/input-password.component.mjs +0 -33
- package/esm2020/lib/inputs/input-text/input-text.component.mjs +0 -21
- package/esm2020/lib/inputs/input-text-checkbox/input-text-checkbox.component.mjs +0 -38
- package/esm2020/lib/inputs/input-textarea/input-textarea.component.mjs +0 -43
- package/esm2020/lib/inputs/input-time/input-time.component.mjs +0 -24
- package/esm2020/lib/inputs/kvinputs.module.mjs +0 -108
- package/esm2020/lib/inputs/multi-select/multi-select.component.mjs +0 -38
- package/esm2020/lib/inputs/radio-group/radio-group.component.mjs +0 -53
- package/esm2020/lib/inputs/switch/switch.component.mjs +0 -32
- package/esm2020/lib/keevo-components.module.mjs +0 -105
- package/esm2020/lib/label/label.component.mjs +0 -15
- package/esm2020/lib/label/label.module.mjs +0 -24
- package/esm2020/lib/loader/loader.component.mjs +0 -18
- package/esm2020/lib/loader/loader.module.mjs +0 -28
- package/esm2020/lib/loader/loader.service.mjs +0 -29
- package/esm2020/lib/login/kvlogin.module.mjs +0 -47
- package/esm2020/lib/login/login.component.mjs +0 -52
- package/esm2020/lib/menu/kvmenu.module.mjs +0 -43
- package/esm2020/lib/menu/menu.component.mjs +0 -237
- package/esm2020/lib/orgchart/orgchart.component.mjs +0 -100
- package/esm2020/lib/orgchart/orgchart.module.mjs +0 -24
- package/esm2020/lib/page-form/kv-page-form.module.mjs +0 -38
- package/esm2020/lib/page-form/page-form.component.mjs +0 -144
- package/esm2020/lib/picklist/kvpicklist.module.mjs +0 -32
- package/esm2020/lib/picklist/picklist.component.mjs +0 -48
- package/esm2020/lib/pipes/codigofile.pipe.mjs +0 -19
- package/esm2020/lib/pipes/cpfcnpj.pipe.mjs +0 -25
- package/esm2020/lib/pipes/pipes.module.mjs +0 -34
- package/esm2020/lib/pipes/telefone.pipe.mjs +0 -45
- package/esm2020/lib/table/kvtable.module.mjs +0 -32
- package/esm2020/lib/table/table.component.mjs +0 -499
- package/esm2020/lib/tree-table/kv-treetable.component.mjs +0 -371
- package/esm2020/lib/tree-table/kv-treetable.module.mjs +0 -32
- package/esm2020/lib/tree-view/kvtree-view.module.mjs +0 -28
- package/esm2020/lib/tree-view/tree-view.component.mjs +0 -29
- package/esm2020/lib/workspace/kvworkspace.module.mjs +0 -47
- package/esm2020/lib/workspace/workspace.component.mjs +0 -77
- package/esm2020/public-api.mjs +0 -137
- package/fesm2015/keevo-components.mjs +0 -4706
- package/fesm2015/keevo-components.mjs.map +0 -1
- package/fesm2020/keevo-components.mjs +0 -4697
- package/fesm2020/keevo-components.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/api/base-components/base-component-button.d.ts +0 -14
- package/lib/api/base-components/base-component-chart.d.ts +0 -40
- package/lib/api/base-components/base-component-crud-form.d.ts +0 -137
- package/lib/api/base-components/base-component-crud-list.d.ts +0 -63
- package/lib/api/base-components/base-component-crud.d.ts +0 -36
- package/lib/api/base-components/base-component-dropdown-new.d.ts +0 -14
- package/lib/api/base-components/base-component-dropdown.d.ts +0 -42
- package/lib/api/base-components/base-component-input.d.ts +0 -31
- package/lib/api/base-components/base-component-multi-select.d.ts +0 -35
- package/lib/api/base-components/base-component.d.ts +0 -21
- package/lib/api/components/chart/chart.config.d.ts +0 -11
- package/lib/api/components/chart/chart.model.d.ts +0 -9
- package/lib/api/components/chart/orchart.config.d.ts +0 -35
- package/lib/api/components/chart/orchart.item.d.ts +0 -26
- package/lib/api/components/dropdown/filtro.combo.d.ts +0 -4
- package/lib/api/components/error/error.component.d.ts +0 -12
- package/lib/api/components/error/kverror.module.d.ts +0 -10
- package/lib/api/components/table/action-item.d.ts +0 -5
- package/lib/api/components/table/kv-menuitem.d.ts +0 -9
- package/lib/api/components/table/table.config.column.d.ts +0 -21
- package/lib/api/components/table/table.config.d.ts +0 -17
- package/lib/api/components/table/table.paginate.d.ts +0 -6
- package/lib/api/helpers/component-providers.d.ts +0 -2
- package/lib/api/helpers/keevo-validators.d.ts +0 -10
- package/lib/api/helpers/translate-primeng.d.ts +0 -4
- package/lib/api/models/menu/menu.model.d.ts +0 -10
- package/lib/api/models/menu/sistemamenu.model.d.ts +0 -8
- package/lib/api/modules/primeng.module.d.ts +0 -60
- package/lib/api/services/base.api.service.d.ts +0 -25
- package/lib/api/services/component.service.d.ts +0 -11
- package/lib/api/services/form.service.d.ts +0 -27
- package/lib/api/services/imagens.service.d.ts +0 -8
- package/lib/api/services/notification.service.d.ts +0 -25
- package/lib/api/services/object.service.d.ts +0 -8
- package/lib/buttons/button-personalize/button-personalize.component.d.ts +0 -7
- package/lib/buttons/button-popup/button-popup.component.d.ts +0 -13
- package/lib/buttons/button-secondary/button-secondary.component.d.ts +0 -7
- package/lib/buttons/button-success/button-success.component.d.ts +0 -7
- package/lib/buttons/kvbutton.module.d.ts +0 -11
- package/lib/chart/chart.component.d.ts +0 -56
- package/lib/chart/kvchart.module.d.ts +0 -10
- package/lib/directives/template.directive.d.ts +0 -11
- package/lib/inputs/check/check.component.d.ts +0 -11
- package/lib/inputs/dropdown/dropdown.component.d.ts +0 -14
- package/lib/inputs/editor/editor.component.d.ts +0 -39
- package/lib/inputs/input-calendar/input-calendar.component.d.ts +0 -27
- package/lib/inputs/input-mask/input-mask.component.d.ts +0 -10
- package/lib/inputs/input-number/input-number.component.d.ts +0 -19
- package/lib/inputs/input-password/input-password.component.d.ts +0 -13
- package/lib/inputs/input-text/input-text.component.d.ts +0 -9
- package/lib/inputs/input-text-checkbox/input-text-checkbox.component.d.ts +0 -15
- package/lib/inputs/input-textarea/input-textarea.component.d.ts +0 -16
- package/lib/inputs/input-time/input-time.component.d.ts +0 -10
- package/lib/inputs/kvinputs.module.d.ts +0 -25
- package/lib/inputs/multi-select/multi-select.component.d.ts +0 -12
- package/lib/inputs/radio-group/radio-group.component.d.ts +0 -18
- package/lib/inputs/switch/switch.component.d.ts +0 -13
- package/lib/keevo-components.module.d.ts +0 -19
- package/lib/label/label.component.d.ts +0 -7
- package/lib/label/label.module.d.ts +0 -8
- package/lib/loader/loader.component.d.ts +0 -10
- package/lib/loader/loader.module.d.ts +0 -9
- package/lib/loader/loader.service.d.ts +0 -10
- package/lib/login/kvlogin.module.d.ts +0 -13
- package/lib/login/login.component.d.ts +0 -30
- package/lib/menu/kvmenu.module.d.ts +0 -12
- package/lib/menu/menu.component.d.ts +0 -74
- package/lib/orgchart/orgchart.component.d.ts +0 -27
- package/lib/orgchart/orgchart.module.d.ts +0 -9
- package/lib/page-form/kv-page-form.module.d.ts +0 -11
- package/lib/page-form/page-form.component.d.ts +0 -69
- package/lib/picklist/kvpicklist.module.d.ts +0 -10
- package/lib/picklist/picklist.component.d.ts +0 -20
- package/lib/pipes/codigofile.pipe.d.ts +0 -7
- package/lib/pipes/cpfcnpj.pipe.d.ts +0 -7
- package/lib/pipes/pipes.module.d.ts +0 -10
- package/lib/pipes/telefone.pipe.d.ts +0 -7
- package/lib/table/kvtable.module.d.ts +0 -10
- package/lib/table/table.component.d.ts +0 -104
- package/lib/tree-table/kv-treetable.component.d.ts +0 -84
- package/lib/tree-table/kv-treetable.module.d.ts +0 -11
- package/lib/tree-view/kvtree-view.module.d.ts +0 -9
- package/lib/tree-view/tree-view.component.d.ts +0 -14
- package/lib/workspace/kvworkspace.module.d.ts +0 -13
- package/lib/workspace/workspace.component.d.ts +0 -28
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Component, OnInit } from "@angular/core";
|
|
2
|
+
import { DialogService } from "primeng/dynamicdialog";
|
|
3
|
+
import { Router } from "@angular/router";
|
|
4
|
+
|
|
5
|
+
import { BaseComponentCrud } from "./base-component-crud";
|
|
6
|
+
import { TablePaginate } from "../components/table/table.paginate";
|
|
7
|
+
import { TableConfig } from "../components/table/table.config";
|
|
8
|
+
import { ActionItem } from "../components/table/action-item";
|
|
9
|
+
import { NotificationService } from "../services/notification.service";
|
|
10
|
+
import { Observable } from "rxjs";
|
|
11
|
+
import { loading } from "../../loader/loader.service";
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
template: ''
|
|
15
|
+
})
|
|
16
|
+
export abstract class BaseComponentCrudList extends BaseComponentCrud implements OnInit {
|
|
17
|
+
|
|
18
|
+
dataSource: any;
|
|
19
|
+
selectedItem: any;
|
|
20
|
+
tableConfig!: TableConfig;
|
|
21
|
+
totalRecords: number = 0;
|
|
22
|
+
actionsPageList: ActionItem[] = [];
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
dialogService: DialogService,
|
|
26
|
+
notificationService: NotificationService,
|
|
27
|
+
public router: Router) {
|
|
28
|
+
super
|
|
29
|
+
(
|
|
30
|
+
dialogService,
|
|
31
|
+
notificationService
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ngOnInit() {
|
|
36
|
+
this.loadFilters();
|
|
37
|
+
this.configureTable();
|
|
38
|
+
|
|
39
|
+
// Tabela não configurada para paginação
|
|
40
|
+
if (!this.tableConfig.lazy)
|
|
41
|
+
this.loadTable(new TablePaginate());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Método disparado para configuração das tabelas do componente de lista
|
|
46
|
+
*/
|
|
47
|
+
abstract configureTable(): void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Método disparado para edição de registros
|
|
51
|
+
* @param registry - Registro que está sendo editado
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
abstract edit(registry: any): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Método disparado para carregamento dos filtros da tela
|
|
58
|
+
*/
|
|
59
|
+
abstract loadFilters(): void;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Método disparado para carregar a tabela do componente de lista
|
|
63
|
+
* @param tablePaginate - Classe dos dados da paginação da tabela
|
|
64
|
+
*/
|
|
65
|
+
abstract loadTable(tablePaginate: TablePaginate): void;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Método disparado ao clicar no botão de novo registro
|
|
69
|
+
*/
|
|
70
|
+
abstract newRegistry(): void;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Método que seta o registro selecionado na tabela
|
|
74
|
+
* @param event - Registro
|
|
75
|
+
*/
|
|
76
|
+
protected activeItem(event: any) {
|
|
77
|
+
this.selectedItem = event;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Método que dispara o carregamento da tabela
|
|
82
|
+
* @param obs - Observable de carregamento dos dados
|
|
83
|
+
*/
|
|
84
|
+
protected loadData(obs: Observable<any>) {
|
|
85
|
+
obs
|
|
86
|
+
.pipe(loading())
|
|
87
|
+
.subscribe({
|
|
88
|
+
next: (res: any) => {
|
|
89
|
+
this.totalRecords = res.item1;
|
|
90
|
+
this.dataSource = res.item2
|
|
91
|
+
},
|
|
92
|
+
error: (e) => {
|
|
93
|
+
this.toastError(e);
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Método que dispara a paginação
|
|
100
|
+
*/
|
|
101
|
+
protected paginate(event: any) {
|
|
102
|
+
this.loadTable(event);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Método que dispara a atualização da página inteira
|
|
107
|
+
*/
|
|
108
|
+
protected refresh() {
|
|
109
|
+
this.loadTable(new TablePaginate());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { DialogService } from 'primeng/dynamicdialog';
|
|
2
|
+
import { Component, Type } from "@angular/core";
|
|
3
|
+
import { FormService, paramsDialog } from "../services/form.service";
|
|
4
|
+
import { NotificationService } from '../services/notification.service';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
template: ''
|
|
9
|
+
})
|
|
10
|
+
export abstract class BaseComponentCrud {
|
|
11
|
+
|
|
12
|
+
public isReport: boolean = false;
|
|
13
|
+
public itemsReport: any = [];
|
|
14
|
+
|
|
15
|
+
constructor(
|
|
16
|
+
public dialogService: DialogService,
|
|
17
|
+
public notificationService: NotificationService) {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Fecha um relatório
|
|
22
|
+
*/
|
|
23
|
+
public closeReport() {
|
|
24
|
+
this.isReport = false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Abre um form dialog
|
|
29
|
+
* @param componentType - Componente que será renderizado
|
|
30
|
+
* @param callBackFunction - Função de callback que deverá ser chamada após o fechamento do dialog
|
|
31
|
+
* @param paramsDialog - Parâmetros do dialog
|
|
32
|
+
*/
|
|
33
|
+
protected openDialog(componentType: Type<any>, callBackFunction: Function, paramsDialog?: paramsDialog) {
|
|
34
|
+
FormService.openDialog(
|
|
35
|
+
this.dialogService,
|
|
36
|
+
componentType,
|
|
37
|
+
callBackFunction,
|
|
38
|
+
paramsDialog);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Imprime um relatório na tela
|
|
43
|
+
* @param obs - Observable com o carregamento do relatório
|
|
44
|
+
*/
|
|
45
|
+
protected printReportFilter(obs: Observable<any>) {
|
|
46
|
+
obs
|
|
47
|
+
//.pipe(loading())
|
|
48
|
+
.subscribe({
|
|
49
|
+
next: (res: any) => {
|
|
50
|
+
this.itemsReport = res;
|
|
51
|
+
this.isReport = true;
|
|
52
|
+
},
|
|
53
|
+
error: (e) => {
|
|
54
|
+
this.toastError(e);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Exibe um toast com um erro
|
|
61
|
+
* @param err - Erro
|
|
62
|
+
*/
|
|
63
|
+
protected toastError(err: any) {
|
|
64
|
+
if (err) {
|
|
65
|
+
if (err.message) {
|
|
66
|
+
this.notificationService.toastError(err.message);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Component, Input, TemplateRef } from "@angular/core";
|
|
2
|
+
import { BaseComponentDropDown } from "./base-component-dropdown"
|
|
3
|
+
import { FormGroup, FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
4
|
+
import { KeevoComponentsModule } from "../../keevo-components.module";
|
|
5
|
+
import { PrimeNgModule } from "../modules/primeng.module";
|
|
6
|
+
import { LabelModule } from "../../label/label.module";
|
|
7
|
+
import { kvErrorModule } from "../components/error/kverror.module";
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'app-base-dropdown',
|
|
11
|
+
template: `
|
|
12
|
+
<span>
|
|
13
|
+
<kv-label
|
|
14
|
+
[componentId]="componentId"
|
|
15
|
+
[label]="label"
|
|
16
|
+
/>
|
|
17
|
+
<p-dropdown
|
|
18
|
+
appendTo="body"
|
|
19
|
+
[class]="baseInputClass"
|
|
20
|
+
[disabled]="disabled"
|
|
21
|
+
[filter]="filter"
|
|
22
|
+
[inputId]="componentId"
|
|
23
|
+
[(ngModel)]="value"
|
|
24
|
+
[options]="filteredOptions"
|
|
25
|
+
[optionLabel]="optionLabel"
|
|
26
|
+
[optionValue]="optionValue"
|
|
27
|
+
[optionDisabled]="optionDisabled"
|
|
28
|
+
[group]="group"
|
|
29
|
+
[optionGroupLabel]="optionGroupLabel"
|
|
30
|
+
[optionGroupChildren]="optionGroupChildren"
|
|
31
|
+
[showClear]="showClear"
|
|
32
|
+
[lazy]="lazy"
|
|
33
|
+
scrollHeight="250px"
|
|
34
|
+
(onBlur)="onInputBlur($event)"
|
|
35
|
+
(onClick)="onInputClick($event)"
|
|
36
|
+
(onChange)="onInputChange($event)"
|
|
37
|
+
(onFilter)="onInputFilter($event)"
|
|
38
|
+
[style]="{'width':widthField}"
|
|
39
|
+
[panelStyle]="{ width: widthField, overflow: 'auto' }"
|
|
40
|
+
styleClass="inputs"
|
|
41
|
+
>
|
|
42
|
+
|
|
43
|
+
<ng-template
|
|
44
|
+
*ngIf="showAddButton"
|
|
45
|
+
pTemplate="footer"
|
|
46
|
+
>
|
|
47
|
+
<p-divider></p-divider>
|
|
48
|
+
<div class="flex flex-wrap card-container p-1">
|
|
49
|
+
<div class="flex justify-content-center">
|
|
50
|
+
<button
|
|
51
|
+
pButton
|
|
52
|
+
label="Incluir"
|
|
53
|
+
pTooltip="Clique aqui para incluir um novo registro"
|
|
54
|
+
tooltipPosition="bottom"
|
|
55
|
+
icon="pi pi-plus"
|
|
56
|
+
class="p-button-rounded p-button-success mr-2"
|
|
57
|
+
(click)="addClick($event)"
|
|
58
|
+
></button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</ng-template>
|
|
62
|
+
|
|
63
|
+
<ng-template
|
|
64
|
+
let-selectedItem
|
|
65
|
+
pTemplate="item"
|
|
66
|
+
*ngIf="itemTemplate"
|
|
67
|
+
>
|
|
68
|
+
<ng-container
|
|
69
|
+
[ngTemplateOutlet]="itemTemplate"
|
|
70
|
+
[ngTemplateOutletContext]="{ $implicit: selectedItem }"
|
|
71
|
+
>
|
|
72
|
+
</ng-container>
|
|
73
|
+
</ng-template>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
<ng-template
|
|
77
|
+
let-item
|
|
78
|
+
pTemplate="selectedItem"
|
|
79
|
+
*ngIf="selectedItemTemplate"
|
|
80
|
+
>
|
|
81
|
+
<ng-container
|
|
82
|
+
[ngTemplateOutlet]="selectedItemTemplate"
|
|
83
|
+
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
84
|
+
>
|
|
85
|
+
|
|
86
|
+
</ng-container>
|
|
87
|
+
</ng-template>
|
|
88
|
+
|
|
89
|
+
</p-dropdown>
|
|
90
|
+
|
|
91
|
+
<kv-error [hasError]="hasControlError()">{{ erroMessage() }}</kv-error>
|
|
92
|
+
</span>
|
|
93
|
+
<ng-content></ng-content>
|
|
94
|
+
`,
|
|
95
|
+
standalone: true,
|
|
96
|
+
imports: [KeevoComponentsModule, ReactiveFormsModule, FormsModule, PrimeNgModule, LabelModule, kvErrorModule]
|
|
97
|
+
})
|
|
98
|
+
export class BaseComponentDropdownNew extends BaseComponentDropDown {
|
|
99
|
+
|
|
100
|
+
@Input() formGroup!: FormGroup;
|
|
101
|
+
@Input() formControlName!: string;
|
|
102
|
+
|
|
103
|
+
@Input() dropDowValue!: any;
|
|
104
|
+
@Input() itemTemplate!: TemplateRef<any>;
|
|
105
|
+
@Input() selectedItemTemplate!: TemplateRef<any>;
|
|
106
|
+
|
|
107
|
+
override ngOnInit(): void {
|
|
108
|
+
if (this.dropDowValue)
|
|
109
|
+
this.value = this.dropDowValue;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
EventEmitter,
|
|
4
|
+
Input,
|
|
5
|
+
OnInit,
|
|
6
|
+
Output,
|
|
7
|
+
Type,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
|
|
10
|
+
import { FormControl } from '@angular/forms';
|
|
11
|
+
import { Observable, of } from 'rxjs';
|
|
12
|
+
import { DialogService } from 'primeng/dynamicdialog';
|
|
13
|
+
import { BaseComponentInput } from './base-component-input';
|
|
14
|
+
import { ComponentService } from '../services/component.service';
|
|
15
|
+
import { ObjectService } from '../services/object.service';
|
|
16
|
+
import { filtroCombo } from '../components/dropdown/filtro.combo';
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
template: '',
|
|
20
|
+
})
|
|
21
|
+
export abstract class BaseComponentDropDown extends BaseComponentInput<any> implements OnInit {
|
|
22
|
+
|
|
23
|
+
@Input() filteredOptions!: any[];
|
|
24
|
+
@Input() options!: any[];
|
|
25
|
+
@Input() optionLabel!: string;
|
|
26
|
+
@Input() optionValue!: string;
|
|
27
|
+
@Input() optionDisabled!: string;
|
|
28
|
+
|
|
29
|
+
@Input() group!: boolean;
|
|
30
|
+
@Input() optionGroupLabel!: string;
|
|
31
|
+
@Input() optionGroupChildren!: string;
|
|
32
|
+
|
|
33
|
+
@Input() filter: boolean = true;
|
|
34
|
+
@Input() lazy: boolean = false;
|
|
35
|
+
|
|
36
|
+
@Input() showAddButton: boolean = false;
|
|
37
|
+
@Input() showClear: boolean = true;
|
|
38
|
+
@Input() widthField?: string;
|
|
39
|
+
|
|
40
|
+
@Output() onAddClick: EventEmitter<any> = new EventEmitter();
|
|
41
|
+
@Output() onClick: EventEmitter<any> = new EventEmitter();
|
|
42
|
+
@Output() onSelectionChange: EventEmitter<any> = new EventEmitter();
|
|
43
|
+
@Output() onSelectionValue: EventEmitter<any> = new EventEmitter();
|
|
44
|
+
@Output() requestComplete: EventEmitter<any> = new EventEmitter();
|
|
45
|
+
|
|
46
|
+
constructor(
|
|
47
|
+
componentService: ComponentService,
|
|
48
|
+
private dialogService: DialogService
|
|
49
|
+
) {
|
|
50
|
+
super(componentService);
|
|
51
|
+
this.registerOnTouched(() => { });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override ngOnInit(): void {
|
|
55
|
+
super.ngOnInit();
|
|
56
|
+
this.setPlaceHolder('Selecione um valor');
|
|
57
|
+
|
|
58
|
+
if (!this.lazy) this.carregarCombo();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
protected addClick(event: Event) {
|
|
62
|
+
this.onAddClick.emit(event);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public carregarCombo(filtro?: filtroCombo): void {
|
|
66
|
+
if (filtro) {
|
|
67
|
+
this.carregarComboObs(this.listarCombo(filtro));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.carregarComboObs(this.listar());
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private carregarComboObs(obs: Observable<any>) {
|
|
75
|
+
if (obs) {
|
|
76
|
+
obs
|
|
77
|
+
.subscribe({
|
|
78
|
+
next: (data: any) => {
|
|
79
|
+
this.options = data;
|
|
80
|
+
this.filteredOptions = data;
|
|
81
|
+
this.requestComplete.emit(true);
|
|
82
|
+
},
|
|
83
|
+
error: (error: any) => {
|
|
84
|
+
console.log(error);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public filterOptions(field: string, value: any): void {
|
|
91
|
+
if (this.options) {
|
|
92
|
+
let lista = ObjectService.filterObject(this.options, field, value);
|
|
93
|
+
if (lista?.length > 0) {
|
|
94
|
+
of(lista).subscribe((opts: any[]) => {
|
|
95
|
+
this.filteredOptions = opts;
|
|
96
|
+
});
|
|
97
|
+
} else this.filteredOptions = [];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
protected listar(): any { }
|
|
102
|
+
protected listarCombo(value: any): any { }
|
|
103
|
+
|
|
104
|
+
protected openDialog(
|
|
105
|
+
componentType: Type<any>,
|
|
106
|
+
width?: string,
|
|
107
|
+
height?: string
|
|
108
|
+
) {
|
|
109
|
+
const ref = this.dialogService.open(componentType, {
|
|
110
|
+
width: width || '70%',
|
|
111
|
+
height: height,
|
|
112
|
+
closable: false,
|
|
113
|
+
maximizable: true,
|
|
114
|
+
data: { popup: true },
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
ref.onClose.subscribe((id: any) => {
|
|
118
|
+
if (id) {
|
|
119
|
+
this.listar().subscribe((data: any) => {
|
|
120
|
+
this.options = data;
|
|
121
|
+
this.filteredOptions = data;
|
|
122
|
+
if (id) this.formControl?.setValue(id);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
protected onInputChange(event: any) {
|
|
129
|
+
this.onSelectionValue.emit(event);
|
|
130
|
+
|
|
131
|
+
if (this.formControl) {
|
|
132
|
+
const controlName = this.getName(this.formControl as FormControl);
|
|
133
|
+
if (controlName) {
|
|
134
|
+
let currentItem = ObjectService.findObject(
|
|
135
|
+
this.options,
|
|
136
|
+
controlName,
|
|
137
|
+
event.value
|
|
138
|
+
);
|
|
139
|
+
this.onSelectionChange.emit(currentItem);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onInputClick(event: any) {
|
|
145
|
+
this.onClick.emit(event);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
onInputFilter(event: any) {
|
|
149
|
+
if (event) {
|
|
150
|
+
if (event.filter) {
|
|
151
|
+
if (event.filter.length > 2) {
|
|
152
|
+
this.carregarCombo({ termoPesquisa: event.filter } as filtroCombo);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
override writeValue(value: any): void {
|
|
159
|
+
if (this.lazy && value) {
|
|
160
|
+
this.carregarCombo({ id: value } as filtroCombo);
|
|
161
|
+
}
|
|
162
|
+
this.value = value;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AfterContentInit,
|
|
3
|
+
AfterViewInit,
|
|
4
|
+
Component,
|
|
5
|
+
ContentChildren,
|
|
6
|
+
EventEmitter,
|
|
7
|
+
Input,
|
|
8
|
+
OnInit,
|
|
9
|
+
Output,
|
|
10
|
+
QueryList,
|
|
11
|
+
ViewChildren
|
|
12
|
+
} from "@angular/core";
|
|
13
|
+
|
|
14
|
+
import { FormControl } from '@angular/forms';
|
|
15
|
+
|
|
16
|
+
import { BaseComponent } from './base-component';
|
|
17
|
+
|
|
18
|
+
import { ComponentService } from '../services/component.service';
|
|
19
|
+
import { ErrorComponent } from '../components/error/error.component';
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
template: '',
|
|
23
|
+
})
|
|
24
|
+
export abstract class BaseComponentInput<T> extends BaseComponent<T> implements OnInit, AfterContentInit, AfterViewInit {
|
|
25
|
+
|
|
26
|
+
protected formControl: FormControl | undefined;
|
|
27
|
+
protected hasError: boolean | undefined = false;
|
|
28
|
+
|
|
29
|
+
@Input() placeholder: string = '';
|
|
30
|
+
|
|
31
|
+
@Output() onBlur: EventEmitter<any> = new EventEmitter();
|
|
32
|
+
@Output() onInput: EventEmitter<any> = new EventEmitter();
|
|
33
|
+
@Output() onClose: EventEmitter<any> = new EventEmitter();
|
|
34
|
+
|
|
35
|
+
@ViewChildren(ErrorComponent) viewErrors!: QueryList<ErrorComponent>;
|
|
36
|
+
@ContentChildren(ErrorComponent) contentErrors!: QueryList<ErrorComponent>;
|
|
37
|
+
|
|
38
|
+
constructor(protected readonly componentService: ComponentService) {
|
|
39
|
+
super();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public get baseInputClass(): string {
|
|
43
|
+
return `${this.hasError ? 'ng-invalid ng-dirty' : ''} !important`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
erroMessage(): string | undefined {
|
|
47
|
+
if (!this.formControl?.errors) return;
|
|
48
|
+
|
|
49
|
+
let message: string = '';
|
|
50
|
+
|
|
51
|
+
if (this.formControl.errors) {
|
|
52
|
+
const objErrors = this.formControl.errors as any;
|
|
53
|
+
if (objErrors.erroMessage) message = objErrors.erroMessage;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return message;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getName(control: FormControl): string | null {
|
|
60
|
+
return Object.entries(control.parent?.controls ?? []).find(([_, value]) => value === control)?.[0] ?? null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
hasControlError(): boolean {
|
|
64
|
+
if (!this.formControl) return false;
|
|
65
|
+
return (this.formControl.dirty || this.formControl.touched) && this.formControl.errors !== null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
ngAfterViewInit(): void {
|
|
69
|
+
this.viewErrors.forEach(c => {
|
|
70
|
+
c.emitError.subscribe(res => {
|
|
71
|
+
this.hasError = res;
|
|
72
|
+
this.componentService.changeDetectorRef.detectChanges();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ngAfterContentInit() {
|
|
78
|
+
this.contentErrors.forEach(c => {
|
|
79
|
+
c.emitError.subscribe(res => {
|
|
80
|
+
this.hasError = res;
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
ngOnInit(): void {
|
|
86
|
+
this.formControl = this.componentService.getFormControl();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
onInputBlur(event: Event) {
|
|
90
|
+
if (this.onTouched)
|
|
91
|
+
this.onTouched();
|
|
92
|
+
|
|
93
|
+
this.onBlur.emit(event);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
onInputClose(event: Event) {
|
|
97
|
+
this.onClose.emit(event);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
onInputInput(event: Event) {
|
|
101
|
+
this.onInput.emit(event);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
protected setPlaceHolder(p: string) {
|
|
105
|
+
if (!this.placeholder) this.placeholder = p;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
EventEmitter,
|
|
4
|
+
Input,
|
|
5
|
+
OnInit,
|
|
6
|
+
Output,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
|
|
9
|
+
import { FormControl } from '@angular/forms';
|
|
10
|
+
import { Observable, of } from 'rxjs';
|
|
11
|
+
import { BaseComponentInput } from './base-component-input';
|
|
12
|
+
import { ComponentService } from '../services/component.service';
|
|
13
|
+
import { ObjectService } from '../services/object.service';
|
|
14
|
+
import { filtroCombo } from '../components/dropdown/filtro.combo';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
template: '',
|
|
18
|
+
})
|
|
19
|
+
export abstract class BaseComponentMultiSelect extends BaseComponentInput<any> implements OnInit {
|
|
20
|
+
|
|
21
|
+
@Input() options: any;
|
|
22
|
+
@Input() optionLabel!: string;
|
|
23
|
+
@Input() optionValue!: string;
|
|
24
|
+
@Input() filter: boolean = false;
|
|
25
|
+
@Input() showClear: boolean = false;
|
|
26
|
+
|
|
27
|
+
@Input() lazy: boolean = false;
|
|
28
|
+
@Input() filteredOptions!: any[];
|
|
29
|
+
|
|
30
|
+
@Output() onSelectionChange: EventEmitter<any> = new EventEmitter();
|
|
31
|
+
@Output() onPanelHide: EventEmitter<any> = new EventEmitter();
|
|
32
|
+
@Output() onSelectionValue: EventEmitter<any> = new EventEmitter();
|
|
33
|
+
@Output() onClick: EventEmitter<any> = new EventEmitter();
|
|
34
|
+
|
|
35
|
+
loadedCombo: boolean = false;
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
componentService: ComponentService,
|
|
39
|
+
) {
|
|
40
|
+
super(componentService);
|
|
41
|
+
this.registerOnTouched(() => { });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
override ngOnInit(): void {
|
|
45
|
+
super.ngOnInit();
|
|
46
|
+
this.setPlaceHolder('Selecione um valor');
|
|
47
|
+
|
|
48
|
+
if (!this.lazy) this.carregarCombo();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public carregarCombo(filtro?: filtroCombo): void {
|
|
52
|
+
if (filtro) {
|
|
53
|
+
this.carregarComboObs(this.listarCombo(filtro));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.carregarComboObs(this.listar());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private carregarComboObs(obs: Observable<any>) {
|
|
61
|
+
if (obs) {
|
|
62
|
+
obs
|
|
63
|
+
.subscribe({
|
|
64
|
+
next: (data: any) => {
|
|
65
|
+
this.options = data;
|
|
66
|
+
this.filteredOptions = data;
|
|
67
|
+
this.loadedCombo = true
|
|
68
|
+
},
|
|
69
|
+
error: (error: any) => {
|
|
70
|
+
console.log(error);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public filterOptions(field: string, value: any): void {
|
|
77
|
+
if (this.options) {
|
|
78
|
+
let lista = ObjectService.filterObject(this.options, field, value);
|
|
79
|
+
if (lista?.length > 0) {
|
|
80
|
+
of(lista).subscribe((opts: any[]) => {
|
|
81
|
+
this.filteredOptions = opts;
|
|
82
|
+
});
|
|
83
|
+
} else this.filteredOptions = [];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
protected onInputChange(event: any) {
|
|
88
|
+
this.onSelectionValue.emit(event);
|
|
89
|
+
|
|
90
|
+
if (this.formControl) {
|
|
91
|
+
const controlName = this.getName(this.formControl as FormControl);
|
|
92
|
+
if (controlName) {
|
|
93
|
+
let currentItem = ObjectService.findObject(
|
|
94
|
+
this.options,
|
|
95
|
+
controlName,
|
|
96
|
+
event.value
|
|
97
|
+
);
|
|
98
|
+
this.onSelectionChange.emit(currentItem);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
onInputClick(event: any) {
|
|
104
|
+
this.onClick.emit(event);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
onInputFilter(event: any) {
|
|
108
|
+
if (event) {
|
|
109
|
+
if (event.filter) {
|
|
110
|
+
if (event.filter.length > 2) {
|
|
111
|
+
this.carregarCombo({ termoPesquisa: event.filter } as filtroCombo);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
protected listar(): any { }
|
|
118
|
+
protected listarCombo(value: any): any { }
|
|
119
|
+
|
|
120
|
+
panelHide(event: Event) {
|
|
121
|
+
this.onPanelHide.emit(event);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public override get baseInputClass(): string {
|
|
125
|
+
return `p-multiselect-sm ${this.hasError ? 'ng-invalid ng-dirty' : ''}`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
selectionChange(event: Event) {
|
|
129
|
+
this.onSelectionChange.emit(event);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public requestCompleted() {
|
|
133
|
+
return this.loadedCombo;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
}
|