monkey-front-components 0.0.384 → 0.0.387
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/esm2020/lib/components/base/base-component.mjs +322 -0
- package/esm2020/lib/components/base/base-dynamic-array.mjs +221 -0
- package/esm2020/lib/components/base/base-dynamic.mjs +99 -0
- package/esm2020/lib/components/base/base-scroll-component.mjs +55 -0
- package/esm2020/lib/components/base/base-validators.mjs +19 -0
- package/esm2020/lib/components/base/index.mjs +6 -0
- package/esm2020/lib/components/dynamic/button/button.component.mjs +52 -0
- package/esm2020/lib/components/dynamic/button/index.mjs +2 -0
- package/esm2020/lib/components/dynamic/dynamic-directive.mjs +95 -0
- package/esm2020/lib/components/dynamic/dynamic.module.mjs +84 -0
- package/esm2020/lib/components/dynamic/file-upload/file-upload.component.mjs +52 -0
- package/esm2020/lib/components/dynamic/file-upload/index.mjs +2 -0
- package/esm2020/lib/components/dynamic/form/dynamic-form-array.component.mjs +72 -0
- package/esm2020/lib/components/dynamic/form/dynamic-form.component.mjs +46 -0
- package/esm2020/lib/components/dynamic/form/index.mjs +3 -0
- package/esm2020/lib/components/dynamic/index.mjs +9 -0
- package/esm2020/lib/components/dynamic/input/index.mjs +2 -0
- package/esm2020/lib/components/dynamic/input/input.component.mjs +65 -0
- package/esm2020/lib/components/dynamic/input-phone/index.mjs +2 -0
- package/esm2020/lib/components/dynamic/input-phone/input-phone.component.mjs +65 -0
- package/esm2020/lib/components/dynamic/radio/index.mjs +2 -0
- package/esm2020/lib/components/dynamic/radio/radio.component.mjs +33 -0
- package/esm2020/lib/components/dynamic/select/index.mjs +2 -0
- package/esm2020/lib/components/dynamic/select/select.component.mjs +80 -0
- package/esm2020/lib/components/dynamic/select-search/index.mjs +2 -0
- package/esm2020/lib/components/dynamic/select-search/select-search.component.mjs +80 -0
- package/esm2020/lib/components/index.mjs +4 -0
- package/esm2020/lib/components/shared/filter/filter.component.mjs +119 -0
- package/esm2020/lib/components/shared/filter/filter.module.mjs +63 -0
- package/esm2020/lib/components/shared/filter/index.mjs +3 -0
- package/esm2020/lib/components/shared/filter/menu/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/menu/menu.component.mjs +120 -0
- package/esm2020/lib/components/shared/filter/menu/menu.module.mjs +70 -0
- package/esm2020/lib/components/shared/filter/options/children/children.component.mjs +50 -0
- package/esm2020/lib/components/shared/filter/options/children/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/options/currency/currency.component.mjs +46 -0
- package/esm2020/lib/components/shared/filter/options/currency/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/options/date-range/date-range.component.mjs +65 -0
- package/esm2020/lib/components/shared/filter/options/date-range/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/options/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/options/input/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/options/input/input.component.mjs +46 -0
- package/esm2020/lib/components/shared/filter/options/options.component.mjs +68 -0
- package/esm2020/lib/components/shared/filter/options/options.module.mjs +95 -0
- package/esm2020/lib/components/shared/filter/options/status/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/options/status/status.component.mjs +66 -0
- package/esm2020/lib/components/shared/filter/selected/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/selected/item/children/children.component.mjs +57 -0
- package/esm2020/lib/components/shared/filter/selected/item/children/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/selected/item/currency/currency.component.mjs +29 -0
- package/esm2020/lib/components/shared/filter/selected/item/currency/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/selected/item/date-range/date-range.component.mjs +42 -0
- package/esm2020/lib/components/shared/filter/selected/item/date-range/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.mjs +33 -0
- package/esm2020/lib/components/shared/filter/selected/item/date-with-action/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/selected/item/index.mjs +8 -0
- package/esm2020/lib/components/shared/filter/selected/item/input/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/selected/item/input/input.component.mjs +28 -0
- package/esm2020/lib/components/shared/filter/selected/item/item.component.mjs +74 -0
- package/esm2020/lib/components/shared/filter/selected/item/status/index.mjs +2 -0
- package/esm2020/lib/components/shared/filter/selected/item/status/status.component.mjs +39 -0
- package/esm2020/lib/components/shared/filter/selected/selected.component.mjs +80 -0
- package/esm2020/lib/components/shared/filter/selected/selected.module.mjs +90 -0
- package/esm2020/lib/components/shared/index.mjs +5 -0
- package/esm2020/lib/components/shared/password-strength/index.mjs +3 -0
- package/esm2020/lib/components/shared/password-strength/password-strength.component.mjs +85 -0
- package/esm2020/lib/components/shared/password-strength/password-strength.mjs +2 -0
- package/esm2020/lib/components/shared/password-strength/password-strength.module.mjs +50 -0
- package/esm2020/lib/components/shared/products/filter/filter.component.mjs +36 -0
- package/esm2020/lib/components/shared/products/index.mjs +3 -0
- package/esm2020/lib/components/shared/products/products.component.mjs +91 -0
- package/esm2020/lib/components/shared/products/products.module.mjs +22 -0
- package/esm2020/lib/components/shared/products/providers/index.mjs +2 -0
- package/esm2020/lib/components/shared/products/providers/products.model.mjs +38 -0
- package/esm2020/lib/components/shared/progress-bar/index.mjs +4 -0
- package/esm2020/lib/components/shared/progress-bar/progress-bar.component.mjs +28 -0
- package/esm2020/lib/components/shared/progress-bar/progress-bar.module.mjs +18 -0
- package/esm2020/lib/components/shared/progress-bar/progress-bar.service.mjs +49 -0
- package/esm2020/lib/interfaces/field-config.mjs +2 -0
- package/esm2020/lib/interfaces/index.mjs +2 -0
- package/esm2020/monkey-front-components.mjs +5 -0
- package/esm2020/public-api.mjs +5 -0
- package/fesm2015/monkey-front-components.mjs +2877 -0
- package/fesm2015/monkey-front-components.mjs.map +1 -0
- package/fesm2020/monkey-front-components.mjs +2859 -0
- package/fesm2020/monkey-front-components.mjs.map +1 -0
- package/lib/components/base/base-component.d.ts +50 -0
- package/lib/components/base/base-dynamic-array.d.ts +34 -0
- package/lib/components/base/base-dynamic.d.ts +24 -0
- package/lib/components/base/base-scroll-component.d.ts +16 -0
- package/lib/components/base/base-validators.d.ts +1 -0
- package/{src/lib/components/base/index.ts → lib/components/base/index.d.ts} +5 -5
- package/lib/components/dynamic/button/button.component.d.ts +17 -0
- package/{src/lib/components/dynamic/button/index.ts → lib/components/dynamic/button/index.d.ts} +1 -1
- package/lib/components/dynamic/dynamic-directive.d.ts +22 -0
- package/lib/components/dynamic/dynamic.module.d.ts +20 -0
- package/lib/components/dynamic/file-upload/file-upload.component.d.ts +17 -0
- package/{src/lib/components/dynamic/file-upload/index.ts → lib/components/dynamic/file-upload/index.d.ts} +1 -1
- package/lib/components/dynamic/form/dynamic-form-array.component.d.ts +16 -0
- package/lib/components/dynamic/form/dynamic-form.component.d.ts +14 -0
- package/{src/lib/components/dynamic/form/index.ts → lib/components/dynamic/form/index.d.ts} +2 -2
- package/{src/lib/components/dynamic/index.ts → lib/components/dynamic/index.d.ts} +8 -8
- package/{src/lib/components/dynamic/input/index.ts → lib/components/dynamic/input/index.d.ts} +1 -1
- package/lib/components/dynamic/input/input.component.d.ts +20 -0
- package/{src/lib/components/dynamic/input-phone/index.ts → lib/components/dynamic/input-phone/index.d.ts} +1 -1
- package/lib/components/dynamic/input-phone/input-phone.component.d.ts +20 -0
- package/{src/lib/components/dynamic/radio/index.ts → lib/components/dynamic/radio/index.d.ts} +1 -1
- package/lib/components/dynamic/radio/radio.component.d.ts +11 -0
- package/{src/lib/components/dynamic/select/index.ts → lib/components/dynamic/select/index.d.ts} +1 -1
- package/lib/components/dynamic/select/select.component.d.ts +16 -0
- package/{src/lib/components/dynamic/select-search/index.ts → lib/components/dynamic/select-search/index.d.ts} +1 -1
- package/lib/components/dynamic/select-search/select-search.component.d.ts +16 -0
- package/{src/lib/components/index.ts → lib/components/index.d.ts} +3 -3
- package/lib/components/shared/filter/filter.component.d.ts +32 -0
- package/lib/components/shared/filter/filter.module.d.ts +14 -0
- package/{src/lib/components/shared/filter/index.ts → lib/components/shared/filter/index.d.ts} +2 -2
- package/{src/lib/components/shared/filter/menu/index.ts → lib/components/shared/filter/menu/index.d.ts} +1 -1
- package/lib/components/shared/filter/menu/menu.component.d.ts +24 -0
- package/lib/components/shared/filter/menu/menu.module.d.ts +14 -0
- package/lib/components/shared/filter/options/children/children.component.d.ts +17 -0
- package/{src/lib/components/shared/filter/options/children/index.ts → lib/components/shared/filter/options/children/index.d.ts} +1 -1
- package/lib/components/shared/filter/options/currency/currency.component.d.ts +17 -0
- package/{src/lib/components/shared/filter/options/currency/index.ts → lib/components/shared/filter/options/currency/index.d.ts} +1 -1
- package/lib/components/shared/filter/options/date-range/date-range.component.d.ts +24 -0
- package/{src/lib/components/shared/filter/options/date-range/index.ts → lib/components/shared/filter/options/date-range/index.d.ts} +1 -1
- package/{src/lib/components/shared/filter/options/index.ts → lib/components/shared/filter/options/index.d.ts} +1 -1
- package/{src/lib/components/shared/filter/options/input/index.ts → lib/components/shared/filter/options/input/index.d.ts} +1 -1
- package/lib/components/shared/filter/options/input/input.component.d.ts +17 -0
- package/lib/components/shared/filter/options/options.component.d.ts +20 -0
- package/lib/components/shared/filter/options/options.module.d.ts +18 -0
- package/{src/lib/components/shared/filter/options/status/index.ts → lib/components/shared/filter/options/status/index.d.ts} +1 -1
- package/lib/components/shared/filter/options/status/status.component.d.ts +19 -0
- package/{src/lib/components/shared/filter/selected/index.ts → lib/components/shared/filter/selected/index.d.ts} +1 -1
- package/lib/components/shared/filter/selected/item/children/children.component.d.ts +16 -0
- package/{src/lib/components/shared/filter/selected/item/children/index.ts → lib/components/shared/filter/selected/item/children/index.d.ts} +1 -1
- package/lib/components/shared/filter/selected/item/currency/currency.component.d.ts +11 -0
- package/{src/lib/components/shared/filter/selected/item/currency/index.ts → lib/components/shared/filter/selected/item/currency/index.d.ts} +1 -1
- package/lib/components/shared/filter/selected/item/date-range/date-range.component.d.ts +12 -0
- package/{src/lib/components/shared/filter/selected/item/date-range/index.ts → lib/components/shared/filter/selected/item/date-range/index.d.ts} +1 -1
- package/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.d.ts +11 -0
- package/{src/lib/components/shared/filter/selected/item/date-with-action/index.ts → lib/components/shared/filter/selected/item/date-with-action/index.d.ts} +1 -1
- package/{src/lib/components/shared/filter/selected/item/index.ts → lib/components/shared/filter/selected/item/index.d.ts} +7 -7
- package/{src/lib/components/shared/filter/selected/item/input/index.ts → lib/components/shared/filter/selected/item/input/index.d.ts} +1 -1
- package/lib/components/shared/filter/selected/item/input/input.component.d.ts +11 -0
- package/lib/components/shared/filter/selected/item/item.component.d.ts +20 -0
- package/{src/lib/components/shared/filter/selected/item/status/index.ts → lib/components/shared/filter/selected/item/status/index.d.ts} +1 -1
- package/lib/components/shared/filter/selected/item/status/status.component.d.ts +13 -0
- package/lib/components/shared/filter/selected/selected.component.d.ts +18 -0
- package/lib/components/shared/filter/selected/selected.module.d.ts +21 -0
- package/{src/lib/components/shared/index.ts → lib/components/shared/index.d.ts} +4 -4
- package/{src/lib/components/shared/password-strength/index.ts → lib/components/shared/password-strength/index.d.ts} +2 -2
- package/lib/components/shared/password-strength/password-strength.component.d.ts +23 -0
- package/lib/components/shared/password-strength/password-strength.d.ts +5 -0
- package/lib/components/shared/password-strength/password-strength.module.d.ts +12 -0
- package/lib/components/shared/products/filter/filter.component.d.ts +12 -0
- package/{src/lib/components/shared/products/index.ts → lib/components/shared/products/index.d.ts} +2 -2
- package/lib/components/shared/products/products.component.d.ts +20 -0
- package/lib/components/shared/products/products.module.d.ts +11 -0
- package/{src/lib/components/shared/products/providers/index.ts → lib/components/shared/products/providers/index.d.ts} +1 -1
- package/lib/components/shared/products/providers/products.model.d.ts +13 -0
- package/{src/lib/components/shared/progress-bar/index.ts → lib/components/shared/progress-bar/index.d.ts} +3 -3
- package/lib/components/shared/progress-bar/progress-bar.component.d.ts +12 -0
- package/lib/components/shared/progress-bar/progress-bar.module.d.ts +8 -0
- package/lib/components/shared/progress-bar/progress-bar.service.d.ts +14 -0
- package/lib/interfaces/field-config.d.ts +54 -0
- package/{src/lib/interfaces/index.ts → lib/interfaces/index.d.ts} +1 -1
- package/monkey-front-components-0.0.387.tgz +0 -0
- package/monkey-front-components.d.ts +5 -0
- package/package.json +25 -5
- package/public-api.d.ts +1 -0
- package/karma.conf.js +0 -44
- package/monkey-front-components-0.0.384.tgz +0 -0
- package/ng-package.json +0 -10
- package/src/lib/components/base/base-component.ts +0 -359
- package/src/lib/components/base/base-dynamic-array.ts +0 -233
- package/src/lib/components/base/base-dynamic.ts +0 -90
- package/src/lib/components/base/base-scroll-component.ts +0 -52
- package/src/lib/components/base/base-validators.ts +0 -19
- package/src/lib/components/dynamic/button/button.component.html +0 -4
- package/src/lib/components/dynamic/button/button.component.scss +0 -7
- package/src/lib/components/dynamic/button/button.component.ts +0 -47
- package/src/lib/components/dynamic/dynamic-directive.ts +0 -102
- package/src/lib/components/dynamic/dynamic.module.ts +0 -53
- package/src/lib/components/dynamic/file-upload/file-upload.component.html +0 -10
- package/src/lib/components/dynamic/file-upload/file-upload.component.ts +0 -46
- package/src/lib/components/dynamic/form/dynamic-form-array.component.html +0 -19
- package/src/lib/components/dynamic/form/dynamic-form-array.component.scss +0 -10
- package/src/lib/components/dynamic/form/dynamic-form-array.component.ts +0 -75
- package/src/lib/components/dynamic/form/dynamic-form.component.html +0 -7
- package/src/lib/components/dynamic/form/dynamic-form.component.ts +0 -49
- package/src/lib/components/dynamic/input/input.component.html +0 -9
- package/src/lib/components/dynamic/input/input.component.ts +0 -58
- package/src/lib/components/dynamic/input-phone/input-phone.component.html +0 -7
- package/src/lib/components/dynamic/input-phone/input-phone.component.ts +0 -58
- package/src/lib/components/dynamic/radio/radio.component.html +0 -8
- package/src/lib/components/dynamic/radio/radio.component.ts +0 -22
- package/src/lib/components/dynamic/select/select.component.html +0 -14
- package/src/lib/components/dynamic/select/select.component.ts +0 -75
- package/src/lib/components/dynamic/select-search/select-search.component.html +0 -15
- package/src/lib/components/dynamic/select-search/select-search.component.ts +0 -76
- package/src/lib/components/shared/filter/filter.component.html +0 -51
- package/src/lib/components/shared/filter/filter.component.scss +0 -79
- package/src/lib/components/shared/filter/filter.component.ts +0 -117
- package/src/lib/components/shared/filter/filter.module.ts +0 -36
- package/src/lib/components/shared/filter/menu/menu.component.html +0 -28
- package/src/lib/components/shared/filter/menu/menu.component.scss +0 -62
- package/src/lib/components/shared/filter/menu/menu.component.ts +0 -122
- package/src/lib/components/shared/filter/menu/menu.module.ts +0 -41
- package/src/lib/components/shared/filter/options/children/children.component.html +0 -6
- package/src/lib/components/shared/filter/options/children/children.component.scss +0 -30
- package/src/lib/components/shared/filter/options/children/children.component.ts +0 -58
- package/src/lib/components/shared/filter/options/currency/currency.component.html +0 -3
- package/src/lib/components/shared/filter/options/currency/currency.component.scss +0 -19
- package/src/lib/components/shared/filter/options/currency/currency.component.ts +0 -52
- package/src/lib/components/shared/filter/options/date-range/date-range.component.html +0 -3
- package/src/lib/components/shared/filter/options/date-range/date-range.component.scss +0 -34
- package/src/lib/components/shared/filter/options/date-range/date-range.component.ts +0 -72
- package/src/lib/components/shared/filter/options/input/input.component.html +0 -3
- package/src/lib/components/shared/filter/options/input/input.component.scss +0 -19
- package/src/lib/components/shared/filter/options/input/input.component.ts +0 -52
- package/src/lib/components/shared/filter/options/options.component.html +0 -43
- package/src/lib/components/shared/filter/options/options.component.scss +0 -56
- package/src/lib/components/shared/filter/options/options.component.ts +0 -58
- package/src/lib/components/shared/filter/options/options.module.ts +0 -58
- package/src/lib/components/shared/filter/options/status/status.component.html +0 -4
- package/src/lib/components/shared/filter/options/status/status.component.scss +0 -29
- package/src/lib/components/shared/filter/options/status/status.component.ts +0 -73
- package/src/lib/components/shared/filter/selected/item/children/children.component.html +0 -19
- package/src/lib/components/shared/filter/selected/item/children/children.component.scss +0 -68
- package/src/lib/components/shared/filter/selected/item/children/children.component.ts +0 -49
- package/src/lib/components/shared/filter/selected/item/currency/currency.component.html +0 -1
- package/src/lib/components/shared/filter/selected/item/currency/currency.component.scss +0 -4
- package/src/lib/components/shared/filter/selected/item/currency/currency.component.ts +0 -26
- package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.html +0 -2
- package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.scss +0 -4
- package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.ts +0 -39
- package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.html +0 -1
- package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.scss +0 -4
- package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.ts +0 -29
- package/src/lib/components/shared/filter/selected/item/input/input.component.html +0 -1
- package/src/lib/components/shared/filter/selected/item/input/input.component.scss +0 -4
- package/src/lib/components/shared/filter/selected/item/input/input.component.ts +0 -26
- package/src/lib/components/shared/filter/selected/item/item.component.html +0 -38
- package/src/lib/components/shared/filter/selected/item/item.component.scss +0 -72
- package/src/lib/components/shared/filter/selected/item/item.component.ts +0 -71
- package/src/lib/components/shared/filter/selected/item/status/status.component.html +0 -1
- package/src/lib/components/shared/filter/selected/item/status/status.component.scss +0 -4
- package/src/lib/components/shared/filter/selected/item/status/status.component.ts +0 -36
- package/src/lib/components/shared/filter/selected/selected.component.html +0 -3
- package/src/lib/components/shared/filter/selected/selected.component.scss +0 -9
- package/src/lib/components/shared/filter/selected/selected.component.ts +0 -76
- package/src/lib/components/shared/filter/selected/selected.module.ts +0 -60
- package/src/lib/components/shared/password-strength/password-strength.component.html +0 -50
- package/src/lib/components/shared/password-strength/password-strength.component.scss +0 -70
- package/src/lib/components/shared/password-strength/password-strength.component.ts +0 -89
- package/src/lib/components/shared/password-strength/password-strength.module.ts +0 -24
- package/src/lib/components/shared/password-strength/password-strength.ts +0 -5
- package/src/lib/components/shared/products/filter/filter.component.html +0 -6
- package/src/lib/components/shared/products/filter/filter.component.scss +0 -20
- package/src/lib/components/shared/products/filter/filter.component.ts +0 -34
- package/src/lib/components/shared/products/products.component.html +0 -15
- package/src/lib/components/shared/products/products.component.scss +0 -70
- package/src/lib/components/shared/products/products.component.ts +0 -104
- package/src/lib/components/shared/products/products.module.ts +0 -13
- package/src/lib/components/shared/products/providers/products.model.ts +0 -60
- package/src/lib/components/shared/progress-bar/progress-bar.component.html +0 -3
- package/src/lib/components/shared/progress-bar/progress-bar.component.scss +0 -6
- package/src/lib/components/shared/progress-bar/progress-bar.component.ts +0 -27
- package/src/lib/components/shared/progress-bar/progress-bar.module.ts +0 -10
- package/src/lib/components/shared/progress-bar/progress-bar.service.ts +0 -59
- package/src/lib/interfaces/field-config.ts +0 -58
- package/src/public-api.ts +0 -5
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -20
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
-
import { Directive, OnInit } from '@angular/core';
|
|
3
|
-
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
|
|
4
|
-
import { BaseComponent } from './base-component';
|
|
5
|
-
|
|
6
|
-
@Directive({
|
|
7
|
-
selector: '[baseScrollComponent]'
|
|
8
|
-
})
|
|
9
|
-
export abstract class BaseScrollComponent extends BaseComponent implements OnInit {
|
|
10
|
-
private routeScrollPositions: { [url: string]: number } = {};
|
|
11
|
-
|
|
12
|
-
constructor(private _pId: Object, private _rt: Router) {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
private saveScroll(url: string) {
|
|
17
|
-
const element: any = document.getElementById('container-3');
|
|
18
|
-
this.routeScrollPositions[url] = element.scrollTop;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
private restoreScroll(url: string) {
|
|
22
|
-
const savedScroll = this.routeScrollPositions[url];
|
|
23
|
-
const element: any = document.getElementById('container-3');
|
|
24
|
-
if (!savedScroll) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
element.scrollTop = savedScroll;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
private addScrollTopListeners() {
|
|
32
|
-
if ('scrollRestoration' in history) {
|
|
33
|
-
history.scrollRestoration = 'manual';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
this._rt.events.subscribe(event => {
|
|
37
|
-
if (event instanceof NavigationStart) {
|
|
38
|
-
this.saveScroll(this._rt.url);
|
|
39
|
-
} else if (event instanceof NavigationEnd) {
|
|
40
|
-
setTimeout(() => {
|
|
41
|
-
this.restoreScroll(event.url);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
ngOnInit(): void {
|
|
48
|
-
if (isPlatformBrowser(this._pId)) {
|
|
49
|
-
this.addScrollTopListeners();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Validators as Validators_ } from '@angular/forms';
|
|
2
|
-
import { Validators } from 'monkey-front-core';
|
|
3
|
-
|
|
4
|
-
export const validators: any = {
|
|
5
|
-
required: Validators_.required,
|
|
6
|
-
email: Validators.email,
|
|
7
|
-
governmentId: Validators.documentBR,
|
|
8
|
-
governmentIdRut: Validators.documentCL,
|
|
9
|
-
documentBR: Validators.documentBR,
|
|
10
|
-
documentCL: Validators.documentCL,
|
|
11
|
-
date: Validators.date,
|
|
12
|
-
zipCode: Validators.zipCode,
|
|
13
|
-
minLength: (param: number) => {
|
|
14
|
-
return Validators_.minLength(param);
|
|
15
|
-
},
|
|
16
|
-
maxLength: (param: number) => {
|
|
17
|
-
return Validators_.maxLength(param);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, HostBinding, Input, OnChanges, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { MECXFieldConfig } from '../../../interfaces';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'mecx-dynamic-button',
|
|
7
|
-
templateUrl: './button.component.html',
|
|
8
|
-
styleUrls: ['./button.component.scss'],
|
|
9
|
-
encapsulation: ViewEncapsulation.None
|
|
10
|
-
})
|
|
11
|
-
export class MECXDynamicButtonComponent implements OnChanges {
|
|
12
|
-
@Input() _field: MECXFieldConfig | null = null;
|
|
13
|
-
|
|
14
|
-
@Input() _form: FormGroup | null = null;
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line object-curly-newline
|
|
17
|
-
@Input() _formErrors: any | any[] = {};
|
|
18
|
-
|
|
19
|
-
@Input() self: any;
|
|
20
|
-
|
|
21
|
-
constructor(private cdr: ChangeDetectorRef) {
|
|
22
|
-
// not to do
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@HostBinding('class')
|
|
26
|
-
get className() {
|
|
27
|
-
return this._field?.style?.class;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
ngOnChanges() {
|
|
31
|
-
this.cdr.detectChanges();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
onClick() {
|
|
35
|
-
const { _form, _field, self } = this;
|
|
36
|
-
if (_form?.disabled || !_field) return;
|
|
37
|
-
const { name, value } = _field;
|
|
38
|
-
const func = _field?.functions?.onClick;
|
|
39
|
-
if (func) {
|
|
40
|
-
self[func]({
|
|
41
|
-
name,
|
|
42
|
-
value,
|
|
43
|
-
form: _form
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectorRef,
|
|
3
|
-
ComponentFactoryResolver,
|
|
4
|
-
Directive,
|
|
5
|
-
Input,
|
|
6
|
-
OnChanges,
|
|
7
|
-
OnInit,
|
|
8
|
-
ViewContainerRef
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { FormGroup } from '@angular/forms';
|
|
11
|
-
import { MECXFieldConfig } from '../../interfaces';
|
|
12
|
-
import { MECXDynamicButtonComponent } from './button';
|
|
13
|
-
import { MECXDynamicFileUploadComponent } from './file-upload';
|
|
14
|
-
import { MECXDynamicInputComponent } from './input';
|
|
15
|
-
import { MECXDynamicInputPhoneComponent } from './input-phone';
|
|
16
|
-
import { MECXDynamicRadioComponent } from './radio';
|
|
17
|
-
import { MECXDynamicSelectComponent } from './select';
|
|
18
|
-
import { MECXDynamicSelectSearchComponent } from './select-search';
|
|
19
|
-
|
|
20
|
-
const componentMapper: any = {
|
|
21
|
-
input: MECXDynamicInputComponent,
|
|
22
|
-
'input-phone': MECXDynamicInputPhoneComponent,
|
|
23
|
-
radiobutton: MECXDynamicRadioComponent,
|
|
24
|
-
select: MECXDynamicSelectComponent,
|
|
25
|
-
'select-search': MECXDynamicSelectSearchComponent,
|
|
26
|
-
'file-upload': MECXDynamicFileUploadComponent,
|
|
27
|
-
button: MECXDynamicButtonComponent
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
@Directive({
|
|
31
|
-
selector: '[MECXDynamic]'
|
|
32
|
-
})
|
|
33
|
-
export class MECXDynamicDirective implements OnInit, OnChanges {
|
|
34
|
-
@Input() field: MECXFieldConfig | null = null;
|
|
35
|
-
|
|
36
|
-
@Input() form: FormGroup | null = null;
|
|
37
|
-
|
|
38
|
-
@Input() formErrors: any;
|
|
39
|
-
|
|
40
|
-
@Input() self: any;
|
|
41
|
-
|
|
42
|
-
@Input() plusValidations: any;
|
|
43
|
-
|
|
44
|
-
componentRef: any;
|
|
45
|
-
|
|
46
|
-
constructor(private resolver: ComponentFactoryResolver, private container: ViewContainerRef,
|
|
47
|
-
private cdr: ChangeDetectorRef) {
|
|
48
|
-
// not to do
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private handleInternalPlusValidation() {
|
|
52
|
-
if (!this.field?.alwaysShowPlusValidation) return false;
|
|
53
|
-
const { operator, value, field } = this.field?.alwaysShowPlusValidation;
|
|
54
|
-
const validators: any = {
|
|
55
|
-
e: (val1: any, val2: string) => { return val1 === val2; },
|
|
56
|
-
lt: (val1: any, val2: string) => { return val1 < val2; },
|
|
57
|
-
gt: (val1: any, val2: string) => { return val1 > val2; }
|
|
58
|
-
};
|
|
59
|
-
const data = this.form?.controls[field as string]?.value;
|
|
60
|
-
|
|
61
|
-
return validators[operator as string](data, value);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
private buildComponent() {
|
|
65
|
-
if (this.componentRef?.instance) return;
|
|
66
|
-
const factory = this.resolver.resolveComponentFactory(
|
|
67
|
-
componentMapper[this.field?.fieldType as string]
|
|
68
|
-
);
|
|
69
|
-
this.componentRef = this.container.createComponent(factory);
|
|
70
|
-
this.componentRef.instance._field = this.field;
|
|
71
|
-
this.componentRef.instance._form = this.form;
|
|
72
|
-
// eslint-disable-next-line object-curly-newline
|
|
73
|
-
this.componentRef.instance._formErrors = this.formErrors || {};
|
|
74
|
-
this.componentRef.instance.self = this.self;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
ngOnInit() {
|
|
78
|
-
if (!this.field?.alwaysShow && !this.handleInternalPlusValidation()) return;
|
|
79
|
-
this.buildComponent();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
ngOnChanges() {
|
|
83
|
-
if (this.plusValidations && this.plusValidations[this.field?.name as string]) {
|
|
84
|
-
if (!this.field?.alwaysShow && this.plusValidations[this.field?.name as string].alwaysShow) {
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
this.buildComponent();
|
|
87
|
-
this.cdr.detectChanges();
|
|
88
|
-
}, 1);
|
|
89
|
-
}
|
|
90
|
-
if (this.componentRef?.instance &&
|
|
91
|
-
!this.plusValidations[this.field?.name as string].alwaysShow) {
|
|
92
|
-
this.componentRef.destroy();
|
|
93
|
-
this.componentRef = null;
|
|
94
|
-
this.form?.controls[this.field?.name as string]?.setValue(null);
|
|
95
|
-
this.form?.controls[this.field?.name as string]?.clearValidators();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (!this.componentRef?.instance) return;
|
|
99
|
-
this.componentRef.instance._formErrors = this.formErrors || {
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
-
import {
|
|
6
|
-
MonkeyButtonModule,
|
|
7
|
-
MonkeyFileUploadModule,
|
|
8
|
-
MonkeyInputModule,
|
|
9
|
-
MonkeyInputPhoneModule,
|
|
10
|
-
MonkeyOptionModule,
|
|
11
|
-
MonkeyRadioButtonModule,
|
|
12
|
-
MonkeySelectModule
|
|
13
|
-
} from 'monkey-style-guide';
|
|
14
|
-
import { MECXDynamicButtonComponent } from './button';
|
|
15
|
-
import { MECXDynamicDirective } from './dynamic-directive';
|
|
16
|
-
import { MECXDynamicFileUploadComponent } from './file-upload';
|
|
17
|
-
import { MECXDynamicFormComponent, MECXDynamicFormArrayComponent } from './form';
|
|
18
|
-
import { MECXDynamicInputComponent } from './input';
|
|
19
|
-
import { MECXDynamicInputPhoneComponent } from './input-phone';
|
|
20
|
-
import { MECXDynamicRadioComponent } from './radio';
|
|
21
|
-
import { MECXDynamicSelectComponent } from './select';
|
|
22
|
-
import { MECXDynamicSelectSearchComponent } from './select-search';
|
|
23
|
-
|
|
24
|
-
@NgModule({
|
|
25
|
-
declarations: [
|
|
26
|
-
MECXDynamicButtonComponent,
|
|
27
|
-
MECXDynamicFileUploadComponent,
|
|
28
|
-
MECXDynamicFormComponent,
|
|
29
|
-
MECXDynamicFormArrayComponent,
|
|
30
|
-
MECXDynamicInputComponent,
|
|
31
|
-
MECXDynamicInputPhoneComponent,
|
|
32
|
-
MECXDynamicRadioComponent,
|
|
33
|
-
MECXDynamicSelectComponent,
|
|
34
|
-
MECXDynamicSelectSearchComponent,
|
|
35
|
-
MECXDynamicDirective
|
|
36
|
-
],
|
|
37
|
-
imports: [
|
|
38
|
-
CommonModule,
|
|
39
|
-
FormsModule,
|
|
40
|
-
ReactiveFormsModule,
|
|
41
|
-
MonkeyInputModule,
|
|
42
|
-
MonkeySelectModule,
|
|
43
|
-
MonkeyRadioButtonModule,
|
|
44
|
-
MonkeyOptionModule,
|
|
45
|
-
MonkeyFileUploadModule,
|
|
46
|
-
MonkeyButtonModule,
|
|
47
|
-
MonkeyInputPhoneModule,
|
|
48
|
-
TranslateModule.forChild()
|
|
49
|
-
],
|
|
50
|
-
exports: [MECXDynamicDirective, MECXDynamicFormComponent, MECXDynamicFormArrayComponent],
|
|
51
|
-
entryComponents: [MECXDynamicInputComponent]
|
|
52
|
-
})
|
|
53
|
-
export class MECXDynamicModule {}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<monkey-file-upload
|
|
2
|
-
errorMessage="{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}"
|
|
3
|
-
[icon]="_field?.icon" [formControl]="_form.controls[_field?.name]"
|
|
4
|
-
[placeholder]="_field?.placeholder | translate"
|
|
5
|
-
[helperMessage]="_field?.helperMessage | translate" [label]="_field?.label | translate"
|
|
6
|
-
[maxSize]="_field?.maxSize || 5242880" [fileUpload]="_function"
|
|
7
|
-
[maxSizeErrorMessage]="'FIELD.FILE.MAX-FILE' | translate"
|
|
8
|
-
[allowedExtensionErrorMessage]="'FIELD.FILE.ALLOWED-EXTENSION' | translate"
|
|
9
|
-
[allowedExtensions]="_field?.allowedExtensions || []" *ngIf="_field">
|
|
10
|
-
</monkey-file-upload>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, HostBinding, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { MECXFieldConfig } from '../../../interfaces';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'mecx-dynamic-file-upload',
|
|
7
|
-
templateUrl: './file-upload.component.html',
|
|
8
|
-
encapsulation: ViewEncapsulation.None
|
|
9
|
-
})
|
|
10
|
-
export class MECXDynamicFileUploadComponent {
|
|
11
|
-
@Input() _field: MECXFieldConfig;
|
|
12
|
-
|
|
13
|
-
@Input() _form: FormGroup;
|
|
14
|
-
|
|
15
|
-
// eslint-disable-next-line object-curly-newline
|
|
16
|
-
@Input() _formErrors: any | any[] = {};
|
|
17
|
-
|
|
18
|
-
@Input() self: any;
|
|
19
|
-
|
|
20
|
-
_function: Function = (file: any, callback?: Function) => {
|
|
21
|
-
if (this._form?.disabled) return;
|
|
22
|
-
if (!this._field?.functions?.onHandleUpload) {
|
|
23
|
-
console.error('onHandleUpload not declared');
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const { func, type } = this._field?.functions?.onHandleUpload;
|
|
27
|
-
if (!func || !this.self[func]) {
|
|
28
|
-
console.error('onHandleUpload not declared');
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this.self[func](file, type, callback);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
constructor(private cdr: ChangeDetectorRef) {
|
|
35
|
-
// not to do
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@HostBinding('class')
|
|
39
|
-
get className() {
|
|
40
|
-
return this._field?.style?.class;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
ngOnChanges() {
|
|
44
|
-
this.cdr.detectChanges();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<form name="form" [formGroup]="_form" *ngIf="_form">
|
|
2
|
-
<div formArrayName="fields">
|
|
3
|
-
<div *ngFor="let item of formValues.controls; let indForm=index" [formGroupName]="indForm">
|
|
4
|
-
<monkey-button type="secondary" color="error" icon="close-20" iconPosition="right"
|
|
5
|
-
[label]="'BUTTONS.REMOVE' | translate" (click)="onHandleRemove(indForm)"
|
|
6
|
-
*ngIf="formValues.controls.length > 1 && !disabled">
|
|
7
|
-
</monkey-button>
|
|
8
|
-
<div class="row mt-3">
|
|
9
|
-
<div *ngFor="let field of fields;" MECXDynamic [field]="field" [form]="item" [self]="self"
|
|
10
|
-
[formErrors]="__monkeyecxFormErrors[indForm]"
|
|
11
|
-
[plusValidations]="_plusValidations[indForm]" [style.display]="'none'">
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</form>
|
|
17
|
-
<monkey-button type="secondary" color="theme" icon="more-20" iconPosition="right"
|
|
18
|
-
[label]="'BUTTONS.ADD' | translate" (click)="onHandleAdd()" *ngIf="!disabled">
|
|
19
|
-
</monkey-button>
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, ViewEncapsulation, OnDestroy, ChangeDetectorRef } from '@angular/core';
|
|
2
|
-
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
|
-
import { takeUntil } from 'rxjs/operators';
|
|
5
|
-
import { BaseDynamicArray } from '../../base';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'mecx-dynamic-form-array',
|
|
9
|
-
templateUrl: './dynamic-form-array.component.html',
|
|
10
|
-
styleUrls: ['./dynamic-form-array.component.scss'],
|
|
11
|
-
encapsulation: ViewEncapsulation.None
|
|
12
|
-
})
|
|
13
|
-
export class MECXDynamicFormArrayComponent extends BaseDynamicArray implements OnInit, OnDestroy {
|
|
14
|
-
private unsubscribeAll = new Subject();
|
|
15
|
-
|
|
16
|
-
constructor(fb: FormBuilder, private cdr: ChangeDetectorRef) {
|
|
17
|
-
super(fb);
|
|
18
|
-
this.__monkeyecxFormErrors = [];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
ngOnInit() {
|
|
22
|
-
super.ngOnInit();
|
|
23
|
-
|
|
24
|
-
this.onHandleSubmit.pipe(takeUntil(this.unsubscribeAll)).subscribe((func: Function) => {
|
|
25
|
-
this.onSubmit(func);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
ngOnDestroy() {
|
|
30
|
-
this.unsubscribeAll.next();
|
|
31
|
-
this.unsubscribeAll.complete();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
onSubmit(callback: Function) {
|
|
35
|
-
const { _form } = this;
|
|
36
|
-
// eslint-disable-next-line object-curly-newline
|
|
37
|
-
this.__monkeyecxFormErrors = [];
|
|
38
|
-
|
|
39
|
-
let validate = {
|
|
40
|
-
isValid: false
|
|
41
|
-
};
|
|
42
|
-
let hasErrors: boolean = false;
|
|
43
|
-
if (this.formValues) {
|
|
44
|
-
this.__monkeyecxFormErrors = [this.formValues.length];
|
|
45
|
-
this.formValues.controls.forEach((item: any, index: number) => {
|
|
46
|
-
if (item instanceof FormGroup) {
|
|
47
|
-
if (!this.validateForm(item, index)) {
|
|
48
|
-
hasErrors = true;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
validate = {
|
|
54
|
-
isValid: !hasErrors
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
this.cdr.detectChanges();
|
|
58
|
-
|
|
59
|
-
this.onHandleSubmitFormReady.next({
|
|
60
|
-
validate,
|
|
61
|
-
callback,
|
|
62
|
-
form: _form
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
onHandleAdd() {
|
|
67
|
-
this.formValues?.push(this.formBase() as any);
|
|
68
|
-
this.cdr.detectChanges();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
onHandleRemove(index: number) {
|
|
72
|
-
this.formValues?.removeAt(index);
|
|
73
|
-
this._plusValidations.splice(index, 1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, ViewEncapsulation, OnDestroy, ChangeDetectorRef } from '@angular/core';
|
|
2
|
-
import { FormBuilder } from '@angular/forms';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
|
-
import { takeUntil } from 'rxjs/operators';
|
|
5
|
-
import { BaseDynamic } from '../../base/base-dynamic';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'mecx-dynamic-form',
|
|
9
|
-
templateUrl: './dynamic-form.component.html',
|
|
10
|
-
styles: [],
|
|
11
|
-
encapsulation: ViewEncapsulation.None
|
|
12
|
-
})
|
|
13
|
-
export class MECXDynamicFormComponent extends BaseDynamic implements OnInit, OnDestroy {
|
|
14
|
-
private unsubscribeAll = new Subject();
|
|
15
|
-
|
|
16
|
-
constructor(fb: FormBuilder, private cdr: ChangeDetectorRef) {
|
|
17
|
-
super(fb);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
ngOnInit() {
|
|
21
|
-
super.ngOnInit();
|
|
22
|
-
|
|
23
|
-
this.onHandleSubmit.pipe(takeUntil(this.unsubscribeAll)).subscribe((func: Function) => {
|
|
24
|
-
this.onSubmit(func);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
ngOnDestroy() {
|
|
29
|
-
this.unsubscribeAll.next();
|
|
30
|
-
this.unsubscribeAll.complete();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
onSubmit(callback: Function) {
|
|
34
|
-
const { _form } = this;
|
|
35
|
-
// eslint-disable-next-line object-curly-newline
|
|
36
|
-
this.__monkeyecxFormErrors = {};
|
|
37
|
-
|
|
38
|
-
const isValid = this.validateForm(_form as any);
|
|
39
|
-
this.cdr.detectChanges();
|
|
40
|
-
|
|
41
|
-
this.onHandleSubmitFormReady.next({
|
|
42
|
-
validate: {
|
|
43
|
-
isValid
|
|
44
|
-
},
|
|
45
|
-
callback,
|
|
46
|
-
form: _form
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<monkey-input
|
|
2
|
-
errorMessage="{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}"
|
|
3
|
-
[mask]="_field?.mask" [prefix]="_field?.prefix" [name]="_field?.name"
|
|
4
|
-
[formControl]="_form.controls[_field?.name]" [placeholder]="_field?.placeholder | translate"
|
|
5
|
-
[helperMessage]="_field?.helperMessage | translate" [label]="_field?.label | translate"
|
|
6
|
-
[type]="_field?.type" #inputElement (onChange)="onChange($event)"
|
|
7
|
-
[onlyNumber]="_field?.onlyNumber" [currency]="_field?.currency" [maxLength]="_field?.maxLength"
|
|
8
|
-
[maxDateToday]="_field?.maxDateToday">
|
|
9
|
-
</monkey-input>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, HostBinding, Input, OnChanges, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { MonkeyInputComponent } from 'monkey-style-guide';
|
|
4
|
-
import { MECXFieldConfig } from '../../../interfaces';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'mecx-dynamic-input',
|
|
8
|
-
templateUrl: './input.component.html',
|
|
9
|
-
encapsulation: ViewEncapsulation.None
|
|
10
|
-
})
|
|
11
|
-
export class MECXDynamicInputComponent implements OnInit, OnChanges {
|
|
12
|
-
@Input() _field: MECXFieldConfig | null = null;
|
|
13
|
-
|
|
14
|
-
@Input() _form: FormGroup | null = null;
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line object-curly-newline
|
|
17
|
-
@Input() _formErrors: any | any[] = {};
|
|
18
|
-
|
|
19
|
-
@Input() self: any;
|
|
20
|
-
|
|
21
|
-
@ViewChild('inputElement', {
|
|
22
|
-
static: true
|
|
23
|
-
}) inputElement: MonkeyInputComponent | null = null;
|
|
24
|
-
|
|
25
|
-
constructor(private cdr: ChangeDetectorRef) {
|
|
26
|
-
// not to do
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@HostBinding('class')
|
|
30
|
-
get className() {
|
|
31
|
-
return this._field?.style?.class;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
ngOnInit() {
|
|
35
|
-
this.cdr.detectChanges();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
ngOnChanges() {
|
|
39
|
-
this.cdr.detectChanges();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
onChange(event: string) {
|
|
43
|
-
const { _form, _field, self } = this;
|
|
44
|
-
if (!_field || !_form) return;
|
|
45
|
-
const { name } = _field;
|
|
46
|
-
const func = _field?.functions?.onChange;
|
|
47
|
-
const isValid = _form?.get(_field?.name as string)?.valid;
|
|
48
|
-
if (func) {
|
|
49
|
-
self[func]({
|
|
50
|
-
name,
|
|
51
|
-
isValid,
|
|
52
|
-
event,
|
|
53
|
-
ctrl: _form.get(this._field?.name as string),
|
|
54
|
-
form: _form
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<monkey-input-phone [name]="_field?.name" [label]="_field?.label | translate"
|
|
2
|
-
[helperMessage]="_field?.helperMessage | translate"
|
|
3
|
-
[placeholder]="_field?.placeholder | translate" [icon]="_field?.icon"
|
|
4
|
-
(onChange)="onChange($event)" [internationalNumber]="_field?.internationalNumber"
|
|
5
|
-
errorMessage="{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}"
|
|
6
|
-
[maxLength]="_field?.maxLength" [formControl]="_form.controls[_field?.name]" #inputElement>
|
|
7
|
-
</monkey-input-phone>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, HostBinding, Input, OnChanges, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { MonkeyInputComponent } from 'monkey-style-guide';
|
|
4
|
-
import { MECXFieldConfig } from '../../../interfaces';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'mecx-dynamic-input-phone',
|
|
8
|
-
templateUrl: './input-phone.component.html',
|
|
9
|
-
encapsulation: ViewEncapsulation.None
|
|
10
|
-
})
|
|
11
|
-
export class MECXDynamicInputPhoneComponent implements OnInit, OnChanges {
|
|
12
|
-
@Input() _field: MECXFieldConfig | null = null;
|
|
13
|
-
|
|
14
|
-
@Input() _form: FormGroup | null = null;
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line object-curly-newline
|
|
17
|
-
@Input() _formErrors: any | any[] = {};
|
|
18
|
-
|
|
19
|
-
@Input() self: any;
|
|
20
|
-
|
|
21
|
-
@ViewChild('inputElement', {
|
|
22
|
-
static: true
|
|
23
|
-
}) inputElement: MonkeyInputComponent | null = null;
|
|
24
|
-
|
|
25
|
-
constructor(private cdr: ChangeDetectorRef) {
|
|
26
|
-
// not to do
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@HostBinding('class')
|
|
30
|
-
get className() {
|
|
31
|
-
return this._field?.style?.class;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
ngOnInit() {
|
|
35
|
-
this.cdr.detectChanges();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
ngOnChanges() {
|
|
39
|
-
this.cdr.detectChanges();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
onChange(event: string) {
|
|
43
|
-
const { _form, _field, self } = this;
|
|
44
|
-
if (!_field || !_form) return;
|
|
45
|
-
const { name } = _field;
|
|
46
|
-
const func = _field?.functions?.onChange;
|
|
47
|
-
const isValid = _form?.get(_field?.name as string)?.valid;
|
|
48
|
-
if (func) {
|
|
49
|
-
self[func]({
|
|
50
|
-
name,
|
|
51
|
-
isValid,
|
|
52
|
-
event,
|
|
53
|
-
ctrl: _form.get(this._field?.name as string),
|
|
54
|
-
form: _form
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<monkey-radiobutton
|
|
2
|
-
errorMessage="{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}"
|
|
3
|
-
[formControl]="_form.controls[_field?.name]" [helperMessage]="_field?.helperMessage | translate"
|
|
4
|
-
[label]="_field?.label | translate">
|
|
5
|
-
<monkey-option *ngFor="let value of _field?.value" [label]="value.description | translate"
|
|
6
|
-
[value]="value.value">
|
|
7
|
-
</monkey-option>
|
|
8
|
-
</monkey-radiobutton>
|