monkey-front-components 0.0.383 → 0.0.384
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/karma.conf.js +44 -0
- package/monkey-front-components-0.0.384.tgz +0 -0
- package/ng-package.json +10 -0
- package/package.json +7 -27
- package/src/lib/components/base/base-component.ts +359 -0
- package/src/lib/components/base/base-dynamic-array.ts +233 -0
- package/src/lib/components/base/base-dynamic.ts +90 -0
- package/src/lib/components/base/base-scroll-component.ts +52 -0
- package/src/lib/components/base/base-validators.ts +19 -0
- package/{lib/components/base/index.d.ts → src/lib/components/base/index.ts} +5 -5
- package/src/lib/components/dynamic/button/button.component.html +4 -0
- package/src/lib/components/dynamic/button/button.component.scss +7 -0
- package/src/lib/components/dynamic/button/button.component.ts +47 -0
- package/{lib/components/dynamic/button/index.d.ts → src/lib/components/dynamic/button/index.ts} +1 -1
- package/src/lib/components/dynamic/dynamic-directive.ts +102 -0
- package/src/lib/components/dynamic/dynamic.module.ts +53 -0
- package/src/lib/components/dynamic/file-upload/file-upload.component.html +10 -0
- package/src/lib/components/dynamic/file-upload/file-upload.component.ts +46 -0
- package/{lib/components/dynamic/file-upload/index.d.ts → src/lib/components/dynamic/file-upload/index.ts} +1 -1
- package/src/lib/components/dynamic/form/dynamic-form-array.component.html +19 -0
- package/src/lib/components/dynamic/form/dynamic-form-array.component.scss +10 -0
- package/src/lib/components/dynamic/form/dynamic-form-array.component.ts +75 -0
- package/src/lib/components/dynamic/form/dynamic-form.component.html +7 -0
- package/src/lib/components/dynamic/form/dynamic-form.component.ts +49 -0
- package/{lib/components/dynamic/form/index.d.ts → src/lib/components/dynamic/form/index.ts} +2 -2
- package/{lib/components/dynamic/index.d.ts → src/lib/components/dynamic/index.ts} +8 -8
- package/{lib/components/dynamic/input/index.d.ts → src/lib/components/dynamic/input/index.ts} +1 -1
- package/src/lib/components/dynamic/input/input.component.html +9 -0
- package/src/lib/components/dynamic/input/input.component.ts +58 -0
- package/{lib/components/dynamic/input-phone/index.d.ts → src/lib/components/dynamic/input-phone/index.ts} +1 -1
- package/src/lib/components/dynamic/input-phone/input-phone.component.html +7 -0
- package/src/lib/components/dynamic/input-phone/input-phone.component.ts +58 -0
- package/{lib/components/dynamic/radio/index.d.ts → src/lib/components/dynamic/radio/index.ts} +1 -1
- package/src/lib/components/dynamic/radio/radio.component.html +8 -0
- package/src/lib/components/dynamic/radio/radio.component.ts +22 -0
- package/{lib/components/dynamic/select/index.d.ts → src/lib/components/dynamic/select/index.ts} +1 -1
- package/src/lib/components/dynamic/select/select.component.html +14 -0
- package/src/lib/components/dynamic/select/select.component.ts +75 -0
- package/{lib/components/dynamic/select-search/index.d.ts → src/lib/components/dynamic/select-search/index.ts} +1 -1
- package/src/lib/components/dynamic/select-search/select-search.component.html +15 -0
- package/src/lib/components/dynamic/select-search/select-search.component.ts +76 -0
- package/{lib/components/index.d.ts → src/lib/components/index.ts} +3 -3
- package/src/lib/components/shared/filter/filter.component.html +51 -0
- package/src/lib/components/shared/filter/filter.component.scss +79 -0
- package/src/lib/components/shared/filter/filter.component.ts +117 -0
- package/src/lib/components/shared/filter/filter.module.ts +36 -0
- package/{lib/components/shared/filter/index.d.ts → src/lib/components/shared/filter/index.ts} +2 -2
- package/{lib/components/shared/filter/menu/index.d.ts → src/lib/components/shared/filter/menu/index.ts} +1 -1
- package/src/lib/components/shared/filter/menu/menu.component.html +28 -0
- package/src/lib/components/shared/filter/menu/menu.component.scss +62 -0
- package/src/lib/components/shared/filter/menu/menu.component.ts +122 -0
- package/src/lib/components/shared/filter/menu/menu.module.ts +41 -0
- package/src/lib/components/shared/filter/options/children/children.component.html +6 -0
- package/src/lib/components/shared/filter/options/children/children.component.scss +30 -0
- package/src/lib/components/shared/filter/options/children/children.component.ts +58 -0
- package/{lib/components/shared/filter/options/children/index.d.ts → src/lib/components/shared/filter/options/children/index.ts} +1 -1
- package/src/lib/components/shared/filter/options/currency/currency.component.html +3 -0
- package/src/lib/components/shared/filter/options/currency/currency.component.scss +19 -0
- package/src/lib/components/shared/filter/options/currency/currency.component.ts +52 -0
- package/{lib/components/shared/filter/options/currency/index.d.ts → src/lib/components/shared/filter/options/currency/index.ts} +1 -1
- package/src/lib/components/shared/filter/options/date-range/date-range.component.html +3 -0
- package/src/lib/components/shared/filter/options/date-range/date-range.component.scss +34 -0
- package/src/lib/components/shared/filter/options/date-range/date-range.component.ts +72 -0
- package/{lib/components/shared/filter/options/date-range/index.d.ts → src/lib/components/shared/filter/options/date-range/index.ts} +1 -1
- package/{lib/components/shared/filter/options/index.d.ts → src/lib/components/shared/filter/options/index.ts} +1 -1
- package/{lib/components/shared/filter/options/input/index.d.ts → src/lib/components/shared/filter/options/input/index.ts} +1 -1
- package/src/lib/components/shared/filter/options/input/input.component.html +3 -0
- package/src/lib/components/shared/filter/options/input/input.component.scss +19 -0
- package/src/lib/components/shared/filter/options/input/input.component.ts +52 -0
- package/src/lib/components/shared/filter/options/options.component.html +43 -0
- package/src/lib/components/shared/filter/options/options.component.scss +56 -0
- package/src/lib/components/shared/filter/options/options.component.ts +58 -0
- package/src/lib/components/shared/filter/options/options.module.ts +58 -0
- package/{lib/components/shared/filter/options/status/index.d.ts → src/lib/components/shared/filter/options/status/index.ts} +1 -1
- package/src/lib/components/shared/filter/options/status/status.component.html +4 -0
- package/src/lib/components/shared/filter/options/status/status.component.scss +29 -0
- package/src/lib/components/shared/filter/options/status/status.component.ts +73 -0
- package/{lib/components/shared/filter/selected/index.d.ts → src/lib/components/shared/filter/selected/index.ts} +1 -1
- package/src/lib/components/shared/filter/selected/item/children/children.component.html +19 -0
- package/src/lib/components/shared/filter/selected/item/children/children.component.scss +68 -0
- package/src/lib/components/shared/filter/selected/item/children/children.component.ts +49 -0
- package/{lib/components/shared/filter/selected/item/children/index.d.ts → src/lib/components/shared/filter/selected/item/children/index.ts} +1 -1
- package/src/lib/components/shared/filter/selected/item/currency/currency.component.html +1 -0
- package/src/lib/components/shared/filter/selected/item/currency/currency.component.scss +4 -0
- package/src/lib/components/shared/filter/selected/item/currency/currency.component.ts +26 -0
- package/{lib/components/shared/filter/selected/item/currency/index.d.ts → src/lib/components/shared/filter/selected/item/currency/index.ts} +1 -1
- package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.html +2 -0
- package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.scss +4 -0
- package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.ts +39 -0
- package/{lib/components/shared/filter/selected/item/date-range/index.d.ts → src/lib/components/shared/filter/selected/item/date-range/index.ts} +1 -1
- package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.html +1 -0
- package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.scss +4 -0
- package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.ts +29 -0
- package/{lib/components/shared/filter/selected/item/date-with-action/index.d.ts → src/lib/components/shared/filter/selected/item/date-with-action/index.ts} +1 -1
- package/{lib/components/shared/filter/selected/item/index.d.ts → src/lib/components/shared/filter/selected/item/index.ts} +7 -7
- package/{lib/components/shared/filter/selected/item/input/index.d.ts → src/lib/components/shared/filter/selected/item/input/index.ts} +1 -1
- package/src/lib/components/shared/filter/selected/item/input/input.component.html +1 -0
- package/src/lib/components/shared/filter/selected/item/input/input.component.scss +4 -0
- package/src/lib/components/shared/filter/selected/item/input/input.component.ts +26 -0
- package/src/lib/components/shared/filter/selected/item/item.component.html +38 -0
- package/src/lib/components/shared/filter/selected/item/item.component.scss +72 -0
- package/src/lib/components/shared/filter/selected/item/item.component.ts +71 -0
- package/{lib/components/shared/filter/selected/item/status/index.d.ts → src/lib/components/shared/filter/selected/item/status/index.ts} +1 -1
- package/src/lib/components/shared/filter/selected/item/status/status.component.html +1 -0
- package/src/lib/components/shared/filter/selected/item/status/status.component.scss +4 -0
- package/src/lib/components/shared/filter/selected/item/status/status.component.ts +36 -0
- package/src/lib/components/shared/filter/selected/selected.component.html +3 -0
- package/src/lib/components/shared/filter/selected/selected.component.scss +9 -0
- package/src/lib/components/shared/filter/selected/selected.component.ts +76 -0
- package/src/lib/components/shared/filter/selected/selected.module.ts +60 -0
- package/{lib/components/shared/index.d.ts → src/lib/components/shared/index.ts} +4 -4
- package/{lib/components/shared/password-strength/index.d.ts → src/lib/components/shared/password-strength/index.ts} +2 -2
- package/src/lib/components/shared/password-strength/password-strength.component.html +50 -0
- package/src/lib/components/shared/password-strength/password-strength.component.scss +70 -0
- package/src/lib/components/shared/password-strength/password-strength.component.ts +89 -0
- package/src/lib/components/shared/password-strength/password-strength.module.ts +24 -0
- package/src/lib/components/shared/password-strength/password-strength.ts +5 -0
- package/src/lib/components/shared/products/filter/filter.component.html +6 -0
- package/src/lib/components/shared/products/filter/filter.component.scss +20 -0
- package/src/lib/components/shared/products/filter/filter.component.ts +34 -0
- package/{lib/components/shared/products/index.d.ts → src/lib/components/shared/products/index.ts} +2 -2
- package/src/lib/components/shared/products/products.component.html +15 -0
- package/src/lib/components/shared/products/products.component.scss +70 -0
- package/src/lib/components/shared/products/products.component.ts +104 -0
- package/src/lib/components/shared/products/products.module.ts +13 -0
- package/{lib/components/shared/products/providers/index.d.ts → src/lib/components/shared/products/providers/index.ts} +1 -1
- package/src/lib/components/shared/products/providers/products.model.ts +60 -0
- package/{lib/components/shared/progress-bar/index.d.ts → src/lib/components/shared/progress-bar/index.ts} +3 -3
- package/src/lib/components/shared/progress-bar/progress-bar.component.html +3 -0
- package/src/lib/components/shared/progress-bar/progress-bar.component.scss +6 -0
- package/src/lib/components/shared/progress-bar/progress-bar.component.ts +27 -0
- package/src/lib/components/shared/progress-bar/progress-bar.module.ts +10 -0
- package/src/lib/components/shared/progress-bar/progress-bar.service.ts +59 -0
- package/src/lib/interfaces/field-config.ts +58 -0
- package/{lib/interfaces/index.d.ts → src/lib/interfaces/index.ts} +1 -1
- package/src/public-api.ts +5 -0
- package/src/test.ts +26 -0
- package/tsconfig.lib.json +20 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/esm2020/lib/components/base/base-component.mjs +0 -322
- package/esm2020/lib/components/base/base-dynamic-array.mjs +0 -221
- package/esm2020/lib/components/base/base-dynamic.mjs +0 -99
- package/esm2020/lib/components/base/base-scroll-component.mjs +0 -55
- package/esm2020/lib/components/base/base-validators.mjs +0 -19
- package/esm2020/lib/components/base/index.mjs +0 -6
- package/esm2020/lib/components/dynamic/button/button.component.mjs +0 -52
- package/esm2020/lib/components/dynamic/button/index.mjs +0 -2
- package/esm2020/lib/components/dynamic/dynamic-directive.mjs +0 -95
- package/esm2020/lib/components/dynamic/dynamic.module.mjs +0 -84
- package/esm2020/lib/components/dynamic/file-upload/file-upload.component.mjs +0 -52
- package/esm2020/lib/components/dynamic/file-upload/index.mjs +0 -2
- package/esm2020/lib/components/dynamic/form/dynamic-form-array.component.mjs +0 -72
- package/esm2020/lib/components/dynamic/form/dynamic-form.component.mjs +0 -46
- package/esm2020/lib/components/dynamic/form/index.mjs +0 -3
- package/esm2020/lib/components/dynamic/index.mjs +0 -9
- package/esm2020/lib/components/dynamic/input/index.mjs +0 -2
- package/esm2020/lib/components/dynamic/input/input.component.mjs +0 -65
- package/esm2020/lib/components/dynamic/input-phone/index.mjs +0 -2
- package/esm2020/lib/components/dynamic/input-phone/input-phone.component.mjs +0 -65
- package/esm2020/lib/components/dynamic/radio/index.mjs +0 -2
- package/esm2020/lib/components/dynamic/radio/radio.component.mjs +0 -33
- package/esm2020/lib/components/dynamic/select/index.mjs +0 -2
- package/esm2020/lib/components/dynamic/select/select.component.mjs +0 -80
- package/esm2020/lib/components/dynamic/select-search/index.mjs +0 -2
- package/esm2020/lib/components/dynamic/select-search/select-search.component.mjs +0 -80
- package/esm2020/lib/components/index.mjs +0 -4
- package/esm2020/lib/components/shared/filter/filter.component.mjs +0 -119
- package/esm2020/lib/components/shared/filter/filter.module.mjs +0 -63
- package/esm2020/lib/components/shared/filter/index.mjs +0 -3
- package/esm2020/lib/components/shared/filter/menu/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/menu/menu.component.mjs +0 -120
- package/esm2020/lib/components/shared/filter/menu/menu.module.mjs +0 -70
- package/esm2020/lib/components/shared/filter/options/children/children.component.mjs +0 -50
- package/esm2020/lib/components/shared/filter/options/children/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/options/currency/currency.component.mjs +0 -46
- package/esm2020/lib/components/shared/filter/options/currency/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/options/date-range/date-range.component.mjs +0 -65
- package/esm2020/lib/components/shared/filter/options/date-range/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/options/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/options/input/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/options/input/input.component.mjs +0 -46
- package/esm2020/lib/components/shared/filter/options/options.component.mjs +0 -68
- package/esm2020/lib/components/shared/filter/options/options.module.mjs +0 -95
- package/esm2020/lib/components/shared/filter/options/status/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/options/status/status.component.mjs +0 -66
- package/esm2020/lib/components/shared/filter/selected/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/selected/item/children/children.component.mjs +0 -57
- package/esm2020/lib/components/shared/filter/selected/item/children/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/selected/item/currency/currency.component.mjs +0 -29
- package/esm2020/lib/components/shared/filter/selected/item/currency/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/selected/item/date-range/date-range.component.mjs +0 -42
- package/esm2020/lib/components/shared/filter/selected/item/date-range/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.mjs +0 -33
- package/esm2020/lib/components/shared/filter/selected/item/date-with-action/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/selected/item/index.mjs +0 -8
- package/esm2020/lib/components/shared/filter/selected/item/input/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/selected/item/input/input.component.mjs +0 -28
- package/esm2020/lib/components/shared/filter/selected/item/item.component.mjs +0 -74
- package/esm2020/lib/components/shared/filter/selected/item/status/index.mjs +0 -2
- package/esm2020/lib/components/shared/filter/selected/item/status/status.component.mjs +0 -39
- package/esm2020/lib/components/shared/filter/selected/selected.component.mjs +0 -80
- package/esm2020/lib/components/shared/filter/selected/selected.module.mjs +0 -90
- package/esm2020/lib/components/shared/index.mjs +0 -5
- package/esm2020/lib/components/shared/password-strength/index.mjs +0 -3
- package/esm2020/lib/components/shared/password-strength/password-strength.component.mjs +0 -85
- package/esm2020/lib/components/shared/password-strength/password-strength.mjs +0 -2
- package/esm2020/lib/components/shared/password-strength/password-strength.module.mjs +0 -50
- package/esm2020/lib/components/shared/products/filter/filter.component.mjs +0 -36
- package/esm2020/lib/components/shared/products/index.mjs +0 -3
- package/esm2020/lib/components/shared/products/products.component.mjs +0 -91
- package/esm2020/lib/components/shared/products/products.module.mjs +0 -22
- package/esm2020/lib/components/shared/products/providers/index.mjs +0 -2
- package/esm2020/lib/components/shared/products/providers/products.model.mjs +0 -38
- package/esm2020/lib/components/shared/progress-bar/index.mjs +0 -4
- package/esm2020/lib/components/shared/progress-bar/progress-bar.component.mjs +0 -28
- package/esm2020/lib/components/shared/progress-bar/progress-bar.module.mjs +0 -18
- package/esm2020/lib/components/shared/progress-bar/progress-bar.service.mjs +0 -49
- package/esm2020/lib/interfaces/field-config.mjs +0 -2
- package/esm2020/lib/interfaces/index.mjs +0 -2
- package/esm2020/monkey-front-components.mjs +0 -5
- package/esm2020/public-api.mjs +0 -5
- package/fesm2015/monkey-front-components.mjs +0 -2877
- package/fesm2015/monkey-front-components.mjs.map +0 -1
- package/fesm2020/monkey-front-components.mjs +0 -2859
- package/fesm2020/monkey-front-components.mjs.map +0 -1
- package/lib/components/base/base-component.d.ts +0 -50
- package/lib/components/base/base-dynamic-array.d.ts +0 -34
- package/lib/components/base/base-dynamic.d.ts +0 -24
- package/lib/components/base/base-scroll-component.d.ts +0 -16
- package/lib/components/base/base-validators.d.ts +0 -1
- package/lib/components/dynamic/button/button.component.d.ts +0 -17
- package/lib/components/dynamic/dynamic-directive.d.ts +0 -22
- package/lib/components/dynamic/dynamic.module.d.ts +0 -20
- package/lib/components/dynamic/file-upload/file-upload.component.d.ts +0 -17
- package/lib/components/dynamic/form/dynamic-form-array.component.d.ts +0 -16
- package/lib/components/dynamic/form/dynamic-form.component.d.ts +0 -14
- package/lib/components/dynamic/input/input.component.d.ts +0 -20
- package/lib/components/dynamic/input-phone/input-phone.component.d.ts +0 -20
- package/lib/components/dynamic/radio/radio.component.d.ts +0 -11
- package/lib/components/dynamic/select/select.component.d.ts +0 -16
- package/lib/components/dynamic/select-search/select-search.component.d.ts +0 -16
- package/lib/components/shared/filter/filter.component.d.ts +0 -32
- package/lib/components/shared/filter/filter.module.d.ts +0 -14
- package/lib/components/shared/filter/menu/menu.component.d.ts +0 -24
- package/lib/components/shared/filter/menu/menu.module.d.ts +0 -14
- package/lib/components/shared/filter/options/children/children.component.d.ts +0 -17
- package/lib/components/shared/filter/options/currency/currency.component.d.ts +0 -17
- package/lib/components/shared/filter/options/date-range/date-range.component.d.ts +0 -24
- package/lib/components/shared/filter/options/input/input.component.d.ts +0 -17
- package/lib/components/shared/filter/options/options.component.d.ts +0 -20
- package/lib/components/shared/filter/options/options.module.d.ts +0 -18
- package/lib/components/shared/filter/options/status/status.component.d.ts +0 -19
- package/lib/components/shared/filter/selected/item/children/children.component.d.ts +0 -16
- package/lib/components/shared/filter/selected/item/currency/currency.component.d.ts +0 -11
- package/lib/components/shared/filter/selected/item/date-range/date-range.component.d.ts +0 -12
- package/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.d.ts +0 -11
- package/lib/components/shared/filter/selected/item/input/input.component.d.ts +0 -11
- package/lib/components/shared/filter/selected/item/item.component.d.ts +0 -20
- package/lib/components/shared/filter/selected/item/status/status.component.d.ts +0 -13
- package/lib/components/shared/filter/selected/selected.component.d.ts +0 -18
- package/lib/components/shared/filter/selected/selected.module.d.ts +0 -21
- package/lib/components/shared/password-strength/password-strength.component.d.ts +0 -23
- package/lib/components/shared/password-strength/password-strength.d.ts +0 -5
- package/lib/components/shared/password-strength/password-strength.module.d.ts +0 -12
- package/lib/components/shared/products/filter/filter.component.d.ts +0 -12
- package/lib/components/shared/products/products.component.d.ts +0 -20
- package/lib/components/shared/products/products.module.d.ts +0 -11
- package/lib/components/shared/products/providers/products.model.d.ts +0 -13
- package/lib/components/shared/progress-bar/progress-bar.component.d.ts +0 -12
- package/lib/components/shared/progress-bar/progress-bar.module.d.ts +0 -8
- package/lib/components/shared/progress-bar/progress-bar.service.d.ts +0 -14
- package/lib/interfaces/field-config.d.ts +0 -54
- package/monkey-front-components-0.0.383.tgz +0 -0
- package/monkey-front-components.d.ts +0 -5
- package/public-api.d.ts +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
export * from './input-phone.component';
|
|
1
|
+
export * from './input-phone.component';
|
|
@@ -0,0 +1,7 @@
|
|
|
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>
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
}
|
package/{lib/components/dynamic/radio/index.d.ts → src/lib/components/dynamic/radio/index.ts}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './radio.component';
|
|
1
|
+
export * from './radio.component';
|
|
@@ -0,0 +1,8 @@
|
|
|
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>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { 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-radio',
|
|
7
|
+
templateUrl: './radio.component.html',
|
|
8
|
+
encapsulation: ViewEncapsulation.None
|
|
9
|
+
})
|
|
10
|
+
export class MECXDynamicRadioComponent {
|
|
11
|
+
@Input() _field: MECXFieldConfig | null = null;
|
|
12
|
+
|
|
13
|
+
@Input() _form: FormGroup | null = null;
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line object-curly-newline
|
|
16
|
+
@Input() _formErrors: any | any[] = {};
|
|
17
|
+
|
|
18
|
+
@HostBinding('class')
|
|
19
|
+
get className() {
|
|
20
|
+
return this._field?.style?.class;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/{lib/components/dynamic/select/index.d.ts → src/lib/components/dynamic/select/index.ts}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './select.component';
|
|
1
|
+
export * from './select.component';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<monkey-select
|
|
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" (click)="onHandleGenericLoad()"
|
|
5
|
+
[onHandleOptions]="_onHandleOptions" (onChange)="onChange($event)"
|
|
6
|
+
[labelSelect]="_form.get(_field?.name).value || ('FIELD.SELECT' | translate)"
|
|
7
|
+
[placeholder]="_field?.placeholder | translate">
|
|
8
|
+
<monkey-option [label]="'FIELD.LOADING' | translate" *ngIf="!_field?.value?.length"
|
|
9
|
+
enableClick="false">
|
|
10
|
+
</monkey-option>
|
|
11
|
+
<monkey-option *ngFor="let value of _field?.value" [label]="value.description | translate"
|
|
12
|
+
[value]="value.value">
|
|
13
|
+
</monkey-option>
|
|
14
|
+
</monkey-select>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
HostBinding,
|
|
4
|
+
Input,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
ViewEncapsulation
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import { FormGroup } from '@angular/forms';
|
|
9
|
+
import { MECXFieldConfig, MECXFieldConfigValue } from '../../../interfaces';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'mecx-dynamic-select',
|
|
13
|
+
templateUrl: './select.component.html',
|
|
14
|
+
encapsulation: ViewEncapsulation.None
|
|
15
|
+
})
|
|
16
|
+
export class MECXDynamicSelectComponent {
|
|
17
|
+
@Input() _field: MECXFieldConfig | null = null;
|
|
18
|
+
|
|
19
|
+
@Input() _form: FormGroup | null = null;
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line object-curly-newline
|
|
22
|
+
@Input() _formErrors: any | any[] = {};
|
|
23
|
+
|
|
24
|
+
@Input() self: any;
|
|
25
|
+
|
|
26
|
+
@HostBinding('class')
|
|
27
|
+
get className() {
|
|
28
|
+
return this._field?.style?.class;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_onHandleOptions = new EventEmitter<any>();
|
|
32
|
+
|
|
33
|
+
onHandleGenericLoad() {
|
|
34
|
+
const { _form, _field, self } = this;
|
|
35
|
+
if (_form?.disabled || !_field || !_field?.functions?.onHandleGenericLoad) return;
|
|
36
|
+
const { name } = _field;
|
|
37
|
+
if ((_field?.value as MECXFieldConfigValue[])?.length) return;
|
|
38
|
+
const { func, url } = _field?.functions?.onHandleGenericLoad;
|
|
39
|
+
if (!func || !self[func]) {
|
|
40
|
+
console.error('onHandleGenericLoad not declared');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
_form?.disable();
|
|
44
|
+
self[func]({
|
|
45
|
+
name,
|
|
46
|
+
url,
|
|
47
|
+
form: _form,
|
|
48
|
+
callback: (data: any[]) => {
|
|
49
|
+
if (this._field) {
|
|
50
|
+
this._field.value = data;
|
|
51
|
+
}
|
|
52
|
+
this._form?.enable();
|
|
53
|
+
this._onHandleOptions.next(null);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
onChange(event: string) {
|
|
59
|
+
const { _form, _field, self } = this;
|
|
60
|
+
if (!_field || !_form) return;
|
|
61
|
+
const { name } = _field;
|
|
62
|
+
const func = _field?.functions?.onChange;
|
|
63
|
+
const isValid = _form?.get(_field.name as string)?.valid;
|
|
64
|
+
if (func) {
|
|
65
|
+
self[func]({
|
|
66
|
+
name,
|
|
67
|
+
isValid,
|
|
68
|
+
event,
|
|
69
|
+
ctrl: _form?.get(this._field?.name as string),
|
|
70
|
+
form: _form,
|
|
71
|
+
value: _field.value
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './select-search.component';
|
|
1
|
+
export * from './select-search.component';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<monkey-select-search
|
|
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" (click)="onHandleGenericLoad()"
|
|
5
|
+
[onHandleOptions]="_onHandleOptions" (onChange)="onChange($event)"
|
|
6
|
+
[fieldToCompare]="_field?.fieldToCompare"
|
|
7
|
+
[labelSelect]="_form.get(_field?.name).value || ('FIELD.SELECT' | translate)"
|
|
8
|
+
[placeholder]="_field?.placeholder | translate">
|
|
9
|
+
<monkey-option [label]="'FIELD.LOADING' | translate" *ngIf="!_field?.value?.length"
|
|
10
|
+
enableClick="false">
|
|
11
|
+
</monkey-option>
|
|
12
|
+
<monkey-option *ngFor="let value of _field?.value" [label]="value.description | translate"
|
|
13
|
+
[value]="value.value">
|
|
14
|
+
</monkey-option>
|
|
15
|
+
</monkey-select-search>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
HostBinding,
|
|
4
|
+
Input,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
ViewEncapsulation
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import { FormGroup } from '@angular/forms';
|
|
9
|
+
import { MECXFieldConfig } from '../../../interfaces';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'mecx-dynamic-select-search',
|
|
13
|
+
templateUrl: './select-search.component.html',
|
|
14
|
+
encapsulation: ViewEncapsulation.None
|
|
15
|
+
})
|
|
16
|
+
export class MECXDynamicSelectSearchComponent {
|
|
17
|
+
@Input() _field: MECXFieldConfig | null = null;
|
|
18
|
+
|
|
19
|
+
@Input() _form: FormGroup | null = null;
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line object-curly-newline
|
|
22
|
+
@Input() _formErrors: any | any[] = {};
|
|
23
|
+
|
|
24
|
+
@Input() self: any;
|
|
25
|
+
|
|
26
|
+
@HostBinding('class')
|
|
27
|
+
get className() {
|
|
28
|
+
return this._field?.style?.class;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_onHandleOptions = new EventEmitter<any>();
|
|
32
|
+
|
|
33
|
+
onHandleGenericLoad() {
|
|
34
|
+
const { _form, _field, self } = this;
|
|
35
|
+
if (_form?.disabled || !_field || !_field?.functions?.onHandleGenericLoad) return;
|
|
36
|
+
const { name } = _field;
|
|
37
|
+
const { func, url } = _field?.functions?.onHandleGenericLoad || {
|
|
38
|
+
func: null, url: ''
|
|
39
|
+
};
|
|
40
|
+
if (!func || !self[func]) {
|
|
41
|
+
console.error('onHandleGenericLoad not declared');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
_form?.disable();
|
|
45
|
+
self[func]({
|
|
46
|
+
name,
|
|
47
|
+
url,
|
|
48
|
+
form: _form,
|
|
49
|
+
callback: (data: any[]) => {
|
|
50
|
+
if (this._field) {
|
|
51
|
+
this._field.value = data;
|
|
52
|
+
}
|
|
53
|
+
this._form?.enable();
|
|
54
|
+
this._onHandleOptions.next(null);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
onChange(event: string) {
|
|
60
|
+
const { _form, _field, self } = this;
|
|
61
|
+
if (!_field || !_form) return;
|
|
62
|
+
const { name } = _field;
|
|
63
|
+
const func = _field?.functions?.onChange;
|
|
64
|
+
const isValid = _form?.get(_field?.name as string)?.valid;
|
|
65
|
+
if (func) {
|
|
66
|
+
self[func]({
|
|
67
|
+
name,
|
|
68
|
+
isValid,
|
|
69
|
+
event,
|
|
70
|
+
ctrl: _form.get(this._field?.name as string),
|
|
71
|
+
form: _form,
|
|
72
|
+
value: _field.value
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './base';
|
|
2
|
-
export * from './dynamic';
|
|
3
|
-
export * from './shared';
|
|
1
|
+
export * from './base';
|
|
2
|
+
export * from './dynamic';
|
|
3
|
+
export * from './shared';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<div class="d-flex flex-column full-width">
|
|
2
|
+
<div class="d-flex flex-column flex-md-row justify-content-between">
|
|
3
|
+
<div class="d-flex full-width">
|
|
4
|
+
<ng-container *ngIf="enableSearch">
|
|
5
|
+
<monkey-input-filter [placeholder]="searchPlaceholder | translate"
|
|
6
|
+
(onChange)="onSearchFilter($event)" icon="search-16" iconPosition="left"
|
|
7
|
+
[(value)]="_search">
|
|
8
|
+
</monkey-input-filter>
|
|
9
|
+
</ng-container>
|
|
10
|
+
<ng-container *ngIf="!_hasFilterByMenu">
|
|
11
|
+
<div class="d-flex actions" id="mecx-filters-add-filter">
|
|
12
|
+
<monkey-button type="filter" color="border" (click)="onHandleShowMenu()" icon="more-16"
|
|
13
|
+
iconPosition="right">
|
|
14
|
+
{{ 'BUTTONS.ADD-FILTER' | translate }}
|
|
15
|
+
</monkey-button>
|
|
16
|
+
</div>
|
|
17
|
+
</ng-container>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="order hidden-sm hidden-xs">
|
|
20
|
+
<ng-container *ngTemplateOutlet="orderBy"></ng-container>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<ng-container *ngIf="_hasFilterByMenu">
|
|
24
|
+
<div class="separator"></div>
|
|
25
|
+
<div class="d-flex full-width">
|
|
26
|
+
<mecx-filter-selected (onSubmit)="onHandleSubmit($event)" (onClose)="onHandleClose()"
|
|
27
|
+
[model]="menus"></mecx-filter-selected>
|
|
28
|
+
<div class="more-filters">
|
|
29
|
+
<monkey-button type="filter" color="border" icon="more-16" id="mecx-filters-add-filter"
|
|
30
|
+
(click)="onHandleShowMenu()">
|
|
31
|
+
</monkey-button>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</ng-container>
|
|
35
|
+
<div class="order hidden-md hidden-lg">
|
|
36
|
+
<ng-container *ngTemplateOutlet="orderBy"></ng-container>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<mecx-filter-menu
|
|
41
|
+
*monkeyecxPopover="_showMenu; target: $any(_actionElement); closed: closeMenu; dir: 'ltr'"
|
|
42
|
+
(onSubmit)="onHandleSubmit($event)" (onClose)="onHandleClose()" [model]="menus">
|
|
43
|
+
</mecx-filter-menu>
|
|
44
|
+
|
|
45
|
+
<ng-template #orderBy>
|
|
46
|
+
<monkey-select-filter (onChange)="onHandleOrder($event)" [placeholder]="orderPlaceholder | translate" type="none"
|
|
47
|
+
[(value)]="_order">
|
|
48
|
+
<monkey-option *ngFor="let ordBy of orders" [label]="ordBy?.label | translate" [value]="ordBy?.value">
|
|
49
|
+
</monkey-option>
|
|
50
|
+
</monkey-select-filter>
|
|
51
|
+
</ng-template>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
@import 'node_modules/monkey-style-guide/assets/scss/partials/breakpoints';
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 100%;
|
|
6
|
+
align-items: center;
|
|
7
|
+
|
|
8
|
+
@include media-breakpoint('lt-md') {
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
|
|
12
|
+
::ng-deep monkey-input-filter {
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
::ng-deep monkey-select-filter {
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
::ng-deep monkey-button {
|
|
21
|
+
width: 100%;
|
|
22
|
+
|
|
23
|
+
button {
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.actions {
|
|
30
|
+
::ng-deep monkey-button {
|
|
31
|
+
@include media-breakpoint('gt-sm') {
|
|
32
|
+
margin-left: 8px;
|
|
33
|
+
|
|
34
|
+
button {
|
|
35
|
+
width: 170px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.more-filters {
|
|
42
|
+
::ng-deep monkey-button {
|
|
43
|
+
monkey-icon {
|
|
44
|
+
margin-right: unset !important;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.order {
|
|
50
|
+
@include media-breakpoint('gt-sm') {
|
|
51
|
+
width: 230px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@include media-breakpoint('lt-md') {
|
|
55
|
+
margin-top: 8px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
::ng-deep monkey-button {
|
|
60
|
+
margin-bottom: 0px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
::ng-deep mecx-form-field-filter mecx-form-field-body {
|
|
64
|
+
height: 40px;
|
|
65
|
+
margin: 0px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
::ng-deep monkey-input-filter {
|
|
69
|
+
@include media-breakpoint('gt-sm') {
|
|
70
|
+
width: 464px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.separator {
|
|
75
|
+
border-bottom: 1px solid #ebebeb;
|
|
76
|
+
margin-top: 16px;
|
|
77
|
+
margin-bottom: 16px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { MonkeyEcxFilterMenu, MonkeyEcxFilterOrder, MonkeyEcxUtils } from 'monkey-front-core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'mecx-filter',
|
|
6
|
+
templateUrl: './filter.component.html',
|
|
7
|
+
styleUrls: ['./filter.component.scss']
|
|
8
|
+
})
|
|
9
|
+
export class MECXFilterComponent implements OnChanges {
|
|
10
|
+
@Input() searchPlaceholder = '';
|
|
11
|
+
|
|
12
|
+
@Input() orderPlaceholder = '';
|
|
13
|
+
|
|
14
|
+
@Input() menus: MonkeyEcxFilterMenu[] = [];
|
|
15
|
+
|
|
16
|
+
@Input() orders: MonkeyEcxFilterOrder[] = [];
|
|
17
|
+
|
|
18
|
+
@Input() enableSearch = true;
|
|
19
|
+
|
|
20
|
+
@Input()
|
|
21
|
+
set search(value: string) {
|
|
22
|
+
this._search = value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Input()
|
|
26
|
+
set order(value: any) {
|
|
27
|
+
this._order = value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Input() isLoading = false;
|
|
31
|
+
|
|
32
|
+
@Output() onFilter = new EventEmitter<any>();
|
|
33
|
+
|
|
34
|
+
_order: MonkeyEcxFilterOrder = null;
|
|
35
|
+
|
|
36
|
+
_search = '';
|
|
37
|
+
|
|
38
|
+
_showMenu = false;
|
|
39
|
+
|
|
40
|
+
_hasFilterByMenu = false;
|
|
41
|
+
|
|
42
|
+
_actionElement: HTMLElement = null;
|
|
43
|
+
|
|
44
|
+
closeMenu = () => {
|
|
45
|
+
this._showMenu = false;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
constructor() {
|
|
49
|
+
// not to do
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private validateValue({ field, value, getValue }: any) {
|
|
53
|
+
try {
|
|
54
|
+
value = value || getValue()?.[field];
|
|
55
|
+
if (!value) return false;
|
|
56
|
+
if (typeof value === 'object') {
|
|
57
|
+
return value && JSON.stringify(value) !== '{}';
|
|
58
|
+
}
|
|
59
|
+
return MonkeyEcxUtils.persistNullEmptyUndefined(value);
|
|
60
|
+
} catch (e) {
|
|
61
|
+
// not to do
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private handleFilters() {
|
|
67
|
+
const { menus } = this;
|
|
68
|
+
let found = menus.find((_: any) => {
|
|
69
|
+
return this.validateValue(_);
|
|
70
|
+
});
|
|
71
|
+
if (!found) {
|
|
72
|
+
found = menus.find(({ children }) => {
|
|
73
|
+
return (children || [])?.find((_: any) => {
|
|
74
|
+
return this.validateValue(_);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
this._hasFilterByMenu = !!found;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
82
|
+
if (changes.menus) {
|
|
83
|
+
const { currentValue } = changes.menus;
|
|
84
|
+
if (currentValue && JSON.stringify(currentValue) !== '{}') {
|
|
85
|
+
this.handleFilters();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
onSearchFilter(event: string) {
|
|
91
|
+
this.onFilter.next({ search: event });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
onClearFilter() {
|
|
95
|
+
this._search = '';
|
|
96
|
+
this.onFilter.next({ search: null });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
onHandleSubmit(event: any) {
|
|
100
|
+
this.onFilter.next(event);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
onHandleShowMenu() {
|
|
104
|
+
this._actionElement = document.getElementById('mecx-filters-add-filter');
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
this._showMenu = true;
|
|
107
|
+
}, 0);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onHandleClose() {
|
|
111
|
+
this._showMenu = false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
onHandleOrder(event: any) {
|
|
115
|
+
this.onFilter.next({ sort: event });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { MonkeyEcxDirectivesModule, MonkeyEcxPipesModule } from 'monkey-front-core';
|
|
6
|
+
import {
|
|
7
|
+
MonkeyButtonModule,
|
|
8
|
+
MonkeyIconModule,
|
|
9
|
+
MonkeyInputModule,
|
|
10
|
+
MonkeyOptionModule,
|
|
11
|
+
MonkeySelectModule
|
|
12
|
+
} from 'monkey-style-guide';
|
|
13
|
+
import { MECXFilterComponent } from './filter.component';
|
|
14
|
+
import { MECXFilterMenuModule } from './menu';
|
|
15
|
+
import { MECXFilterSelectedModule } from './selected';
|
|
16
|
+
|
|
17
|
+
@NgModule({
|
|
18
|
+
declarations: [MECXFilterComponent],
|
|
19
|
+
imports: [
|
|
20
|
+
MonkeyEcxDirectivesModule,
|
|
21
|
+
MonkeyEcxPipesModule,
|
|
22
|
+
MonkeyButtonModule,
|
|
23
|
+
MonkeyInputModule,
|
|
24
|
+
MonkeyIconModule,
|
|
25
|
+
MonkeySelectModule,
|
|
26
|
+
MonkeyOptionModule,
|
|
27
|
+
TranslateModule.forChild(),
|
|
28
|
+
MECXFilterMenuModule,
|
|
29
|
+
MECXFilterSelectedModule,
|
|
30
|
+
CommonModule,
|
|
31
|
+
FormsModule,
|
|
32
|
+
ReactiveFormsModule
|
|
33
|
+
],
|
|
34
|
+
exports: [MECXFilterComponent]
|
|
35
|
+
})
|
|
36
|
+
export class MECXFilterModule {}
|
package/{lib/components/shared/filter/index.d.ts → src/lib/components/shared/filter/index.ts}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './filter.component';
|
|
2
|
-
export * from './filter.module';
|
|
1
|
+
export * from './filter.component';
|
|
2
|
+
export * from './filter.module';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './menu.module';
|
|
1
|
+
export * from './menu.module';
|