@wizishop/img-manager 0.2.104 → 14.0.0
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/animations/easeInOut/ease-in-out.animation.mjs +12 -0
- package/esm2020/lib/animations/insertRemove/insert-remove.animation.mjs +9 -0
- package/esm2020/lib/animations/listAnnimation/list.animation.mjs +16 -0
- package/esm2020/lib/components/canva-btn/canva-btn.component.mjs +67 -0
- package/esm2020/lib/components/images-view/images-actions-handler.mjs +151 -0
- package/esm2020/lib/components/images-view/images-view.component.mjs +474 -0
- package/esm2020/lib/components/images-view/mosaic-view/img-card/img-card.component.mjs +66 -0
- package/esm2020/lib/components/images-view/mosaic-view/mosaic-view.component.mjs +68 -0
- package/esm2020/lib/components/images-view/table-view/table-view.component.mjs +48 -0
- package/esm2020/lib/components/img-editor/cropper/cropper.component.mjs +307 -0
- package/esm2020/lib/components/img-editor/img-editor.component.mjs +109 -0
- package/esm2020/lib/components/img-editor/info-section/info-section.component.mjs +54 -0
- package/esm2020/lib/components/img-selection/img-selection.component.mjs +59 -0
- package/esm2020/lib/components/img-tabs/img-tabs.component.mjs +122 -0
- package/esm2020/lib/components/img-upload/img-upload.component.mjs +118 -0
- package/esm2020/lib/components/loader/loader.component.mjs +21 -0
- package/esm2020/lib/components/pexels-lib/pexels-lib.component.mjs +200 -0
- package/esm2020/lib/components/shared/alert/alert.component.mjs +27 -0
- package/esm2020/lib/components/shared/checkbox/checkbox.component.mjs +52 -0
- package/esm2020/lib/components/shared/dropdown/dropdown.component.mjs +21 -0
- package/esm2020/lib/components/shared/input-search/input-search.component.mjs +54 -0
- package/esm2020/lib/components/shared/pagination/page-selector/page-selector.component.mjs +49 -0
- package/esm2020/lib/components/shared/pagination/pagination.component.mjs +49 -0
- package/esm2020/lib/components/shared/select/call-to-action.model.mjs +2 -0
- package/esm2020/lib/components/shared/select/select-items.dto.mjs +2 -0
- package/esm2020/lib/components/shared/select/select.component.mjs +110 -0
- package/esm2020/lib/components/shared/table/table.component.mjs +116 -0
- package/esm2020/lib/components/upload-list/upload-list.component.mjs +79 -0
- package/esm2020/lib/directives/abstract-debounce/abstract-debounce.directive.mjs +37 -0
- package/esm2020/lib/directives/abstract-debounce/debounce-keyup.directive.mjs +24 -0
- package/esm2020/lib/directives/auto-hide.directive.mjs +48 -0
- package/esm2020/lib/directives/copy-to-clipboard.directive.mjs +37 -0
- package/esm2020/lib/directives/drag-drop.directive.mjs +57 -0
- package/esm2020/lib/directives/loading.directive.mjs +42 -0
- package/esm2020/lib/directives/table/checkBoxRow.directive.mjs +114 -0
- package/esm2020/lib/directives/table/column.directive.mjs +45 -0
- package/esm2020/lib/directives/table/columnHeader.directive.mjs +204 -0
- package/esm2020/lib/directives/table/raw.directive.mjs +31 -0
- package/esm2020/lib/directives/zindex-toggle.directive.mjs +42 -0
- package/esm2020/lib/dto/ImgManagerDisplayConfig.dto.mjs +2 -0
- package/esm2020/lib/dto/canva-create-design.dto.mjs +4 -0
- package/esm2020/lib/dto/canva.dto.mjs +4 -0
- package/esm2020/lib/dto/config/apis/api.dto.mjs +9 -0
- package/esm2020/lib/dto/config/external/external-config.dto.mjs +3 -0
- package/esm2020/lib/dto/config/image-cdn/image-cdn-config.dto.mjs +10 -0
- package/esm2020/lib/dto/export-dtos.api.mjs +11 -0
- package/esm2020/lib/dto/img-editor-config.dto.mjs +2 -0
- package/esm2020/lib/dto/img-manager.dto.mjs +2 -0
- package/esm2020/lib/dto/pexels-img.dto.mjs +2 -0
- package/esm2020/lib/dto/picture-name-update.dto.mjs +2 -0
- package/esm2020/lib/dto/stateDisplayed.dto.mjs +2 -0
- package/esm2020/lib/dto/tabDisplayed.dto.mjs +2 -0
- package/esm2020/lib/dto/wizi-block-media.dto.mjs +3 -0
- package/esm2020/lib/pipes/images/img-src.pipe.mjs +28 -0
- package/esm2020/lib/pipes/number-to-array.pipe.mjs +16 -0
- package/esm2020/lib/pipes/pagination/array-total-pages/array-pages.pipe.mjs +28 -0
- package/esm2020/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.mjs +53 -0
- package/esm2020/lib/pipes/pagination/text/custom-text.pipe.mjs +35 -0
- package/esm2020/lib/pipes/pagination/total-pages/is-last-page.pipe.mjs +25 -0
- package/esm2020/lib/pipes/select/select-filters.pipe.mjs +19 -0
- package/esm2020/lib/services/alert.service.mjs +53 -0
- package/esm2020/lib/services/canva.service.mjs +159 -0
- package/esm2020/lib/services/config/external-config.service.mjs +49 -0
- package/esm2020/lib/services/config/img-cdn.service.mjs +28 -0
- package/esm2020/lib/services/dom.service.mjs +36 -0
- package/{esm2015/lib/services/img-event.service.js → esm2020/lib/services/img-event.service.mjs} +11 -12
- package/esm2020/lib/services/img-manager.service.mjs +138 -0
- package/{esm2015/lib/services/img-selection.service.js → esm2020/lib/services/img-selection.service.mjs} +11 -12
- package/esm2020/lib/services/pexels.service.mjs +62 -0
- package/esm2020/lib/services/rename-picture.service.mjs +68 -0
- package/esm2020/lib/services/table/filters-table.service.mjs +63 -0
- package/{esm2015/lib/services/user-settings.service.js → esm2020/lib/services/user-settings.service.mjs} +11 -12
- package/esm2020/lib/wz-img-manager.component.mjs +186 -0
- package/esm2020/lib/wz-img-manager.module.mjs +193 -0
- package/esm2020/public-api.mjs +11 -0
- package/esm2020/wizishop-img-manager.mjs +5 -0
- package/fesm2015/wizishop-img-manager.mjs +4134 -0
- package/fesm2015/wizishop-img-manager.mjs.map +1 -0
- package/fesm2020/wizishop-img-manager.mjs +4140 -0
- package/fesm2020/wizishop-img-manager.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/canva-btn/canva-btn.component.d.ts +9 -6
- package/lib/components/images-view/images-actions-handler.d.ts +3 -0
- package/lib/components/images-view/images-view.component.d.ts +3 -0
- package/lib/components/images-view/mosaic-view/img-card/img-card.component.d.ts +3 -0
- package/lib/components/images-view/mosaic-view/mosaic-view.component.d.ts +3 -0
- package/lib/components/images-view/table-view/table-view.component.d.ts +3 -0
- package/lib/components/img-editor/cropper/cropper.component.d.ts +12 -5
- package/lib/components/img-editor/img-editor.component.d.ts +3 -0
- package/lib/components/img-editor/info-section/info-section.component.d.ts +3 -0
- package/lib/components/img-selection/img-selection.component.d.ts +3 -0
- package/lib/components/img-tabs/img-tabs.component.d.ts +3 -0
- package/lib/components/img-upload/img-upload.component.d.ts +4 -1
- package/lib/components/loader/loader.component.d.ts +3 -0
- package/lib/components/pexels-lib/pexels-lib.component.d.ts +3 -0
- package/lib/components/shared/alert/alert.component.d.ts +3 -0
- package/lib/components/shared/checkbox/checkbox.component.d.ts +3 -0
- package/lib/components/shared/dropdown/dropdown.component.d.ts +3 -0
- package/lib/components/shared/input-search/input-search.component.d.ts +3 -0
- package/lib/components/shared/pagination/page-selector/page-selector.component.d.ts +3 -0
- package/lib/components/shared/pagination/pagination.component.d.ts +3 -0
- package/lib/components/shared/select/select.component.d.ts +3 -0
- package/lib/components/shared/table/table.component.d.ts +3 -0
- package/lib/components/upload-list/upload-list.component.d.ts +3 -0
- package/lib/directives/abstract-debounce/abstract-debounce.directive.d.ts +3 -0
- package/lib/directives/abstract-debounce/debounce-keyup.directive.d.ts +3 -0
- package/lib/directives/auto-hide.directive.d.ts +3 -0
- package/lib/directives/copy-to-clipboard.directive.d.ts +3 -0
- package/lib/directives/drag-drop.directive.d.ts +3 -0
- package/lib/directives/loading.directive.d.ts +3 -0
- package/lib/directives/table/checkBoxRow.directive.d.ts +3 -0
- package/lib/directives/table/column.directive.d.ts +3 -0
- package/lib/directives/table/columnHeader.directive.d.ts +3 -0
- package/lib/directives/table/raw.directive.d.ts +3 -0
- package/lib/directives/zindex-toggle.directive.d.ts +3 -0
- package/lib/dto/pexels-img.dto.d.ts +1 -0
- package/lib/pipes/images/img-src.pipe.d.ts +3 -0
- package/lib/pipes/number-to-array.pipe.d.ts +3 -0
- package/lib/pipes/pagination/array-total-pages/array-pages.pipe.d.ts +3 -0
- package/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.d.ts +7 -1
- package/lib/pipes/pagination/text/custom-text.pipe.d.ts +3 -0
- package/lib/pipes/pagination/total-pages/is-last-page.pipe.d.ts +3 -0
- package/lib/pipes/select/select-filters.pipe.d.ts +3 -0
- package/lib/services/alert.service.d.ts +3 -0
- package/lib/services/canva.service.d.ts +3 -0
- package/lib/services/config/external-config.service.d.ts +3 -0
- package/lib/services/config/img-cdn.service.d.ts +3 -0
- package/lib/services/dom.service.d.ts +3 -0
- package/lib/services/img-event.service.d.ts +3 -0
- package/lib/services/img-manager.service.d.ts +5 -2
- package/lib/services/img-selection.service.d.ts +3 -0
- package/lib/services/pexels.service.d.ts +7 -4
- package/lib/services/rename-picture.service.d.ts +3 -0
- package/lib/services/table/filters-table.service.d.ts +3 -0
- package/lib/services/user-settings.service.d.ts +3 -0
- package/lib/wz-img-manager.component.d.ts +3 -0
- package/lib/wz-img-manager.module.d.ts +56 -0
- package/package.json +46 -26
- package/wizishop-img-manager-14.0.0.tgz +0 -0
- package/wz-img-manager.scss +2745 -3141
- package/bundles/wizishop-img-manager.umd.js +0 -5046
- package/bundles/wizishop-img-manager.umd.js.map +0 -1
- package/bundles/wizishop-img-manager.umd.min.js +0 -16
- package/bundles/wizishop-img-manager.umd.min.js.map +0 -1
- package/esm2015/lib/animations/easeInOut/ease-in-out.animation.js +0 -12
- package/esm2015/lib/animations/insertRemove/insert-remove.animation.js +0 -9
- package/esm2015/lib/animations/listAnnimation/list.animation.js +0 -16
- package/esm2015/lib/components/canva-btn/canva-btn.component.js +0 -70
- package/esm2015/lib/components/images-view/images-actions-handler.js +0 -180
- package/esm2015/lib/components/images-view/images-view.component.js +0 -492
- package/esm2015/lib/components/images-view/mosaic-view/img-card/img-card.component.js +0 -84
- package/esm2015/lib/components/images-view/mosaic-view/mosaic-view.component.js +0 -79
- package/esm2015/lib/components/images-view/table-view/table-view.component.js +0 -49
- package/esm2015/lib/components/img-editor/cropper/cropper.component.js +0 -280
- package/esm2015/lib/components/img-editor/img-editor.component.js +0 -112
- package/esm2015/lib/components/img-editor/info-section/info-section.component.js +0 -59
- package/esm2015/lib/components/img-selection/img-selection.component.js +0 -62
- package/esm2015/lib/components/img-tabs/img-tabs.component.js +0 -131
- package/esm2015/lib/components/img-upload/img-upload.component.js +0 -125
- package/esm2015/lib/components/loader/loader.component.js +0 -28
- package/esm2015/lib/components/pexels-lib/pexels-lib.component.js +0 -208
- package/esm2015/lib/components/shared/alert/alert.component.js +0 -37
- package/esm2015/lib/components/shared/checkbox/checkbox.component.js +0 -69
- package/esm2015/lib/components/shared/dropdown/dropdown.component.js +0 -26
- package/esm2015/lib/components/shared/input-search/input-search.component.js +0 -62
- package/esm2015/lib/components/shared/pagination/page-selector/page-selector.component.js +0 -55
- package/esm2015/lib/components/shared/pagination/pagination.component.js +0 -51
- package/esm2015/lib/components/shared/select/call-to-action.model.js +0 -1
- package/esm2015/lib/components/shared/select/select-items.dto.js +0 -1
- package/esm2015/lib/components/shared/select/select.component.js +0 -133
- package/esm2015/lib/components/shared/table/table.component.js +0 -133
- package/esm2015/lib/components/upload-list/upload-list.component.js +0 -87
- package/esm2015/lib/directives/abstract-debounce/abstract-debounce.directive.js +0 -40
- package/esm2015/lib/directives/abstract-debounce/debounce-keyup.directive.js +0 -26
- package/esm2015/lib/directives/auto-hide.directive.js +0 -55
- package/esm2015/lib/directives/copy-to-clipboard.directive.js +0 -40
- package/esm2015/lib/directives/drag-drop.directive.js +0 -68
- package/esm2015/lib/directives/loading.directive.js +0 -44
- package/esm2015/lib/directives/table/checkBoxRow.directive.js +0 -128
- package/esm2015/lib/directives/table/column.directive.js +0 -49
- package/esm2015/lib/directives/table/columnHeader.directive.js +0 -221
- package/esm2015/lib/directives/table/raw.directive.js +0 -33
- package/esm2015/lib/directives/zindex-toggle.directive.js +0 -49
- package/esm2015/lib/dto/ImgManagerDisplayConfig.dto.js +0 -1
- package/esm2015/lib/dto/canva-create-design.dto.js +0 -4
- package/esm2015/lib/dto/canva.dto.js +0 -4
- package/esm2015/lib/dto/config/apis/api.dto.js +0 -9
- package/esm2015/lib/dto/config/external/external-config.dto.js +0 -3
- package/esm2015/lib/dto/config/image-cdn/image-cdn-config.dto.js +0 -10
- package/esm2015/lib/dto/export-dtos.api.js +0 -5
- package/esm2015/lib/dto/img-editor-config.dto.js +0 -1
- package/esm2015/lib/dto/img-manager.dto.js +0 -1
- package/esm2015/lib/dto/pexels-img.dto.js +0 -1
- package/esm2015/lib/dto/picture-name-update.dto.js +0 -1
- package/esm2015/lib/dto/stateDisplayed.dto.js +0 -1
- package/esm2015/lib/dto/tabDisplayed.dto.js +0 -1
- package/esm2015/lib/dto/wizi-block-media.dto.js +0 -3
- package/esm2015/lib/pipes/images/img-src.pipe.js +0 -29
- package/esm2015/lib/pipes/number-to-array.pipe.js +0 -14
- package/esm2015/lib/pipes/pagination/array-total-pages/array-pages.pipe.js +0 -26
- package/esm2015/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.js +0 -51
- package/esm2015/lib/pipes/pagination/text/custom-text.pipe.js +0 -36
- package/esm2015/lib/pipes/pagination/total-pages/is-last-page.pipe.js +0 -23
- package/esm2015/lib/pipes/select/select-filters.pipe.js +0 -17
- package/esm2015/lib/services/alert.service.js +0 -59
- package/esm2015/lib/services/canva.service.js +0 -171
- package/esm2015/lib/services/config/external-config.service.js +0 -55
- package/esm2015/lib/services/config/img-cdn.service.js +0 -29
- package/esm2015/lib/services/dom.service.js +0 -36
- package/esm2015/lib/services/img-manager.service.js +0 -142
- package/esm2015/lib/services/pexels.service.js +0 -70
- package/esm2015/lib/services/rename-picture.service.js +0 -74
- package/esm2015/lib/services/table/filters-table.service.js +0 -67
- package/esm2015/lib/wz-img-manager.component.js +0 -212
- package/esm2015/lib/wz-img-manager.module.js +0 -132
- package/esm2015/public-api.js +0 -11
- package/esm2015/wizishop-img-manager.js +0 -57
- package/esm5/lib/animations/easeInOut/ease-in-out.animation.js +0 -12
- package/esm5/lib/animations/insertRemove/insert-remove.animation.js +0 -9
- package/esm5/lib/animations/listAnnimation/list.animation.js +0 -16
- package/esm5/lib/components/canva-btn/canva-btn.component.js +0 -72
- package/esm5/lib/components/images-view/images-actions-handler.js +0 -183
- package/esm5/lib/components/images-view/images-view.component.js +0 -535
- package/esm5/lib/components/images-view/mosaic-view/img-card/img-card.component.js +0 -87
- package/esm5/lib/components/images-view/mosaic-view/mosaic-view.component.js +0 -82
- package/esm5/lib/components/images-view/table-view/table-view.component.js +0 -52
- package/esm5/lib/components/img-editor/cropper/cropper.component.js +0 -285
- package/esm5/lib/components/img-editor/img-editor.component.js +0 -115
- package/esm5/lib/components/img-editor/info-section/info-section.component.js +0 -64
- package/esm5/lib/components/img-selection/img-selection.component.js +0 -64
- package/esm5/lib/components/img-tabs/img-tabs.component.js +0 -133
- package/esm5/lib/components/img-upload/img-upload.component.js +0 -138
- package/esm5/lib/components/loader/loader.component.js +0 -29
- package/esm5/lib/components/pexels-lib/pexels-lib.component.js +0 -216
- package/esm5/lib/components/shared/alert/alert.component.js +0 -38
- package/esm5/lib/components/shared/checkbox/checkbox.component.js +0 -71
- package/esm5/lib/components/shared/dropdown/dropdown.component.js +0 -27
- package/esm5/lib/components/shared/input-search/input-search.component.js +0 -68
- package/esm5/lib/components/shared/pagination/page-selector/page-selector.component.js +0 -64
- package/esm5/lib/components/shared/pagination/pagination.component.js +0 -56
- package/esm5/lib/components/shared/select/call-to-action.model.js +0 -1
- package/esm5/lib/components/shared/select/select-items.dto.js +0 -1
- package/esm5/lib/components/shared/select/select.component.js +0 -136
- package/esm5/lib/components/shared/table/table.component.js +0 -135
- package/esm5/lib/components/upload-list/upload-list.component.js +0 -103
- package/esm5/lib/directives/abstract-debounce/abstract-debounce.directive.js +0 -42
- package/esm5/lib/directives/abstract-debounce/debounce-keyup.directive.js +0 -28
- package/esm5/lib/directives/auto-hide.directive.js +0 -57
- package/esm5/lib/directives/copy-to-clipboard.directive.js +0 -42
- package/esm5/lib/directives/drag-drop.directive.js +0 -69
- package/esm5/lib/directives/loading.directive.js +0 -46
- package/esm5/lib/directives/table/checkBoxRow.directive.js +0 -137
- package/esm5/lib/directives/table/column.directive.js +0 -50
- package/esm5/lib/directives/table/columnHeader.directive.js +0 -229
- package/esm5/lib/directives/table/raw.directive.js +0 -34
- package/esm5/lib/directives/zindex-toggle.directive.js +0 -54
- package/esm5/lib/dto/ImgManagerDisplayConfig.dto.js +0 -1
- package/esm5/lib/dto/canva-create-design.dto.js +0 -8
- package/esm5/lib/dto/canva.dto.js +0 -8
- package/esm5/lib/dto/config/apis/api.dto.js +0 -11
- package/esm5/lib/dto/config/external/external-config.dto.js +0 -7
- package/esm5/lib/dto/config/image-cdn/image-cdn-config.dto.js +0 -12
- package/esm5/lib/dto/export-dtos.api.js +0 -5
- package/esm5/lib/dto/img-editor-config.dto.js +0 -1
- package/esm5/lib/dto/img-manager.dto.js +0 -1
- package/esm5/lib/dto/pexels-img.dto.js +0 -1
- package/esm5/lib/dto/picture-name-update.dto.js +0 -1
- package/esm5/lib/dto/stateDisplayed.dto.js +0 -1
- package/esm5/lib/dto/tabDisplayed.dto.js +0 -1
- package/esm5/lib/dto/wizi-block-media.dto.js +0 -7
- package/esm5/lib/pipes/images/img-src.pipe.js +0 -30
- package/esm5/lib/pipes/number-to-array.pipe.js +0 -17
- package/esm5/lib/pipes/pagination/array-total-pages/array-pages.pipe.js +0 -29
- package/esm5/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.js +0 -54
- package/esm5/lib/pipes/pagination/text/custom-text.pipe.js +0 -37
- package/esm5/lib/pipes/pagination/total-pages/is-last-page.pipe.js +0 -26
- package/esm5/lib/pipes/select/select-filters.pipe.js +0 -20
- package/esm5/lib/services/alert.service.js +0 -62
- package/esm5/lib/services/canva.service.js +0 -181
- package/esm5/lib/services/config/external-config.service.js +0 -56
- package/esm5/lib/services/config/img-cdn.service.js +0 -34
- package/esm5/lib/services/dom.service.js +0 -39
- package/esm5/lib/services/img-event.service.js +0 -46
- package/esm5/lib/services/img-manager.service.js +0 -143
- package/esm5/lib/services/img-selection.service.js +0 -143
- package/esm5/lib/services/pexels.service.js +0 -72
- package/esm5/lib/services/rename-picture.service.js +0 -88
- package/esm5/lib/services/table/filters-table.service.js +0 -68
- package/esm5/lib/services/user-settings.service.js +0 -30
- package/esm5/lib/wz-img-manager.component.js +0 -228
- package/esm5/lib/wz-img-manager.module.js +0 -131
- package/esm5/public-api.js +0 -11
- package/esm5/wizishop-img-manager.js +0 -57
- package/fesm2015/wizishop-img-manager.js +0 -4514
- package/fesm2015/wizishop-img-manager.js.map +0 -1
- package/fesm5/wizishop-img-manager.js +0 -4788
- package/fesm5/wizishop-img-manager.js.map +0 -1
- package/wizishop-img-manager-0.2.104.tgz +0 -0
- package/wizishop-img-manager.d.ts +0 -56
- package/wizishop-img-manager.metadata.json +0 -1
|
@@ -0,0 +1,4134 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, ViewEncapsulation, Input, EventEmitter, Directive, Output, HostBinding, HostListener, ViewChild, Pipe, Inject, NgModule } from '@angular/core';
|
|
3
|
+
import { ReplaySubject, Observable, Subject, BehaviorSubject, forkJoin } from 'rxjs';
|
|
4
|
+
import * as i3 from '@angular/common/http';
|
|
5
|
+
import { HttpParams, HttpHeaders, HttpClientModule } from '@angular/common/http';
|
|
6
|
+
import { take, map, takeUntil, debounceTime, distinctUntilChanged, tap } from 'rxjs/operators';
|
|
7
|
+
import * as i1 from '@wizishop/ng-wizi-bulma';
|
|
8
|
+
import { NwbAllModule } from '@wizishop/ng-wizi-bulma';
|
|
9
|
+
import * as i7 from '@ngx-translate/core';
|
|
10
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
11
|
+
import * as i2 from '@angular/common';
|
|
12
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
13
|
+
import * as i3$2 from '@angular/router';
|
|
14
|
+
import * as i2$1 from '@angular/forms';
|
|
15
|
+
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
16
|
+
import { trigger, state, style, transition, animate, query, stagger } from '@angular/animations';
|
|
17
|
+
import * as i3$1 from 'ngx-perfect-scrollbar';
|
|
18
|
+
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
|
|
19
|
+
import * as i4 from 'ngx-image-cropper';
|
|
20
|
+
import { ImageCropperModule } from 'ngx-image-cropper';
|
|
21
|
+
import { v4 } from 'uuid';
|
|
22
|
+
import * as i3$3 from '@angular/cdk/drag-drop';
|
|
23
|
+
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
24
|
+
import { NgScrollbarModule } from 'ngx-scrollbar';
|
|
25
|
+
import { NgScrollbarReachedModule } from 'ngx-scrollbar/reached-event';
|
|
26
|
+
import { CdkTableModule } from '@angular/cdk/table';
|
|
27
|
+
|
|
28
|
+
class ImgSelectionService {
|
|
29
|
+
constructor() {
|
|
30
|
+
this.imgSelectedList = [];
|
|
31
|
+
this.multipleImgMode = false;
|
|
32
|
+
this.imgSelectionSubscriber = [];
|
|
33
|
+
this.imgListLoading = new ReplaySubject();
|
|
34
|
+
}
|
|
35
|
+
getImgSelection() {
|
|
36
|
+
return this.imgSelectedList;
|
|
37
|
+
}
|
|
38
|
+
// Use in img manager webelement, when the product img selection is retrieved
|
|
39
|
+
setImgSelection(imgSelectedList) {
|
|
40
|
+
this.imgSelectedList.length = 0; // Remove all the elements from the array and keep the reference
|
|
41
|
+
if (imgSelectedList && imgSelectedList.length) {
|
|
42
|
+
imgSelectedList.forEach(elem => this.imgSelectedList.push(elem));
|
|
43
|
+
}
|
|
44
|
+
this.emitImgSelectionChange();
|
|
45
|
+
}
|
|
46
|
+
addImgSelected(picture) {
|
|
47
|
+
if (this.multipleImgMode) {
|
|
48
|
+
this.imgSelectedList.push(picture);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.imgSelectedList = [picture];
|
|
52
|
+
}
|
|
53
|
+
this.emitImgSelectionChange();
|
|
54
|
+
}
|
|
55
|
+
getImgSelectionChange() {
|
|
56
|
+
const obsImgSelection = new Observable(subscriber => {
|
|
57
|
+
this.imgSelectionSubscriber.push(subscriber);
|
|
58
|
+
});
|
|
59
|
+
return obsImgSelection;
|
|
60
|
+
}
|
|
61
|
+
emitImgSelectionChange() {
|
|
62
|
+
this.imgSelectionSubscriber.map(obs => obs.next(JSON.parse(JSON.stringify(this.imgSelectedList))));
|
|
63
|
+
}
|
|
64
|
+
removeImgSelectedByIndex(index) {
|
|
65
|
+
this.imgSelectedList.splice(index, 1);
|
|
66
|
+
this.emitImgSelectionChange();
|
|
67
|
+
}
|
|
68
|
+
removeImgSelectedById(id_file) {
|
|
69
|
+
if (!this.multipleImgMode) {
|
|
70
|
+
this.imgSelectedList = [];
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let index = 0;
|
|
74
|
+
for (const img of this.imgSelectedList) {
|
|
75
|
+
if (img.id_file === id_file) {
|
|
76
|
+
this.removeImgSelectedByIndex(index);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
index++;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
removeImgSelectionByIds(id_file_list) {
|
|
83
|
+
if (!this.multipleImgMode) {
|
|
84
|
+
this.imgSelectedList = [];
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
for (let index = this.imgSelectedList.length - 1; index > -1; index--) {
|
|
88
|
+
const id_file = this.imgSelectedList[index].id_file;
|
|
89
|
+
if (id_file_list.indexOf(id_file) !== -1) {
|
|
90
|
+
this.removeImgSelectedByIndex(index);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
removeAllImgSelected() {
|
|
95
|
+
this.imgSelectedList.length = 0;
|
|
96
|
+
this.emitImgSelectionChange();
|
|
97
|
+
// Remove all the elements from the array and keep the reference
|
|
98
|
+
}
|
|
99
|
+
setMultipleImgMode(activated) {
|
|
100
|
+
this.multipleImgMode = activated;
|
|
101
|
+
}
|
|
102
|
+
initImgSelectedList(imgSelectedList) {
|
|
103
|
+
// Retrieve the imgSelectedList from parameter
|
|
104
|
+
if (imgSelectedList) {
|
|
105
|
+
this.imgSelectedList = imgSelectedList;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
// Remove all elements from imgSelectedList
|
|
109
|
+
if (this.imgSelectedList && this.imgSelectedList.length) {
|
|
110
|
+
this.imgSelectedList.splice(0, this.imgSelectedList.length);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.imgSelectedList = [];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Use to display the loader on img selection list
|
|
117
|
+
* @param loading
|
|
118
|
+
*/
|
|
119
|
+
emitImgListLoading(loading) {
|
|
120
|
+
this.imgListLoading.next(loading);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Use to display the loader on img selection list
|
|
124
|
+
* @param loading
|
|
125
|
+
*/
|
|
126
|
+
getImgListLoadingEventListner() {
|
|
127
|
+
return this.imgListLoading.asObservable();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Use angular cdk function
|
|
131
|
+
* Called by img selection component
|
|
132
|
+
* @param event
|
|
133
|
+
*/
|
|
134
|
+
moveImgOrder(event) {
|
|
135
|
+
const fromIndex = event.previousIndex;
|
|
136
|
+
const toIndex = event.currentIndex;
|
|
137
|
+
this.imgSelectedList.splice(toIndex, 0, this.imgSelectedList.splice(fromIndex, 1)[0]);
|
|
138
|
+
this.emitImgSelectionChange();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
ImgSelectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgSelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
142
|
+
ImgSelectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgSelectionService, providedIn: 'root' });
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgSelectionService, decorators: [{
|
|
144
|
+
type: Injectable,
|
|
145
|
+
args: [{
|
|
146
|
+
providedIn: 'root'
|
|
147
|
+
}]
|
|
148
|
+
}], ctorParameters: function () { return []; } });
|
|
149
|
+
|
|
150
|
+
class ImgManagerService {
|
|
151
|
+
constructor(http) {
|
|
152
|
+
this.http = http;
|
|
153
|
+
this.params = new HttpParams().set("limit", "20").set("page", "1");
|
|
154
|
+
// Display the img selection
|
|
155
|
+
this.pageFicheProductConfig = {
|
|
156
|
+
stateDisplayed: 'closed',
|
|
157
|
+
multipleImgMode: true,
|
|
158
|
+
showImgManagerModule: true,
|
|
159
|
+
showSelection: true,
|
|
160
|
+
displayBtn: true,
|
|
161
|
+
pageficheProduct: true
|
|
162
|
+
};
|
|
163
|
+
this.angularFicheProductConfig = {
|
|
164
|
+
stateDisplayed: 'closed',
|
|
165
|
+
multipleImgMode: true,
|
|
166
|
+
showImgManagerModule: true,
|
|
167
|
+
showSelection: true,
|
|
168
|
+
displayBtn: false,
|
|
169
|
+
pageficheProduct: true
|
|
170
|
+
};
|
|
171
|
+
this.wiziblockConfig = {
|
|
172
|
+
stateDisplayed: 'closed',
|
|
173
|
+
multipleImgMode: false,
|
|
174
|
+
showImgManagerModule: true,
|
|
175
|
+
showSelection: false,
|
|
176
|
+
displayBtn: false
|
|
177
|
+
};
|
|
178
|
+
this.simpleWithButtonOpenerConfig = {
|
|
179
|
+
stateDisplayed: 'closed',
|
|
180
|
+
multipleImgMode: false,
|
|
181
|
+
showImgManagerModule: true,
|
|
182
|
+
showSelection: false,
|
|
183
|
+
displayBtn: true
|
|
184
|
+
};
|
|
185
|
+
this.fullWindowConfig = {
|
|
186
|
+
stateDisplayed: 'window',
|
|
187
|
+
multipleImgMode: false,
|
|
188
|
+
showImgManagerModule: true,
|
|
189
|
+
showSelection: false,
|
|
190
|
+
displayBtn: false
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
setApiConfig(img_manager_route, shop_token) {
|
|
194
|
+
this.imgManagerRoute = img_manager_route;
|
|
195
|
+
this.shopToken = shop_token;
|
|
196
|
+
}
|
|
197
|
+
getOptionsHeaders(params) {
|
|
198
|
+
const header = { headers: new HttpHeaders({
|
|
199
|
+
Authorization: 'Bearer ' + this.shopToken
|
|
200
|
+
})
|
|
201
|
+
};
|
|
202
|
+
if (params) {
|
|
203
|
+
this.getParams(params);
|
|
204
|
+
header['params'] = this.params;
|
|
205
|
+
}
|
|
206
|
+
return header;
|
|
207
|
+
}
|
|
208
|
+
getShopImgList(params) {
|
|
209
|
+
return this.http.get(`${this.imgManagerRoute}/images`, this.getOptionsHeaders(params));
|
|
210
|
+
}
|
|
211
|
+
getShopTotalImgList(params) {
|
|
212
|
+
return this.http.get(`${this.imgManagerRoute}/total/image`, this.getOptionsHeaders(params));
|
|
213
|
+
}
|
|
214
|
+
getShopImg(idFile) {
|
|
215
|
+
return this.http.get(`${this.imgManagerRoute}/images/${idFile}`, this.getOptionsHeaders());
|
|
216
|
+
}
|
|
217
|
+
getParams(params) {
|
|
218
|
+
this.params = new HttpParams();
|
|
219
|
+
this.params = this.params.set('id_file:sort', 'desc');
|
|
220
|
+
for (const param in params) {
|
|
221
|
+
this.params = this.params.set(param, params[param]);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
uploadFile(formData) {
|
|
225
|
+
return this.http.post(`${this.imgManagerRoute}/images/template`, formData, this.getOptionsHeaders());
|
|
226
|
+
}
|
|
227
|
+
uploadFileByUrl(url, fileName) {
|
|
228
|
+
const body = {
|
|
229
|
+
url,
|
|
230
|
+
fileName
|
|
231
|
+
};
|
|
232
|
+
return this.http.post(`${this.imgManagerRoute}/images/template`, { url, fileName }, this.getOptionsHeaders());
|
|
233
|
+
}
|
|
234
|
+
replaceImg(imageBase64, id_file) {
|
|
235
|
+
const body = {
|
|
236
|
+
imageBase64,
|
|
237
|
+
type: "RAW"
|
|
238
|
+
};
|
|
239
|
+
return this.http.put(`${this.imgManagerRoute}/images/${id_file}/replace`, body, this.getOptionsHeaders());
|
|
240
|
+
}
|
|
241
|
+
changeImgName(fileName, id_file) {
|
|
242
|
+
return this.http.put(`${this.imgManagerRoute}/images/${id_file}?file_name=${fileName}`, null, this.getOptionsHeaders());
|
|
243
|
+
}
|
|
244
|
+
removeImg(id_file) {
|
|
245
|
+
return this.http.delete(`${this.imgManagerRoute}/images/${id_file}`, this.getOptionsHeaders());
|
|
246
|
+
}
|
|
247
|
+
removeMultipleImg(id_array) {
|
|
248
|
+
return this.http.post(`${this.imgManagerRoute}/images-multiple-delete`, { id_array }, this.getOptionsHeaders());
|
|
249
|
+
}
|
|
250
|
+
getImgManagerDisplayConfig(displayName) {
|
|
251
|
+
switch (displayName) {
|
|
252
|
+
case "window":
|
|
253
|
+
return this.fullWindowConfig;
|
|
254
|
+
case "wizi-block":
|
|
255
|
+
return this.wiziblockConfig;
|
|
256
|
+
case "fiche-product":
|
|
257
|
+
return this.pageFicheProductConfig;
|
|
258
|
+
case "simple-with-button":
|
|
259
|
+
return this.simpleWithButtonOpenerConfig;
|
|
260
|
+
case 'angular-fiche-product':
|
|
261
|
+
return this.angularFicheProductConfig;
|
|
262
|
+
default:
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
getAllImgManagerDisplayConfig() {
|
|
267
|
+
return [
|
|
268
|
+
this.fullWindowConfig,
|
|
269
|
+
this.wiziblockConfig,
|
|
270
|
+
this.pageFicheProductConfig,
|
|
271
|
+
this.simpleWithButtonOpenerConfig,
|
|
272
|
+
];
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
ImgManagerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgManagerService, deps: [{ token: i3.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
276
|
+
ImgManagerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgManagerService, providedIn: 'root' });
|
|
277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgManagerService, decorators: [{
|
|
278
|
+
type: Injectable,
|
|
279
|
+
args: [{
|
|
280
|
+
providedIn: 'root'
|
|
281
|
+
}]
|
|
282
|
+
}], ctorParameters: function () { return [{ type: i3.HttpClient }]; } });
|
|
283
|
+
|
|
284
|
+
class ImgCDNService {
|
|
285
|
+
constructor() {
|
|
286
|
+
this.imgCDNConfig = null;
|
|
287
|
+
}
|
|
288
|
+
setImgCDNConfig(imgCDNConfig) {
|
|
289
|
+
this.imgCDNConfig = imgCDNConfig;
|
|
290
|
+
}
|
|
291
|
+
getUrlImg(size) {
|
|
292
|
+
const urlProperty = Object.keys(this.imgCDNConfig)
|
|
293
|
+
.filter(url => new RegExp(size, 'i').test(url))[0];
|
|
294
|
+
return this.imgCDNConfig[urlProperty];
|
|
295
|
+
}
|
|
296
|
+
getAllSize() {
|
|
297
|
+
return Object.keys(this.imgCDNConfig)
|
|
298
|
+
.map(elem => elem.match(/_(\w+)_/)[1]);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
ImgCDNService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgCDNService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
302
|
+
ImgCDNService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgCDNService, providedIn: 'root' });
|
|
303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgCDNService, decorators: [{
|
|
304
|
+
type: Injectable,
|
|
305
|
+
args: [{
|
|
306
|
+
providedIn: 'root'
|
|
307
|
+
}]
|
|
308
|
+
}], ctorParameters: function () { return []; } });
|
|
309
|
+
|
|
310
|
+
class ImgManagerConfigService {
|
|
311
|
+
constructor(imgManagerService, imgCDNService) {
|
|
312
|
+
this.imgManagerService = imgManagerService;
|
|
313
|
+
this.imgCDNService = imgCDNService;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Set imgManagerService and imgCDNService
|
|
317
|
+
* Canva and Pexel service retrieve the externalConfig at their initialization
|
|
318
|
+
* @param externalConfig
|
|
319
|
+
*/
|
|
320
|
+
setExternalConfig(externalConfig) {
|
|
321
|
+
this.externalConfig = externalConfig;
|
|
322
|
+
this.imgManagerService.setApiConfig(externalConfig.api.image_manager_route, externalConfig.api.shop_token);
|
|
323
|
+
this.imgCDNService.setImgCDNConfig(externalConfig.imgCDNConfig);
|
|
324
|
+
}
|
|
325
|
+
getCanvaApiURL() {
|
|
326
|
+
return this.externalConfig.api.canva_url;
|
|
327
|
+
}
|
|
328
|
+
getCanvaApiToken() {
|
|
329
|
+
return this.externalConfig.api.canva_token;
|
|
330
|
+
}
|
|
331
|
+
getRouteAssets() {
|
|
332
|
+
return this.externalConfig.api.assets_route;
|
|
333
|
+
}
|
|
334
|
+
getPexelsApiURL() {
|
|
335
|
+
return this.externalConfig.api.pexels_route;
|
|
336
|
+
}
|
|
337
|
+
getPexelsApiToken() {
|
|
338
|
+
return this.externalConfig.api.pexels_token;
|
|
339
|
+
}
|
|
340
|
+
getShopCategory() {
|
|
341
|
+
return this.externalConfig.api.shop_category;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
ImgManagerConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgManagerConfigService, deps: [{ token: ImgManagerService }, { token: ImgCDNService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
345
|
+
ImgManagerConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgManagerConfigService, providedIn: 'root' });
|
|
346
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgManagerConfigService, decorators: [{
|
|
347
|
+
type: Injectable,
|
|
348
|
+
args: [{
|
|
349
|
+
providedIn: 'root'
|
|
350
|
+
}]
|
|
351
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgCDNService }]; } });
|
|
352
|
+
|
|
353
|
+
class UserSettingsService {
|
|
354
|
+
constructor() {
|
|
355
|
+
this.userdisplayPreference = 'WzImgManagerListDisplayed';
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* true : display list
|
|
359
|
+
* false : display mosaic
|
|
360
|
+
* @param value
|
|
361
|
+
*/
|
|
362
|
+
setUserDisplayPreference(value) {
|
|
363
|
+
localStorage.setItem(this.userdisplayPreference, '' + value);
|
|
364
|
+
}
|
|
365
|
+
getUserDisplayPreference() {
|
|
366
|
+
const value = localStorage.getItem(this.userdisplayPreference);
|
|
367
|
+
return value == 'true';
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
UserSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: UserSettingsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
371
|
+
UserSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: UserSettingsService, providedIn: 'root' });
|
|
372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: UserSettingsService, decorators: [{
|
|
373
|
+
type: Injectable,
|
|
374
|
+
args: [{
|
|
375
|
+
providedIn: 'root'
|
|
376
|
+
}]
|
|
377
|
+
}], ctorParameters: function () { return []; } });
|
|
378
|
+
|
|
379
|
+
class ImgEventService {
|
|
380
|
+
constructor() {
|
|
381
|
+
this.imgToEditEvent = new Subject();
|
|
382
|
+
this.imgRemoved = new Subject();
|
|
383
|
+
this.imgAdded = new Subject();
|
|
384
|
+
this.listDisplayedChange = new Subject();
|
|
385
|
+
}
|
|
386
|
+
emitImgRemoved(id_file) {
|
|
387
|
+
this.imgRemoved.next(id_file);
|
|
388
|
+
}
|
|
389
|
+
getImgRemovedEventListner() {
|
|
390
|
+
return this.imgRemoved.asObservable();
|
|
391
|
+
}
|
|
392
|
+
emitImgToEdit(imgToEdit) {
|
|
393
|
+
this.imgToEditEvent.next(imgToEdit);
|
|
394
|
+
}
|
|
395
|
+
getImgToEditEventListner() {
|
|
396
|
+
return this.imgToEditEvent.asObservable();
|
|
397
|
+
}
|
|
398
|
+
emitImgAdded(id_file) {
|
|
399
|
+
this.imgAdded.next(id_file);
|
|
400
|
+
}
|
|
401
|
+
getImgAddedEventListner() {
|
|
402
|
+
return this.imgAdded.asObservable();
|
|
403
|
+
}
|
|
404
|
+
emitlistDisplayedChange(value) {
|
|
405
|
+
this.listDisplayedChange.next(value);
|
|
406
|
+
}
|
|
407
|
+
getlistDisplayedChange() {
|
|
408
|
+
return this.listDisplayedChange.asObservable();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
ImgEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
412
|
+
ImgEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgEventService, providedIn: 'root' });
|
|
413
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgEventService, decorators: [{
|
|
414
|
+
type: Injectable,
|
|
415
|
+
args: [{
|
|
416
|
+
providedIn: 'root'
|
|
417
|
+
}]
|
|
418
|
+
}], ctorParameters: function () { return []; } });
|
|
419
|
+
|
|
420
|
+
class AlertService {
|
|
421
|
+
constructor(nwbAlertService, translateService) {
|
|
422
|
+
this.nwbAlertService = nwbAlertService;
|
|
423
|
+
this.translateService = translateService;
|
|
424
|
+
this.actionMsg = 'ImgManager.alert.action';
|
|
425
|
+
this.alertConfig = {
|
|
426
|
+
message: '',
|
|
427
|
+
duration: 5000
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
openAlert(msgKey) {
|
|
431
|
+
this.closePreviousAlert();
|
|
432
|
+
this.translateService.get(msgKey).subscribe(trans => {
|
|
433
|
+
this.alertConfig.message = trans;
|
|
434
|
+
this.setAlertColor(msgKey);
|
|
435
|
+
this.alertRefComponent = this.nwbAlertService.open(this.alertConfig);
|
|
436
|
+
this.alertRefComponent.afterClosed().subscribe();
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
openAlertWithBackendRespons(msgKey, msgBackend) {
|
|
440
|
+
this.translateService.get(msgKey).subscribe(trans => {
|
|
441
|
+
this.alertConfig.message = trans;
|
|
442
|
+
this.alertConfig.message += '<br/>' + JSON.parse(msgBackend).message;
|
|
443
|
+
this.closePreviousAlert();
|
|
444
|
+
this.alertRefComponent = this.nwbAlertService.open(this.alertConfig);
|
|
445
|
+
this.alertRefComponent.afterClosed().subscribe();
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
closePreviousAlert() {
|
|
449
|
+
if (this.alertRefComponent) {
|
|
450
|
+
this.alertRefComponent.dismiss();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
setAlertColor(msgKey) {
|
|
454
|
+
const isErrorMsg = /error/i.test(msgKey);
|
|
455
|
+
this.alertConfig.color = isErrorMsg ? 'is-danger' : 'is-success';
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
AlertService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AlertService, deps: [{ token: i1.NwbAlertService }, { token: i7.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
459
|
+
AlertService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AlertService, providedIn: 'root' });
|
|
460
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AlertService, decorators: [{
|
|
461
|
+
type: Injectable,
|
|
462
|
+
args: [{
|
|
463
|
+
providedIn: 'root'
|
|
464
|
+
}]
|
|
465
|
+
}], ctorParameters: function () { return [{ type: i1.NwbAlertService }, { type: i7.TranslateService }]; } });
|
|
466
|
+
|
|
467
|
+
class CanvaService {
|
|
468
|
+
constructor(externalConfigService, imgManager, wzImgEventService, alertService, translateService) {
|
|
469
|
+
this.externalConfigService = externalConfigService;
|
|
470
|
+
this.imgManager = imgManager;
|
|
471
|
+
this.wzImgEventService = wzImgEventService;
|
|
472
|
+
this.alertService = alertService;
|
|
473
|
+
this.translateService = translateService;
|
|
474
|
+
this.imgLoading = false;
|
|
475
|
+
this.uploadingImg = 'ImgManager.CanvaBtn.uploadingImg';
|
|
476
|
+
this.successUploadPhoto = 'ImgManager.CanvaBtn.successImport';
|
|
477
|
+
this.errorUploadCanvaImg = 'ImgManager.CanvaBtn.errorUploadCanvaImg';
|
|
478
|
+
this.errorRenameCanvaImg = 'ImgManager.CanvaBtn.errorRenameCanvaImg';
|
|
479
|
+
this.forceToOpenCanva = false;
|
|
480
|
+
this.bindExpectedImgSizeEvent = new BehaviorSubject(null);
|
|
481
|
+
this.bindExpectedSizeDone = this.bindExpectedImgSizeEvent.asObservable();
|
|
482
|
+
}
|
|
483
|
+
setCanvaApiConfig() {
|
|
484
|
+
this.canvaApiURL = this.externalConfigService.getCanvaApiURL();
|
|
485
|
+
this.canvaApiKey = this.externalConfigService.getCanvaApiToken();
|
|
486
|
+
}
|
|
487
|
+
getCanvaLogo() {
|
|
488
|
+
return this.externalConfigService.getRouteAssets() + "canva/icon_canva.svg";
|
|
489
|
+
}
|
|
490
|
+
bindEventExepectedImgSizeChange() {
|
|
491
|
+
return this.bindExpectedSizeDone;
|
|
492
|
+
}
|
|
493
|
+
expectedImgSizesChange(mediaDTO) {
|
|
494
|
+
this.bindExpectedImgSizeEvent.next(mediaDTO);
|
|
495
|
+
if (this.forceToOpenCanva) {
|
|
496
|
+
this.openCanva(parseInt(mediaDTO.image_width), parseInt(mediaDTO.image_height));
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
getCanvaApi() {
|
|
500
|
+
if (!this.canvaApiURL || !this.canvaApiKey) {
|
|
501
|
+
this.setCanvaApiConfig();
|
|
502
|
+
}
|
|
503
|
+
return new Observable(observer => {
|
|
504
|
+
this.loadCanva().subscribe({
|
|
505
|
+
complete: () => {
|
|
506
|
+
if (this.canvaApi && Canva.DesignButton) {
|
|
507
|
+
observer.next(this.canvaApi);
|
|
508
|
+
observer.complete();
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
this.initializeCanva(observer);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
initializeCanva(observer) {
|
|
518
|
+
if (Canva.DesignButton) {
|
|
519
|
+
Canva.DesignButton.initialize({
|
|
520
|
+
apiKey: this.canvaApiKey
|
|
521
|
+
}).then((canvaApi) => {
|
|
522
|
+
this.canvaApi = canvaApi;
|
|
523
|
+
observer.next(this.canvaApi);
|
|
524
|
+
observer.complete();
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
loadCanva() {
|
|
529
|
+
return new Observable(observer => {
|
|
530
|
+
if (this.canvaApi) {
|
|
531
|
+
observer.complete();
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
this.loadCanvaScript(observer);
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
loadCanvaScript(observer) {
|
|
539
|
+
const node = document.createElement('script');
|
|
540
|
+
node.src = this.canvaApiURL;
|
|
541
|
+
node.type = 'text/javascript';
|
|
542
|
+
node.async = false;
|
|
543
|
+
node.charset = 'utf-8';
|
|
544
|
+
node.onload = () => {
|
|
545
|
+
observer.complete();
|
|
546
|
+
};
|
|
547
|
+
document.getElementsByTagName('head')[0].appendChild(node);
|
|
548
|
+
}
|
|
549
|
+
openCanva(width, height) {
|
|
550
|
+
if (this.imgLoading) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
this.getCanvaApi().pipe(take(1)).subscribe((api) => {
|
|
554
|
+
this.canvaApi = api;
|
|
555
|
+
this.addOverflowBody();
|
|
556
|
+
this.createDesign(width, height);
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
addOverflowBody() {
|
|
560
|
+
document.body.classList.add('ovh-canva');
|
|
561
|
+
}
|
|
562
|
+
removeOverflowBody() {
|
|
563
|
+
document.body.classList.remove('ovh-canva');
|
|
564
|
+
}
|
|
565
|
+
createDesign(width, height) {
|
|
566
|
+
const createDesign = {
|
|
567
|
+
type: 'EtsyShopIcon',
|
|
568
|
+
dimensions: {
|
|
569
|
+
units: 'px',
|
|
570
|
+
width: width ? width : undefined,
|
|
571
|
+
height: height ? height : undefined,
|
|
572
|
+
},
|
|
573
|
+
publishLabel: this.translateService.instant('ImgManager.CanvaBtn.publish'),
|
|
574
|
+
};
|
|
575
|
+
this.canvaApi.createDesign({
|
|
576
|
+
design: createDesign,
|
|
577
|
+
onDesignPublish: ({ exportUrl, designTitle }) => this.designPublished(exportUrl, designTitle),
|
|
578
|
+
onDesignClose: () => {
|
|
579
|
+
this.removeOverflowBody();
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
designPublished(exportUrl, designTitle) {
|
|
584
|
+
this.alertService.openAlert(this.uploadingImg);
|
|
585
|
+
this.imgLoading = true;
|
|
586
|
+
this.imgManager.uploadFileByUrl(exportUrl, designTitle).pipe(take(1)).subscribe((img) => {
|
|
587
|
+
this.imgLoading = false;
|
|
588
|
+
this.removeOverflowBody();
|
|
589
|
+
this.wzImgEventService.emitImgAdded(img.id_file);
|
|
590
|
+
this.alertService.openAlert(this.successUploadPhoto);
|
|
591
|
+
}, error => {
|
|
592
|
+
this.imgLoading = false;
|
|
593
|
+
this.removeOverflowBody();
|
|
594
|
+
if (error.error.code === 406 && error.error.message) {
|
|
595
|
+
this.alertService.openAlertWithBackendRespons(this.errorUploadCanvaImg, error.error.message);
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
this.alertService.openAlert(this.errorUploadCanvaImg);
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
CanvaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CanvaService, deps: [{ token: ImgManagerConfigService }, { token: ImgManagerService }, { token: ImgEventService }, { token: AlertService }, { token: i7.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
604
|
+
CanvaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CanvaService, providedIn: 'root' });
|
|
605
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CanvaService, decorators: [{
|
|
606
|
+
type: Injectable,
|
|
607
|
+
args: [{
|
|
608
|
+
providedIn: 'root'
|
|
609
|
+
}]
|
|
610
|
+
}], ctorParameters: function () { return [{ type: ImgManagerConfigService }, { type: ImgManagerService }, { type: ImgEventService }, { type: AlertService }, { type: i7.TranslateService }]; } });
|
|
611
|
+
|
|
612
|
+
class DomService {
|
|
613
|
+
constructor() {
|
|
614
|
+
this.documentEventSource = new Subject();
|
|
615
|
+
this.documentEventDone = this.documentEventSource.asObservable();
|
|
616
|
+
this.documentScrollSource = new Subject();
|
|
617
|
+
this.documentScrollDone = this.documentScrollSource.asObservable();
|
|
618
|
+
}
|
|
619
|
+
documentEvent() {
|
|
620
|
+
return this.documentEventDone;
|
|
621
|
+
}
|
|
622
|
+
setDocumentEventListener() {
|
|
623
|
+
document.body.addEventListener('click', event => {
|
|
624
|
+
this.documentEventSource.next(event.target);
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
documentScroll() {
|
|
628
|
+
return this.documentScrollDone;
|
|
629
|
+
}
|
|
630
|
+
setScrollEventListener() {
|
|
631
|
+
window.onscroll = () => {
|
|
632
|
+
this.documentScrollSource.next(window);
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
DomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
637
|
+
DomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DomService, providedIn: 'root' });
|
|
638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DomService, decorators: [{
|
|
639
|
+
type: Injectable,
|
|
640
|
+
args: [{
|
|
641
|
+
providedIn: 'root'
|
|
642
|
+
}]
|
|
643
|
+
}] });
|
|
644
|
+
|
|
645
|
+
const easeInOut = // the fade-in/fade-out animation.
|
|
646
|
+
trigger('easeInOut', [
|
|
647
|
+
// the "in" style determines the "resting" state of the element when it is visible.
|
|
648
|
+
state('in', style({ opacity: 1 })),
|
|
649
|
+
// fade in when created. this could also be written as transition('void => *')
|
|
650
|
+
transition(':enter', [
|
|
651
|
+
style({ opacity: 0 }),
|
|
652
|
+
animate('0.5s ease-in-out')
|
|
653
|
+
]),
|
|
654
|
+
]);
|
|
655
|
+
|
|
656
|
+
class LoaderComponent {
|
|
657
|
+
constructor() {
|
|
658
|
+
this.small = false;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
LoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: LoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
662
|
+
LoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: LoaderComponent, selector: "wz-loader", inputs: { text: "text", small: "small", position: "position" }, ngImport: i0, template: "<div class=\"wz-loader\" [ngClass]=\"{'is-small': small}\" [ngStyle]=\"{'position': position}\">\n <div class='loader loader1'>\n <div>\n <div>\n <div>\n <div>\n <div>\n <div></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <p class=\"is-textcentered\" *ngIf=\"text\" [innerHTML]=\"text\"></p>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: LoaderComponent, decorators: [{
|
|
664
|
+
type: Component,
|
|
665
|
+
args: [{ selector: 'wz-loader', encapsulation: ViewEncapsulation.None, template: "<div class=\"wz-loader\" [ngClass]=\"{'is-small': small}\" [ngStyle]=\"{'position': position}\">\n <div class='loader loader1'>\n <div>\n <div>\n <div>\n <div>\n <div>\n <div></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <p class=\"is-textcentered\" *ngIf=\"text\" [innerHTML]=\"text\"></p>\n</div>\n" }]
|
|
666
|
+
}], propDecorators: { text: [{
|
|
667
|
+
type: Input
|
|
668
|
+
}], small: [{
|
|
669
|
+
type: Input
|
|
670
|
+
}], position: [{
|
|
671
|
+
type: Input
|
|
672
|
+
}] } });
|
|
673
|
+
|
|
674
|
+
class DragDropDirective {
|
|
675
|
+
constructor() {
|
|
676
|
+
this.onFileDropped = new EventEmitter();
|
|
677
|
+
this.background = '#fff';
|
|
678
|
+
this.opacity = '1';
|
|
679
|
+
}
|
|
680
|
+
onDragOver(evt) {
|
|
681
|
+
evt.preventDefault();
|
|
682
|
+
evt.stopPropagation();
|
|
683
|
+
this.background = '#f5f5f5';
|
|
684
|
+
this.opacity = '0.8';
|
|
685
|
+
}
|
|
686
|
+
onDragLeave(evt) {
|
|
687
|
+
evt.preventDefault();
|
|
688
|
+
evt.stopPropagation();
|
|
689
|
+
this.background = '#fff';
|
|
690
|
+
this.opacity = '1';
|
|
691
|
+
}
|
|
692
|
+
ondrop(evt) {
|
|
693
|
+
evt.preventDefault();
|
|
694
|
+
evt.stopPropagation();
|
|
695
|
+
this.background = '#f5f5f5';
|
|
696
|
+
this.opacity = '1';
|
|
697
|
+
const files = evt.dataTransfer.files;
|
|
698
|
+
if (files.length > 0) {
|
|
699
|
+
this.onFileDropped.emit(files);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
DragDropDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DragDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
704
|
+
DragDropDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: DragDropDirective, selector: "[appDragDrop]", outputs: { onFileDropped: "onFileDropped" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "ondrop($event)" }, properties: { "style.background-color": "this.background", "style.opacity": "this.opacity" } }, ngImport: i0 });
|
|
705
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DragDropDirective, decorators: [{
|
|
706
|
+
type: Directive,
|
|
707
|
+
args: [{
|
|
708
|
+
selector: '[appDragDrop]'
|
|
709
|
+
}]
|
|
710
|
+
}], propDecorators: { onFileDropped: [{
|
|
711
|
+
type: Output
|
|
712
|
+
}], background: [{
|
|
713
|
+
type: HostBinding,
|
|
714
|
+
args: ['style.background-color']
|
|
715
|
+
}], opacity: [{
|
|
716
|
+
type: HostBinding,
|
|
717
|
+
args: ['style.opacity']
|
|
718
|
+
}], onDragOver: [{
|
|
719
|
+
type: HostListener,
|
|
720
|
+
args: ['dragover', ['$event']]
|
|
721
|
+
}], onDragLeave: [{
|
|
722
|
+
type: HostListener,
|
|
723
|
+
args: ['dragleave', ['$event']]
|
|
724
|
+
}], ondrop: [{
|
|
725
|
+
type: HostListener,
|
|
726
|
+
args: ['drop', ['$event']]
|
|
727
|
+
}] } });
|
|
728
|
+
|
|
729
|
+
class ImgUploadComponent {
|
|
730
|
+
constructor(imgManager, alertService, externalConfigService) {
|
|
731
|
+
this.imgManager = imgManager;
|
|
732
|
+
this.alertService = alertService;
|
|
733
|
+
this.externalConfigService = externalConfigService;
|
|
734
|
+
this.files = [];
|
|
735
|
+
this.isLoading = false;
|
|
736
|
+
this.imgUploaded = new EventEmitter();
|
|
737
|
+
this.loadingText = 'ImgManager.ImgUpload.loading';
|
|
738
|
+
this.errorUploadingImg = 'ImgManager.ImgUpload.errorUploadingImg';
|
|
739
|
+
this.errorNotImg = 'ImgManager.ImgUpload.errorNotImg';
|
|
740
|
+
this.MAX_IMAGE_SIZE = 10000000; // In bytes
|
|
741
|
+
}
|
|
742
|
+
ngOnInit() {
|
|
743
|
+
this.assetsIcon = this.getAssets();
|
|
744
|
+
}
|
|
745
|
+
filesChangeByClick(event) {
|
|
746
|
+
this.uploadFile(event.target.files);
|
|
747
|
+
}
|
|
748
|
+
getAssets() {
|
|
749
|
+
return this.externalConfigService.getRouteAssets() + "img/icon_picture.svg";
|
|
750
|
+
}
|
|
751
|
+
filesChangeByDragAndDrop(filesList) {
|
|
752
|
+
console.log('filesList', filesList);
|
|
753
|
+
this.removeDragAndDropStyle();
|
|
754
|
+
this.uploadFile(Array.from(filesList));
|
|
755
|
+
}
|
|
756
|
+
uploadFile(files) {
|
|
757
|
+
if (files && !files.length) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
this.isLoading = true;
|
|
761
|
+
const imgToUploadList = [];
|
|
762
|
+
for (const file of files) {
|
|
763
|
+
if (!this.isFileImage(file.type)) {
|
|
764
|
+
this.alertService.openAlert(this.errorNotImg);
|
|
765
|
+
this.isLoading = false;
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
if (!this.isSizeValid(file.size)) {
|
|
769
|
+
this.alertService.openAlert(`L'image : ${file.name} est trop grande (${this.getImageSizeInKo(file.size)}ko). Taille maximum acceptée: ${this.getImageSizeInKo(this.MAX_IMAGE_SIZE)}ko`);
|
|
770
|
+
this.isLoading = false;
|
|
771
|
+
continue;
|
|
772
|
+
}
|
|
773
|
+
const formData = new FormData();
|
|
774
|
+
formData.append('image', file, file.name);
|
|
775
|
+
imgToUploadList.push(this.imgManager.uploadFile(formData));
|
|
776
|
+
}
|
|
777
|
+
forkJoin(imgToUploadList).subscribe((img) => {
|
|
778
|
+
this.onImgUpload(img),
|
|
779
|
+
this.isLoading = false;
|
|
780
|
+
}, error => {
|
|
781
|
+
var _a;
|
|
782
|
+
if (((_a = error === null || error === void 0 ? void 0 : error.error) === null || _a === void 0 ? void 0 : _a.message) && error.statusText !== 'Bad Request') {
|
|
783
|
+
this.alertService.openAlertWithBackendRespons(this.errorUploadingImg, error.error.message);
|
|
784
|
+
}
|
|
785
|
+
else {
|
|
786
|
+
this.alertService.openAlert(this.errorUploadingImg);
|
|
787
|
+
}
|
|
788
|
+
this.isLoading = false;
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Send the img uploaded to the tabs components,
|
|
793
|
+
* Then the tabs components add the img to upload list by calling the method onImgUploaded of the upload-list component
|
|
794
|
+
* @param img
|
|
795
|
+
*/
|
|
796
|
+
onImgUpload(img) {
|
|
797
|
+
this.imgUploaded.emit(img);
|
|
798
|
+
}
|
|
799
|
+
isFileImage(fileType) {
|
|
800
|
+
return fileType.split('/')[0] === 'image';
|
|
801
|
+
}
|
|
802
|
+
isSizeValid(imageBytesSize) {
|
|
803
|
+
return imageBytesSize < this.MAX_IMAGE_SIZE;
|
|
804
|
+
}
|
|
805
|
+
getImageSizeInKo(size) {
|
|
806
|
+
return Math.round(size / 1024);
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Remove the style of the drag and drop box
|
|
810
|
+
* After an img is droped, the box is still grey
|
|
811
|
+
*/
|
|
812
|
+
removeDragAndDropStyle() {
|
|
813
|
+
this.dragAndDropBox.nativeElement.style = '';
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
ImgUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgUploadComponent, deps: [{ token: ImgManagerService }, { token: AlertService }, { token: ImgManagerConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
|
817
|
+
ImgUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ImgUploadComponent, selector: "img-upload", inputs: { stateDisplayed: "stateDisplayed" }, outputs: { imgUploaded: "imgUploaded" }, viewQueries: [{ propertyName: "dragAndDropBox", first: true, predicate: ["dragAndDropBox"], descendants: true }], ngImport: i0, template: "<div\n class=\"img-upload has-text-centered\"\n [ngClass]=\"{'img-upload--small': stateDisplayed === 'small'}\"\n (click)=\"fileInput.click()\"\n appDragDrop\n (onFileDropped)=\"filesChangeByDragAndDrop($any($event))\"\n #dragAndDropBox\n [@easeInOut]=\"'in'\"\n>\n <input hidden type=\"file\" #fileInput (change)=\"filesChangeByClick($event)\" accept=\"image/*\" multiple >\n <div class=\"img-upload__container\" [ngClass]=\"{'img-upload__container--small': stateDisplayed === 'small'}\">\n\n <div class=\"img-upload__container__wrapper\">\n\n <div class=\"img-upload__container__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\" [position]=\"'relative'\"></wz-loader>\n </div>\n\n <ng-container *ngIf=\"!isLoading\">\n <div class=\"blueColor img-upload__container__dropImgIconDiv\">\n <img *ngIf=\"assetsIcon\" [src]=\"assetsIcon\" alt=\"icon picture\" />\n <p>{{ 'ImgManager.ImgUpload.dropImg' | translate }}</p>\n </div>\n\n <p class=\"img-upload__container__or\">{{ 'ImgManager.ImgUpload.or' | translate }}</p>\n\n <div class=\"img-upload__container__text\">\n <i class=\"fal fa-file-upload\"></i>{{ 'ImgManager.ImgUpload.selectImg' | translate }}\n </div>\n </ng-container>\n\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: LoaderComponent, selector: "wz-loader", inputs: ["text", "small", "position"] }, { kind: "directive", type: DragDropDirective, selector: "[appDragDrop]", outputs: ["onFileDropped"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }], animations: [
|
|
818
|
+
easeInOut
|
|
819
|
+
] });
|
|
820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgUploadComponent, decorators: [{
|
|
821
|
+
type: Component,
|
|
822
|
+
args: [{ selector: 'img-upload', animations: [
|
|
823
|
+
easeInOut
|
|
824
|
+
], template: "<div\n class=\"img-upload has-text-centered\"\n [ngClass]=\"{'img-upload--small': stateDisplayed === 'small'}\"\n (click)=\"fileInput.click()\"\n appDragDrop\n (onFileDropped)=\"filesChangeByDragAndDrop($any($event))\"\n #dragAndDropBox\n [@easeInOut]=\"'in'\"\n>\n <input hidden type=\"file\" #fileInput (change)=\"filesChangeByClick($event)\" accept=\"image/*\" multiple >\n <div class=\"img-upload__container\" [ngClass]=\"{'img-upload__container--small': stateDisplayed === 'small'}\">\n\n <div class=\"img-upload__container__wrapper\">\n\n <div class=\"img-upload__container__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\" [position]=\"'relative'\"></wz-loader>\n </div>\n\n <ng-container *ngIf=\"!isLoading\">\n <div class=\"blueColor img-upload__container__dropImgIconDiv\">\n <img *ngIf=\"assetsIcon\" [src]=\"assetsIcon\" alt=\"icon picture\" />\n <p>{{ 'ImgManager.ImgUpload.dropImg' | translate }}</p>\n </div>\n\n <p class=\"img-upload__container__or\">{{ 'ImgManager.ImgUpload.or' | translate }}</p>\n\n <div class=\"img-upload__container__text\">\n <i class=\"fal fa-file-upload\"></i>{{ 'ImgManager.ImgUpload.selectImg' | translate }}\n </div>\n </ng-container>\n\n </div>\n </div>\n</div>\n" }]
|
|
825
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: AlertService }, { type: ImgManagerConfigService }]; }, propDecorators: { stateDisplayed: [{
|
|
826
|
+
type: Input
|
|
827
|
+
}], imgUploaded: [{
|
|
828
|
+
type: Output
|
|
829
|
+
}], dragAndDropBox: [{
|
|
830
|
+
type: ViewChild,
|
|
831
|
+
args: ['dragAndDropBox']
|
|
832
|
+
}] } });
|
|
833
|
+
|
|
834
|
+
const listAnnimation = // the fade-in/fade-out animation.
|
|
835
|
+
trigger('listAnimation', [
|
|
836
|
+
transition(':enter, * => 0, * => -1', []),
|
|
837
|
+
transition(':increment', [
|
|
838
|
+
query(':enter', [
|
|
839
|
+
style({ opacity: 0, transform: 'translateY(100px)' }),
|
|
840
|
+
stagger(50, [
|
|
841
|
+
animate('500ms cubic-bezier(0.35, 0, 0.25, 1)', style({ opacity: 1, transform: 'none' })),
|
|
842
|
+
]),
|
|
843
|
+
], { optional: true })
|
|
844
|
+
]),
|
|
845
|
+
]);
|
|
846
|
+
|
|
847
|
+
class PexelsService {
|
|
848
|
+
constructor(http, externalConfigService, translateService) {
|
|
849
|
+
this.http = http;
|
|
850
|
+
this.externalConfigService = externalConfigService;
|
|
851
|
+
this.translateService = translateService;
|
|
852
|
+
this.languages = { 'fr': 'fr-FR', 'en': 'en-US', 'it': 'it-IT', 'es': 'es-ES' };
|
|
853
|
+
this.setLang(this.translateService.currentLang);
|
|
854
|
+
this.translateService.onLangChange.subscribe(langData => {
|
|
855
|
+
this.setLang(langData.lang);
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
setLang(lang) {
|
|
859
|
+
this.lang = this.languages[lang] ? this.languages[lang] : 'fr-FR';
|
|
860
|
+
}
|
|
861
|
+
searchOnPexels(toSearch, perPage, page) {
|
|
862
|
+
if (!this.apiBaseUrl || this.apiKey) {
|
|
863
|
+
this.apiBaseUrl = this.externalConfigService.getPexelsApiURL();
|
|
864
|
+
this.apiKey = this.externalConfigService.getPexelsApiToken();
|
|
865
|
+
}
|
|
866
|
+
const httpOptions = {
|
|
867
|
+
headers: new HttpHeaders({
|
|
868
|
+
Authorization: 'Bearer ' + this.apiKey
|
|
869
|
+
})
|
|
870
|
+
};
|
|
871
|
+
let request;
|
|
872
|
+
// If search value is not empty or blank
|
|
873
|
+
if (toSearch && !/^\s*$/.test(toSearch)) {
|
|
874
|
+
request = `/search?query=${toSearch}&per_page=${perPage}&page=${page}&locale=${this.lang}`;
|
|
875
|
+
}
|
|
876
|
+
else { // Search by category or display Pexels selection
|
|
877
|
+
const shopCategory = this.externalConfigService.getShopCategory();
|
|
878
|
+
// Search by shop category
|
|
879
|
+
if (shopCategory && shopCategory !== 'other' && shopCategory !== 'btob') {
|
|
880
|
+
request = `/search?query=${shopCategory}&per_page=${perPage}&page=${page}&locale=en-US`;
|
|
881
|
+
}
|
|
882
|
+
else { // Display Pexels selection
|
|
883
|
+
request = `/curated?per_page=${perPage}&page=${page}`;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return this.http.get(this.apiBaseUrl + request, httpOptions).pipe(map((data) => {
|
|
887
|
+
return data;
|
|
888
|
+
}));
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
PexelsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PexelsService, deps: [{ token: i3.HttpClient }, { token: ImgManagerConfigService }, { token: i7.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
892
|
+
PexelsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PexelsService, providedIn: 'root' });
|
|
893
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PexelsService, decorators: [{
|
|
894
|
+
type: Injectable,
|
|
895
|
+
args: [{
|
|
896
|
+
providedIn: 'root'
|
|
897
|
+
}]
|
|
898
|
+
}], ctorParameters: function () { return [{ type: i3.HttpClient }, { type: ImgManagerConfigService }, { type: i7.TranslateService }]; } });
|
|
899
|
+
|
|
900
|
+
class AbstractDebounceDirective {
|
|
901
|
+
constructor() {
|
|
902
|
+
this.debounceTime = 500;
|
|
903
|
+
this.onEventChange = new EventEmitter();
|
|
904
|
+
this.emitEvent$ = new Subject();
|
|
905
|
+
this.subscription$ = new Subject();
|
|
906
|
+
}
|
|
907
|
+
ngOnInit() {
|
|
908
|
+
this.emitEvent$
|
|
909
|
+
.pipe(takeUntil(this.subscription$), debounceTime(this.debounceTime), distinctUntilChanged(), tap(value => this.emitChange(value)))
|
|
910
|
+
.subscribe();
|
|
911
|
+
}
|
|
912
|
+
emitChange(value) {
|
|
913
|
+
this.onEventChange.emit(value);
|
|
914
|
+
}
|
|
915
|
+
ngOnDestroy() {
|
|
916
|
+
this.subscription$.next();
|
|
917
|
+
this.subscription$.complete();
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
AbstractDebounceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AbstractDebounceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
921
|
+
AbstractDebounceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: AbstractDebounceDirective, selector: "AbstractDebounceDirective", inputs: { debounceTime: "debounceTime" }, outputs: { onEventChange: "onEventChange" }, ngImport: i0 });
|
|
922
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AbstractDebounceDirective, decorators: [{
|
|
923
|
+
type: Directive,
|
|
924
|
+
args: [{
|
|
925
|
+
selector: 'AbstractDebounceDirective'
|
|
926
|
+
}]
|
|
927
|
+
}], ctorParameters: function () { return []; }, propDecorators: { debounceTime: [{
|
|
928
|
+
type: Input
|
|
929
|
+
}], onEventChange: [{
|
|
930
|
+
type: Output
|
|
931
|
+
}] } });
|
|
932
|
+
|
|
933
|
+
class DebounceKeyupDirective extends AbstractDebounceDirective {
|
|
934
|
+
constructor() {
|
|
935
|
+
super();
|
|
936
|
+
}
|
|
937
|
+
onKeyUp(event) {
|
|
938
|
+
event.preventDefault();
|
|
939
|
+
this.emitEvent$.next(event);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
DebounceKeyupDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DebounceKeyupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
943
|
+
DebounceKeyupDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: DebounceKeyupDirective, selector: "input[debounceKeyUp]", host: { listeners: { "keyup": "onKeyUp($event)" } }, usesInheritance: true, ngImport: i0 });
|
|
944
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DebounceKeyupDirective, decorators: [{
|
|
945
|
+
type: Directive,
|
|
946
|
+
args: [{
|
|
947
|
+
selector: 'input[debounceKeyUp]'
|
|
948
|
+
}]
|
|
949
|
+
}], ctorParameters: function () { return []; }, propDecorators: { onKeyUp: [{
|
|
950
|
+
type: HostListener,
|
|
951
|
+
args: ['keyup', ['$event']]
|
|
952
|
+
}] } });
|
|
953
|
+
|
|
954
|
+
class InputSearchComponent {
|
|
955
|
+
constructor() {
|
|
956
|
+
this.placeholder = '';
|
|
957
|
+
this.smallPadding = false;
|
|
958
|
+
this.innerValue = '';
|
|
959
|
+
this.changeDebounced = new EventEmitter(); // debounced
|
|
960
|
+
this.onTouchedCallback = () => { };
|
|
961
|
+
this.onChangeCallback = () => { };
|
|
962
|
+
}
|
|
963
|
+
get value() {
|
|
964
|
+
return this.innerValue;
|
|
965
|
+
}
|
|
966
|
+
set value(v) {
|
|
967
|
+
if (v !== this.innerValue) {
|
|
968
|
+
this.innerValue = v;
|
|
969
|
+
this.onChangeCallback(v);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
writeValue(value) {
|
|
973
|
+
if (value !== this.innerValue) {
|
|
974
|
+
this.innerValue = value;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
registerOnChange(fn) {
|
|
978
|
+
this.onChangeCallback = fn;
|
|
979
|
+
}
|
|
980
|
+
registerOnTouched(fn) {
|
|
981
|
+
this.onTouchedCallback = fn;
|
|
982
|
+
}
|
|
983
|
+
handleDebouncedKeyUp(event) {
|
|
984
|
+
this.changeDebounced.emit(event.target.value);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
InputSearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: InputSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
988
|
+
InputSearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: InputSearchComponent, selector: "wz-input-search", inputs: { placeholder: "placeholder", smallPadding: "smallPadding", id: "id" }, outputs: { changeDebounced: "changeDebounced" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: InputSearchComponent, multi: true }], ngImport: i0, template: "<div class=\"input-search field\" [ngClass]=\"smallPadding ? 'small-padding' : ''\">\n <p class=\"control has-icons-left has-icons-right\">\n <input\n [placeholder]=\"placeholder\"\n value=\"\"\n class=\"input\"\n type=\"text\"\n [attr.id]=\"id\"\n [(ngModel)]=\"value\"\n debounceKeyUp\n [debounceTime]=\"1000\"\n (onEventChange)=\"handleDebouncedKeyUp($event)\"\n />\n <i class=\"icon fal fa-search\"></i>\n </p>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: DebounceKeyupDirective, selector: "input[debounceKeyUp]" }] });
|
|
989
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: InputSearchComponent, decorators: [{
|
|
990
|
+
type: Component,
|
|
991
|
+
args: [{ selector: 'wz-input-search', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: InputSearchComponent, multi: true }], template: "<div class=\"input-search field\" [ngClass]=\"smallPadding ? 'small-padding' : ''\">\n <p class=\"control has-icons-left has-icons-right\">\n <input\n [placeholder]=\"placeholder\"\n value=\"\"\n class=\"input\"\n type=\"text\"\n [attr.id]=\"id\"\n [(ngModel)]=\"value\"\n debounceKeyUp\n [debounceTime]=\"1000\"\n (onEventChange)=\"handleDebouncedKeyUp($event)\"\n />\n <i class=\"icon fal fa-search\"></i>\n </p>\n</div>\n" }]
|
|
992
|
+
}], propDecorators: { placeholder: [{
|
|
993
|
+
type: Input
|
|
994
|
+
}], smallPadding: [{
|
|
995
|
+
type: Input
|
|
996
|
+
}], id: [{
|
|
997
|
+
type: Input
|
|
998
|
+
}], changeDebounced: [{
|
|
999
|
+
type: Output
|
|
1000
|
+
}] } });
|
|
1001
|
+
|
|
1002
|
+
class AlertComponent {
|
|
1003
|
+
constructor() {
|
|
1004
|
+
this.icon = true;
|
|
1005
|
+
this.warning = false;
|
|
1006
|
+
this.success = false;
|
|
1007
|
+
this.iconClass = 'fas fa-info';
|
|
1008
|
+
}
|
|
1009
|
+
ngOnInit() { }
|
|
1010
|
+
}
|
|
1011
|
+
AlertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1012
|
+
AlertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: AlertComponent, selector: "wz-alert", inputs: { icon: "icon", warning: "warning", success: "success", iconClass: "iconClass" }, ngImport: i0, template: "<div class=\"wz-alert\" [ngClass]=\"{ success: success, warning: warning }\">\n <i *ngIf=\"icon\" [ngClass]=\"iconClass\"></i>\n <p><ng-content></ng-content></p>\n</div>\n", styles: [".wz-alert{width:100%;background-color:#52aecd26;color:#52aecd;border-radius:3px;display:flex;flex-wrap:nowrap;justify-content:space-between;padding:20px}.wz-alert.success{background-color:#2ecc7126}.wz-alert.success p{color:#11552e}.wz-alert.success p>*{color:#11552e}.wz-alert.success i{color:#2ecc71}.wz-alert.warning{background-color:#e9565626}.wz-alert.warning p{color:#3a0505}.wz-alert.warning p>*{color:#3a0505}.wz-alert.warning i{color:#e95656}.wz-alert p{width:100%;font-size:rem(14);line-height:rem(25);margin:0;padding:0;color:#1e5568}.wz-alert p>*{color:#1e5568}.wz-alert i{width:auto;margin:0 10px 0 0;color:inherit;font-size:rem(14);line-height:rem(25)}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1013
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AlertComponent, decorators: [{
|
|
1014
|
+
type: Component,
|
|
1015
|
+
args: [{ selector: 'wz-alert', template: "<div class=\"wz-alert\" [ngClass]=\"{ success: success, warning: warning }\">\n <i *ngIf=\"icon\" [ngClass]=\"iconClass\"></i>\n <p><ng-content></ng-content></p>\n</div>\n", styles: [".wz-alert{width:100%;background-color:#52aecd26;color:#52aecd;border-radius:3px;display:flex;flex-wrap:nowrap;justify-content:space-between;padding:20px}.wz-alert.success{background-color:#2ecc7126}.wz-alert.success p{color:#11552e}.wz-alert.success p>*{color:#11552e}.wz-alert.success i{color:#2ecc71}.wz-alert.warning{background-color:#e9565626}.wz-alert.warning p{color:#3a0505}.wz-alert.warning p>*{color:#3a0505}.wz-alert.warning i{color:#e95656}.wz-alert p{width:100%;font-size:rem(14);line-height:rem(25);margin:0;padding:0;color:#1e5568}.wz-alert p>*{color:#1e5568}.wz-alert i{width:auto;margin:0 10px 0 0;color:inherit;font-size:rem(14);line-height:rem(25)}\n"] }]
|
|
1016
|
+
}], ctorParameters: function () { return []; }, propDecorators: { icon: [{
|
|
1017
|
+
type: Input
|
|
1018
|
+
}], warning: [{
|
|
1019
|
+
type: Input
|
|
1020
|
+
}], success: [{
|
|
1021
|
+
type: Input
|
|
1022
|
+
}], iconClass: [{
|
|
1023
|
+
type: Input
|
|
1024
|
+
}] } });
|
|
1025
|
+
|
|
1026
|
+
class LoadingDirective {
|
|
1027
|
+
constructor(el) {
|
|
1028
|
+
this.currentLoading = 0;
|
|
1029
|
+
this.interval = null;
|
|
1030
|
+
this.element = el;
|
|
1031
|
+
this.launchLoading();
|
|
1032
|
+
}
|
|
1033
|
+
launchLoading() {
|
|
1034
|
+
if (this.interval !== null) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
this.currentLoading = 10;
|
|
1038
|
+
this.element.nativeElement.style.width = this.currentLoading + '%';
|
|
1039
|
+
this.interval = setInterval(() => {
|
|
1040
|
+
if (this.currentLoading < 80) {
|
|
1041
|
+
this.currentLoading += Math.floor(Math.random() * 15);
|
|
1042
|
+
this.element.nativeElement.style.width = this.currentLoading + '%';
|
|
1043
|
+
}
|
|
1044
|
+
if (this.currentLoading >= 80 && this.currentLoading < 95) {
|
|
1045
|
+
this.currentLoading += Math.floor(Math.random() * 2);
|
|
1046
|
+
this.element.nativeElement.style.width = this.currentLoading + '%';
|
|
1047
|
+
}
|
|
1048
|
+
}, 70);
|
|
1049
|
+
}
|
|
1050
|
+
ngOnDestroy() {
|
|
1051
|
+
if (this.interval) {
|
|
1052
|
+
clearInterval(this.interval);
|
|
1053
|
+
this.interval = null;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
LoadingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: LoadingDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1058
|
+
LoadingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: LoadingDirective, selector: "[btnLoadingAnim]", ngImport: i0 });
|
|
1059
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: LoadingDirective, decorators: [{
|
|
1060
|
+
type: Directive,
|
|
1061
|
+
args: [{
|
|
1062
|
+
selector: '[btnLoadingAnim]'
|
|
1063
|
+
}]
|
|
1064
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
1065
|
+
|
|
1066
|
+
class PexelLibComponent {
|
|
1067
|
+
constructor(wzImgLibService, imgManager, alertService, translateService) {
|
|
1068
|
+
this.wzImgLibService = wzImgLibService;
|
|
1069
|
+
this.imgManager = imgManager;
|
|
1070
|
+
this.alertService = alertService;
|
|
1071
|
+
this.translateService = translateService;
|
|
1072
|
+
this.searchValue = '';
|
|
1073
|
+
/** Pass to true to hide search input */
|
|
1074
|
+
this.disableSearch = false;
|
|
1075
|
+
this.showImgUploaded = new EventEmitter();
|
|
1076
|
+
this.perPage = 30;
|
|
1077
|
+
this.searchUpdated = new Subject();
|
|
1078
|
+
this.nbResult = 0;
|
|
1079
|
+
this.currentPage = 1;
|
|
1080
|
+
this.isLoading = true;
|
|
1081
|
+
this.initComponent = true;
|
|
1082
|
+
this.photosColumns = [];
|
|
1083
|
+
this.nbColumuns = 6;
|
|
1084
|
+
this.responsiveColumns = [1250, 1050, 750, 500];
|
|
1085
|
+
this.outerElement = null;
|
|
1086
|
+
this.uploadingImg = 'ImgManager.PexelLib.uploadingImg';
|
|
1087
|
+
this.untitled = 'ImgManager.PexelLib.untitled';
|
|
1088
|
+
this.successUploadPhoto = 'ImgManager.PexelLib.successImport';
|
|
1089
|
+
this.errorUploadPhoto = 'ImgManager.PexelLib.errorUploadPhoto';
|
|
1090
|
+
this.errorRetrievePhotos = 'ImgManager.PexelLib.errorRetrievePhotos';
|
|
1091
|
+
this.subs = [];
|
|
1092
|
+
}
|
|
1093
|
+
set content(control) {
|
|
1094
|
+
this.outerElement = control;
|
|
1095
|
+
}
|
|
1096
|
+
ngOnInit() {
|
|
1097
|
+
}
|
|
1098
|
+
ngAfterViewInit() {
|
|
1099
|
+
this.oldSearchValue = this.searchValue;
|
|
1100
|
+
this.isLoading = false;
|
|
1101
|
+
this.setNbColumnsToDisplayPhoto();
|
|
1102
|
+
this.setPhotosColumns();
|
|
1103
|
+
this.search();
|
|
1104
|
+
}
|
|
1105
|
+
setNbColumnsToDisplayPhoto() {
|
|
1106
|
+
const width = this.outerElement.nativeElement.offsetWidth;
|
|
1107
|
+
if (this.stateDisplayed !== 'window') {
|
|
1108
|
+
this.nbColumuns = 8;
|
|
1109
|
+
}
|
|
1110
|
+
this.responsiveColumns.forEach(value => {
|
|
1111
|
+
if (width < value) {
|
|
1112
|
+
this.nbColumuns--;
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
onSearchNameChanged() {
|
|
1117
|
+
this.onSearchChange();
|
|
1118
|
+
}
|
|
1119
|
+
onBottomReached() {
|
|
1120
|
+
this.scrollHandler();
|
|
1121
|
+
}
|
|
1122
|
+
onSearchChange() {
|
|
1123
|
+
this.search();
|
|
1124
|
+
}
|
|
1125
|
+
search() {
|
|
1126
|
+
if (this.isLoading) {
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
if (this.searchValue !== this.oldSearchValue) {
|
|
1130
|
+
this.resetSearch();
|
|
1131
|
+
}
|
|
1132
|
+
// All the picture are displayed
|
|
1133
|
+
if (this.nbResult && this.nbResult <= (this.currentPage - 1) * this.perPage) {
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
this.isLoading = true;
|
|
1137
|
+
const searchSub = this.wzImgLibService.searchOnPexels(this.searchValue, this.perPage, this.currentPage).subscribe((data) => {
|
|
1138
|
+
this.wzImgLibDto = data;
|
|
1139
|
+
this.nbResult = this.wzImgLibDto.total_results;
|
|
1140
|
+
if (this.nbResult) {
|
|
1141
|
+
data.photos.forEach(photo => {
|
|
1142
|
+
const bestColumnIndex = this.getBestColumn();
|
|
1143
|
+
const height = (photo.height / photo.width) * 1000;
|
|
1144
|
+
this.photosColumns[bestColumnIndex].height += height;
|
|
1145
|
+
this.photosColumns[bestColumnIndex].photos.push(photo);
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
this.isLoading = false;
|
|
1149
|
+
this.initComponent = false;
|
|
1150
|
+
}, error => {
|
|
1151
|
+
this.isLoading = false;
|
|
1152
|
+
this.initComponent = false;
|
|
1153
|
+
this.alertService.openAlert(this.errorRetrievePhotos);
|
|
1154
|
+
});
|
|
1155
|
+
this.subs.push(searchSub);
|
|
1156
|
+
}
|
|
1157
|
+
scrollHandler() {
|
|
1158
|
+
if (this.isLoading) {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
const bestColumnIndex = this.getBestColumn();
|
|
1162
|
+
const lastPic = this.photosColumns[bestColumnIndex].photos[this.photosColumns[bestColumnIndex].photos.length - 1];
|
|
1163
|
+
const lastPhoto = lastPic ? document.querySelector('img[src="' + lastPic.src.medium + '"]') : null;
|
|
1164
|
+
if (lastPhoto) {
|
|
1165
|
+
if (!this.isLoading) {
|
|
1166
|
+
this.currentPage += 1;
|
|
1167
|
+
this.search();
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
setPhotosColumns() {
|
|
1172
|
+
for (let indexColumn = 0; indexColumn < this.nbColumuns; indexColumn++) {
|
|
1173
|
+
const photosColumn = {
|
|
1174
|
+
height: 0,
|
|
1175
|
+
photos: []
|
|
1176
|
+
};
|
|
1177
|
+
this.photosColumns.push(photosColumn);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
getBestColumn() {
|
|
1181
|
+
const bestColumn = {
|
|
1182
|
+
index: 0,
|
|
1183
|
+
height: this.photosColumns[0].height
|
|
1184
|
+
};
|
|
1185
|
+
this.photosColumns.forEach((photosColumn, index) => {
|
|
1186
|
+
if (bestColumn.height > photosColumn.height) {
|
|
1187
|
+
bestColumn.index = index;
|
|
1188
|
+
bestColumn.height = photosColumn.height;
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
return bestColumn.index;
|
|
1192
|
+
}
|
|
1193
|
+
resetSearch() {
|
|
1194
|
+
this.oldSearchValue = this.searchValue;
|
|
1195
|
+
this.photosColumns = [];
|
|
1196
|
+
this.currentPage = 1;
|
|
1197
|
+
this.setPhotosColumns();
|
|
1198
|
+
}
|
|
1199
|
+
uploadPhoto(photo, url) {
|
|
1200
|
+
photo.uploading = true;
|
|
1201
|
+
const uploadSub = this.imgManager.uploadFileByUrl(url, photo.alt).subscribe(img => {
|
|
1202
|
+
photo.uploading = false;
|
|
1203
|
+
photo.uploaded = true;
|
|
1204
|
+
this.alertService.openAlert(this.successUploadPhoto);
|
|
1205
|
+
}, error => {
|
|
1206
|
+
photo.uploading = false;
|
|
1207
|
+
if (error.error.code === 406 && error.error.message) {
|
|
1208
|
+
this.alertService.openAlertWithBackendRespons(this.errorUploadPhoto, error.error.message);
|
|
1209
|
+
}
|
|
1210
|
+
else {
|
|
1211
|
+
this.alertService.openAlert(this.errorUploadPhoto);
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
// Display img uploading msg
|
|
1215
|
+
this.alertService.openAlert(this.uploadingImg);
|
|
1216
|
+
this.subs.push(uploadSub);
|
|
1217
|
+
}
|
|
1218
|
+
ngOnDestroy() {
|
|
1219
|
+
this.subs.forEach(sub => sub.unsubscribe());
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
PexelLibComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PexelLibComponent, deps: [{ token: PexelsService }, { token: ImgManagerService }, { token: AlertService }, { token: i7.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1223
|
+
PexelLibComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: PexelLibComponent, selector: "pexels-lib", inputs: { stateDisplayed: "stateDisplayed", searchValue: "searchValue", disableSearch: "disableSearch" }, outputs: { showImgUploaded: "showImgUploaded" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["outerElement"], descendants: true }], ngImport: i0, template: "<div class=\"pexels-lib\" #outerElement [@easeInOut]=\"'in'\">\n <perfect-scrollbar\n scrollYMarginOffset=\"300\"\n class=\"pexels-lib__scroll\"\n [ngClass]=\"{'pexels-lib__scroll--smallDisplay': stateDisplayed === 'small'}\"\n (psYReachEnd)=\"onBottomReached()\"\n >\n <div\n *ngIf=\"!disableSearch\"\n class=\"pexels-lib__search\"\n [ngClass]=\"{'pexels-lib__search--smallDisplay': stateDisplayed === 'small'}\"\n >\n <wz-input-search\n [(ngModel)]=\"searchValue\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n (changeDebounced)=\"onSearchNameChanged()\"\n [smallPadding]=\"stateDisplayed === 'small'\">\n </wz-input-search>\n </div>\n\n <div *ngIf=\"!initComponent\" class=\"pexels-lib__wrapper\">\n <p *ngIf=\"nbResult\" class=\"pexels-lib__wrapper__result-nb\">{{ 'ImgManager.PexelLib.nbImgFound' | translate }} : {{ nbResult }}</p>\n\n <div class=\"pexels-lib__wrapper__result\">\n\n <div *ngFor=\"let photosColumn of photosColumns; let indexCol = index;\" class=\"pexels-lib__wrapper__result__column\" [@listAnimation]=\"photosColumn.photos.length\">\n <div *ngFor=\"let photo of photosColumn.photos; let indexPhoto = index;\" class=\"pexels-lib__wrapper__result__column__element\">\n\n <img [alt]=\"photo.src.medium\" [src]=\"photo.src.medium\"\n class=\"pexels-lib__wrapper__result__column__element__img\"/>\n\n <div class=\"pexels-lib__wrapper__result__column__element__wrapper\">\n <span class=\"pexels-lib__wrapper__result__column__element__wrapper__infos\">\n {{ photo.width }} x {{ photo.height}}\n </span>\n\n <div class=\"dropdown is-up\" [ngClass]=\"{'is-hoverable': !photo.uploading}\">\n <div class=\"dropdown-trigger\">\n <button\n class=\"button pexels-lib__wrapper__result__column__element__wrapper__button\"\n aria-haspopup=\"true\"\n aria-controls=\"dropdown-menu\">\n\n <div *ngIf=\"!photo.uploading\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <span>{{ 'ImgManager.PexelLib.import' | translate }}</span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-up\" aria-hidden=\"true\"></i>\n </span>\n <ng-container *ngIf=\"photo.uploaded\">\n <i class=\"fal fa-check\"></i>\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"photo.uploading\">\n {{ 'ImgManager.PexelLib.importation' | translate }}\n <span btnLoadingAnim class=\"btnLoadingAnnimation\"></span>\n </ng-container>\n\n </button>\n </div>\n <div class=\"dropdown-menu pexels-lib__wrapper__result__column__element__wrapper__dropdown\" id=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-content__wrapper\">\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.portrait)\">\n <p>{{ 'ImgManager.PexelLib.portrait' | translate }}</p>\n <i class=\"fal fa-check iPortrait\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.landscape)\">\n <p>{{ 'ImgManager.PexelLib.landscape' | translate }}</p>\n <i class=\"fal fa-check iLandscape\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <p>{{ 'ImgManager.PexelLib.original' | translate }}</p>\n <i class=\"fal fa-check iOriginal\"></i>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"isLoading\">\n <wz-loader></wz-loader>\n </ng-container>\n <div\n *ngIf=\"!isLoading && !nbResult\"\n class=\"pexels-lib__alert\"\n [@easeInOut]=\"'in'\">\n <wz-alert [warning]=\"true\">\n {{ 'ImgManager.PexelLib.noResult' | translate }}\n </wz-alert>\n </div>\n\n </perfect-scrollbar>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "component", type: LoaderComponent, selector: "wz-loader", inputs: ["text", "small", "position"] }, { kind: "component", type: InputSearchComponent, selector: "wz-input-search", inputs: ["placeholder", "smallPadding", "id"], outputs: ["changeDebounced"] }, { kind: "component", type: AlertComponent, selector: "wz-alert", inputs: ["icon", "warning", "success", "iconClass"] }, { kind: "directive", type: LoadingDirective, selector: "[btnLoadingAnim]" }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }], animations: [
|
|
1224
|
+
easeInOut,
|
|
1225
|
+
listAnnimation
|
|
1226
|
+
] });
|
|
1227
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PexelLibComponent, decorators: [{
|
|
1228
|
+
type: Component,
|
|
1229
|
+
args: [{ selector: 'pexels-lib', animations: [
|
|
1230
|
+
easeInOut,
|
|
1231
|
+
listAnnimation
|
|
1232
|
+
], template: "<div class=\"pexels-lib\" #outerElement [@easeInOut]=\"'in'\">\n <perfect-scrollbar\n scrollYMarginOffset=\"300\"\n class=\"pexels-lib__scroll\"\n [ngClass]=\"{'pexels-lib__scroll--smallDisplay': stateDisplayed === 'small'}\"\n (psYReachEnd)=\"onBottomReached()\"\n >\n <div\n *ngIf=\"!disableSearch\"\n class=\"pexels-lib__search\"\n [ngClass]=\"{'pexels-lib__search--smallDisplay': stateDisplayed === 'small'}\"\n >\n <wz-input-search\n [(ngModel)]=\"searchValue\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n (changeDebounced)=\"onSearchNameChanged()\"\n [smallPadding]=\"stateDisplayed === 'small'\">\n </wz-input-search>\n </div>\n\n <div *ngIf=\"!initComponent\" class=\"pexels-lib__wrapper\">\n <p *ngIf=\"nbResult\" class=\"pexels-lib__wrapper__result-nb\">{{ 'ImgManager.PexelLib.nbImgFound' | translate }} : {{ nbResult }}</p>\n\n <div class=\"pexels-lib__wrapper__result\">\n\n <div *ngFor=\"let photosColumn of photosColumns; let indexCol = index;\" class=\"pexels-lib__wrapper__result__column\" [@listAnimation]=\"photosColumn.photos.length\">\n <div *ngFor=\"let photo of photosColumn.photos; let indexPhoto = index;\" class=\"pexels-lib__wrapper__result__column__element\">\n\n <img [alt]=\"photo.src.medium\" [src]=\"photo.src.medium\"\n class=\"pexels-lib__wrapper__result__column__element__img\"/>\n\n <div class=\"pexels-lib__wrapper__result__column__element__wrapper\">\n <span class=\"pexels-lib__wrapper__result__column__element__wrapper__infos\">\n {{ photo.width }} x {{ photo.height}}\n </span>\n\n <div class=\"dropdown is-up\" [ngClass]=\"{'is-hoverable': !photo.uploading}\">\n <div class=\"dropdown-trigger\">\n <button\n class=\"button pexels-lib__wrapper__result__column__element__wrapper__button\"\n aria-haspopup=\"true\"\n aria-controls=\"dropdown-menu\">\n\n <div *ngIf=\"!photo.uploading\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <span>{{ 'ImgManager.PexelLib.import' | translate }}</span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-up\" aria-hidden=\"true\"></i>\n </span>\n <ng-container *ngIf=\"photo.uploaded\">\n <i class=\"fal fa-check\"></i>\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"photo.uploading\">\n {{ 'ImgManager.PexelLib.importation' | translate }}\n <span btnLoadingAnim class=\"btnLoadingAnnimation\"></span>\n </ng-container>\n\n </button>\n </div>\n <div class=\"dropdown-menu pexels-lib__wrapper__result__column__element__wrapper__dropdown\" id=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-content__wrapper\">\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.portrait)\">\n <p>{{ 'ImgManager.PexelLib.portrait' | translate }}</p>\n <i class=\"fal fa-check iPortrait\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.landscape)\">\n <p>{{ 'ImgManager.PexelLib.landscape' | translate }}</p>\n <i class=\"fal fa-check iLandscape\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <p>{{ 'ImgManager.PexelLib.original' | translate }}</p>\n <i class=\"fal fa-check iOriginal\"></i>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"isLoading\">\n <wz-loader></wz-loader>\n </ng-container>\n <div\n *ngIf=\"!isLoading && !nbResult\"\n class=\"pexels-lib__alert\"\n [@easeInOut]=\"'in'\">\n <wz-alert [warning]=\"true\">\n {{ 'ImgManager.PexelLib.noResult' | translate }}\n </wz-alert>\n </div>\n\n </perfect-scrollbar>\n</div>\n" }]
|
|
1233
|
+
}], ctorParameters: function () { return [{ type: PexelsService }, { type: ImgManagerService }, { type: AlertService }, { type: i7.TranslateService }]; }, propDecorators: { stateDisplayed: [{
|
|
1234
|
+
type: Input
|
|
1235
|
+
}], searchValue: [{
|
|
1236
|
+
type: Input
|
|
1237
|
+
}], disableSearch: [{
|
|
1238
|
+
type: Input
|
|
1239
|
+
}], showImgUploaded: [{
|
|
1240
|
+
type: Output
|
|
1241
|
+
}], content: [{
|
|
1242
|
+
type: ViewChild,
|
|
1243
|
+
args: ['outerElement']
|
|
1244
|
+
}] } });
|
|
1245
|
+
|
|
1246
|
+
class RenamePictureService {
|
|
1247
|
+
constructor(imgManager, alertService) {
|
|
1248
|
+
this.imgManager = imgManager;
|
|
1249
|
+
this.alertService = alertService;
|
|
1250
|
+
this.picturesList = [];
|
|
1251
|
+
this.pictureNameChanged = new Subject();
|
|
1252
|
+
this.errorRenameImg = 'ImgManager.ImgList.errorRenameImg';
|
|
1253
|
+
this.msgSavingImgName = 'ImgManager.ImgLib.savingImgName';
|
|
1254
|
+
this.msgImgNameSaved = 'ImgManager.ImgLib.imgNameSaved';
|
|
1255
|
+
this.setEvents();
|
|
1256
|
+
}
|
|
1257
|
+
setPicturesList(picturesList) {
|
|
1258
|
+
this.picturesList = picturesList;
|
|
1259
|
+
}
|
|
1260
|
+
onRenamePicture(pictureRenamed) {
|
|
1261
|
+
this.pictureNameChanged.next(pictureRenamed);
|
|
1262
|
+
}
|
|
1263
|
+
setEvents() {
|
|
1264
|
+
this.pictureNameChanged
|
|
1265
|
+
.pipe(debounceTime(800)) // wait 0.8 sec after the last event before emitting last event
|
|
1266
|
+
.subscribe((pictureNameUpdate) => {
|
|
1267
|
+
this.renamePicture(pictureNameUpdate);
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
renamePicture(pictureNameUpdate) {
|
|
1271
|
+
const picture = this.getPictureById(pictureNameUpdate.id);
|
|
1272
|
+
if (!picture) {
|
|
1273
|
+
this.alertService.openAlert(this.errorRenameImg);
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
this.alertService.openAlert(this.msgSavingImgName);
|
|
1277
|
+
this.imgManager
|
|
1278
|
+
.changeImgName(picture.display_name, picture.id_file)
|
|
1279
|
+
.subscribe((data) => {
|
|
1280
|
+
picture.display_name = data.display_name;
|
|
1281
|
+
this.alertService.openAlert(this.msgImgNameSaved);
|
|
1282
|
+
}, (error) => {
|
|
1283
|
+
picture.display_name = pictureNameUpdate.previousName;
|
|
1284
|
+
this.alertService.openAlert(this.errorRenameImg);
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
getPictureById(id_file) {
|
|
1288
|
+
if (!this.picturesList) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
for (const picture of this.picturesList) {
|
|
1292
|
+
if (picture.id_file === id_file) {
|
|
1293
|
+
return picture;
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
return null;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
RenamePictureService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: RenamePictureService, deps: [{ token: ImgManagerService }, { token: AlertService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1300
|
+
RenamePictureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: RenamePictureService, providedIn: 'root' });
|
|
1301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: RenamePictureService, decorators: [{
|
|
1302
|
+
type: Injectable,
|
|
1303
|
+
args: [{ providedIn: 'root' }]
|
|
1304
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: AlertService }]; } });
|
|
1305
|
+
|
|
1306
|
+
class ImagesActionHandler {
|
|
1307
|
+
constructor(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService) {
|
|
1308
|
+
this.imgManager = imgManager;
|
|
1309
|
+
this.imgSelectionService = imgSelectionService;
|
|
1310
|
+
this.http = http;
|
|
1311
|
+
this.imgCDNService = imgCDNService;
|
|
1312
|
+
this.imgEventCardService = imgEventCardService;
|
|
1313
|
+
this.alertService = alertService;
|
|
1314
|
+
this.translateService = translateService;
|
|
1315
|
+
this.externalService = externalService;
|
|
1316
|
+
this.picturesList = [];
|
|
1317
|
+
this.picturesListChange = new EventEmitter();
|
|
1318
|
+
this.tableFilters = {
|
|
1319
|
+
sort: undefined,
|
|
1320
|
+
order: undefined,
|
|
1321
|
+
searchValue: '',
|
|
1322
|
+
totalItems: 0,
|
|
1323
|
+
itemsPerPage: 30,
|
|
1324
|
+
currentPage: 1
|
|
1325
|
+
};
|
|
1326
|
+
this.displayPexelsResults = false;
|
|
1327
|
+
this.disable = false;
|
|
1328
|
+
this.disableChange = new EventEmitter();
|
|
1329
|
+
this.filtersChange = new EventEmitter();
|
|
1330
|
+
this.pictureNameChange = new EventEmitter();
|
|
1331
|
+
this.isLoading = false;
|
|
1332
|
+
this.errorRemoveImg = 'ImgManager.ImgList.errorRemoveImg';
|
|
1333
|
+
this.errorAlreadyUsedImg = 'ImgManager.ImgList.errorAlreadyUsed';
|
|
1334
|
+
this.fakeImgRoute = this.externalService.getRouteAssets() + 'img/fake.png';
|
|
1335
|
+
}
|
|
1336
|
+
/** Event emit when the header checkbox is checked */
|
|
1337
|
+
onToggleAllCheckBoxRow(event) {
|
|
1338
|
+
this.picturesList.forEach(data => {
|
|
1339
|
+
data.delSelected = event;
|
|
1340
|
+
});
|
|
1341
|
+
this._pictureListeChange();
|
|
1342
|
+
}
|
|
1343
|
+
onToggleDelSelection(index) {
|
|
1344
|
+
if (this.disable) {
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
this.picturesList[index].delSelected = !this.picturesList[index].delSelected;
|
|
1348
|
+
this._pictureListeChange();
|
|
1349
|
+
}
|
|
1350
|
+
/** Event emit each time filters change */
|
|
1351
|
+
onFiltersChange() {
|
|
1352
|
+
this.filtersChange.emit();
|
|
1353
|
+
}
|
|
1354
|
+
onEdit(picture) {
|
|
1355
|
+
this.imgEventCardService.emitImgToEdit(picture);
|
|
1356
|
+
}
|
|
1357
|
+
onToggleSelectImg(index) {
|
|
1358
|
+
if (this.disable || this.stateDisplayed === 'window') {
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1361
|
+
if (!this.picturesList[index].selected) {
|
|
1362
|
+
this.imgSelectionService.addImgSelected(this.picturesList[index]);
|
|
1363
|
+
this.picturesList[index].selected = true;
|
|
1364
|
+
}
|
|
1365
|
+
else {
|
|
1366
|
+
this.imgSelectionService.removeImgSelectedById(this.picturesList[index].id_file);
|
|
1367
|
+
this.picturesList[index].selected = false;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
onRemoveImg(picture) {
|
|
1371
|
+
picture.deleted = true;
|
|
1372
|
+
this.imgManager.removeImg(picture.id_file).subscribe(data => {
|
|
1373
|
+
this.imgEventCardService.emitImgRemoved(picture.id_file);
|
|
1374
|
+
this.imgSelectionService.removeImgSelectedById(picture.id_file);
|
|
1375
|
+
}, error => {
|
|
1376
|
+
const msg = error.status === 409 ? this.errorAlreadyUsedImg : this.errorRemoveImg;
|
|
1377
|
+
picture.deleted = false;
|
|
1378
|
+
this.alertService.openAlert(msg);
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
onPictureNotLoading(event) {
|
|
1382
|
+
event.target.src = this.fakeImgRoute;
|
|
1383
|
+
}
|
|
1384
|
+
onDownloadImg(display_name, file_name) {
|
|
1385
|
+
this.http.get(this.getRAWImgRoute(file_name), { responseType: 'blob' }).subscribe(val => {
|
|
1386
|
+
let url = URL.createObjectURL(val);
|
|
1387
|
+
this.downloadUrl(url, display_name);
|
|
1388
|
+
URL.revokeObjectURL(url);
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
onNameChange(id_file) {
|
|
1392
|
+
this.pictureNameChange.emit({ id: id_file, previousName: this.previousName });
|
|
1393
|
+
}
|
|
1394
|
+
getRAWImgRoute(file_name) {
|
|
1395
|
+
return this.imgCDNService.getUrlImg('raw') + file_name;
|
|
1396
|
+
}
|
|
1397
|
+
_pictureListeChange() {
|
|
1398
|
+
this.picturesListChange.emit();
|
|
1399
|
+
}
|
|
1400
|
+
downloadUrl(url, fileName) {
|
|
1401
|
+
const a = document.createElement('a');
|
|
1402
|
+
a.href = url;
|
|
1403
|
+
a.download = fileName;
|
|
1404
|
+
a.click();
|
|
1405
|
+
}
|
|
1406
|
+
ngDestroy() {
|
|
1407
|
+
if (this.getDataAPISub) {
|
|
1408
|
+
this.getDataAPISub.unsubscribe();
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
ImagesActionHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImagesActionHandler, deps: [{ token: ImgManagerService }, { token: ImgSelectionService }, { token: i3.HttpClient }, { token: ImgCDNService }, { token: ImgEventService }, { token: AlertService }, { token: i7.TranslateService }, { token: ImgManagerConfigService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1413
|
+
ImagesActionHandler.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: ImagesActionHandler, inputs: { picturesList: "picturesList", tableFilters: "tableFilters", displayPexelsResults: "displayPexelsResults", disable: "disable", isLoading: "isLoading", stateDisplayed: "stateDisplayed" }, outputs: { picturesListChange: "picturesListChange", disableChange: "disableChange", filtersChange: "filtersChange", pictureNameChange: "pictureNameChange" }, ngImport: i0 });
|
|
1414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImagesActionHandler, decorators: [{
|
|
1415
|
+
type: Directive
|
|
1416
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgSelectionService }, { type: i3.HttpClient }, { type: ImgCDNService }, { type: ImgEventService }, { type: AlertService }, { type: i7.TranslateService }, { type: ImgManagerConfigService }]; }, propDecorators: { picturesList: [{
|
|
1417
|
+
type: Input
|
|
1418
|
+
}], picturesListChange: [{
|
|
1419
|
+
type: Output
|
|
1420
|
+
}], tableFilters: [{
|
|
1421
|
+
type: Input
|
|
1422
|
+
}], displayPexelsResults: [{
|
|
1423
|
+
type: Input
|
|
1424
|
+
}], disable: [{
|
|
1425
|
+
type: Input
|
|
1426
|
+
}], disableChange: [{
|
|
1427
|
+
type: Output
|
|
1428
|
+
}], filtersChange: [{
|
|
1429
|
+
type: Output
|
|
1430
|
+
}], pictureNameChange: [{
|
|
1431
|
+
type: Output
|
|
1432
|
+
}], isLoading: [{
|
|
1433
|
+
type: Input
|
|
1434
|
+
}], stateDisplayed: [{
|
|
1435
|
+
type: Input
|
|
1436
|
+
}] } });
|
|
1437
|
+
|
|
1438
|
+
class ImageSrcPipe {
|
|
1439
|
+
constructor(imgCDNService) {
|
|
1440
|
+
this.imgCDNService = imgCDNService;
|
|
1441
|
+
}
|
|
1442
|
+
transform(pictureName, size) {
|
|
1443
|
+
if (!size) {
|
|
1444
|
+
throw "The size is undefined in ImageSrcPipe.";
|
|
1445
|
+
}
|
|
1446
|
+
const route = this.imgCDNService.getUrlImg(size);
|
|
1447
|
+
if (!route) {
|
|
1448
|
+
throw "The expected size is not defined in ImageSrcPipe.";
|
|
1449
|
+
}
|
|
1450
|
+
return route + pictureName;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
ImageSrcPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImageSrcPipe, deps: [{ token: ImgCDNService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1454
|
+
ImageSrcPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: ImageSrcPipe, name: "imgSrc" });
|
|
1455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImageSrcPipe, decorators: [{
|
|
1456
|
+
type: Pipe,
|
|
1457
|
+
args: [{
|
|
1458
|
+
name: 'imgSrc'
|
|
1459
|
+
}]
|
|
1460
|
+
}], ctorParameters: function () { return [{ type: ImgCDNService }]; } });
|
|
1461
|
+
|
|
1462
|
+
class ImgCardComponent extends ImagesActionHandler {
|
|
1463
|
+
constructor(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService) {
|
|
1464
|
+
super(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService);
|
|
1465
|
+
this.focusInput = false;
|
|
1466
|
+
this.toggleImgSelected = new EventEmitter();
|
|
1467
|
+
this.switchDisplayWindow = new EventEmitter();
|
|
1468
|
+
this.isUploadSection = false;
|
|
1469
|
+
this.activeConfirmDelete = false;
|
|
1470
|
+
}
|
|
1471
|
+
ngOnInit() {
|
|
1472
|
+
this.isUploadSection = this.tabDisplayed === 'img-upload';
|
|
1473
|
+
}
|
|
1474
|
+
displayLargeWindow() {
|
|
1475
|
+
this.switchDisplayWindow.emit(true);
|
|
1476
|
+
}
|
|
1477
|
+
onToggleImgSelected() {
|
|
1478
|
+
this.toggleImgSelected.next();
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
ImgCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgCardComponent, deps: [{ token: ImgManagerService }, { token: ImgSelectionService }, { token: i3.HttpClient }, { token: ImgCDNService }, { token: ImgEventService }, { token: AlertService }, { token: i7.TranslateService }, { token: ImgManagerConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1482
|
+
ImgCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ImgCardComponent, selector: "img-card", inputs: { tabDisplayed: "tabDisplayed", fullSize: "fullSize", picture: "picture", index: "index" }, outputs: { toggleImgSelected: "toggleImgSelected", switchDisplayWindow: "switchDisplayWindow" }, usesInheritance: true, ngImport: i0, template: "<div class=\"addCssPriority\" [@easeInOut]=\"'in'\" [ngClass]=\"{ 'fullSize': fullSize }\">\n <div class=\"img-card\">\n <div class=\"img-card__container\"\n [ngClass]=\"{\n 'smallDisplay': stateDisplayed === 'small' || isUploadSection,\n 'imgSelected': picture.selected,\n 'deletion': picture.deleted}\">\n <img\n class=\"img-card__container__img\"\n [src]=\"picture.file_name | imgSrc : '400'\"\n [alt]=\"picture.display_name\"\n (click)=\"onToggleImgSelected()\"\n (error)=\"picture.imgNotLoaded=true;onPictureNotLoading($event);\"\n />\n <div\n class=\"img-card__container__config\"\n *ngIf=\"!picture.deleted && stateDisplayed !== 'small'\"\n >\n <button class=\"size\"><i class=\"fal fa-image-polaroid\"></i><span>{{picture.raw_height}}x{{picture.raw_width}}</span></button>\n <button class=\"dl\" (click)=\"onDownloadImg(picture.display_name, picture.file_name)\"><i class=\"fal fa-download\"></i><span>{{ 'ImgManager.ImgCard.download' | translate }}</span></button>\n <button class=\"edit\" (click)=\"onEdit(picture)\"><i class=\"far fa-crop-alt\"></i><span>{{ 'ImgManager.ImgCard.edit' | translate }}</span></button>\n <button class=\"deleted\" (click)=\"activeConfirmDelete = true;\"><i class=\"fal fa-times\"></i><span>{{ 'ImgManager.ImgCard.del' | translate }}</span></button>\n <button class=\"selected\" (click)=\"onToggleImgSelected()\" *ngIf=\"stateDisplayed !== 'window'\">\n <i *ngIf=\"!picture.selected\" class=\"fal fa-square\"></i>\n <i *ngIf=\"picture.selected\" class=\"fas fa-check-square checked\"></i>\n <span>{{ 'ImgManager.ImgCard.select' | translate }}</span>\n </button>\n </div>\n <div\n class=\"img-card__container__config img-card__container__config--small\"\n *ngIf=\"!picture.deleted && stateDisplayed === 'small'\"\n >\n <button class=\"show-edit\" (click)=\"displayLargeWindow()\"><i class=\"fas fa-edit\"></i></button>\n </div>\n <div class=\"img-card__container__delete\" [ngClass]=\"{ 'show' : activeConfirmDelete}\">\n <span>{{ 'ImgManager.ImgCard.confirmDeleteImg' | translate }}</span>\n <div>\n <button (click)=\"activeConfirmDelete = false;\">{{ 'no' | translate }}</button>\n <button (click)=\"onRemoveImg(picture);activeConfirmDelete = false;\">{{ 'yes' | translate }}</button>\n </div>\n </div>\n <div class=\"img-card__container__valid\" *ngIf=\"stateDisplayed === 'small' && tabDisplayed == 'img-upload'\">\n <i class=\"far fa-check\"></i>\n <span>{{ 'ImgManager.ImgCard.validImgSmall' | translate }}</span>\n </div>\n <div\n *ngIf=\"picture.imgNotLoaded\"\n class=\"img-card__container__overlay\"\n [ngClass]=\"{'img-card__container__overlay--smallDisplay': stateDisplayed === 'small' || isUploadSection}\">\n <i (click)=\"onToggleImgSelected()\" class=\"fad fa-folder-times\"></i>\n </div>\n <span btnLoadingAnim class=\"btnLoadingAnnimation\" *ngIf=\"picture.deleted\"></span>\n\n </div>\n <div\n class=\"img-card__nameContainer\"\n [ngClass]=\"{'smallNameDisplay': stateDisplayed === 'small' || isUploadSection, 'focus': focusInput}\">\n <input\n type=\"text\"\n class=\"wzImgMngInput img-card__nameContainer__name\"\n [(ngModel)]=\"picture.display_name\"\n (ngModelChange)=\"onNameChange(picture.id_file)\"\n (focus)=\"previousName=picture.display_name;focusInput = true;\"\n (blur)=\"focusInput = false;\"\n >\n <span>{{picture.display_name}}</span>\n </div>\n\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: LoadingDirective, selector: "[btnLoadingAnim]" }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }, { kind: "pipe", type: ImageSrcPipe, name: "imgSrc" }], animations: [
|
|
1483
|
+
easeInOut
|
|
1484
|
+
] });
|
|
1485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgCardComponent, decorators: [{
|
|
1486
|
+
type: Component,
|
|
1487
|
+
args: [{ selector: 'img-card', animations: [
|
|
1488
|
+
easeInOut
|
|
1489
|
+
], template: "<div class=\"addCssPriority\" [@easeInOut]=\"'in'\" [ngClass]=\"{ 'fullSize': fullSize }\">\n <div class=\"img-card\">\n <div class=\"img-card__container\"\n [ngClass]=\"{\n 'smallDisplay': stateDisplayed === 'small' || isUploadSection,\n 'imgSelected': picture.selected,\n 'deletion': picture.deleted}\">\n <img\n class=\"img-card__container__img\"\n [src]=\"picture.file_name | imgSrc : '400'\"\n [alt]=\"picture.display_name\"\n (click)=\"onToggleImgSelected()\"\n (error)=\"picture.imgNotLoaded=true;onPictureNotLoading($event);\"\n />\n <div\n class=\"img-card__container__config\"\n *ngIf=\"!picture.deleted && stateDisplayed !== 'small'\"\n >\n <button class=\"size\"><i class=\"fal fa-image-polaroid\"></i><span>{{picture.raw_height}}x{{picture.raw_width}}</span></button>\n <button class=\"dl\" (click)=\"onDownloadImg(picture.display_name, picture.file_name)\"><i class=\"fal fa-download\"></i><span>{{ 'ImgManager.ImgCard.download' | translate }}</span></button>\n <button class=\"edit\" (click)=\"onEdit(picture)\"><i class=\"far fa-crop-alt\"></i><span>{{ 'ImgManager.ImgCard.edit' | translate }}</span></button>\n <button class=\"deleted\" (click)=\"activeConfirmDelete = true;\"><i class=\"fal fa-times\"></i><span>{{ 'ImgManager.ImgCard.del' | translate }}</span></button>\n <button class=\"selected\" (click)=\"onToggleImgSelected()\" *ngIf=\"stateDisplayed !== 'window'\">\n <i *ngIf=\"!picture.selected\" class=\"fal fa-square\"></i>\n <i *ngIf=\"picture.selected\" class=\"fas fa-check-square checked\"></i>\n <span>{{ 'ImgManager.ImgCard.select' | translate }}</span>\n </button>\n </div>\n <div\n class=\"img-card__container__config img-card__container__config--small\"\n *ngIf=\"!picture.deleted && stateDisplayed === 'small'\"\n >\n <button class=\"show-edit\" (click)=\"displayLargeWindow()\"><i class=\"fas fa-edit\"></i></button>\n </div>\n <div class=\"img-card__container__delete\" [ngClass]=\"{ 'show' : activeConfirmDelete}\">\n <span>{{ 'ImgManager.ImgCard.confirmDeleteImg' | translate }}</span>\n <div>\n <button (click)=\"activeConfirmDelete = false;\">{{ 'no' | translate }}</button>\n <button (click)=\"onRemoveImg(picture);activeConfirmDelete = false;\">{{ 'yes' | translate }}</button>\n </div>\n </div>\n <div class=\"img-card__container__valid\" *ngIf=\"stateDisplayed === 'small' && tabDisplayed == 'img-upload'\">\n <i class=\"far fa-check\"></i>\n <span>{{ 'ImgManager.ImgCard.validImgSmall' | translate }}</span>\n </div>\n <div\n *ngIf=\"picture.imgNotLoaded\"\n class=\"img-card__container__overlay\"\n [ngClass]=\"{'img-card__container__overlay--smallDisplay': stateDisplayed === 'small' || isUploadSection}\">\n <i (click)=\"onToggleImgSelected()\" class=\"fad fa-folder-times\"></i>\n </div>\n <span btnLoadingAnim class=\"btnLoadingAnnimation\" *ngIf=\"picture.deleted\"></span>\n\n </div>\n <div\n class=\"img-card__nameContainer\"\n [ngClass]=\"{'smallNameDisplay': stateDisplayed === 'small' || isUploadSection, 'focus': focusInput}\">\n <input\n type=\"text\"\n class=\"wzImgMngInput img-card__nameContainer__name\"\n [(ngModel)]=\"picture.display_name\"\n (ngModelChange)=\"onNameChange(picture.id_file)\"\n (focus)=\"previousName=picture.display_name;focusInput = true;\"\n (blur)=\"focusInput = false;\"\n >\n <span>{{picture.display_name}}</span>\n </div>\n\n </div>\n</div>\n" }]
|
|
1490
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgSelectionService }, { type: i3.HttpClient }, { type: ImgCDNService }, { type: ImgEventService }, { type: AlertService }, { type: i7.TranslateService }, { type: ImgManagerConfigService }]; }, propDecorators: { tabDisplayed: [{
|
|
1491
|
+
type: Input
|
|
1492
|
+
}], fullSize: [{
|
|
1493
|
+
type: Input
|
|
1494
|
+
}], picture: [{
|
|
1495
|
+
type: Input
|
|
1496
|
+
}], index: [{
|
|
1497
|
+
type: Input
|
|
1498
|
+
}], toggleImgSelected: [{
|
|
1499
|
+
type: Output
|
|
1500
|
+
}], switchDisplayWindow: [{
|
|
1501
|
+
type: Output
|
|
1502
|
+
}] } });
|
|
1503
|
+
|
|
1504
|
+
class UploadListComponent {
|
|
1505
|
+
constructor(imgSelectionService, renamePictureService) {
|
|
1506
|
+
this.imgSelectionService = imgSelectionService;
|
|
1507
|
+
this.renamePictureService = renamePictureService;
|
|
1508
|
+
this.picturesList = [];
|
|
1509
|
+
this.multipleImgMode = false;
|
|
1510
|
+
this.switchDisplayWindow = new EventEmitter();
|
|
1511
|
+
}
|
|
1512
|
+
ngOnInit() {
|
|
1513
|
+
this.setEvents();
|
|
1514
|
+
}
|
|
1515
|
+
onImgUploaded(img) {
|
|
1516
|
+
img.forEach(picture => this.picturesList.push(picture));
|
|
1517
|
+
this.renamePictureService.setPicturesList(this.picturesList);
|
|
1518
|
+
}
|
|
1519
|
+
onToggleSelectImg(index) {
|
|
1520
|
+
if (this.stateDisplayed === 'window') {
|
|
1521
|
+
return;
|
|
1522
|
+
}
|
|
1523
|
+
if (!this.picturesList[index].selected) {
|
|
1524
|
+
this.imgSelectionService.addImgSelected(this.picturesList[index]);
|
|
1525
|
+
this.picturesList[index].selected = true;
|
|
1526
|
+
}
|
|
1527
|
+
else {
|
|
1528
|
+
this.imgSelectionService.removeImgSelectedById(this.picturesList[index].id_file);
|
|
1529
|
+
this.picturesList[index].selected = false;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
switchDisplayWindowCard() {
|
|
1533
|
+
this.switchDisplayWindow.emit(true);
|
|
1534
|
+
}
|
|
1535
|
+
onRenamePicture(pictureRenamed) {
|
|
1536
|
+
this.renamePictureService.onRenamePicture(pictureRenamed);
|
|
1537
|
+
}
|
|
1538
|
+
setEvents() {
|
|
1539
|
+
this.imgSelectionChange = this.imgSelectionService.getImgSelectionChange().subscribe(imgSelection => {
|
|
1540
|
+
const idFileList = [];
|
|
1541
|
+
imgSelection.map(img => idFileList.push(img.id_file));
|
|
1542
|
+
for (const picture of this.picturesList) {
|
|
1543
|
+
if (idFileList.indexOf(picture.id_file) === -1) {
|
|
1544
|
+
picture.selected = false;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
ngOnDestroy() {
|
|
1550
|
+
this.imgSelectionChange.unsubscribe();
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
UploadListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: UploadListComponent, deps: [{ token: ImgSelectionService }, { token: RenamePictureService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1554
|
+
UploadListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: UploadListComponent, selector: "upload-list", inputs: { stateDisplayed: "stateDisplayed", tabDisplayed: "tabDisplayed", multipleImgMode: "multipleImgMode" }, outputs: { switchDisplayWindow: "switchDisplayWindow" }, ngImport: i0, template: "<div class=\"upload-list\" [ngClass]=\"{'smallDisplay': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n\n <perfect-scrollbar\n #scrollable\n [config]=\"{ suppressScrollX: true }\"\n class=\"upload-list__scroll\"\n [ngClass]=\"{\n 'upload-list__scroll--smallDisplay': stateDisplayed === 'small',\n 'upload-list__scroll--window': stateDisplayed === 'window'}\"\n >\n <div class=\"upload-list__box\">\n <div class=\"upload-list__box__container\">\n <div>\n <p class=\"mainColor\">\n {{ picturesList? picturesList.length : '' }}\n <ng-container *ngIf=\"picturesList && picturesList.length > 1\">{{ 'ImgManager.UploadList.imgSuccessImport' | translate }}</ng-container>\n <ng-container *ngIf=\"picturesList && picturesList.length === 1\">{{ 'ImgManager.UploadList.imgSuccessImportOne' | translate }}</ng-container>\n </p>\n <div class=\"dropdown is-hoverable\">\n <div class=\"dropdown-trigger\">\n <i\n aria-haspopup=\"true\" aria-controls=\"dropdown-menuInfoSeo\"\n class=\"fas fa-info-circle\">\n </i>\n </div>\n <div class=\"dropdown-menu dropDownShadow\" id=\"dropdown-menuInfoSeo\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.rezise' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.webp' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.cdn' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.lazyloading' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"upload-list__box__cards\">\n <div class=\"upload-list__box__cards__card\" *ngFor=\"let picture of picturesList; let index = index;\">\n <img-card\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n ></img-card>\n <div class=\"upload-list__box__cards__card__btnBox\">\n <button class=\"button success upload-list__box__cards__card__btnBox__btn\"><i class=\"fal fa-check\"></i></button>\n </div>\n </div>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "component", type: ImgCardComponent, selector: "img-card", inputs: ["tabDisplayed", "fullSize", "picture", "index"], outputs: ["toggleImgSelected", "switchDisplayWindow"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }], animations: [
|
|
1555
|
+
easeInOut
|
|
1556
|
+
] });
|
|
1557
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: UploadListComponent, decorators: [{
|
|
1558
|
+
type: Component,
|
|
1559
|
+
args: [{ selector: 'upload-list', animations: [
|
|
1560
|
+
easeInOut
|
|
1561
|
+
], template: "<div class=\"upload-list\" [ngClass]=\"{'smallDisplay': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n\n <perfect-scrollbar\n #scrollable\n [config]=\"{ suppressScrollX: true }\"\n class=\"upload-list__scroll\"\n [ngClass]=\"{\n 'upload-list__scroll--smallDisplay': stateDisplayed === 'small',\n 'upload-list__scroll--window': stateDisplayed === 'window'}\"\n >\n <div class=\"upload-list__box\">\n <div class=\"upload-list__box__container\">\n <div>\n <p class=\"mainColor\">\n {{ picturesList? picturesList.length : '' }}\n <ng-container *ngIf=\"picturesList && picturesList.length > 1\">{{ 'ImgManager.UploadList.imgSuccessImport' | translate }}</ng-container>\n <ng-container *ngIf=\"picturesList && picturesList.length === 1\">{{ 'ImgManager.UploadList.imgSuccessImportOne' | translate }}</ng-container>\n </p>\n <div class=\"dropdown is-hoverable\">\n <div class=\"dropdown-trigger\">\n <i\n aria-haspopup=\"true\" aria-controls=\"dropdown-menuInfoSeo\"\n class=\"fas fa-info-circle\">\n </i>\n </div>\n <div class=\"dropdown-menu dropDownShadow\" id=\"dropdown-menuInfoSeo\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.rezise' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.webp' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.cdn' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.lazyloading' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"upload-list__box__cards\">\n <div class=\"upload-list__box__cards__card\" *ngFor=\"let picture of picturesList; let index = index;\">\n <img-card\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n ></img-card>\n <div class=\"upload-list__box__cards__card__btnBox\">\n <button class=\"button success upload-list__box__cards__card__btnBox__btn\"><i class=\"fal fa-check\"></i></button>\n </div>\n </div>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n" }]
|
|
1562
|
+
}], ctorParameters: function () { return [{ type: ImgSelectionService }, { type: RenamePictureService }]; }, propDecorators: { stateDisplayed: [{
|
|
1563
|
+
type: Input
|
|
1564
|
+
}], tabDisplayed: [{
|
|
1565
|
+
type: Input
|
|
1566
|
+
}], multipleImgMode: [{
|
|
1567
|
+
type: Input
|
|
1568
|
+
}], switchDisplayWindow: [{
|
|
1569
|
+
type: Output
|
|
1570
|
+
}] } });
|
|
1571
|
+
|
|
1572
|
+
class CopyClipboardDirective {
|
|
1573
|
+
constructor() {
|
|
1574
|
+
this.copied = new EventEmitter();
|
|
1575
|
+
}
|
|
1576
|
+
onClick(event) {
|
|
1577
|
+
event.preventDefault();
|
|
1578
|
+
if (!this.payload)
|
|
1579
|
+
return;
|
|
1580
|
+
let listener = (e) => {
|
|
1581
|
+
let clipboard = e.clipboardData || window["clipboardData"];
|
|
1582
|
+
clipboard.setData("text", this.payload.toString());
|
|
1583
|
+
e.preventDefault();
|
|
1584
|
+
this.copied.emit(this.payload);
|
|
1585
|
+
};
|
|
1586
|
+
document.addEventListener("copy", listener, false);
|
|
1587
|
+
document.execCommand("copy");
|
|
1588
|
+
document.removeEventListener("copy", listener, false);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
CopyClipboardDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CopyClipboardDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1592
|
+
CopyClipboardDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: CopyClipboardDirective, selector: "[copy-clipboard]", inputs: { payload: ["copy-clipboard", "payload"] }, outputs: { copied: "copied" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
|
|
1593
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CopyClipboardDirective, decorators: [{
|
|
1594
|
+
type: Directive,
|
|
1595
|
+
args: [{ selector: '[copy-clipboard]' }]
|
|
1596
|
+
}], propDecorators: { payload: [{
|
|
1597
|
+
type: Input,
|
|
1598
|
+
args: ["copy-clipboard"]
|
|
1599
|
+
}], copied: [{
|
|
1600
|
+
type: Output,
|
|
1601
|
+
args: ["copied"]
|
|
1602
|
+
}], onClick: [{
|
|
1603
|
+
type: HostListener,
|
|
1604
|
+
args: ["click", ["$event"]]
|
|
1605
|
+
}] } });
|
|
1606
|
+
|
|
1607
|
+
class EditorInfoSectionComponent {
|
|
1608
|
+
constructor(alertService) {
|
|
1609
|
+
this.alertService = alertService;
|
|
1610
|
+
this._isNameModified = false;
|
|
1611
|
+
this.isNameModifiedChange = new EventEmitter();
|
|
1612
|
+
this.msgCopyToClipBoard = 'ImgManager.ImgEditor.copytoClipBoard';
|
|
1613
|
+
}
|
|
1614
|
+
set isNameModified(isNameModified) {
|
|
1615
|
+
this._isNameModified = isNameModified;
|
|
1616
|
+
}
|
|
1617
|
+
get isNameModified() {
|
|
1618
|
+
return this._isNameModified;
|
|
1619
|
+
}
|
|
1620
|
+
ngOnInit() {
|
|
1621
|
+
this.init();
|
|
1622
|
+
}
|
|
1623
|
+
init() {
|
|
1624
|
+
this.imgName = this.imgToEdit.display_name;
|
|
1625
|
+
}
|
|
1626
|
+
getFileSize() {
|
|
1627
|
+
return this.imgToEdit ? Math.round(parseInt(this.imgToEdit.size) / 1000) : '-';
|
|
1628
|
+
}
|
|
1629
|
+
copyToClipBoard(event) {
|
|
1630
|
+
this.alertService.openAlert(this.msgCopyToClipBoard);
|
|
1631
|
+
}
|
|
1632
|
+
onNameChange() {
|
|
1633
|
+
this.isNameModifiedChange.emit(true);
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
EditorInfoSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: EditorInfoSectionComponent, deps: [{ token: AlertService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1637
|
+
EditorInfoSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: EditorInfoSectionComponent, selector: "info-section", inputs: { imgToEdit: "imgToEdit", isNameModified: "isNameModified" }, outputs: { isNameModifiedChange: "isNameModifiedChange" }, ngImport: i0, template: "\n<!-- Img properties -->\n<div class=\"img-editor__infoSection__propertyEditable\">\n <p class=\"mainColor\">\n {{ 'ImgManager.UploadList.properties.imgName' | translate }}\n <span class=\"img-editor__infoSection__propertyEditable__tooltips\" [nwbToolTip]=\"'ImgManager.ImgEditor.NameInfo' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></span>\n </p>\n <input\n type=\"text\"\n class=\"img-editor__infoSection__propertyEditable__input\"\n placeholder=\"{{'ImgManager.ImgEditor.nameEx' | translate}} \"\n [(ngModel)]=\"imgToEdit.display_name\"\n debounceKeyUp\n [debounceTime]=\"500\"\n (onEventChange)=\"onNameChange()\">\n</div>\n<div class=\"img-editor__infoSection__propertyEditable\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgURL' | translate }}</p>\n <button [copy-clipboard]=\"imgToEdit.file_name | imgSrc : 'raw'\" (copied)=\"copyToClipBoard($event)\" ><span class=\"img-editor__infoSection__propertyEditable__span\">{{imgToEdit.file_name}}</span> <i class=\"far fa-copy\"></i></button>\n</div>\n<div class=\"img-editor__infoSection__property\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgSize' | translate }} :</p>\n <p>{{imgToEdit.raw_height}}*{{imgToEdit.raw_width}}px</p>\n</div>\n<div class=\"img-editor__infoSection__property\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgWeight' | translate }} :</p>\n <p >{{getFileSize()}} ko</p>\n</div>\n\n<!-- SEO info -->\n\n<span class=\"img-editor__infoSection__divider\"></span>\n\n<div class=\"img-editor__infoSection__titleSEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.title' | translate }}</p>\n</div>\n\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.rezise' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.reziseTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.webp' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.webpTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.cdn' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.cdnTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.lazyloading' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.lazyloadingTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n", dependencies: [{ kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NwbToolTipDirective, selector: "[nwbToolTip]", inputs: ["nwbToolTip", "nwbToolTipPosition", "nwbToolTipIsMultiline"] }, { kind: "directive", type: CopyClipboardDirective, selector: "[copy-clipboard]", inputs: ["copy-clipboard"], outputs: ["copied"] }, { kind: "directive", type: DebounceKeyupDirective, selector: "input[debounceKeyUp]" }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }, { kind: "pipe", type: ImageSrcPipe, name: "imgSrc" }] });
|
|
1638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: EditorInfoSectionComponent, decorators: [{
|
|
1639
|
+
type: Component,
|
|
1640
|
+
args: [{ selector: 'info-section', template: "\n<!-- Img properties -->\n<div class=\"img-editor__infoSection__propertyEditable\">\n <p class=\"mainColor\">\n {{ 'ImgManager.UploadList.properties.imgName' | translate }}\n <span class=\"img-editor__infoSection__propertyEditable__tooltips\" [nwbToolTip]=\"'ImgManager.ImgEditor.NameInfo' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></span>\n </p>\n <input\n type=\"text\"\n class=\"img-editor__infoSection__propertyEditable__input\"\n placeholder=\"{{'ImgManager.ImgEditor.nameEx' | translate}} \"\n [(ngModel)]=\"imgToEdit.display_name\"\n debounceKeyUp\n [debounceTime]=\"500\"\n (onEventChange)=\"onNameChange()\">\n</div>\n<div class=\"img-editor__infoSection__propertyEditable\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgURL' | translate }}</p>\n <button [copy-clipboard]=\"imgToEdit.file_name | imgSrc : 'raw'\" (copied)=\"copyToClipBoard($event)\" ><span class=\"img-editor__infoSection__propertyEditable__span\">{{imgToEdit.file_name}}</span> <i class=\"far fa-copy\"></i></button>\n</div>\n<div class=\"img-editor__infoSection__property\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgSize' | translate }} :</p>\n <p>{{imgToEdit.raw_height}}*{{imgToEdit.raw_width}}px</p>\n</div>\n<div class=\"img-editor__infoSection__property\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgWeight' | translate }} :</p>\n <p >{{getFileSize()}} ko</p>\n</div>\n\n<!-- SEO info -->\n\n<span class=\"img-editor__infoSection__divider\"></span>\n\n<div class=\"img-editor__infoSection__titleSEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.title' | translate }}</p>\n</div>\n\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.rezise' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.reziseTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.webp' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.webpTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.cdn' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.cdnTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.lazyloading' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.lazyloadingTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n" }]
|
|
1641
|
+
}], ctorParameters: function () { return [{ type: AlertService }]; }, propDecorators: { imgToEdit: [{
|
|
1642
|
+
type: Input
|
|
1643
|
+
}], isNameModified: [{
|
|
1644
|
+
type: Input
|
|
1645
|
+
}], isNameModifiedChange: [{
|
|
1646
|
+
type: Output
|
|
1647
|
+
}] } });
|
|
1648
|
+
|
|
1649
|
+
const insertRemove = // the fade-in/fade-out animation.
|
|
1650
|
+
trigger('insertRemoveAnnim', [
|
|
1651
|
+
transition(':enter', [
|
|
1652
|
+
style({ opacity: 0 }),
|
|
1653
|
+
animate('0.5s ease-in-out', style({ opacity: 1 })),
|
|
1654
|
+
])
|
|
1655
|
+
]);
|
|
1656
|
+
|
|
1657
|
+
class DropdownComponent {
|
|
1658
|
+
constructor() {
|
|
1659
|
+
this.disable = false;
|
|
1660
|
+
}
|
|
1661
|
+
ngOnInit() {
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
DropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1665
|
+
DropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: DropdownComponent, selector: "dropdown", inputs: { dropDownMenuClass: "dropDownMenuClass", disable: "disable" }, ngImport: i0, template: "<div class=\"dropdown dropdownWizi\" [ngClass]=\"{'is-hoverable': !disable}\">\n <div class=\"dropdown-trigger\">\n\n <!-- Label -->\n <ng-content select=\"[label]\"></ng-content>\n\n </div>\n <div class=\"dropdown-menu\" [ngClass]=\"dropDownMenuClass\" role=\"menu\">\n <div class=\"dropdown-content\">\n\n <!-- Content -->\n <ng-content select=\"[item]\"></ng-content>\n\n </div>\n </div>\n</div>", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1666
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
1667
|
+
type: Component,
|
|
1668
|
+
args: [{ selector: 'dropdown', template: "<div class=\"dropdown dropdownWizi\" [ngClass]=\"{'is-hoverable': !disable}\">\n <div class=\"dropdown-trigger\">\n\n <!-- Label -->\n <ng-content select=\"[label]\"></ng-content>\n\n </div>\n <div class=\"dropdown-menu\" [ngClass]=\"dropDownMenuClass\" role=\"menu\">\n <div class=\"dropdown-content\">\n\n <!-- Content -->\n <ng-content select=\"[item]\"></ng-content>\n\n </div>\n </div>\n</div>" }]
|
|
1669
|
+
}], ctorParameters: function () { return []; }, propDecorators: { dropDownMenuClass: [{
|
|
1670
|
+
type: Input
|
|
1671
|
+
}], disable: [{
|
|
1672
|
+
type: Input
|
|
1673
|
+
}] } });
|
|
1674
|
+
|
|
1675
|
+
class CropperComponent {
|
|
1676
|
+
constructor(imgCDNService) {
|
|
1677
|
+
this.imgCDNService = imgCDNService;
|
|
1678
|
+
this._isImgModified = false;
|
|
1679
|
+
this.isImgModifiedChange = new EventEmitter();
|
|
1680
|
+
this.editClosed = new EventEmitter();
|
|
1681
|
+
this.currentCroppedImageChange = new EventEmitter();
|
|
1682
|
+
this.msgFailLoad = 'ImgManager.ImgEditor.msgFailLoad';
|
|
1683
|
+
this.isNameModified = false;
|
|
1684
|
+
this.isCropperReady = false; // Use to not display the crop validation btn, after the img is loaded or changed
|
|
1685
|
+
this.currentCroppedImage = ''; // Img modified return in base64
|
|
1686
|
+
this.isCropped = false;
|
|
1687
|
+
this.isLoading = false;
|
|
1688
|
+
this._isImgCropped = false;
|
|
1689
|
+
this.imgCropperChange = new Subject();
|
|
1690
|
+
this.skipNextImgCropped = 1;
|
|
1691
|
+
this.imageChangedEvent = '';
|
|
1692
|
+
this.croppedImage = '';
|
|
1693
|
+
this.canvasRotation = 0;
|
|
1694
|
+
this.rotation = 0;
|
|
1695
|
+
this.scale = 1;
|
|
1696
|
+
this.showCropper = false;
|
|
1697
|
+
this.containWithinAspectRatio = false;
|
|
1698
|
+
this.transform = {};
|
|
1699
|
+
// dropdown list
|
|
1700
|
+
this.resolutionConfig = [
|
|
1701
|
+
{
|
|
1702
|
+
label: 'ImgManager.ImgEditor.config.origin',
|
|
1703
|
+
config: {
|
|
1704
|
+
maintainAspectRatio: true
|
|
1705
|
+
},
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
label: 'ImgManager.ImgEditor.config.free',
|
|
1709
|
+
config: {
|
|
1710
|
+
maintainAspectRatio: false
|
|
1711
|
+
},
|
|
1712
|
+
active: true
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
label: 'ImgManager.ImgEditor.config.square',
|
|
1716
|
+
config: {
|
|
1717
|
+
maintainAspectRatio: true,
|
|
1718
|
+
aspectRatio: 1 / 1
|
|
1719
|
+
}
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
label: 'ImgManager.ImgEditor.config.Portrait',
|
|
1723
|
+
config: {
|
|
1724
|
+
maintainAspectRatio: true,
|
|
1725
|
+
aspectRatio: 3 / 4
|
|
1726
|
+
}
|
|
1727
|
+
},
|
|
1728
|
+
{
|
|
1729
|
+
label: 'ImgManager.ImgEditor.config.landscape',
|
|
1730
|
+
config: {
|
|
1731
|
+
maintainAspectRatio: true,
|
|
1732
|
+
aspectRatio: 5 / 3
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
];
|
|
1736
|
+
this.rotationConfig = [
|
|
1737
|
+
{
|
|
1738
|
+
label: 'ImgManager.ImgEditor.config.schedule',
|
|
1739
|
+
icon: "fal fa-redo-alt",
|
|
1740
|
+
method: "rotateRight",
|
|
1741
|
+
active: true
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
label: 'ImgManager.ImgEditor.config.AntiSchedule',
|
|
1745
|
+
icon: "fal fa-undo-alt",
|
|
1746
|
+
method: "rotateLeft"
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
label: 'ImgManager.ImgEditor.config.flipVert',
|
|
1750
|
+
icon: "fal fa-sort-alt",
|
|
1751
|
+
method: "flipVertical"
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
label: 'ImgManager.ImgEditor.config.flipHoriz',
|
|
1755
|
+
icon: "fal fa-exchange-alt",
|
|
1756
|
+
method: "flipHorizontal"
|
|
1757
|
+
}
|
|
1758
|
+
];
|
|
1759
|
+
this.zoomConfig = [
|
|
1760
|
+
{
|
|
1761
|
+
label: 'ImgManager.ImgEditor.config.zoom',
|
|
1762
|
+
icon: "fal fa-search-plus",
|
|
1763
|
+
method: "zoomIn",
|
|
1764
|
+
active: true
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
label: 'ImgManager.ImgEditor.config.dezoom',
|
|
1768
|
+
icon: "fal fa-search-minus",
|
|
1769
|
+
method: "zoomOut"
|
|
1770
|
+
}
|
|
1771
|
+
];
|
|
1772
|
+
// Img cropper variables
|
|
1773
|
+
this.imgCropperConfig = {
|
|
1774
|
+
maintainAspectRatio: false,
|
|
1775
|
+
aspectRatio: undefined
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
set isImgModified(isImgModified) {
|
|
1779
|
+
this._isImgModified = isImgModified;
|
|
1780
|
+
if (!isImgModified) {
|
|
1781
|
+
this.restartEdit();
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
get isImgModified() {
|
|
1785
|
+
return this._isImgModified;
|
|
1786
|
+
}
|
|
1787
|
+
set isImgCropped(isImgCropped) {
|
|
1788
|
+
setTimeout(() => {
|
|
1789
|
+
this._isImgCropped = isImgCropped;
|
|
1790
|
+
}, 0);
|
|
1791
|
+
}
|
|
1792
|
+
get isImgCropped() {
|
|
1793
|
+
return this._isImgCropped;
|
|
1794
|
+
}
|
|
1795
|
+
ngOnInit() {
|
|
1796
|
+
this.init();
|
|
1797
|
+
this.detectImgCropperChange();
|
|
1798
|
+
}
|
|
1799
|
+
init() {
|
|
1800
|
+
this.imgRoute = this.getRAWImgRoute();
|
|
1801
|
+
this.imgType = this.getImgType();
|
|
1802
|
+
this.croppedImage = null;
|
|
1803
|
+
this.setDefautAspectRatio();
|
|
1804
|
+
}
|
|
1805
|
+
getRAWImgRoute() {
|
|
1806
|
+
return this.imgCDNService.getUrlImg('raw') + this.imgToEdit.file_name;
|
|
1807
|
+
}
|
|
1808
|
+
getImgType() {
|
|
1809
|
+
return (this.imgToEdit.file_name ? this.imgToEdit.file_name.split('.').pop() : undefined);
|
|
1810
|
+
}
|
|
1811
|
+
setDefautAspectRatio() {
|
|
1812
|
+
const height = parseInt(this.imgToEdit.raw_height);
|
|
1813
|
+
const width = parseInt(this.imgToEdit.raw_width);
|
|
1814
|
+
this.defaultAspectRatio = height / width;
|
|
1815
|
+
this.resolutionConfig[0].config.aspectRatio = this.defaultAspectRatio;
|
|
1816
|
+
this.imgCropperConfig.aspectRatio = this.defaultAspectRatio;
|
|
1817
|
+
}
|
|
1818
|
+
onEditClosed(msgKey) {
|
|
1819
|
+
this.editClosed.emit(msgKey);
|
|
1820
|
+
}
|
|
1821
|
+
onRestart() {
|
|
1822
|
+
this.isImgModifiedChange.emit(false);
|
|
1823
|
+
}
|
|
1824
|
+
restartEdit() {
|
|
1825
|
+
this.init();
|
|
1826
|
+
this.resetConfCropper();
|
|
1827
|
+
}
|
|
1828
|
+
onImgModified() {
|
|
1829
|
+
this.isImgModified = true;
|
|
1830
|
+
this.isImgModifiedChange.emit(true);
|
|
1831
|
+
}
|
|
1832
|
+
////// Img cropper methods ////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
1833
|
+
/* Cropper output events */
|
|
1834
|
+
fileChangeEvent(event) {
|
|
1835
|
+
this.imageChangedEvent = event;
|
|
1836
|
+
}
|
|
1837
|
+
imageCropped(event) {
|
|
1838
|
+
this.imgCropperChange.next();
|
|
1839
|
+
this.currentCroppedImage = event.base64;
|
|
1840
|
+
this.currentCroppedImageChange.emit(this.currentCroppedImage);
|
|
1841
|
+
}
|
|
1842
|
+
imageLoaded() {
|
|
1843
|
+
this.showCropper = true;
|
|
1844
|
+
}
|
|
1845
|
+
cropperReady() {
|
|
1846
|
+
this.isCropperReady = true;
|
|
1847
|
+
}
|
|
1848
|
+
loadImageFailed() {
|
|
1849
|
+
this.onEditClosed(this.msgFailLoad);
|
|
1850
|
+
}
|
|
1851
|
+
/* Resize functions */
|
|
1852
|
+
changeResolutionSize(index) {
|
|
1853
|
+
this.setActiveItem(this.resolutionConfig, index);
|
|
1854
|
+
const config = this.resolutionConfig[index].config;
|
|
1855
|
+
this.setCropperProperties(config);
|
|
1856
|
+
}
|
|
1857
|
+
confirmCrop() {
|
|
1858
|
+
setTimeout(() => {
|
|
1859
|
+
this.imgRoute = null;
|
|
1860
|
+
this.croppedImage = this.currentCroppedImage;
|
|
1861
|
+
this.skipNextImgCropped = 2;
|
|
1862
|
+
this.isImgCropped = false;
|
|
1863
|
+
}, 0);
|
|
1864
|
+
this.resetConfCropper();
|
|
1865
|
+
this.onImgModified();
|
|
1866
|
+
}
|
|
1867
|
+
resetConfCropper() {
|
|
1868
|
+
this.scale = 1;
|
|
1869
|
+
this.rotation = 0;
|
|
1870
|
+
this.canvasRotation = 0;
|
|
1871
|
+
this.transform = {};
|
|
1872
|
+
}
|
|
1873
|
+
setActiveItem(array, index) {
|
|
1874
|
+
// Set active-item class for the dropdown
|
|
1875
|
+
array.forEach((item, indexItem) => {
|
|
1876
|
+
item.active = indexItem === index ? true : false;
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
setCropperProperties(config) {
|
|
1880
|
+
for (const property in config) {
|
|
1881
|
+
this.imgCropperConfig[property] = config[property];
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
detectImgCropperChange() {
|
|
1885
|
+
this.imgCropperChange
|
|
1886
|
+
.subscribe(() => {
|
|
1887
|
+
this.skipNextImgCropped--;
|
|
1888
|
+
if (this.skipNextImgCropped >= 0) {
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
this.skipNextImgCropped = 0;
|
|
1892
|
+
this.isImgCropped = true;
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
/* Rotations functions */
|
|
1896
|
+
rotateLeft() {
|
|
1897
|
+
this.canvasRotation--;
|
|
1898
|
+
this.flipAfterRotate();
|
|
1899
|
+
this.onImgModified();
|
|
1900
|
+
}
|
|
1901
|
+
rotateRight() {
|
|
1902
|
+
this.canvasRotation++;
|
|
1903
|
+
this.flipAfterRotate();
|
|
1904
|
+
this.onImgModified();
|
|
1905
|
+
}
|
|
1906
|
+
flipHorizontal() {
|
|
1907
|
+
this.transform = Object.assign(Object.assign({}, this.transform), { flipH: !this.transform.flipH });
|
|
1908
|
+
this.onImgModified();
|
|
1909
|
+
}
|
|
1910
|
+
flipVertical() {
|
|
1911
|
+
this.transform = Object.assign(Object.assign({}, this.transform), { flipV: !this.transform.flipV });
|
|
1912
|
+
this.onImgModified();
|
|
1913
|
+
}
|
|
1914
|
+
flipAfterRotate() {
|
|
1915
|
+
const flippedH = this.transform.flipH;
|
|
1916
|
+
const flippedV = this.transform.flipV;
|
|
1917
|
+
this.transform = Object.assign(Object.assign({}, this.transform), { flipH: flippedV, flipV: flippedH });
|
|
1918
|
+
}
|
|
1919
|
+
/* Zoom functions */
|
|
1920
|
+
zoomOut() {
|
|
1921
|
+
this.scale -= this.scale < 0.2 ? 0 : .1;
|
|
1922
|
+
this.transform = Object.assign(Object.assign({}, this.transform), { scale: this.scale });
|
|
1923
|
+
this.onImgModified();
|
|
1924
|
+
}
|
|
1925
|
+
zoomIn() {
|
|
1926
|
+
this.scale += .1;
|
|
1927
|
+
this.transform = Object.assign(Object.assign({}, this.transform), { scale: this.scale });
|
|
1928
|
+
this.onImgModified();
|
|
1929
|
+
}
|
|
1930
|
+
applyMethod(method) {
|
|
1931
|
+
this[method](); // call the method contains in zoomConfig or rotationConfig
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
CropperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CropperComponent, deps: [{ token: ImgCDNService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1935
|
+
CropperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: CropperComponent, selector: "cropper", inputs: { imgToEdit: "imgToEdit", isImgModified: "isImgModified" }, outputs: { isImgModifiedChange: "isImgModifiedChange", editClosed: "editClosed", currentCroppedImageChange: "currentCroppedImageChange" }, ngImport: i0, template: "<div class=\"img-editor__container__toolsContainer\">\n\n <div *ngIf=\"isImgCropped\">\n <div\n class=\"img-editor__container__toolsContainer__tool img-editor__container__toolsContainer__tool--button\"\n (click)=\"confirmCrop()\"\n [nwbToolTip]=\"'ImgManager.ImgEditor.ValidtToolTip' | translate\"\n nwbToolTipPosition=\"left\"\n >\n <i class=\"far fa-check\"></i>\n <p>{{ 'ImgManager.ImgEditor.Valid' | translate }}</p>\n </div>\n </div>\n\n <!-- Resolution -->\n <dropdown dropdownId=\"dropdown-resolution\">\n <ng-container label>\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n >\n <i class=\"far fa-crop\"></i>\n <p>{{ 'ImgManager.ImgEditor.crop' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of resolutionConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"changeResolutionSize(index)\">\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Zoom -->\n <dropdown dropdownId=\"dropdown-rotation\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"zoomIn()\">\n <i class=\"far fa-expand-arrows-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.display' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of zoomConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Rotation -->\n <dropdown dropdownId=\"dropdown-rotation\" dropDownMenuClass=\"img-editor__container__toolsContainer__RotationDropdown\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"rotateRight()\">\n <i class=\"far fa-redo\"></i>\n <p>{{ 'ImgManager.ImgEditor.rotation' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of rotationConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n (click)=\"onRestart()\"\n @insertRemoveAnnim\n >\n <i class=\"far fa-retweet-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.restart' | translate }}</p>\n </div>\n</div>\n\n<div class=\"img-editor__image-cropper\" >\n <image-cropper\n [imageURL]=\"imgRoute\"\n [imageBase64]=\"croppedImage\"\n [maintainAspectRatio]=\"imgCropperConfig.maintainAspectRatio\"\n [containWithinAspectRatio]=\"containWithinAspectRatio\"\n [aspectRatio]=\"imgCropperConfig.aspectRatio\"\n [onlyScaleDown]=\"true\"\n [roundCropper]=\"false\"\n [canvasRotation]=\"canvasRotation\"\n [transform]=\"transform\"\n [alignImage]=\"'center'\"\n [style.display]=\"showCropper ? null : 'none'\"\n [format]=\"imgType\"\n [backgroundColor]=\"'white'\"\n (imageCropped)=\"imageCropped($event)\"\n (imageLoaded)=\"imageLoaded()\"\n (cropperReady)=\"cropperReady()\"\n (loadImageFailed)=\"loadImageFailed()\"\n ></image-cropper>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NwbToolTipDirective, selector: "[nwbToolTip]", inputs: ["nwbToolTip", "nwbToolTipPosition", "nwbToolTipIsMultiline"] }, { kind: "component", type: i4.ImageCropperComponent, selector: "image-cropper", inputs: ["imageChangedEvent", "imageURL", "imageBase64", "imageFile", "format", "transform", "maintainAspectRatio", "aspectRatio", "resizeToWidth", "resizeToHeight", "cropperMinWidth", "cropperMinHeight", "cropperMaxHeight", "cropperMaxWidth", "cropperStaticWidth", "cropperStaticHeight", "canvasRotation", "initialStepSize", "roundCropper", "onlyScaleDown", "imageQuality", "autoCrop", "backgroundColor", "containWithinAspectRatio", "hideResizeSquares", "allowMoveImage", "cropper", "alignImage", "disabled"], outputs: ["imageCropped", "startCropImage", "imageLoaded", "cropperReady", "loadImageFailed", "transformChange"] }, { kind: "component", type: DropdownComponent, selector: "dropdown", inputs: ["dropDownMenuClass", "disable"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }], animations: [
|
|
1936
|
+
insertRemove
|
|
1937
|
+
] });
|
|
1938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CropperComponent, decorators: [{
|
|
1939
|
+
type: Component,
|
|
1940
|
+
args: [{ selector: 'cropper', animations: [
|
|
1941
|
+
insertRemove
|
|
1942
|
+
], template: "<div class=\"img-editor__container__toolsContainer\">\n\n <div *ngIf=\"isImgCropped\">\n <div\n class=\"img-editor__container__toolsContainer__tool img-editor__container__toolsContainer__tool--button\"\n (click)=\"confirmCrop()\"\n [nwbToolTip]=\"'ImgManager.ImgEditor.ValidtToolTip' | translate\"\n nwbToolTipPosition=\"left\"\n >\n <i class=\"far fa-check\"></i>\n <p>{{ 'ImgManager.ImgEditor.Valid' | translate }}</p>\n </div>\n </div>\n\n <!-- Resolution -->\n <dropdown dropdownId=\"dropdown-resolution\">\n <ng-container label>\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n >\n <i class=\"far fa-crop\"></i>\n <p>{{ 'ImgManager.ImgEditor.crop' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of resolutionConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"changeResolutionSize(index)\">\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Zoom -->\n <dropdown dropdownId=\"dropdown-rotation\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"zoomIn()\">\n <i class=\"far fa-expand-arrows-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.display' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of zoomConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Rotation -->\n <dropdown dropdownId=\"dropdown-rotation\" dropDownMenuClass=\"img-editor__container__toolsContainer__RotationDropdown\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"rotateRight()\">\n <i class=\"far fa-redo\"></i>\n <p>{{ 'ImgManager.ImgEditor.rotation' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of rotationConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n (click)=\"onRestart()\"\n @insertRemoveAnnim\n >\n <i class=\"far fa-retweet-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.restart' | translate }}</p>\n </div>\n</div>\n\n<div class=\"img-editor__image-cropper\" >\n <image-cropper\n [imageURL]=\"imgRoute\"\n [imageBase64]=\"croppedImage\"\n [maintainAspectRatio]=\"imgCropperConfig.maintainAspectRatio\"\n [containWithinAspectRatio]=\"containWithinAspectRatio\"\n [aspectRatio]=\"imgCropperConfig.aspectRatio\"\n [onlyScaleDown]=\"true\"\n [roundCropper]=\"false\"\n [canvasRotation]=\"canvasRotation\"\n [transform]=\"transform\"\n [alignImage]=\"'center'\"\n [style.display]=\"showCropper ? null : 'none'\"\n [format]=\"imgType\"\n [backgroundColor]=\"'white'\"\n (imageCropped)=\"imageCropped($event)\"\n (imageLoaded)=\"imageLoaded()\"\n (cropperReady)=\"cropperReady()\"\n (loadImageFailed)=\"loadImageFailed()\"\n ></image-cropper>\n</div>\n" }]
|
|
1943
|
+
}], ctorParameters: function () { return [{ type: ImgCDNService }]; }, propDecorators: { imgToEdit: [{
|
|
1944
|
+
type: Input
|
|
1945
|
+
}], isImgModified: [{
|
|
1946
|
+
type: Input
|
|
1947
|
+
}], isImgModifiedChange: [{
|
|
1948
|
+
type: Output
|
|
1949
|
+
}], editClosed: [{
|
|
1950
|
+
type: Output
|
|
1951
|
+
}], currentCroppedImageChange: [{
|
|
1952
|
+
type: Output
|
|
1953
|
+
}] } });
|
|
1954
|
+
|
|
1955
|
+
class ImgEditorComponent {
|
|
1956
|
+
constructor(imgManagerService) {
|
|
1957
|
+
this.imgManagerService = imgManagerService;
|
|
1958
|
+
this.editClosed = new EventEmitter();
|
|
1959
|
+
this.isLoading = false;
|
|
1960
|
+
this.isImgModified = false;
|
|
1961
|
+
this.isNameModified = false;
|
|
1962
|
+
this.currentCroppedImage = ''; // Img modified return in base64 by the cropper
|
|
1963
|
+
this.msgFailSave = 'ImgManager.ImgEditor.msgFailSave';
|
|
1964
|
+
this.msgFailLoad = 'ImgManager.ImgEditor.msgFailLoad';
|
|
1965
|
+
this.msgSuccessEdit = "Les modifications de l'image ont bien été enregistrées.";
|
|
1966
|
+
}
|
|
1967
|
+
ngOnInit() {
|
|
1968
|
+
this.previousName = this.imgToEdit.display_name;
|
|
1969
|
+
}
|
|
1970
|
+
onSave() {
|
|
1971
|
+
if (this.isLoading) {
|
|
1972
|
+
return;
|
|
1973
|
+
}
|
|
1974
|
+
this.isLoading = true;
|
|
1975
|
+
if (!this.isImgModified && !this.isNameModified) {
|
|
1976
|
+
this.isLoading = false;
|
|
1977
|
+
this.onEditClosed();
|
|
1978
|
+
}
|
|
1979
|
+
const obsReplaceImg = this.imgManagerService.replaceImg(this.currentCroppedImage, this.imgToEdit.id_file);
|
|
1980
|
+
const obsChangeImgName = this.imgManagerService.changeImgName(this.imgToEdit.display_name, this.imgToEdit.id_file);
|
|
1981
|
+
if (this.isImgModified && this.isNameModified) {
|
|
1982
|
+
this.ranameAndReplaceImg(obsChangeImgName, obsReplaceImg);
|
|
1983
|
+
return;
|
|
1984
|
+
}
|
|
1985
|
+
if (this.isImgModified) {
|
|
1986
|
+
obsReplaceImg.subscribe(data => {
|
|
1987
|
+
this.isLoading = false;
|
|
1988
|
+
this.onEditClosed(this.msgSuccessEdit);
|
|
1989
|
+
}, error => {
|
|
1990
|
+
this.isLoading = false;
|
|
1991
|
+
this.currentCroppedImage = '';
|
|
1992
|
+
this.onEditClosed(this.msgFailSave);
|
|
1993
|
+
});
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
if (this.isNameModified) {
|
|
1997
|
+
obsChangeImgName.subscribe(data => {
|
|
1998
|
+
this.isLoading = false;
|
|
1999
|
+
this.previousName = this.imgToEdit.display_name;
|
|
2000
|
+
this.onEditClosed(this.msgSuccessEdit);
|
|
2001
|
+
}, error => {
|
|
2002
|
+
this.isLoading = false;
|
|
2003
|
+
this.imgToEdit.display_name = this.previousName;
|
|
2004
|
+
this.onEditClosed(this.msgFailSave);
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
this.isNameModified = false;
|
|
2008
|
+
}
|
|
2009
|
+
onEditClosed(msgKey) {
|
|
2010
|
+
this.editClosed.emit(msgKey);
|
|
2011
|
+
}
|
|
2012
|
+
onRestartEdit() {
|
|
2013
|
+
this.isImgModified = false;
|
|
2014
|
+
this.isNameModified = false;
|
|
2015
|
+
this.imgToEdit.display_name = this.previousName;
|
|
2016
|
+
}
|
|
2017
|
+
onCancel() {
|
|
2018
|
+
this.onEditClosed('');
|
|
2019
|
+
}
|
|
2020
|
+
onImgCropped(imgBase64) {
|
|
2021
|
+
this.currentCroppedImage = imgBase64;
|
|
2022
|
+
}
|
|
2023
|
+
ranameAndReplaceImg(obsChangeImgName, obsReplaceImg) {
|
|
2024
|
+
// Avoid to use forkjoin, because it can create conflict and loos the img
|
|
2025
|
+
obsChangeImgName.subscribe(res1 => {
|
|
2026
|
+
obsReplaceImg.subscribe(res2 => {
|
|
2027
|
+
this.onEditClosed(this.msgSuccessEdit);
|
|
2028
|
+
}, error => {
|
|
2029
|
+
this.onEditClosed(this.msgFailSave);
|
|
2030
|
+
});
|
|
2031
|
+
}, error => {
|
|
2032
|
+
this.onEditClosed(this.msgFailSave);
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
ImgEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgEditorComponent, deps: [{ token: ImgManagerService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2037
|
+
ImgEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ImgEditorComponent, selector: "img-editor", inputs: { stateDisplayed: "stateDisplayed", imgToEdit: "imgToEdit" }, outputs: { editClosed: "editClosed" }, ngImport: i0, template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading || (!isImgModified && !isNameModified)\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n\n <perfect-scrollbar\n [config]=\"{suppressScrollX: true}\"\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "component", type: EditorInfoSectionComponent, selector: "info-section", inputs: ["imgToEdit", "isNameModified"], outputs: ["isNameModifiedChange"] }, { kind: "component", type: CropperComponent, selector: "cropper", inputs: ["imgToEdit", "isImgModified"], outputs: ["isImgModifiedChange", "editClosed", "currentCroppedImageChange"] }, { kind: "directive", type: LoadingDirective, selector: "[btnLoadingAnim]" }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }], animations: [
|
|
2038
|
+
easeInOut
|
|
2039
|
+
] });
|
|
2040
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgEditorComponent, decorators: [{
|
|
2041
|
+
type: Component,
|
|
2042
|
+
args: [{ selector: 'img-editor', animations: [
|
|
2043
|
+
easeInOut
|
|
2044
|
+
], template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading || (!isImgModified && !isNameModified)\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n\n <perfect-scrollbar\n [config]=\"{suppressScrollX: true}\"\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n" }]
|
|
2045
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }]; }, propDecorators: { stateDisplayed: [{
|
|
2046
|
+
type: Input
|
|
2047
|
+
}], imgToEdit: [{
|
|
2048
|
+
type: Input
|
|
2049
|
+
}], editClosed: [{
|
|
2050
|
+
type: Output
|
|
2051
|
+
}] } });
|
|
2052
|
+
|
|
2053
|
+
class AutoHideDirective {
|
|
2054
|
+
constructor(_elementRef, domService) {
|
|
2055
|
+
this._elementRef = _elementRef;
|
|
2056
|
+
this.domService = domService;
|
|
2057
|
+
this.forceOn = null;
|
|
2058
|
+
this.clickOutside = new EventEmitter();
|
|
2059
|
+
}
|
|
2060
|
+
ngAfterViewInit() {
|
|
2061
|
+
this.domService.documentEvent().subscribe((targetElement) => {
|
|
2062
|
+
const clickedInside = this._elementRef.nativeElement.contains(targetElement);
|
|
2063
|
+
const classNameFromElement = targetElement.getAttribute('class');
|
|
2064
|
+
if (!clickedInside && (classNameFromElement === null || !classNameFromElement.includes(this.triggerElement))) {
|
|
2065
|
+
this.clickOutside.emit(null);
|
|
2066
|
+
}
|
|
2067
|
+
if (this.forceOn != null && classNameFromElement !== null) {
|
|
2068
|
+
let needToClose = true;
|
|
2069
|
+
this.forceOn.forEach(v => {
|
|
2070
|
+
if (!classNameFromElement.includes(v)) {
|
|
2071
|
+
needToClose = false;
|
|
2072
|
+
}
|
|
2073
|
+
});
|
|
2074
|
+
if (needToClose) {
|
|
2075
|
+
this.clickOutside.emit(null);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
AutoHideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AutoHideDirective, deps: [{ token: i0.ElementRef }, { token: DomService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2082
|
+
AutoHideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: AutoHideDirective, selector: "[wzAutoHide]", inputs: { triggerElement: "triggerElement", forceOn: "forceOn" }, outputs: { clickOutside: "clickOutside" }, ngImport: i0 });
|
|
2083
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AutoHideDirective, decorators: [{
|
|
2084
|
+
type: Directive,
|
|
2085
|
+
args: [{
|
|
2086
|
+
selector: '[wzAutoHide]'
|
|
2087
|
+
}]
|
|
2088
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DomService }]; }, propDecorators: { triggerElement: [{
|
|
2089
|
+
type: Input
|
|
2090
|
+
}], forceOn: [{
|
|
2091
|
+
type: Input
|
|
2092
|
+
}], clickOutside: [{
|
|
2093
|
+
type: Output,
|
|
2094
|
+
args: ['clickOutside']
|
|
2095
|
+
}] } });
|
|
2096
|
+
|
|
2097
|
+
class CanvaBtnComponent {
|
|
2098
|
+
constructor(canvaService) {
|
|
2099
|
+
this.canvaService = canvaService;
|
|
2100
|
+
this.showImgUploaded = new EventEmitter();
|
|
2101
|
+
this.imgLoading = false;
|
|
2102
|
+
this.availableFormat = {
|
|
2103
|
+
'ImgManager.CanvaBtn.smallSquare': {
|
|
2104
|
+
'width': 500,
|
|
2105
|
+
'height': 500
|
|
2106
|
+
},
|
|
2107
|
+
'ImgManager.CanvaBtn.mediumSquare': {
|
|
2108
|
+
'width': 1000,
|
|
2109
|
+
'height': 1000
|
|
2110
|
+
},
|
|
2111
|
+
'ImgManager.CanvaBtn.bigSquare': {
|
|
2112
|
+
'width': 2500,
|
|
2113
|
+
'height': 2500
|
|
2114
|
+
}
|
|
2115
|
+
};
|
|
2116
|
+
this.openDropDownMenu = false;
|
|
2117
|
+
this.subs = [];
|
|
2118
|
+
}
|
|
2119
|
+
ngOnInit() {
|
|
2120
|
+
this.canvaLogoRouteAssets = this.canvaService.getCanvaLogo();
|
|
2121
|
+
this.listenCanvaExpectedSize();
|
|
2122
|
+
}
|
|
2123
|
+
listenCanvaExpectedSize() {
|
|
2124
|
+
// Subcribe to askImg from wizi-block
|
|
2125
|
+
const subExpectedImgSizesChange = this.canvaService.bindEventExepectedImgSizeChange().subscribe((mediaDTO) => {
|
|
2126
|
+
if (mediaDTO) {
|
|
2127
|
+
this.expectedWidth = parseInt(mediaDTO.image_width, 10);
|
|
2128
|
+
this.expectedHeight = parseInt(mediaDTO.image_height, 10);
|
|
2129
|
+
}
|
|
2130
|
+
else {
|
|
2131
|
+
this.expectedWidth = undefined;
|
|
2132
|
+
this.expectedHeight = undefined;
|
|
2133
|
+
}
|
|
2134
|
+
});
|
|
2135
|
+
this.subs.push(subExpectedImgSizesChange);
|
|
2136
|
+
}
|
|
2137
|
+
onOpenCanva(width, height) {
|
|
2138
|
+
this.canvaService.openCanva(width, height);
|
|
2139
|
+
}
|
|
2140
|
+
ngOnDestroy() {
|
|
2141
|
+
this.subs.forEach(sub => sub.unsubscribe());
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
CanvaBtnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CanvaBtnComponent, deps: [{ token: CanvaService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2145
|
+
CanvaBtnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: CanvaBtnComponent, selector: "canva-btn", inputs: { stateDisplayed: "stateDisplayed" }, outputs: { showImgUploaded: "showImgUploaded" }, ngImport: i0, template: "<div class=\"canva dropdown is-right is-hoverable\"\n wzAutoHide (clickOutside)=\"openDropDownMenu = false;\"\n [ngClass]=\"{'is-up': stateDisplayed === 'small', 'noTooltip': stateDisplayed !== 'small'}\"\n >\n <div class=\"dropdown-trigger\">\n <div\n class=\"button canva-btn\"\n aria-controls=\"dropdown-menuCanva\"\n (click)=\"openDropDownMenu = true;\"\n >\n <span>{{'ImgManager.CanvaBtn.createImg' | translate}}</span>\n <img [src]=\"canvaLogoRouteAssets\" class=\"canva-btn__logo\">\n\n <span btnLoadingAnim class=\"btnLoadingAnnimation\" *ngIf=\"imgLoading\"></span>\n </div>\n </div>\n <div\n class=\"dropdown-menu dropDownShadow\"\n [ngClass]=\"{'displayDropDownMenu': openDropDownMenu }\"\n id=\"dropdown-menuCanva\"\n role=\"menu\">\n <perfect-scrollbar\n class=\"smallScroll\"\n >\n <div class=\"dropdown-content\">\n <div class=\"dropdownTitle\">\n <p>{{'ImgManager.CanvaBtn.createImg.title' | translate}}</p>\n </div>\n\n <div class=\"infoItem\">\n <p>{{'ImgManager.CanvaBtn.info' | translate}}</p>\n </div>\n\n <ng-container >\n <div\n *ngIf=\"expectedWidth && expectedHeight\"\n class=\"dropdown-item-wrapper\"\n >\n <div class=\"dropdown-item expectedSizes\" (click)=\"onOpenCanva(expectedWidth, expectedHeight)\">\n <p>{{'ImgManager.CanvaBtn.recommanded' | translate}}</p><p>{{expectedWidth}}*{{expectedHeight}}</p>\n </div>\n </div>\n </ng-container>\n\n <div\n *ngFor=\"let format of availableFormat| keyvalue\"\n class=\"dropdown-item-wrapper\">\n <div\n (click)=\"onOpenCanva(format.value.width, format.value.height)\"\n class=\"dropdown-item\">\n <p>{{format.key | translate}}</p><p>{{format.value.width}}*{{format.value.height}}</p>\n </div>\n </div>\n </div>\n </perfect-scrollbar>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "directive", type: LoadingDirective, selector: "[btnLoadingAnim]" }, { kind: "directive", type: AutoHideDirective, selector: "[wzAutoHide]", inputs: ["triggerElement", "forceOn"], outputs: ["clickOutside"] }, { kind: "pipe", type: i2.KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
|
|
2146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CanvaBtnComponent, decorators: [{
|
|
2147
|
+
type: Component,
|
|
2148
|
+
args: [{ selector: 'canva-btn', template: "<div class=\"canva dropdown is-right is-hoverable\"\n wzAutoHide (clickOutside)=\"openDropDownMenu = false;\"\n [ngClass]=\"{'is-up': stateDisplayed === 'small', 'noTooltip': stateDisplayed !== 'small'}\"\n >\n <div class=\"dropdown-trigger\">\n <div\n class=\"button canva-btn\"\n aria-controls=\"dropdown-menuCanva\"\n (click)=\"openDropDownMenu = true;\"\n >\n <span>{{'ImgManager.CanvaBtn.createImg' | translate}}</span>\n <img [src]=\"canvaLogoRouteAssets\" class=\"canva-btn__logo\">\n\n <span btnLoadingAnim class=\"btnLoadingAnnimation\" *ngIf=\"imgLoading\"></span>\n </div>\n </div>\n <div\n class=\"dropdown-menu dropDownShadow\"\n [ngClass]=\"{'displayDropDownMenu': openDropDownMenu }\"\n id=\"dropdown-menuCanva\"\n role=\"menu\">\n <perfect-scrollbar\n class=\"smallScroll\"\n >\n <div class=\"dropdown-content\">\n <div class=\"dropdownTitle\">\n <p>{{'ImgManager.CanvaBtn.createImg.title' | translate}}</p>\n </div>\n\n <div class=\"infoItem\">\n <p>{{'ImgManager.CanvaBtn.info' | translate}}</p>\n </div>\n\n <ng-container >\n <div\n *ngIf=\"expectedWidth && expectedHeight\"\n class=\"dropdown-item-wrapper\"\n >\n <div class=\"dropdown-item expectedSizes\" (click)=\"onOpenCanva(expectedWidth, expectedHeight)\">\n <p>{{'ImgManager.CanvaBtn.recommanded' | translate}}</p><p>{{expectedWidth}}*{{expectedHeight}}</p>\n </div>\n </div>\n </ng-container>\n\n <div\n *ngFor=\"let format of availableFormat| keyvalue\"\n class=\"dropdown-item-wrapper\">\n <div\n (click)=\"onOpenCanva(format.value.width, format.value.height)\"\n class=\"dropdown-item\">\n <p>{{format.key | translate}}</p><p>{{format.value.width}}*{{format.value.height}}</p>\n </div>\n </div>\n </div>\n </perfect-scrollbar>\n </div>\n</div>\n" }]
|
|
2149
|
+
}], ctorParameters: function () { return [{ type: CanvaService }]; }, propDecorators: { stateDisplayed: [{
|
|
2150
|
+
type: Input
|
|
2151
|
+
}], showImgUploaded: [{
|
|
2152
|
+
type: Output
|
|
2153
|
+
}] } });
|
|
2154
|
+
|
|
2155
|
+
class PagniationIsLastPage {
|
|
2156
|
+
/**
|
|
2157
|
+
* Return true, if the current page is the last page. Otherwise, return false.
|
|
2158
|
+
* @param currentPage
|
|
2159
|
+
* @param totalItems
|
|
2160
|
+
* @param itemsPerPage
|
|
2161
|
+
*/
|
|
2162
|
+
transform(currentPage, totalItems, itemsPerPage) {
|
|
2163
|
+
if (!(currentPage >= 0 && totalItems >= 0 && itemsPerPage >= 0)) {
|
|
2164
|
+
throw new Error('currentPage or totalItems or itemsPerPage is/are missing in PagniationIsLastPage pipe.');
|
|
2165
|
+
}
|
|
2166
|
+
return currentPage === Math.ceil(totalItems / itemsPerPage);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
PagniationIsLastPage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PagniationIsLastPage, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2170
|
+
PagniationIsLastPage.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: PagniationIsLastPage, name: "IsLastPage" });
|
|
2171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PagniationIsLastPage, decorators: [{
|
|
2172
|
+
type: Pipe,
|
|
2173
|
+
args: [{
|
|
2174
|
+
name: 'IsLastPage'
|
|
2175
|
+
}]
|
|
2176
|
+
}] });
|
|
2177
|
+
|
|
2178
|
+
class PagniationArrayTotalPages {
|
|
2179
|
+
/**
|
|
2180
|
+
* Return an incremental array corresponding with the number page
|
|
2181
|
+
* [ 1, 2, 3 ..., last page number ]
|
|
2182
|
+
* @param totalItems
|
|
2183
|
+
* @param itemsPerPage
|
|
2184
|
+
*/
|
|
2185
|
+
transform(totalItems, itemsPerPage) {
|
|
2186
|
+
if (!(totalItems >= 0 && itemsPerPage >= 0)) {
|
|
2187
|
+
throw new Error('totalItems or itemsPerPage missing in ArrayTotalPages pipe.');
|
|
2188
|
+
}
|
|
2189
|
+
const arrayLength = Math.ceil(totalItems / itemsPerPage);
|
|
2190
|
+
return Array.apply(null, { length: arrayLength })
|
|
2191
|
+
.map(Number.call, Number)
|
|
2192
|
+
.map((x) => x + 1);
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
PagniationArrayTotalPages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PagniationArrayTotalPages, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2196
|
+
PagniationArrayTotalPages.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: PagniationArrayTotalPages, name: "ArrayTotalPages" });
|
|
2197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PagniationArrayTotalPages, decorators: [{
|
|
2198
|
+
type: Pipe,
|
|
2199
|
+
args: [{
|
|
2200
|
+
name: 'ArrayTotalPages'
|
|
2201
|
+
}]
|
|
2202
|
+
}] });
|
|
2203
|
+
|
|
2204
|
+
class LargeNumberOfPagePipe {
|
|
2205
|
+
/**
|
|
2206
|
+
* Return an incremental array
|
|
2207
|
+
* Display 30 pages, from -15 to +15 of the current page
|
|
2208
|
+
* @param totalItems
|
|
2209
|
+
* @param itemsPerPage
|
|
2210
|
+
*/
|
|
2211
|
+
transform(totalItems, itemsPerPage, currentPage) {
|
|
2212
|
+
if (!(totalItems >= 0 && itemsPerPage >= 0)) {
|
|
2213
|
+
throw new Error('totalItems or itemsPerPage missing in ArrayTotalPages pipe.');
|
|
2214
|
+
}
|
|
2215
|
+
let arrayLength = 32;
|
|
2216
|
+
const startAtPage = currentPage <= 15 ? 0 : currentPage - 15;
|
|
2217
|
+
const totalPage = Math.ceil(totalItems / itemsPerPage);
|
|
2218
|
+
const arrayWithPageNumber = Array.apply(null, { length: arrayLength })
|
|
2219
|
+
.map(Number.call, Number)
|
|
2220
|
+
.map((x) => {
|
|
2221
|
+
const pageIndex = {
|
|
2222
|
+
display: startAtPage + x + 1,
|
|
2223
|
+
value: startAtPage + x + 1
|
|
2224
|
+
};
|
|
2225
|
+
if (x === arrayLength - 2) {
|
|
2226
|
+
pageIndex.display = '...';
|
|
2227
|
+
}
|
|
2228
|
+
if (x === arrayLength - 1) {
|
|
2229
|
+
pageIndex.display = totalPage;
|
|
2230
|
+
pageIndex.value = totalPage;
|
|
2231
|
+
}
|
|
2232
|
+
return pageIndex;
|
|
2233
|
+
});
|
|
2234
|
+
if (startAtPage) {
|
|
2235
|
+
arrayWithPageNumber.unshift({
|
|
2236
|
+
display: 1,
|
|
2237
|
+
value: 1
|
|
2238
|
+
}, {
|
|
2239
|
+
display: "...",
|
|
2240
|
+
value: 2
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
return arrayWithPageNumber;
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
LargeNumberOfPagePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: LargeNumberOfPagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2247
|
+
LargeNumberOfPagePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: LargeNumberOfPagePipe, name: "LargeNumberOfPage" });
|
|
2248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: LargeNumberOfPagePipe, decorators: [{
|
|
2249
|
+
type: Pipe,
|
|
2250
|
+
args: [{
|
|
2251
|
+
name: 'LargeNumberOfPage'
|
|
2252
|
+
}]
|
|
2253
|
+
}] });
|
|
2254
|
+
|
|
2255
|
+
class PageSelectorComponent {
|
|
2256
|
+
constructor() {
|
|
2257
|
+
this.openAbsoluteSelect = false;
|
|
2258
|
+
this.largeNumberOfPage = false;
|
|
2259
|
+
this.numberOfPage = 0;
|
|
2260
|
+
this.pageChange = new EventEmitter();
|
|
2261
|
+
}
|
|
2262
|
+
set pagination(pagination) {
|
|
2263
|
+
this._pagination = pagination;
|
|
2264
|
+
}
|
|
2265
|
+
get pagination() {
|
|
2266
|
+
return this._pagination;
|
|
2267
|
+
}
|
|
2268
|
+
set totalItems(totalItems) {
|
|
2269
|
+
this.numberOfPage = Math.ceil(totalItems / this.pagination.itemsPerPage);
|
|
2270
|
+
this.largeNumberOfPage = this.numberOfPage > 30;
|
|
2271
|
+
}
|
|
2272
|
+
get totalItems() {
|
|
2273
|
+
return this._totalItems;
|
|
2274
|
+
}
|
|
2275
|
+
onGotoPageChange(event, directValue) {
|
|
2276
|
+
if (directValue) {
|
|
2277
|
+
this.pageChange.emit(event);
|
|
2278
|
+
this.openAbsoluteSelect = false;
|
|
2279
|
+
}
|
|
2280
|
+
else {
|
|
2281
|
+
this.pageChange.emit(parseInt(event.target.value));
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
PageSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PageSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2286
|
+
PageSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: PageSelectorComponent, selector: "wz-page-selector", inputs: { pagination: "pagination", totalItems: "totalItems" }, outputs: { pageChange: "pageChange" }, ngImport: i0, template: "<div class=\"wz-selector\">\n\n <div class=\"wz-selector__default\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <div class=\"wz-selector__default__base\" *ngIf=\"largeNumberOfPage;\" (click)=\"openAbsoluteSelect = !openAbsoluteSelect\">\n <input name=\"page-input\" [value]=\"pagination.currentPage\" (change)=\"onGotoPageChange($event, false);openAbsoluteSelect = false;\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\" />\n <i class=\"fas fa-sort-down\"></i>\n </div>\n <div class=\"wz-selector__default__absolute\" *ngIf=\"openAbsoluteSelect\">\n <div class=\"wz-selector__default__absolute__wrapper\" *ngFor=\"let pageIndex of (pagination.totalItems | LargeNumberOfPage: pagination.itemsPerPage : pagination.currentPage).slice().reverse() as result\">\n <div class=\"wz-selector__default__absolute__wrapper__item\" [ngClass]=\"{'selected': pageIndex.value === pagination.currentPage}\" (click)=\"onGotoPageChange(pageIndex.value, true)\">\n <span>{{ pageIndex.display }}</span>\n </div>\n </div>\n </div>\n </div>\n\n <ng-container *ngIf=\"!largeNumberOfPage\">\n <select name=\"page\" (change)=\"onGotoPageChange($event, false)\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <ng-container *ngFor=\"let pageIndex of pagination.totalItems | ArrayTotalPages: pagination.itemsPerPage\">\n <option [selected]=\"pageIndex === pagination.currentPage\" [value]=\"pageIndex\">\n {{ pageIndex }}\n </option>\n </ng-container>\n </select>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "pipe", type: PagniationArrayTotalPages, name: "ArrayTotalPages" }, { kind: "pipe", type: LargeNumberOfPagePipe, name: "LargeNumberOfPage" }] });
|
|
2287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PageSelectorComponent, decorators: [{
|
|
2288
|
+
type: Component,
|
|
2289
|
+
args: [{ selector: 'wz-page-selector', template: "<div class=\"wz-selector\">\n\n <div class=\"wz-selector__default\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <div class=\"wz-selector__default__base\" *ngIf=\"largeNumberOfPage;\" (click)=\"openAbsoluteSelect = !openAbsoluteSelect\">\n <input name=\"page-input\" [value]=\"pagination.currentPage\" (change)=\"onGotoPageChange($event, false);openAbsoluteSelect = false;\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\" />\n <i class=\"fas fa-sort-down\"></i>\n </div>\n <div class=\"wz-selector__default__absolute\" *ngIf=\"openAbsoluteSelect\">\n <div class=\"wz-selector__default__absolute__wrapper\" *ngFor=\"let pageIndex of (pagination.totalItems | LargeNumberOfPage: pagination.itemsPerPage : pagination.currentPage).slice().reverse() as result\">\n <div class=\"wz-selector__default__absolute__wrapper__item\" [ngClass]=\"{'selected': pageIndex.value === pagination.currentPage}\" (click)=\"onGotoPageChange(pageIndex.value, true)\">\n <span>{{ pageIndex.display }}</span>\n </div>\n </div>\n </div>\n </div>\n\n <ng-container *ngIf=\"!largeNumberOfPage\">\n <select name=\"page\" (change)=\"onGotoPageChange($event, false)\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <ng-container *ngFor=\"let pageIndex of pagination.totalItems | ArrayTotalPages: pagination.itemsPerPage\">\n <option [selected]=\"pageIndex === pagination.currentPage\" [value]=\"pageIndex\">\n {{ pageIndex }}\n </option>\n </ng-container>\n </select>\n </ng-container>\n</div>\n" }]
|
|
2290
|
+
}], ctorParameters: function () { return []; }, propDecorators: { pagination: [{
|
|
2291
|
+
type: Input
|
|
2292
|
+
}], totalItems: [{
|
|
2293
|
+
type: Input
|
|
2294
|
+
}], pageChange: [{
|
|
2295
|
+
type: Output
|
|
2296
|
+
}] } });
|
|
2297
|
+
|
|
2298
|
+
class PagniationText {
|
|
2299
|
+
constructor(translateService) {
|
|
2300
|
+
this.translateService = translateService;
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Update pagination text if at least one entrie change
|
|
2304
|
+
* @param currentPage
|
|
2305
|
+
* @param totalItems
|
|
2306
|
+
* @param itemsPerPage
|
|
2307
|
+
*/
|
|
2308
|
+
transform(currentPage, totalItems, itemsPerPage) {
|
|
2309
|
+
let currentItemsLow = 0, currentItemsHigh = 0;
|
|
2310
|
+
if (totalItems) {
|
|
2311
|
+
currentItemsLow = (currentPage - 1) * itemsPerPage + 1;
|
|
2312
|
+
currentItemsHigh = currentPage * itemsPerPage;
|
|
2313
|
+
}
|
|
2314
|
+
if (currentItemsHigh > totalItems) {
|
|
2315
|
+
currentItemsHigh = totalItems;
|
|
2316
|
+
}
|
|
2317
|
+
return this.translateService.instant('PaginationComponent.on', { low: currentItemsLow, high: currentItemsHigh, total: totalItems });
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
PagniationText.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PagniationText, deps: [{ token: i7.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2321
|
+
PagniationText.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: PagniationText, name: "customPagniationText" });
|
|
2322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PagniationText, decorators: [{
|
|
2323
|
+
type: Pipe,
|
|
2324
|
+
args: [{
|
|
2325
|
+
name: 'customPagniationText'
|
|
2326
|
+
}]
|
|
2327
|
+
}], ctorParameters: function () { return [{ type: i7.TranslateService }]; } });
|
|
2328
|
+
|
|
2329
|
+
class PaginationComponent {
|
|
2330
|
+
constructor() {
|
|
2331
|
+
this.pageChange = new EventEmitter();
|
|
2332
|
+
}
|
|
2333
|
+
set pagination(pagination) {
|
|
2334
|
+
this._pagination = pagination;
|
|
2335
|
+
}
|
|
2336
|
+
get pagination() {
|
|
2337
|
+
return this._pagination;
|
|
2338
|
+
}
|
|
2339
|
+
decrementPage() {
|
|
2340
|
+
if (this.pagination.currentPage <= 1) {
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
this.pagination.currentPage--;
|
|
2344
|
+
this.pageChange.emit(this.pagination);
|
|
2345
|
+
}
|
|
2346
|
+
incrementPage() {
|
|
2347
|
+
const isLastPage = new PagniationIsLastPage().transform(this.pagination.currentPage, this.pagination.totalItems, this.pagination.itemsPerPage);
|
|
2348
|
+
if (isLastPage) {
|
|
2349
|
+
return;
|
|
2350
|
+
}
|
|
2351
|
+
this.pagination.currentPage++;
|
|
2352
|
+
this.pageChange.emit(this.pagination);
|
|
2353
|
+
}
|
|
2354
|
+
onGotoPageChange(pageNumber) {
|
|
2355
|
+
this.pagination.currentPage = parseInt(pageNumber);
|
|
2356
|
+
this.pageChange.emit(this.pagination);
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
PaginationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2360
|
+
PaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: PaginationComponent, selector: "wz-pagination", inputs: { pagination: "pagination" }, outputs: { pageChange: "pageChange" }, ngImport: i0, template: "<div class=\"wz-pagination\" *ngIf=\"pagination && pagination.itemsPerPage\">\n <div class=\"wz-pagination__wrapper\">\n <div class=\"wz-pagination__wrapper__page\">\n <p>{{ 'PaginationComponent.page' | translate }}</p>\n\n <wz-page-selector [pagination]=\"pagination\" [totalItems]=\"pagination.totalItems\" (pageChange)=\"onGotoPageChange($event)\"></wz-page-selector>\n </div>\n\n <div class=\"wz-pagination__wrapper__elements\">\n <p>{{ pagination.currentPage | customPagniationText: pagination.totalItems:pagination.itemsPerPage }}</p>\n </div>\n\n <div class=\"wz-pagination__wrapper__arrows\">\n <div\n (click)=\"decrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--left\"\n [ngClass]=\"{ 'wz-pagination__wrapper__arrows__arrow--disabled': pagination.currentPage === 1 }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n <div\n (click)=\"incrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--right\"\n [ngClass]=\"{\n 'wz-pagination__wrapper__arrows__arrow--disabled':\n pagination.currentPage | IsLastPage: pagination.totalItems:pagination.itemsPerPage\n }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PageSelectorComponent, selector: "wz-page-selector", inputs: ["pagination", "totalItems"], outputs: ["pageChange"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }, { kind: "pipe", type: PagniationIsLastPage, name: "IsLastPage" }, { kind: "pipe", type: PagniationText, name: "customPagniationText" }] });
|
|
2361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PaginationComponent, decorators: [{
|
|
2362
|
+
type: Component,
|
|
2363
|
+
args: [{ selector: 'wz-pagination', template: "<div class=\"wz-pagination\" *ngIf=\"pagination && pagination.itemsPerPage\">\n <div class=\"wz-pagination__wrapper\">\n <div class=\"wz-pagination__wrapper__page\">\n <p>{{ 'PaginationComponent.page' | translate }}</p>\n\n <wz-page-selector [pagination]=\"pagination\" [totalItems]=\"pagination.totalItems\" (pageChange)=\"onGotoPageChange($event)\"></wz-page-selector>\n </div>\n\n <div class=\"wz-pagination__wrapper__elements\">\n <p>{{ pagination.currentPage | customPagniationText: pagination.totalItems:pagination.itemsPerPage }}</p>\n </div>\n\n <div class=\"wz-pagination__wrapper__arrows\">\n <div\n (click)=\"decrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--left\"\n [ngClass]=\"{ 'wz-pagination__wrapper__arrows__arrow--disabled': pagination.currentPage === 1 }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n <div\n (click)=\"incrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--right\"\n [ngClass]=\"{\n 'wz-pagination__wrapper__arrows__arrow--disabled':\n pagination.currentPage | IsLastPage: pagination.totalItems:pagination.itemsPerPage\n }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n </div>\n </div>\n</div>\n" }]
|
|
2364
|
+
}], ctorParameters: function () { return []; }, propDecorators: { pagination: [{
|
|
2365
|
+
type: Input
|
|
2366
|
+
}], pageChange: [{
|
|
2367
|
+
type: Output
|
|
2368
|
+
}] } });
|
|
2369
|
+
|
|
2370
|
+
class NumberToArray {
|
|
2371
|
+
transform(number) {
|
|
2372
|
+
return Array.from('x'.repeat(number));
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
NumberToArray.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NumberToArray, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2376
|
+
NumberToArray.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: NumberToArray, name: "numberToArray" });
|
|
2377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NumberToArray, decorators: [{
|
|
2378
|
+
type: Pipe,
|
|
2379
|
+
args: [{
|
|
2380
|
+
name: 'numberToArray'
|
|
2381
|
+
}]
|
|
2382
|
+
}] });
|
|
2383
|
+
|
|
2384
|
+
class MosaicViewComponent extends ImagesActionHandler {
|
|
2385
|
+
constructor(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService) {
|
|
2386
|
+
super(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService);
|
|
2387
|
+
this.nbFakeImg = 0;
|
|
2388
|
+
this.switchDisplayWindow = new EventEmitter();
|
|
2389
|
+
}
|
|
2390
|
+
ngOnInit() {
|
|
2391
|
+
}
|
|
2392
|
+
onSearchChange(event) {
|
|
2393
|
+
// Reset table filters
|
|
2394
|
+
this.tableFilters.sort = undefined;
|
|
2395
|
+
this.tableFilters.order = undefined;
|
|
2396
|
+
this.tableFilters.currentPage = 1;
|
|
2397
|
+
this.filtersChange.emit(this.tableFilters);
|
|
2398
|
+
}
|
|
2399
|
+
onCardRenamePicture(pictureRenamed) {
|
|
2400
|
+
this.pictureNameChange.next(pictureRenamed);
|
|
2401
|
+
}
|
|
2402
|
+
switchDisplayWindowCard() {
|
|
2403
|
+
this.switchDisplayWindow.emit(true);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
MosaicViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MosaicViewComponent, deps: [{ token: ImgManagerService }, { token: ImgSelectionService }, { token: i3.HttpClient }, { token: ImgCDNService }, { token: ImgEventService }, { token: AlertService }, { token: i7.TranslateService }, { token: ImgManagerConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2407
|
+
MosaicViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MosaicViewComponent, selector: "mosaic-view", inputs: { tabDisplayed: "tabDisplayed", fullSize: "fullSize", nbFakeImg: "nbFakeImg" }, outputs: { switchDisplayWindow: "switchDisplayWindow" }, usesInheritance: true, ngImport: i0, template: "<div class=\"mosaic\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small', 'mosaic--displayPexelsImg': displayPexelsResults}\">\n <!-- Search section -->\n <div\n class=\"mosaic__search\"\n [ngClass]=\"{'mosaic__search--small': stateDisplayed === 'small'}\"\n *ngIf=\"tabDisplayed !== 'img-upload'\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"onSearchChange($event)\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [smallPadding]=\"stateDisplayed === 'small'\"\n ></wz-input-search>\n </div>\n\n <!-- Cards section -->\n <div\n class=\"mosaic__container__cards\"\n [ngClass]=\"{'mosaic__container__cards--padding': stateDisplayed !== 'window'}\"\n [@listAnimation]=\"picturesList.length\"\n *ngIf=\"!isLoading && !displayPexelsResults\"\n >\n <img-card\n *ngFor=\"let picture of picturesList; let index = index;\"\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [disable]=\"disable\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (pictureNameChange)=\"onCardRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n [fullSize]=\"fullSize\"\n ></img-card>\n <div\n *ngFor=\"let fakeImg of nbFakeImg | numberToArray\"\n class=\"mosaic__container__cards__fakeImg\"\n [ngClass]=\"{'mosaic__container__cards__fakeImg--smallFakeImg': stateDisplayed === 'small' || tabDisplayed === 'img-upload'}\">\n </div>\n </div>\n <!-- Loader section -->\n <div class=\"mosaic__container__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\"></wz-loader>\n </div>\n\n <!-- Pagination section -->\n <div class=\"mosaic__pagination\" *ngIf=\"picturesList.length && tabDisplayed !== 'img-upload' && !displayPexelsResults\" >\n <wz-pagination\n [pagination]=\"tableFilters\"\n (pageChange)=\"onFiltersChange()\"\n >\n </wz-pagination>\n </div>\n\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ImgCardComponent, selector: "img-card", inputs: ["tabDisplayed", "fullSize", "picture", "index"], outputs: ["toggleImgSelected", "switchDisplayWindow"] }, { kind: "component", type: LoaderComponent, selector: "wz-loader", inputs: ["text", "small", "position"] }, { kind: "component", type: InputSearchComponent, selector: "wz-input-search", inputs: ["placeholder", "smallPadding", "id"], outputs: ["changeDebounced"] }, { kind: "component", type: PaginationComponent, selector: "wz-pagination", inputs: ["pagination"], outputs: ["pageChange"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }, { kind: "pipe", type: NumberToArray, name: "numberToArray" }], animations: [
|
|
2408
|
+
listAnnimation
|
|
2409
|
+
] });
|
|
2410
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MosaicViewComponent, decorators: [{
|
|
2411
|
+
type: Component,
|
|
2412
|
+
args: [{ selector: 'mosaic-view', animations: [
|
|
2413
|
+
listAnnimation
|
|
2414
|
+
], template: "<div class=\"mosaic\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small', 'mosaic--displayPexelsImg': displayPexelsResults}\">\n <!-- Search section -->\n <div\n class=\"mosaic__search\"\n [ngClass]=\"{'mosaic__search--small': stateDisplayed === 'small'}\"\n *ngIf=\"tabDisplayed !== 'img-upload'\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"onSearchChange($event)\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [smallPadding]=\"stateDisplayed === 'small'\"\n ></wz-input-search>\n </div>\n\n <!-- Cards section -->\n <div\n class=\"mosaic__container__cards\"\n [ngClass]=\"{'mosaic__container__cards--padding': stateDisplayed !== 'window'}\"\n [@listAnimation]=\"picturesList.length\"\n *ngIf=\"!isLoading && !displayPexelsResults\"\n >\n <img-card\n *ngFor=\"let picture of picturesList; let index = index;\"\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [disable]=\"disable\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (pictureNameChange)=\"onCardRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n [fullSize]=\"fullSize\"\n ></img-card>\n <div\n *ngFor=\"let fakeImg of nbFakeImg | numberToArray\"\n class=\"mosaic__container__cards__fakeImg\"\n [ngClass]=\"{'mosaic__container__cards__fakeImg--smallFakeImg': stateDisplayed === 'small' || tabDisplayed === 'img-upload'}\">\n </div>\n </div>\n <!-- Loader section -->\n <div class=\"mosaic__container__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\"></wz-loader>\n </div>\n\n <!-- Pagination section -->\n <div class=\"mosaic__pagination\" *ngIf=\"picturesList.length && tabDisplayed !== 'img-upload' && !displayPexelsResults\" >\n <wz-pagination\n [pagination]=\"tableFilters\"\n (pageChange)=\"onFiltersChange()\"\n >\n </wz-pagination>\n </div>\n\n</div>\n" }]
|
|
2415
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgSelectionService }, { type: i3.HttpClient }, { type: ImgCDNService }, { type: ImgEventService }, { type: AlertService }, { type: i7.TranslateService }, { type: ImgManagerConfigService }]; }, propDecorators: { tabDisplayed: [{
|
|
2416
|
+
type: Input
|
|
2417
|
+
}], fullSize: [{
|
|
2418
|
+
type: Input
|
|
2419
|
+
}], nbFakeImg: [{
|
|
2420
|
+
type: Input
|
|
2421
|
+
}], switchDisplayWindow: [{
|
|
2422
|
+
type: Output
|
|
2423
|
+
}] } });
|
|
2424
|
+
|
|
2425
|
+
class FiltersTableService {
|
|
2426
|
+
constructor(filterRoutingBuilder) {
|
|
2427
|
+
this.filterRoutingBuilder = filterRoutingBuilder;
|
|
2428
|
+
this.filterGroups = new Map();
|
|
2429
|
+
this.dataTableFilters = {
|
|
2430
|
+
sort: undefined,
|
|
2431
|
+
order: undefined,
|
|
2432
|
+
searchValue: undefined,
|
|
2433
|
+
totalItems: 0,
|
|
2434
|
+
itemsPerPage: 0,
|
|
2435
|
+
currentPage: 0
|
|
2436
|
+
};
|
|
2437
|
+
this.sortSubject = new Subject();
|
|
2438
|
+
}
|
|
2439
|
+
getTableFilterGroup(dataTableName) {
|
|
2440
|
+
if (this.filterGroups.has(dataTableName)) {
|
|
2441
|
+
return this.filterGroups.get(dataTableName);
|
|
2442
|
+
}
|
|
2443
|
+
const filterGroup = this.filterRoutingBuilder.group(this.dataTableFilters, dataTableName);
|
|
2444
|
+
this.filterGroups.set(dataTableName, filterGroup);
|
|
2445
|
+
return filterGroup;
|
|
2446
|
+
}
|
|
2447
|
+
/**
|
|
2448
|
+
* Use to reset the others sorts of the table
|
|
2449
|
+
* @param dataTableName
|
|
2450
|
+
* @param sortName
|
|
2451
|
+
* @param order
|
|
2452
|
+
*/
|
|
2453
|
+
emitSortChange(dataTableName, sortName, order) {
|
|
2454
|
+
this.sortSubject.next({ dataTableName, sortName, order });
|
|
2455
|
+
}
|
|
2456
|
+
getSortChangeListner() {
|
|
2457
|
+
return this.sortSubject.asObservable();
|
|
2458
|
+
}
|
|
2459
|
+
setPaginationFilters(dataTableName, totalItems, itemsPerPage, currentPage) {
|
|
2460
|
+
const filterGroup = this.getTableFilterGroup(dataTableName);
|
|
2461
|
+
filterGroup.setValues({
|
|
2462
|
+
itemsPerPage,
|
|
2463
|
+
currentPage
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
setInitialPaginationFiltersIfNotExist(dataTableName, itemsPerPage, currentPage) {
|
|
2467
|
+
const filterGroup = this.getTableFilterGroup(dataTableName);
|
|
2468
|
+
filterGroup.setValues({
|
|
2469
|
+
itemsPerPage: filterGroup.get('itemsPerPage') ? parseInt(filterGroup.get('itemsPerPage')) : itemsPerPage,
|
|
2470
|
+
currentPage: filterGroup.get('currentPage') ? parseInt(filterGroup.get('currentPage')) : currentPage
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
FiltersTableService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FiltersTableService, deps: [{ token: i1.NwbFilterRoutingBuilder }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2475
|
+
FiltersTableService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FiltersTableService, providedIn: 'root' });
|
|
2476
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FiltersTableService, decorators: [{
|
|
2477
|
+
type: Injectable,
|
|
2478
|
+
args: [{
|
|
2479
|
+
providedIn: 'root'
|
|
2480
|
+
}]
|
|
2481
|
+
}], ctorParameters: function () { return [{ type: i1.NwbFilterRoutingBuilder }]; } });
|
|
2482
|
+
|
|
2483
|
+
class CheckboxComponent {
|
|
2484
|
+
constructor() {
|
|
2485
|
+
this.label = '';
|
|
2486
|
+
this.alone = false;
|
|
2487
|
+
this.checked = false;
|
|
2488
|
+
this.id = '';
|
|
2489
|
+
this.disabled = false;
|
|
2490
|
+
}
|
|
2491
|
+
registerOnChange(fn) {
|
|
2492
|
+
this._onChange = fn;
|
|
2493
|
+
}
|
|
2494
|
+
registerOnTouched(fn) {
|
|
2495
|
+
this._onTouched = fn;
|
|
2496
|
+
}
|
|
2497
|
+
setDisabledState(isDisabled) {
|
|
2498
|
+
this.disabled = isDisabled;
|
|
2499
|
+
}
|
|
2500
|
+
writeValue(obj) {
|
|
2501
|
+
this.value = obj;
|
|
2502
|
+
}
|
|
2503
|
+
onChange(value) {
|
|
2504
|
+
if (this._onChange) {
|
|
2505
|
+
this._onChange(value);
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
CheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2510
|
+
CheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: CheckboxComponent, selector: "wz-checkbox", inputs: { label: "label", value: "value", type: "type", alone: "alone", checked: "checked", id: "id", name: "name" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: CheckboxComponent, multi: true }], ngImport: i0, template: "<div class=\"checkBoxField field\" [ngClass]=\"{ 'field--nowrap': type === 'column', alone: alone }\">\n <div class=\"field__row\">\n <input\n type=\"checkbox\"\n [id]=\"id\"\n class=\"is-checkradio\"\n [name]=\"name\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"value\"\n [checked]=\"checked\"\n (ngModelChange)=\"onChange($event)\"\n />\n <label [attr.for]=\"id\">{{ label }}</label>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
2511
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
2512
|
+
type: Component,
|
|
2513
|
+
args: [{ selector: 'wz-checkbox', encapsulation: ViewEncapsulation.None, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: CheckboxComponent, multi: true }], template: "<div class=\"checkBoxField field\" [ngClass]=\"{ 'field--nowrap': type === 'column', alone: alone }\">\n <div class=\"field__row\">\n <input\n type=\"checkbox\"\n [id]=\"id\"\n class=\"is-checkradio\"\n [name]=\"name\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"value\"\n [checked]=\"checked\"\n (ngModelChange)=\"onChange($event)\"\n />\n <label [attr.for]=\"id\">{{ label }}</label>\n </div>\n</div>\n" }]
|
|
2514
|
+
}], ctorParameters: function () { return []; }, propDecorators: { label: [{
|
|
2515
|
+
type: Input
|
|
2516
|
+
}], value: [{
|
|
2517
|
+
type: Input
|
|
2518
|
+
}], type: [{
|
|
2519
|
+
type: Input
|
|
2520
|
+
}], alone: [{
|
|
2521
|
+
type: Input
|
|
2522
|
+
}], checked: [{
|
|
2523
|
+
type: Input
|
|
2524
|
+
}], id: [{
|
|
2525
|
+
type: Input
|
|
2526
|
+
}], name: [{
|
|
2527
|
+
type: Input
|
|
2528
|
+
}] } });
|
|
2529
|
+
|
|
2530
|
+
class TableComponent {
|
|
2531
|
+
constructor(filtersTableService) {
|
|
2532
|
+
this.filtersTableService = filtersTableService;
|
|
2533
|
+
this.tableFiltersChange = new EventEmitter();
|
|
2534
|
+
this.placeholder = '';
|
|
2535
|
+
/// Input/Output of checkbox ///
|
|
2536
|
+
/** Pass to true to display checkbox in the header table */
|
|
2537
|
+
this.checkbox = false;
|
|
2538
|
+
/** Emit new header checboxValue */
|
|
2539
|
+
this.toggleAllCheckBox = new EventEmitter();
|
|
2540
|
+
/// Input to disable section ///
|
|
2541
|
+
/** Pass to true to hide search input */
|
|
2542
|
+
this.disableSearch = false;
|
|
2543
|
+
/** Pass to true to hide the pagniator */
|
|
2544
|
+
this.disablePagniation = false;
|
|
2545
|
+
/// Input for loader on table body ///
|
|
2546
|
+
this.isLoading = false;
|
|
2547
|
+
}
|
|
2548
|
+
ngOnInit() {
|
|
2549
|
+
this.headerCheckBoxId = v4(); // Create checkbox unique id
|
|
2550
|
+
/* Handle routing filters */
|
|
2551
|
+
if (this.tableRoutingName) {
|
|
2552
|
+
this._filterGroup = this.filtersTableService.getTableFilterGroup(this.tableRoutingName);
|
|
2553
|
+
// Performe initial fetch data
|
|
2554
|
+
this._filterGroup.valuesChange$.next([]);
|
|
2555
|
+
this.setTablesFilters();
|
|
2556
|
+
// Listen to filters changes with debounced time to limit multiple api calls
|
|
2557
|
+
this.filterGroupChangeSub = this._filterGroup.valuesChange$.subscribe(filters => {
|
|
2558
|
+
this.setTablesFilters();
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
onToggleAllCheckBox(event) {
|
|
2563
|
+
this.toggleAllCheckBox.emit(event.target.checked);
|
|
2564
|
+
}
|
|
2565
|
+
searchChange(event) {
|
|
2566
|
+
// Reset table filters
|
|
2567
|
+
this.tableFilters.sort = undefined;
|
|
2568
|
+
this.tableFilters.order = undefined;
|
|
2569
|
+
this.tableFilters.currentPage = 1;
|
|
2570
|
+
this.tableFiltersChange.emit(this.tableFilters);
|
|
2571
|
+
// Reset routing filters
|
|
2572
|
+
if (this._filterGroup) {
|
|
2573
|
+
this._filterGroup.setValues({
|
|
2574
|
+
searchValue: this.tableFilters.searchValue,
|
|
2575
|
+
sort: undefined,
|
|
2576
|
+
order: undefined,
|
|
2577
|
+
currentPage: 1
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
pageChange() {
|
|
2582
|
+
this.tableFiltersChange.emit(this.tableFilters);
|
|
2583
|
+
if (this._filterGroup) {
|
|
2584
|
+
this._filterGroup.setValues({
|
|
2585
|
+
itemsPerPage: this.tableFilters.itemsPerPage,
|
|
2586
|
+
currentPage: this.tableFilters.currentPage
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
/**
|
|
2591
|
+
* Set tableFilters from routing data existing in the url
|
|
2592
|
+
* */
|
|
2593
|
+
setTablesFilters() {
|
|
2594
|
+
this.tableFilters = {
|
|
2595
|
+
sort: this._filterGroup.get('sort'),
|
|
2596
|
+
order: this._filterGroup.get('order'),
|
|
2597
|
+
searchValue: this._filterGroup.get('searchValue'),
|
|
2598
|
+
itemsPerPage: this._filterGroup.get('itemsPerPage') ? parseInt(this._filterGroup.get('itemsPerPage')) : 0,
|
|
2599
|
+
currentPage: this._filterGroup.get('currentPage') ? parseInt(this._filterGroup.get('currentPage')) : 0,
|
|
2600
|
+
totalItems: this.tableFilters.totalItems
|
|
2601
|
+
};
|
|
2602
|
+
this.tableFiltersChange.emit(this.tableFilters);
|
|
2603
|
+
}
|
|
2604
|
+
ngDestroy() {
|
|
2605
|
+
if (this.filterGroupChangeSub) {
|
|
2606
|
+
this.filterGroupChangeSub.unsubscribe();
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
TableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableComponent, deps: [{ token: FiltersTableService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2611
|
+
TableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: TableComponent, selector: "wz-table", inputs: { tableFilters: "tableFilters", tableRoutingName: "tableRoutingName", placeholder: "placeholder", checkbox: "checkbox", disableSearch: "disableSearch", disablePagniation: "disablePagniation", isLoading: "isLoading" }, outputs: { tableFiltersChange: "tableFiltersChange", toggleAllCheckBox: "toggleAllCheckBox" }, ngImport: i0, template: "<div class=\"wz-table\">\n <!-- Header section -->\n <div class=\"wz-table__head\" id=\"headerTable\">\n <div *ngIf=\"checkbox\" class=\"wz-table__head__cell wz-table__head__cell--checkbox\">\n <wz-checkbox [id]=\"headerCheckBoxId\" (change)=\"onToggleAllCheckBox($event)\" [alone]=\"true\"></wz-checkbox>\n </div>\n\n <!-- Header contents are added with the headerCell directive -->\n <ng-content select=\"[headerCell]\"></ng-content>\n </div>\n\n <!-- Search section -->\n <div *ngIf=\"!disableSearch\" class=\"wz-table__search\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"searchChange($event)\"\n [placeholder]=\"placeholder\"\n [smallPadding]=\"true\"\n ></wz-input-search>\n </div>\n\n <!-- Body section -->\n <div class=\"wz-table__body\">\n <!-- Loader on body -->\n <div class=\"wz-table__body__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\"></wz-loader>\n </div>\n <!-- Body contents are added with the tableRow directive -->\n <ng-content select=\"[tableRow]\" *ngIf=\"!isLoading\"></ng-content>\n </div>\n\n <!-- Pagination section -->\n <wz-pagination *ngIf=\"!disablePagniation\" [pagination]=\"tableFilters\" (pageChange)=\"pageChange()\"></wz-pagination>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: LoaderComponent, selector: "wz-loader", inputs: ["text", "small", "position"] }, { kind: "component", type: InputSearchComponent, selector: "wz-input-search", inputs: ["placeholder", "smallPadding", "id"], outputs: ["changeDebounced"] }, { kind: "component", type: PaginationComponent, selector: "wz-pagination", inputs: ["pagination"], outputs: ["pageChange"] }, { kind: "component", type: CheckboxComponent, selector: "wz-checkbox", inputs: ["label", "value", "type", "alone", "checked", "id", "name"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
2612
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableComponent, decorators: [{
|
|
2613
|
+
type: Component,
|
|
2614
|
+
args: [{ selector: 'wz-table', encapsulation: ViewEncapsulation.None, template: "<div class=\"wz-table\">\n <!-- Header section -->\n <div class=\"wz-table__head\" id=\"headerTable\">\n <div *ngIf=\"checkbox\" class=\"wz-table__head__cell wz-table__head__cell--checkbox\">\n <wz-checkbox [id]=\"headerCheckBoxId\" (change)=\"onToggleAllCheckBox($event)\" [alone]=\"true\"></wz-checkbox>\n </div>\n\n <!-- Header contents are added with the headerCell directive -->\n <ng-content select=\"[headerCell]\"></ng-content>\n </div>\n\n <!-- Search section -->\n <div *ngIf=\"!disableSearch\" class=\"wz-table__search\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"searchChange($event)\"\n [placeholder]=\"placeholder\"\n [smallPadding]=\"true\"\n ></wz-input-search>\n </div>\n\n <!-- Body section -->\n <div class=\"wz-table__body\">\n <!-- Loader on body -->\n <div class=\"wz-table__body__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\"></wz-loader>\n </div>\n <!-- Body contents are added with the tableRow directive -->\n <ng-content select=\"[tableRow]\" *ngIf=\"!isLoading\"></ng-content>\n </div>\n\n <!-- Pagination section -->\n <wz-pagination *ngIf=\"!disablePagniation\" [pagination]=\"tableFilters\" (pageChange)=\"pageChange()\"></wz-pagination>\n</div>\n" }]
|
|
2615
|
+
}], ctorParameters: function () { return [{ type: FiltersTableService }]; }, propDecorators: { tableFilters: [{
|
|
2616
|
+
type: Input
|
|
2617
|
+
}], tableFiltersChange: [{
|
|
2618
|
+
type: Output
|
|
2619
|
+
}], tableRoutingName: [{
|
|
2620
|
+
type: Input
|
|
2621
|
+
}], placeholder: [{
|
|
2622
|
+
type: Input
|
|
2623
|
+
}], checkbox: [{
|
|
2624
|
+
type: Input
|
|
2625
|
+
}], toggleAllCheckBox: [{
|
|
2626
|
+
type: Output
|
|
2627
|
+
}], disableSearch: [{
|
|
2628
|
+
type: Input
|
|
2629
|
+
}], disablePagniation: [{
|
|
2630
|
+
type: Input
|
|
2631
|
+
}], isLoading: [{
|
|
2632
|
+
type: Input
|
|
2633
|
+
}] } });
|
|
2634
|
+
|
|
2635
|
+
class TableColumn {
|
|
2636
|
+
constructor(currentCell, renderer, document) {
|
|
2637
|
+
this.currentCell = currentCell;
|
|
2638
|
+
this.renderer = renderer;
|
|
2639
|
+
this.document = document;
|
|
2640
|
+
this.centerCellValue = ['left', 'center', 'right'];
|
|
2641
|
+
}
|
|
2642
|
+
ngAfterViewInit() {
|
|
2643
|
+
this.applyCustomStylesOnCell();
|
|
2644
|
+
}
|
|
2645
|
+
applyCustomStylesOnCell() {
|
|
2646
|
+
this.currentCell.nativeElement.style.flexGrow = typeof this.columnSize !== 'undefined' ? this.columnSize : '1';
|
|
2647
|
+
this.renderer.addClass(this.currentCell.nativeElement, 'wz-table__body__line__cell');
|
|
2648
|
+
if (this.centerCell) {
|
|
2649
|
+
if (this.centerCellValue.indexOf(this.centerCell) === -1) {
|
|
2650
|
+
throw 'Error : The centerCell directive has no matched value. The value must be one of the following : left, center, right.';
|
|
2651
|
+
}
|
|
2652
|
+
let className = 'wz-table__body__line__cell--center' + '--' + this.centerCell;
|
|
2653
|
+
this.renderer.addClass(this.currentCell.nativeElement, className);
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
TableColumn.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableColumn, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2658
|
+
TableColumn.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: TableColumn, selector: "[tableColumn]", inputs: { columnSize: "columnSize", centerCell: "centerCell" }, ngImport: i0 });
|
|
2659
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableColumn, decorators: [{
|
|
2660
|
+
type: Directive,
|
|
2661
|
+
args: [{
|
|
2662
|
+
selector: '[tableColumn]'
|
|
2663
|
+
}]
|
|
2664
|
+
}], ctorParameters: function () {
|
|
2665
|
+
return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
|
2666
|
+
type: Inject,
|
|
2667
|
+
args: [DOCUMENT]
|
|
2668
|
+
}] }];
|
|
2669
|
+
}, propDecorators: { columnSize: [{
|
|
2670
|
+
type: Input,
|
|
2671
|
+
args: ['columnSize']
|
|
2672
|
+
}], centerCell: [{
|
|
2673
|
+
type: Input,
|
|
2674
|
+
args: ['centerCell']
|
|
2675
|
+
}] } });
|
|
2676
|
+
|
|
2677
|
+
class CheckBoxRow {
|
|
2678
|
+
constructor(currentRow, appRef, renderer, document, resolver, injector) {
|
|
2679
|
+
this.currentRow = currentRow;
|
|
2680
|
+
this.appRef = appRef;
|
|
2681
|
+
this.renderer = renderer;
|
|
2682
|
+
this.document = document;
|
|
2683
|
+
this.resolver = resolver;
|
|
2684
|
+
this.injector = injector;
|
|
2685
|
+
this.checkBoxValueChange = new EventEmitter();
|
|
2686
|
+
}
|
|
2687
|
+
set checkBoxValue(value) {
|
|
2688
|
+
this._value = value;
|
|
2689
|
+
if (this.checkboxComponentRef) {
|
|
2690
|
+
this.setCheckBoxValue();
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
get checkBoxValue() {
|
|
2694
|
+
return this._value;
|
|
2695
|
+
}
|
|
2696
|
+
ngOnInit() {
|
|
2697
|
+
this.createCheckBoxComponent();
|
|
2698
|
+
this.handleChecboxInputs();
|
|
2699
|
+
this.handleCheckboxOutputs();
|
|
2700
|
+
}
|
|
2701
|
+
createCheckBoxComponent() {
|
|
2702
|
+
// Create the container
|
|
2703
|
+
const checkBoxContainer = document.createElement('div');
|
|
2704
|
+
checkBoxContainer.className = 'wz-table__body__line__cell wz-table__body__line__cell--checkbox';
|
|
2705
|
+
// Insert divCheckBox in the DOM as the first child of the row
|
|
2706
|
+
this.renderer.insertBefore(this.currentRow.nativeElement, checkBoxContainer, this.currentRow.nativeElement.firstChild);
|
|
2707
|
+
// Insert the CheckBoxComponent inside the container (DOM and Angular DOM)
|
|
2708
|
+
this.htmlContainer = new HtmlContainer(checkBoxContainer, this.appRef, this.resolver, this.injector);
|
|
2709
|
+
this.checkboxComponentRef = this.htmlContainer.attach(CheckboxComponent);
|
|
2710
|
+
}
|
|
2711
|
+
handleChecboxInputs() {
|
|
2712
|
+
this.checkboxComponentRef.instance.id = this.checkBoxId ? this.checkBoxId : v4();
|
|
2713
|
+
this.checkboxComponentRef.instance.name = this.checkBoxName ? this.checkBoxName : undefined;
|
|
2714
|
+
this.checkboxComponentRef.instance.alone = true;
|
|
2715
|
+
this.setCheckBoxValue();
|
|
2716
|
+
}
|
|
2717
|
+
setCheckBoxValue() {
|
|
2718
|
+
this.checkboxComponentRef.instance.value = this.checkBoxValue;
|
|
2719
|
+
}
|
|
2720
|
+
handleCheckboxOutputs() {
|
|
2721
|
+
// Detect checkbox changes
|
|
2722
|
+
this.checkboxComponentRef.instance.registerOnChange(() => {
|
|
2723
|
+
this._toggleCheckbox();
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
_toggleCheckbox() {
|
|
2727
|
+
this.checkBoxValue = !this.checkBoxValue;
|
|
2728
|
+
this.checkBoxValueChange.emit(this.checkBoxValue);
|
|
2729
|
+
}
|
|
2730
|
+
ngOnDestroy() {
|
|
2731
|
+
this.htmlContainer.dispose();
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
CheckBoxRow.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CheckBoxRow, deps: [{ token: i0.ElementRef }, { token: i0.ApplicationRef }, { token: i0.Renderer2 }, { token: DOCUMENT }, { token: i0.ComponentFactoryResolver }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2735
|
+
CheckBoxRow.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: CheckBoxRow, selector: "[checkBoxRow]", inputs: { checkBoxId: "checkBoxId", checkBoxName: "checkBoxName", checkBoxValue: "checkBoxValue" }, outputs: { checkBoxValueChange: "checkBoxValueChange" }, ngImport: i0 });
|
|
2736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CheckBoxRow, decorators: [{
|
|
2737
|
+
type: Directive,
|
|
2738
|
+
args: [{
|
|
2739
|
+
selector: '[checkBoxRow]'
|
|
2740
|
+
}]
|
|
2741
|
+
}], ctorParameters: function () {
|
|
2742
|
+
return [{ type: i0.ElementRef }, { type: i0.ApplicationRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
|
2743
|
+
type: Inject,
|
|
2744
|
+
args: [DOCUMENT]
|
|
2745
|
+
}] }, { type: i0.ComponentFactoryResolver }, { type: i0.Injector }];
|
|
2746
|
+
}, propDecorators: { checkBoxId: [{
|
|
2747
|
+
type: Input,
|
|
2748
|
+
args: ['checkBoxId']
|
|
2749
|
+
}], checkBoxName: [{
|
|
2750
|
+
type: Input,
|
|
2751
|
+
args: ['checkBoxName']
|
|
2752
|
+
}], checkBoxValue: [{
|
|
2753
|
+
type: Input,
|
|
2754
|
+
args: ['checkBoxValue']
|
|
2755
|
+
}], checkBoxValueChange: [{
|
|
2756
|
+
type: Output
|
|
2757
|
+
}] } });
|
|
2758
|
+
class HtmlContainer {
|
|
2759
|
+
constructor(hostElement, appRef, componentFactoryResolver, injector) {
|
|
2760
|
+
this.hostElement = hostElement;
|
|
2761
|
+
this.appRef = appRef;
|
|
2762
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
2763
|
+
this.injector = injector;
|
|
2764
|
+
this.attached = false;
|
|
2765
|
+
}
|
|
2766
|
+
attach(component) {
|
|
2767
|
+
if (this.attached) {
|
|
2768
|
+
throw new Error('component has already been attached');
|
|
2769
|
+
}
|
|
2770
|
+
this.attached = true;
|
|
2771
|
+
const childComponentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
2772
|
+
let componentRef = childComponentFactory.create(this.injector);
|
|
2773
|
+
this.appRef.attachView(componentRef.hostView);
|
|
2774
|
+
this.disposeFn = () => {
|
|
2775
|
+
this.appRef.detachView(componentRef.hostView);
|
|
2776
|
+
componentRef.destroy();
|
|
2777
|
+
};
|
|
2778
|
+
this.hostElement.appendChild(componentRef.hostView.rootNodes[0]);
|
|
2779
|
+
return componentRef;
|
|
2780
|
+
}
|
|
2781
|
+
dispose() {
|
|
2782
|
+
if (this.attached) {
|
|
2783
|
+
this.disposeFn();
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
class TableColumnHeader {
|
|
2789
|
+
constructor(currentCell, renderer, document, filtersTableService) {
|
|
2790
|
+
this.currentCell = currentCell;
|
|
2791
|
+
this.renderer = renderer;
|
|
2792
|
+
this.document = document;
|
|
2793
|
+
this.filtersTableService = filtersTableService;
|
|
2794
|
+
this._headerName = '';
|
|
2795
|
+
this.filterRouting = false; // Optional. Set to true to use Filter Routing.
|
|
2796
|
+
this.onSortChange = new EventEmitter(); // Emit the sort value (true, false, undefuned) of the current sort icon when clicking
|
|
2797
|
+
this.tableFiltersChange = new EventEmitter();
|
|
2798
|
+
this.centerCellValue = ['left', 'center', 'right'];
|
|
2799
|
+
this.subscriptions = [];
|
|
2800
|
+
}
|
|
2801
|
+
set headerName(value) {
|
|
2802
|
+
this._headerName = value;
|
|
2803
|
+
this.setHeaderName();
|
|
2804
|
+
}
|
|
2805
|
+
get headerName() {
|
|
2806
|
+
return this._headerName;
|
|
2807
|
+
}
|
|
2808
|
+
ngOnInit() {
|
|
2809
|
+
if (this.tableName && this.sortName) {
|
|
2810
|
+
if (this.filterRouting) {
|
|
2811
|
+
this.handleSortRouting();
|
|
2812
|
+
}
|
|
2813
|
+
else {
|
|
2814
|
+
this.handleSortBasic();
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
ngAfterViewInit() {
|
|
2819
|
+
this.applyCustomStylesOnCell();
|
|
2820
|
+
this.renderHeaderColumn();
|
|
2821
|
+
}
|
|
2822
|
+
handleSortRouting() {
|
|
2823
|
+
this.filterGroup = this.filtersTableService.getTableFilterGroup(this.tableName);
|
|
2824
|
+
const filterGroupChangeSub = this.filterGroup.valuesChange$.subscribe(filters => {
|
|
2825
|
+
const filterSort = filters.filter(filter => filter.key === 'sort')[0];
|
|
2826
|
+
if (this.sortName !== filterSort.value) {
|
|
2827
|
+
this.resetSortIcon();
|
|
2828
|
+
}
|
|
2829
|
+
});
|
|
2830
|
+
this.subscriptions.push(filterGroupChangeSub);
|
|
2831
|
+
}
|
|
2832
|
+
handleSortBasic() {
|
|
2833
|
+
const sortChangeSub = this.filtersTableService.getSortChangeListner().subscribe(sort => {
|
|
2834
|
+
if (this.tableName === sort.dataTableName && this.sortName !== sort.sortName) {
|
|
2835
|
+
// Reset the current sort icon
|
|
2836
|
+
this.resetSortIcon();
|
|
2837
|
+
}
|
|
2838
|
+
});
|
|
2839
|
+
this.subscriptions.push(sortChangeSub);
|
|
2840
|
+
}
|
|
2841
|
+
resetSortIcon() {
|
|
2842
|
+
// Replace current icon with default icon
|
|
2843
|
+
this.contentHeader.className = this.contentHeader.className.replace(this.getCurrentSortIcon(), 'idle');
|
|
2844
|
+
}
|
|
2845
|
+
applyCustomStylesOnCell() {
|
|
2846
|
+
this.currentCell.nativeElement.style.flexGrow = typeof this.columnSize !== 'undefined' ? this.columnSize : '1';
|
|
2847
|
+
this.renderer.addClass(this.currentCell.nativeElement, 'wz-table__head__cell');
|
|
2848
|
+
if (this.centerCell) {
|
|
2849
|
+
if (this.centerCellValue.indexOf(this.centerCell) === -1) {
|
|
2850
|
+
throw 'Error : The centerCell directive has no matched value. The value must be one of the following : left, center, right.';
|
|
2851
|
+
}
|
|
2852
|
+
let className = 'wz-table__head__cell--center' + '--' + this.centerCell;
|
|
2853
|
+
this.renderer.addClass(this.currentCell.nativeElement, className);
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
renderHeaderColumn() {
|
|
2857
|
+
this.createHeaderContent();
|
|
2858
|
+
this.renderer.appendChild(this.currentCell.nativeElement, this.contentHeader);
|
|
2859
|
+
}
|
|
2860
|
+
createHeaderContent() {
|
|
2861
|
+
this.contentHeader = document.createElement('a');
|
|
2862
|
+
this.contentHeader.className = 'wz-table__head__cell__search';
|
|
2863
|
+
this.setHeaderName();
|
|
2864
|
+
if (this.tableName && this.sortName) {
|
|
2865
|
+
this.handleSort();
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
setHeaderName() {
|
|
2869
|
+
if (!this.contentHeader) {
|
|
2870
|
+
return;
|
|
2871
|
+
}
|
|
2872
|
+
this.contentHeader.innerHTML = this.headerName;
|
|
2873
|
+
}
|
|
2874
|
+
handleSort() {
|
|
2875
|
+
// Set icon in the header column cell
|
|
2876
|
+
this.contentHeader.className += ' wz-table__head__cell__search--' + this.getInitialSortIcon();
|
|
2877
|
+
// On click on the content header, change the icon and emit event
|
|
2878
|
+
this.renderer.listen(this.contentHeader, 'click', () => {
|
|
2879
|
+
const currentIcon = this.getCurrentSortIcon();
|
|
2880
|
+
let newIcon;
|
|
2881
|
+
let newSort, newOrder;
|
|
2882
|
+
switch (currentIcon) {
|
|
2883
|
+
case 'idle':
|
|
2884
|
+
newIcon = 'up';
|
|
2885
|
+
newSort = this.sortName;
|
|
2886
|
+
newOrder = true;
|
|
2887
|
+
break;
|
|
2888
|
+
case 'up':
|
|
2889
|
+
newIcon = 'down';
|
|
2890
|
+
newSort = this.sortName;
|
|
2891
|
+
newOrder = false;
|
|
2892
|
+
break;
|
|
2893
|
+
case 'down':
|
|
2894
|
+
newIcon = 'idle';
|
|
2895
|
+
break;
|
|
2896
|
+
default:
|
|
2897
|
+
newIcon = 'idle';
|
|
2898
|
+
break;
|
|
2899
|
+
}
|
|
2900
|
+
// Replace the icon
|
|
2901
|
+
this.contentHeader.className = this.contentHeader.className.replace(currentIcon, newIcon);
|
|
2902
|
+
this.emitEvents(newSort, newOrder);
|
|
2903
|
+
});
|
|
2904
|
+
}
|
|
2905
|
+
getInitialSortIcon() {
|
|
2906
|
+
if (!this.filterRouting) {
|
|
2907
|
+
return 'idle';
|
|
2908
|
+
}
|
|
2909
|
+
// Get Initial Sort Icon for Routing Filter
|
|
2910
|
+
let initialSortIcon = 'idle';
|
|
2911
|
+
if (this.filterGroup.get('sort') === this.sortName) {
|
|
2912
|
+
initialSortIcon = this.filterGroup.get('order') == 'true' ? 'up' : 'down';
|
|
2913
|
+
}
|
|
2914
|
+
return initialSortIcon;
|
|
2915
|
+
}
|
|
2916
|
+
getCurrentSortIcon() {
|
|
2917
|
+
const regexp = /wz-table__head__cell__search--(?<icon>\w+)/;
|
|
2918
|
+
const { groups } = regexp.exec(this.contentHeader.className);
|
|
2919
|
+
return groups.icon;
|
|
2920
|
+
}
|
|
2921
|
+
emitEvents(newSort, newOrder) {
|
|
2922
|
+
if (this.filterRouting) {
|
|
2923
|
+
// Will send the filter routing value has changes event
|
|
2924
|
+
this.filterGroup.setValues({
|
|
2925
|
+
sort: newSort,
|
|
2926
|
+
order: newOrder,
|
|
2927
|
+
currentPage: 1
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
else {
|
|
2931
|
+
// Send the event sort change
|
|
2932
|
+
this.filtersTableService.emitSortChange(this.tableName, this.sortName, newOrder);
|
|
2933
|
+
}
|
|
2934
|
+
if (this.tableFilters) {
|
|
2935
|
+
this.tableFilters.sort = this.sortName;
|
|
2936
|
+
this.tableFilters.order = newOrder;
|
|
2937
|
+
this.tableFilters.currentPage = 1;
|
|
2938
|
+
this.tableFiltersChange.emit(this.tableFilters);
|
|
2939
|
+
}
|
|
2940
|
+
this.onSortChange.emit(newOrder);
|
|
2941
|
+
}
|
|
2942
|
+
ngOnDestroy() {
|
|
2943
|
+
this.subscriptions.forEach(subscription => {
|
|
2944
|
+
subscription.unsubscribe();
|
|
2945
|
+
});
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
TableColumnHeader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableColumnHeader, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: DOCUMENT }, { token: FiltersTableService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2949
|
+
TableColumnHeader.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: TableColumnHeader, selector: "[headerCell]", inputs: { headerName: "headerName", columnSize: "columnSize", filterRouting: "filterRouting", tableName: "tableName", sortName: "sortName", centerCell: "centerCell", tableFilters: "tableFilters" }, outputs: { onSortChange: "onSortChange", tableFiltersChange: "tableFiltersChange" }, ngImport: i0 });
|
|
2950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableColumnHeader, decorators: [{
|
|
2951
|
+
type: Directive,
|
|
2952
|
+
args: [{
|
|
2953
|
+
// The selector has the same name as the headerCell selector in table.component.html
|
|
2954
|
+
selector: '[headerCell]'
|
|
2955
|
+
}]
|
|
2956
|
+
}], ctorParameters: function () {
|
|
2957
|
+
return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
|
2958
|
+
type: Inject,
|
|
2959
|
+
args: [DOCUMENT]
|
|
2960
|
+
}] }, { type: FiltersTableService }];
|
|
2961
|
+
}, propDecorators: { headerName: [{
|
|
2962
|
+
type: Input,
|
|
2963
|
+
args: ['headerName']
|
|
2964
|
+
}], columnSize: [{
|
|
2965
|
+
type: Input,
|
|
2966
|
+
args: ['columnSize']
|
|
2967
|
+
}], filterRouting: [{
|
|
2968
|
+
type: Input,
|
|
2969
|
+
args: ['filterRouting']
|
|
2970
|
+
}], tableName: [{
|
|
2971
|
+
type: Input,
|
|
2972
|
+
args: ['tableName']
|
|
2973
|
+
}], sortName: [{
|
|
2974
|
+
type: Input,
|
|
2975
|
+
args: ['sortName']
|
|
2976
|
+
}], centerCell: [{
|
|
2977
|
+
type: Input,
|
|
2978
|
+
args: ['centerCell']
|
|
2979
|
+
}], onSortChange: [{
|
|
2980
|
+
type: Output
|
|
2981
|
+
}], tableFilters: [{
|
|
2982
|
+
type: Input
|
|
2983
|
+
}], tableFiltersChange: [{
|
|
2984
|
+
type: Output
|
|
2985
|
+
}] } });
|
|
2986
|
+
|
|
2987
|
+
class TableRow {
|
|
2988
|
+
constructor(currentCell, renderer, document) {
|
|
2989
|
+
this.currentCell = currentCell;
|
|
2990
|
+
this.renderer = renderer;
|
|
2991
|
+
this.document = document;
|
|
2992
|
+
}
|
|
2993
|
+
ngAfterViewInit() {
|
|
2994
|
+
this.applyCustomStylesOnCell();
|
|
2995
|
+
}
|
|
2996
|
+
applyCustomStylesOnCell() {
|
|
2997
|
+
this.renderer.addClass(this.currentCell.nativeElement, 'wz-table__body__line');
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
TableRow.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableRow, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3001
|
+
TableRow.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: TableRow, selector: "[tableRow]", ngImport: i0 });
|
|
3002
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableRow, decorators: [{
|
|
3003
|
+
type: Directive,
|
|
3004
|
+
args: [{
|
|
3005
|
+
// The selector has the same name as the tableRaw selector in table.component.html
|
|
3006
|
+
selector: '[tableRow]'
|
|
3007
|
+
}]
|
|
3008
|
+
}], ctorParameters: function () {
|
|
3009
|
+
return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
|
3010
|
+
type: Inject,
|
|
3011
|
+
args: [DOCUMENT]
|
|
3012
|
+
}] }];
|
|
3013
|
+
} });
|
|
3014
|
+
|
|
3015
|
+
class TableViewComponent extends ImagesActionHandler {
|
|
3016
|
+
constructor(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService) {
|
|
3017
|
+
super(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService);
|
|
3018
|
+
this.dataTableName = 'imgagesView'; // Name of your table
|
|
3019
|
+
}
|
|
3020
|
+
ngOnInit() {
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
TableViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableViewComponent, deps: [{ token: ImgManagerService }, { token: ImgSelectionService }, { token: i3.HttpClient }, { token: ImgCDNService }, { token: ImgEventService }, { token: AlertService }, { token: i7.TranslateService }, { token: ImgManagerConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3024
|
+
TableViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: TableViewComponent, selector: "table-view", usesInheritance: true, ngImport: i0, template: "<div class=\"table-view\" [@listAnimation]=\"picturesList.length\">\n <wz-table\n [checkbox]=\"true\"\n (toggleAllCheckBox)=\"onToggleAllCheckBoxRow($event)\"\n [(tableFilters)]=\"tableFilters\"\n (tableFiltersChange)=\"onFiltersChange()\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [disablePagniation]=\"displayPexelsResults\"\n [isLoading]=\"isLoading\"\n >\n <!-- Header Section -->\n <div\n headerCell\n [headerName]=\"'ImgManager.ImgList.titleImgName' | translate\"\n columnSize=\"2\"\n sortName=\"name\"\n ></div>\n <div\n headerCell\n centerCell=\"center\"\n [headerName]=\"'ImgManager.ImgList.titleResolution' | translate\"\n ></div>\n <div headerCell columnSize=\"0\"></div>\n\n <!-- Body Section -->\n <div\n tableRow\n checkBoxRow\n [checkBoxValue]=\"picture.delSelected\"\n (checkBoxValueChange)=\"onToggleDelSelection(index)\"\n *ngFor=\"let picture of picturesList; let index = index\"\n >\n\n <div tableColumn columnSize=\"2\">\n <div class=\"table-view__row__container\">\n <div\n class=\"table-view__row__container__imgContainer\"\n [ngClass]=\"{'imgSelected': picture.selected}\"\n (click)=\"onToggleSelectImg(index)\">\n <img\n class=\"table-view__row__container__imgContainer__img\"\n [src]=\"picture.file_name | imgSrc : '100'\"\n alt=\"picture.display_name\"\n [ngClass]=\"{'pictureDeletion': picture.deleted}\"\n (error)=\"picture.imgNotLoaded=true;onPictureNotLoading($event);\"\n />\n <!-- If the img is not loaded, or the link is broken, an icon is displayed -->\n <div\n *ngIf=\"picture.imgNotLoaded\"\n class=\"table-view__row__container__imgContainer__overlay\"\n >\n <i class=\"fad fa-folder-times\"></i>\n </div>\n </div>\n <input\n type=\"text\"\n class=\"wzImgMngInput table-view__row__container__name\"\n [(ngModel)]=\"picture.display_name\"\n (focus)=\"previousName=picture.display_name\"\n (blur)=\"onNameChange(picture.id_file)\"\n (click)=\"onToggleDelSelection(index)\"\n [ngClass]=\"{'desabled': picture.deleted}\"\n [disabled]=\"picture.deleted\"\n >\n </div>\n </div>\n\n <div\n tableColumn\n centerCell=\"center\"\n (click)=\"onToggleDelSelection(index)\"\n >\n <p class=\"grey\">{{picture.raw_height}}x{{picture.raw_width}}</p>\n </div>\n\n <div tableColumn centerCell=\"center\" columnSize=\"0\" class=\"table-view__dropdown-options\">\n <!-- Dropdown -->\n <dropdown dropdownId=\"dropdown-options\" [disable]=\"picture.deleted\">\n <ng-container label>\n <div class=\"table-view__dropdown-options__label rotate\">\n <span> <i class=\"far fa-ellipsis-h is-size-4\" aria-haspopup=\"true\" aria-controls=\"dropdown-menu\"> </i> </span>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onDownloadImg(picture.display_name, picture.file_name)\"\n >\n <i class=\"far fa-download download\"></i> \n <p>{{ 'ImgManager.ImgList.download' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onEdit(picture)\"\n >\n <i class=\"far fa-crop-alt edit\"></i> \n <p>{{ 'ImgManager.ImgList.edit' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onRemoveImg(picture)\"\n >\n <i class=\"fal fa-times deleted\"></i> \n <p>{{ 'ImgManager.ImgList.remove' | translate }}</p>\n </div>\n </ng-container>\n </dropdown>\n </div>\n </div>\n </wz-table>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: DropdownComponent, selector: "dropdown", inputs: ["dropDownMenuClass", "disable"] }, { kind: "component", type: TableComponent, selector: "wz-table", inputs: ["tableFilters", "tableRoutingName", "placeholder", "checkbox", "disableSearch", "disablePagniation", "isLoading"], outputs: ["tableFiltersChange", "toggleAllCheckBox"] }, { kind: "directive", type: TableColumn, selector: "[tableColumn]", inputs: ["columnSize", "centerCell"] }, { kind: "directive", type: CheckBoxRow, selector: "[checkBoxRow]", inputs: ["checkBoxId", "checkBoxName", "checkBoxValue"], outputs: ["checkBoxValueChange"] }, { kind: "directive", type: TableColumnHeader, selector: "[headerCell]", inputs: ["headerName", "columnSize", "filterRouting", "tableName", "sortName", "centerCell", "tableFilters"], outputs: ["onSortChange", "tableFiltersChange"] }, { kind: "directive", type: TableRow, selector: "[tableRow]" }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }, { kind: "pipe", type: ImageSrcPipe, name: "imgSrc" }], animations: [
|
|
3025
|
+
listAnnimation
|
|
3026
|
+
] });
|
|
3027
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TableViewComponent, decorators: [{
|
|
3028
|
+
type: Component,
|
|
3029
|
+
args: [{ selector: 'table-view', animations: [
|
|
3030
|
+
listAnnimation
|
|
3031
|
+
], template: "<div class=\"table-view\" [@listAnimation]=\"picturesList.length\">\n <wz-table\n [checkbox]=\"true\"\n (toggleAllCheckBox)=\"onToggleAllCheckBoxRow($event)\"\n [(tableFilters)]=\"tableFilters\"\n (tableFiltersChange)=\"onFiltersChange()\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [disablePagniation]=\"displayPexelsResults\"\n [isLoading]=\"isLoading\"\n >\n <!-- Header Section -->\n <div\n headerCell\n [headerName]=\"'ImgManager.ImgList.titleImgName' | translate\"\n columnSize=\"2\"\n sortName=\"name\"\n ></div>\n <div\n headerCell\n centerCell=\"center\"\n [headerName]=\"'ImgManager.ImgList.titleResolution' | translate\"\n ></div>\n <div headerCell columnSize=\"0\"></div>\n\n <!-- Body Section -->\n <div\n tableRow\n checkBoxRow\n [checkBoxValue]=\"picture.delSelected\"\n (checkBoxValueChange)=\"onToggleDelSelection(index)\"\n *ngFor=\"let picture of picturesList; let index = index\"\n >\n\n <div tableColumn columnSize=\"2\">\n <div class=\"table-view__row__container\">\n <div\n class=\"table-view__row__container__imgContainer\"\n [ngClass]=\"{'imgSelected': picture.selected}\"\n (click)=\"onToggleSelectImg(index)\">\n <img\n class=\"table-view__row__container__imgContainer__img\"\n [src]=\"picture.file_name | imgSrc : '100'\"\n alt=\"picture.display_name\"\n [ngClass]=\"{'pictureDeletion': picture.deleted}\"\n (error)=\"picture.imgNotLoaded=true;onPictureNotLoading($event);\"\n />\n <!-- If the img is not loaded, or the link is broken, an icon is displayed -->\n <div\n *ngIf=\"picture.imgNotLoaded\"\n class=\"table-view__row__container__imgContainer__overlay\"\n >\n <i class=\"fad fa-folder-times\"></i>\n </div>\n </div>\n <input\n type=\"text\"\n class=\"wzImgMngInput table-view__row__container__name\"\n [(ngModel)]=\"picture.display_name\"\n (focus)=\"previousName=picture.display_name\"\n (blur)=\"onNameChange(picture.id_file)\"\n (click)=\"onToggleDelSelection(index)\"\n [ngClass]=\"{'desabled': picture.deleted}\"\n [disabled]=\"picture.deleted\"\n >\n </div>\n </div>\n\n <div\n tableColumn\n centerCell=\"center\"\n (click)=\"onToggleDelSelection(index)\"\n >\n <p class=\"grey\">{{picture.raw_height}}x{{picture.raw_width}}</p>\n </div>\n\n <div tableColumn centerCell=\"center\" columnSize=\"0\" class=\"table-view__dropdown-options\">\n <!-- Dropdown -->\n <dropdown dropdownId=\"dropdown-options\" [disable]=\"picture.deleted\">\n <ng-container label>\n <div class=\"table-view__dropdown-options__label rotate\">\n <span> <i class=\"far fa-ellipsis-h is-size-4\" aria-haspopup=\"true\" aria-controls=\"dropdown-menu\"> </i> </span>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onDownloadImg(picture.display_name, picture.file_name)\"\n >\n <i class=\"far fa-download download\"></i> \n <p>{{ 'ImgManager.ImgList.download' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onEdit(picture)\"\n >\n <i class=\"far fa-crop-alt edit\"></i> \n <p>{{ 'ImgManager.ImgList.edit' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onRemoveImg(picture)\"\n >\n <i class=\"fal fa-times deleted\"></i> \n <p>{{ 'ImgManager.ImgList.remove' | translate }}</p>\n </div>\n </ng-container>\n </dropdown>\n </div>\n </div>\n </wz-table>\n</div>\n" }]
|
|
3032
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgSelectionService }, { type: i3.HttpClient }, { type: ImgCDNService }, { type: ImgEventService }, { type: AlertService }, { type: i7.TranslateService }, { type: ImgManagerConfigService }]; } });
|
|
3033
|
+
|
|
3034
|
+
class ImagesViewComponent {
|
|
3035
|
+
constructor(imgManager, imgEventService, imgSelectionService, alertService, userSettingsService, renamePictureService) {
|
|
3036
|
+
this.imgManager = imgManager;
|
|
3037
|
+
this.imgEventService = imgEventService;
|
|
3038
|
+
this.imgSelectionService = imgSelectionService;
|
|
3039
|
+
this.alertService = alertService;
|
|
3040
|
+
this.userSettingsService = userSettingsService;
|
|
3041
|
+
this.renamePictureService = renamePictureService;
|
|
3042
|
+
this.listDisplayed = false; // Display format list or mosaic
|
|
3043
|
+
this.multipleImgMode = false;
|
|
3044
|
+
this.switchDisplayWindow = new EventEmitter();
|
|
3045
|
+
// Data filters
|
|
3046
|
+
this.tableFilters = {
|
|
3047
|
+
sort: undefined,
|
|
3048
|
+
order: undefined,
|
|
3049
|
+
searchValue: '',
|
|
3050
|
+
totalItems: 0,
|
|
3051
|
+
itemsPerPage: 0,
|
|
3052
|
+
currentPage: 1
|
|
3053
|
+
};
|
|
3054
|
+
this.widthLargeCard = 219; // Default value of a card width 199 + margin 20
|
|
3055
|
+
this.widthSmallCard = 160; // Default value of a card width 140 + margin 20
|
|
3056
|
+
this.nbFakeImg = 0;
|
|
3057
|
+
this.imgFullWidthConfig = [
|
|
3058
|
+
{
|
|
3059
|
+
max: 419,
|
|
3060
|
+
largeImgWidthFactor: 1,
|
|
3061
|
+
smallImgWidthFactor: 0.5
|
|
3062
|
+
},
|
|
3063
|
+
{
|
|
3064
|
+
max: 499,
|
|
3065
|
+
largeImgWidthFactor: 1,
|
|
3066
|
+
smallImgWidthFactor: 0.5
|
|
3067
|
+
},
|
|
3068
|
+
{
|
|
3069
|
+
max: 719,
|
|
3070
|
+
largeImgWidthFactor: 0.5,
|
|
3071
|
+
smallImgWidthFactor: 0.3333
|
|
3072
|
+
},
|
|
3073
|
+
{
|
|
3074
|
+
max: 1023,
|
|
3075
|
+
largeImgWidthFactor: 0.3333,
|
|
3076
|
+
smallImgWidthFactor: 0.2
|
|
3077
|
+
},
|
|
3078
|
+
{
|
|
3079
|
+
max: 1399,
|
|
3080
|
+
largeImgWidthFactor: 0.25,
|
|
3081
|
+
smallImgWidthFactor: 0.125
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
max: 1599,
|
|
3085
|
+
largeImgWidthFactor: 0.2,
|
|
3086
|
+
smallImgWidthFactor: 0.1111
|
|
3087
|
+
},
|
|
3088
|
+
{
|
|
3089
|
+
largeImgWidthFactor: 0.1666,
|
|
3090
|
+
smallImgWidthFactor: 0.1
|
|
3091
|
+
}
|
|
3092
|
+
];
|
|
3093
|
+
this.imgWidthConfig = [
|
|
3094
|
+
{
|
|
3095
|
+
max: 1024,
|
|
3096
|
+
largeImgWidthFactor: 0.25,
|
|
3097
|
+
smallImgWidthFactor: 0.125
|
|
3098
|
+
},
|
|
3099
|
+
{
|
|
3100
|
+
max: 1199,
|
|
3101
|
+
largeImgWidthFactor: 0.3333,
|
|
3102
|
+
smallImgWidthFactor: 0.2
|
|
3103
|
+
},
|
|
3104
|
+
{
|
|
3105
|
+
max: 1299,
|
|
3106
|
+
largeImgWidthFactor: 0.3333,
|
|
3107
|
+
smallImgWidthFactor: 0.1666
|
|
3108
|
+
},
|
|
3109
|
+
{
|
|
3110
|
+
max: 1399,
|
|
3111
|
+
largeImgWidthFactor: 0.25,
|
|
3112
|
+
smallImgWidthFactor: 0.1666
|
|
3113
|
+
},
|
|
3114
|
+
{
|
|
3115
|
+
max: 1599,
|
|
3116
|
+
largeImgWidthFactor: 0.25,
|
|
3117
|
+
smallImgWidthFactor: 0.14
|
|
3118
|
+
},
|
|
3119
|
+
{
|
|
3120
|
+
largeImgWidthFactor: 0.25,
|
|
3121
|
+
smallImgWidthFactor: 0.125
|
|
3122
|
+
}
|
|
3123
|
+
];
|
|
3124
|
+
this.searchQueryChanged = new Subject();
|
|
3125
|
+
this.filtersChanged = new Subject();
|
|
3126
|
+
this.picturesList = [];
|
|
3127
|
+
this.savePictureList = [];
|
|
3128
|
+
this.nbImgToDelSelected = 0;
|
|
3129
|
+
this.disable = false; // Use to disable action during server request
|
|
3130
|
+
this.isLoading = true;
|
|
3131
|
+
this.isTotalRetieved = false;
|
|
3132
|
+
this.delListImgLoader = false;
|
|
3133
|
+
this.initComponent = true;
|
|
3134
|
+
this.failLoaded = false;
|
|
3135
|
+
this.displayPexelsResults = false; // Use when no img find by name, display img from Pexels
|
|
3136
|
+
this.confirmImgSup = false;
|
|
3137
|
+
// Paginator Params
|
|
3138
|
+
this.pageIndex = 0;
|
|
3139
|
+
this.length = 0;
|
|
3140
|
+
this.pageSize = 30; // Default value
|
|
3141
|
+
this.pageSizeOptions = [25, 50, 100, 250];
|
|
3142
|
+
this.errorGetAllImg = 'ImgManager.ImgLib.errorGetAllImg';
|
|
3143
|
+
this.errorGetTotalImg = 'ImgManager.ImgLib.errorGetTotalImg';
|
|
3144
|
+
this.errorGetImg = 'ImgManager.ImgLib.errorGetCanvaImg';
|
|
3145
|
+
this.msgNoImgFound = 'ImgManager.ImgLib.noImgFound';
|
|
3146
|
+
this.errorRemoveImg = 'ImgManager.ImgList.errorRemoveImg';
|
|
3147
|
+
}
|
|
3148
|
+
ngOnInit() {
|
|
3149
|
+
/* if (this.maxLengthCardShow) {
|
|
3150
|
+
this.reducePictureListMaxLength();
|
|
3151
|
+
} */
|
|
3152
|
+
this.setEvents();
|
|
3153
|
+
this.imgSelectedList = this.imgSelectionService.getImgSelection();
|
|
3154
|
+
}
|
|
3155
|
+
ngAfterViewInit() {
|
|
3156
|
+
this.setNbImgToDisplay();
|
|
3157
|
+
this._getImgList();
|
|
3158
|
+
if (!this.savePictureList) {
|
|
3159
|
+
this.savePictureList = this.picturesList;
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
/* reducePictureListMaxLength() {
|
|
3163
|
+
this.picturesList.splice(0, this.maxLengthCardShow);
|
|
3164
|
+
} */
|
|
3165
|
+
getImgList() {
|
|
3166
|
+
this.filtersChanged.next();
|
|
3167
|
+
}
|
|
3168
|
+
/**
|
|
3169
|
+
* true : go to list display
|
|
3170
|
+
* false : go to mosaic display
|
|
3171
|
+
* @param activate
|
|
3172
|
+
*/
|
|
3173
|
+
onSwitchFormatDisplayed(activate) {
|
|
3174
|
+
this.listDisplayed = activate;
|
|
3175
|
+
this.userSettingsService.setUserDisplayPreference(activate);
|
|
3176
|
+
this.imgEventService.emitlistDisplayedChange(activate);
|
|
3177
|
+
}
|
|
3178
|
+
/**
|
|
3179
|
+
* Calcul the number of img selected for masse deletion
|
|
3180
|
+
*/
|
|
3181
|
+
onImgSelected() {
|
|
3182
|
+
this.setNbImgToDelSelected();
|
|
3183
|
+
}
|
|
3184
|
+
onShowImgUploaded() {
|
|
3185
|
+
this.searchText = null;
|
|
3186
|
+
this.searchedValue = null;
|
|
3187
|
+
this.getImgList();
|
|
3188
|
+
}
|
|
3189
|
+
onRenamePicture(pictureRenamed) {
|
|
3190
|
+
console.log('onRenamePicture pictureRenamed', pictureRenamed);
|
|
3191
|
+
this.renamePictureService.onRenamePicture(pictureRenamed);
|
|
3192
|
+
}
|
|
3193
|
+
removeListImg() {
|
|
3194
|
+
if (this.disable) {
|
|
3195
|
+
return;
|
|
3196
|
+
}
|
|
3197
|
+
this.disable = true;
|
|
3198
|
+
this.delListImgLoader = true;
|
|
3199
|
+
this.confirmImgSup = false;
|
|
3200
|
+
// Get the id of the img to remove
|
|
3201
|
+
// And add deleted property
|
|
3202
|
+
const idImgToRemove = [];
|
|
3203
|
+
this.picturesList.forEach(img => {
|
|
3204
|
+
if (img.delSelected) {
|
|
3205
|
+
img.deleted = true;
|
|
3206
|
+
idImgToRemove.push(img.id_file);
|
|
3207
|
+
}
|
|
3208
|
+
});
|
|
3209
|
+
this.imgManager.removeMultipleImg(idImgToRemove).subscribe(() => {
|
|
3210
|
+
this.getImgList();
|
|
3211
|
+
this.imgSelectionService.removeImgSelectionByIds(idImgToRemove);
|
|
3212
|
+
}, error => {
|
|
3213
|
+
this.getImgList();
|
|
3214
|
+
this.alertService.openAlert(this.errorRemoveImg);
|
|
3215
|
+
});
|
|
3216
|
+
}
|
|
3217
|
+
selectImgChosen() {
|
|
3218
|
+
if (this.disable) {
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
const picturesListSelected = [];
|
|
3222
|
+
this.picturesList.map(img => {
|
|
3223
|
+
if (img.delSelected) {
|
|
3224
|
+
img.delSelected = false;
|
|
3225
|
+
img.selected = true;
|
|
3226
|
+
}
|
|
3227
|
+
if (img.selected) {
|
|
3228
|
+
picturesListSelected.push(img);
|
|
3229
|
+
}
|
|
3230
|
+
});
|
|
3231
|
+
this.setNbImgToDelSelected();
|
|
3232
|
+
this.imgSelectionService.setImgSelection(picturesListSelected);
|
|
3233
|
+
}
|
|
3234
|
+
displayConfirmImgSup() {
|
|
3235
|
+
if (this.disable) {
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
3238
|
+
this.confirmImgSup = true;
|
|
3239
|
+
}
|
|
3240
|
+
cancelSup() {
|
|
3241
|
+
this.confirmImgSup = false;
|
|
3242
|
+
}
|
|
3243
|
+
/**
|
|
3244
|
+
* Event emit when a img selected in order to delete
|
|
3245
|
+
*/
|
|
3246
|
+
onPicturesListChange() {
|
|
3247
|
+
this.setNbImgToDelSelected();
|
|
3248
|
+
}
|
|
3249
|
+
onFiltersChange() {
|
|
3250
|
+
this.getImgList();
|
|
3251
|
+
}
|
|
3252
|
+
/**
|
|
3253
|
+
* Set default number of img per page to display at the initialisation
|
|
3254
|
+
* This number is between 30 and 50
|
|
3255
|
+
*/
|
|
3256
|
+
setNbImgToDisplay() {
|
|
3257
|
+
const containerWidth = this.imgLibContainer.nativeElement.offsetWidth + 30; // + 30px -> left + right margin
|
|
3258
|
+
const scrollWidth = window.innerWidth - document.body.offsetWidth;
|
|
3259
|
+
const [maxImgWidthFactor, minImgWidthFactor] = this.getImgWidthFactors();
|
|
3260
|
+
const minImgWidth = Math.floor(containerWidth * minImgWidthFactor);
|
|
3261
|
+
const maxImgWidth = Math.ceil((containerWidth + scrollWidth) * maxImgWidthFactor);
|
|
3262
|
+
this.nbMaxImgPerLine = Math.floor(containerWidth / minImgWidth);
|
|
3263
|
+
this.nbMinImgPerLine = Math.floor((containerWidth + scrollWidth) / maxImgWidth);
|
|
3264
|
+
this.pageSize = this.getTotalImgPerPage();
|
|
3265
|
+
}
|
|
3266
|
+
getImgWidthFactors() {
|
|
3267
|
+
const screenWidth = window.innerWidth;
|
|
3268
|
+
let minWidth = 0;
|
|
3269
|
+
let imgSizesConfig = [];
|
|
3270
|
+
const currentImgWidthConfig = this.fullSize ? this.imgFullWidthConfig : this.imgWidthConfig;
|
|
3271
|
+
for (const widthConfig of currentImgWidthConfig) {
|
|
3272
|
+
if (!widthConfig.max) {
|
|
3273
|
+
imgSizesConfig = [widthConfig.largeImgWidthFactor, widthConfig.smallImgWidthFactor];
|
|
3274
|
+
break;
|
|
3275
|
+
}
|
|
3276
|
+
if (minWidth < screenWidth && screenWidth <= widthConfig.max) {
|
|
3277
|
+
imgSizesConfig = [widthConfig.largeImgWidthFactor, widthConfig.smallImgWidthFactor];
|
|
3278
|
+
break;
|
|
3279
|
+
}
|
|
3280
|
+
minWidth = widthConfig.max;
|
|
3281
|
+
}
|
|
3282
|
+
return imgSizesConfig;
|
|
3283
|
+
}
|
|
3284
|
+
getTotalImgPerPage() {
|
|
3285
|
+
if (this.nbRowToShow) {
|
|
3286
|
+
const nbImgPerLine = this.stateDisplayed === 'full' ? this.nbMinImgPerLine : this.nbMaxImgPerLine;
|
|
3287
|
+
return nbImgPerLine * this.nbRowToShow;
|
|
3288
|
+
}
|
|
3289
|
+
let total = this.nbMinImgPerLine;
|
|
3290
|
+
while (total < 30 || total % this.nbMaxImgPerLine !== 0 || total % this.nbMinImgPerLine !== 0) {
|
|
3291
|
+
total += this.nbMinImgPerLine;
|
|
3292
|
+
}
|
|
3293
|
+
return total;
|
|
3294
|
+
}
|
|
3295
|
+
setParams() {
|
|
3296
|
+
var _a;
|
|
3297
|
+
this.params = {
|
|
3298
|
+
limit: ((_a = this.maxLengthCardShow) === null || _a === void 0 ? void 0 : _a.toString()) || (this.tableFilters.itemsPerPage ? this.tableFilters.itemsPerPage.toString() : this.pageSize.toString()),
|
|
3299
|
+
page: this.tableFilters.currentPage.toString()
|
|
3300
|
+
};
|
|
3301
|
+
if (this.tableFilters.searchValue) {
|
|
3302
|
+
this.params["display_name:contains"] = this.tableFilters.searchValue.toString();
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
initVariables(loadingSuccess) {
|
|
3306
|
+
this.nbImgToDelSelected = 0;
|
|
3307
|
+
this.disable = false;
|
|
3308
|
+
this.isLoading = false;
|
|
3309
|
+
this.delListImgLoader = false;
|
|
3310
|
+
this.initComponent = false;
|
|
3311
|
+
this.displayPexelsResults = false;
|
|
3312
|
+
this.failLoaded = !loadingSuccess;
|
|
3313
|
+
this.nbFakeImg = 0;
|
|
3314
|
+
}
|
|
3315
|
+
selectImgSelected() {
|
|
3316
|
+
if (!this.imgSelectedList || !this.imgSelectedList.length) {
|
|
3317
|
+
return;
|
|
3318
|
+
}
|
|
3319
|
+
const idImgSlectedList = [];
|
|
3320
|
+
this.imgSelectedList.forEach(img => idImgSlectedList.push(img.id_file));
|
|
3321
|
+
this.picturesList.forEach(picture => {
|
|
3322
|
+
if (idImgSlectedList.indexOf(picture.id_file) !== -1) {
|
|
3323
|
+
picture.selected = true;
|
|
3324
|
+
}
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
displayPexelsLib() {
|
|
3328
|
+
this.displayPexelsResults = true;
|
|
3329
|
+
this.alertService.openAlert(this.msgNoImgFound);
|
|
3330
|
+
}
|
|
3331
|
+
/**
|
|
3332
|
+
* Set a img list in order to fill properly all the line of images displayed in mosaic.
|
|
3333
|
+
* Otherwise, the space-between css will do a bad display
|
|
3334
|
+
*/
|
|
3335
|
+
calculNbImgFake(nbImgDisplayed) {
|
|
3336
|
+
const nbImgPerLine = this.stateDisplayed === 'small' || this.tabDisplayed === 'img-upload' ? this.nbMaxImgPerLine : this.nbMinImgPerLine;
|
|
3337
|
+
if (nbImgDisplayed % nbImgPerLine !== 0) {
|
|
3338
|
+
this.nbFakeImg = nbImgPerLine - nbImgDisplayed % nbImgPerLine;
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
getImg(id_file) {
|
|
3342
|
+
this.imgManager.getShopImg(id_file).pipe(take(1)).subscribe((picture) => {
|
|
3343
|
+
if (!this.imgAlreadyExist(picture.id_file)) {
|
|
3344
|
+
// check the img is not already present
|
|
3345
|
+
this.picturesList.unshift(picture);
|
|
3346
|
+
this.length += 1;
|
|
3347
|
+
}
|
|
3348
|
+
}, error => {
|
|
3349
|
+
this.alertService.openAlert(this.errorGetImg);
|
|
3350
|
+
});
|
|
3351
|
+
}
|
|
3352
|
+
imgAlreadyExist(id_file) {
|
|
3353
|
+
for (const img of this.picturesList) {
|
|
3354
|
+
if (img.id_file === id_file) {
|
|
3355
|
+
return true;
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
return false;
|
|
3359
|
+
}
|
|
3360
|
+
setNbImgToDelSelected() {
|
|
3361
|
+
this.nbImgToDelSelected = this.picturesList.filter(img => img.delSelected).length;
|
|
3362
|
+
if (!this.nbImgToDelSelected) {
|
|
3363
|
+
this.confirmImgSup = false;
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
setEvents() {
|
|
3367
|
+
// Add a timer to retrieve img when the search bar or the paginator are used
|
|
3368
|
+
this.searchQueryChanged
|
|
3369
|
+
.pipe(debounceTime(400)) // wait 0.5 sec after the last event before emitting last event
|
|
3370
|
+
.subscribe(data => {
|
|
3371
|
+
this.getImgList();
|
|
3372
|
+
});
|
|
3373
|
+
this.filtersChanged
|
|
3374
|
+
.pipe(debounceTime(800)) // wait 0.8 sec after the last event before emitting last event
|
|
3375
|
+
.subscribe(data => {
|
|
3376
|
+
this._getImgList();
|
|
3377
|
+
});
|
|
3378
|
+
// Reload img when img is/are removed
|
|
3379
|
+
this.imgRemovedEvent = this.imgEventService.getImgRemovedEventListner().subscribe(id_file => {
|
|
3380
|
+
this.getImgList();
|
|
3381
|
+
});
|
|
3382
|
+
// Create img from Canva
|
|
3383
|
+
this.imgAddedEvent = this.imgEventService.getImgAddedEventListner().subscribe(id_file => {
|
|
3384
|
+
if (id_file && !this.imgAlreadyExist(id_file)) {
|
|
3385
|
+
this.getImg(id_file);
|
|
3386
|
+
}
|
|
3387
|
+
});
|
|
3388
|
+
this.imgSelectionChange = this.imgSelectionService.getImgSelectionChange().subscribe(imgSelection => {
|
|
3389
|
+
if (this.listDisplayed) {
|
|
3390
|
+
return;
|
|
3391
|
+
}
|
|
3392
|
+
const idFileList = [];
|
|
3393
|
+
imgSelection.map(img => idFileList.push(img.id_file));
|
|
3394
|
+
for (const picture of this.picturesList) {
|
|
3395
|
+
if (idFileList.indexOf(picture.id_file) === -1) {
|
|
3396
|
+
picture.selected = false;
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3401
|
+
_getImgList() {
|
|
3402
|
+
this.isLoading = true;
|
|
3403
|
+
this.displayPexelsResults = false;
|
|
3404
|
+
this.setParams();
|
|
3405
|
+
this.refreshTotalImgList();
|
|
3406
|
+
this.imgManager.getShopImgList(this.params).pipe(take(1)).subscribe((data) => {
|
|
3407
|
+
this.initVariables(true);
|
|
3408
|
+
const nbImgDisplayed = data.data.length;
|
|
3409
|
+
this.calculNbImgFake(nbImgDisplayed);
|
|
3410
|
+
this.picturesList = data.data;
|
|
3411
|
+
this.renamePictureService.setPicturesList(this.picturesList);
|
|
3412
|
+
this.selectImgSelected();
|
|
3413
|
+
this.length = this.isTotalRetieved ? this.length : data.totalRecords;
|
|
3414
|
+
this.tableFilters.totalItems = this.isTotalRetieved ? this.tableFilters.totalItems : data.totalRecords;
|
|
3415
|
+
this.tableFilters.itemsPerPage = this.tableFilters.itemsPerPage ? this.tableFilters.itemsPerPage : this.pageSize;
|
|
3416
|
+
// Display Pexels if no result
|
|
3417
|
+
if (data.totalRecords === 0) {
|
|
3418
|
+
this.displayPexelsLib();
|
|
3419
|
+
}
|
|
3420
|
+
}, error => {
|
|
3421
|
+
this.alertService.openAlert(this.errorGetAllImg);
|
|
3422
|
+
this.initVariables(false);
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
refreshTotalImgList() {
|
|
3426
|
+
const searchValue = this.tableFilters.searchValue;
|
|
3427
|
+
if (this.isTotalRetieved && searchValue === this.previousSearchValue) {
|
|
3428
|
+
// Keep current total result
|
|
3429
|
+
return;
|
|
3430
|
+
}
|
|
3431
|
+
this.isTotalRetieved = false;
|
|
3432
|
+
this.imgManager.getShopTotalImgList(this.params).pipe(take(1)).subscribe((data) => {
|
|
3433
|
+
this.previousSearchValue = searchValue;
|
|
3434
|
+
this.isTotalRetieved = true;
|
|
3435
|
+
this.length = data.totalRecords;
|
|
3436
|
+
this.tableFilters.totalItems = data.totalRecords;
|
|
3437
|
+
}, error => {
|
|
3438
|
+
//this.alertService.openAlert(this.errorGetTotalImg);
|
|
3439
|
+
this.initVariables(false);
|
|
3440
|
+
});
|
|
3441
|
+
}
|
|
3442
|
+
switchDisplayWindowMosaic() {
|
|
3443
|
+
this.switchDisplayWindow.emit(true);
|
|
3444
|
+
}
|
|
3445
|
+
ngOnDestroy() {
|
|
3446
|
+
this.searchQueryChanged.unsubscribe();
|
|
3447
|
+
this.imgRemovedEvent.unsubscribe();
|
|
3448
|
+
this.imgAddedEvent.unsubscribe();
|
|
3449
|
+
this.imgSelectionChange.unsubscribe();
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
ImagesViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImagesViewComponent, deps: [{ token: ImgManagerService }, { token: ImgEventService }, { token: ImgSelectionService }, { token: AlertService }, { token: UserSettingsService }, { token: RenamePictureService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3453
|
+
ImagesViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ImagesViewComponent, selector: "images-view", inputs: { stateDisplayed: "stateDisplayed", tabDisplayed: "tabDisplayed", fullSize: "fullSize", maxLengthCardShow: "maxLengthCardShow", nbRowToShow: "nbRowToShow", listDisplayed: "listDisplayed", multipleImgMode: "multipleImgMode" }, outputs: { switchDisplayWindow: "switchDisplayWindow" }, viewQueries: [{ propertyName: "imgLibContainer", first: true, predicate: ["imgLibContainer"], descendants: true }], ngImport: i0, template: "<div class=\"images-view\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n <!-- Subheader : Img number and actions btn (sup img list, switch forma display) -->\n <div\n *ngIf=\"(stateDisplayed !== 'small' || tabDisplayed === 'img-upload')\"\n class=\"images-view__container\"\n [ngClass]=\"{'images-view__container--uploadTab': tabDisplayed === 'img-upload', 'images-view__container--window': stateDisplayed === 'window'}\"\n >\n\n <div *ngIf=\"tabDisplayed !== 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.nbImg' | translate }} : {{length}}</p>\n </div>\n <div *ngIf=\"tabDisplayed === 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.lastImgs' | translate }}</p>\n </div>\n\n <div class=\"field has-addons subHeaderActions\" *ngIf=\"tabDisplayed !== 'img-upload'\">\n\n <!-- For listforma : Display btn del multiple img & Confirm action -->\n <div class=\"images-view__container__boxAction\">\n\n\n <!-- S\u00E9lectionner -->\n <button\n class=\"button success images-view__container__boxAction__import\"\n @insertRemoveAnnim\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup && !delListImgLoader && multipleImgMode\"\n (click)=\"selectImgChosen()\"\n >\n <i class=\"fal fa-check\"></i>\n {{ 'ImgManager.ImgLib.select' | translate }} ({{nbImgToDelSelected}})\n </button>\n\n <!-- Display btn del multiple img -->\n <button\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup\"\n (click)=\"displayConfirmImgSup()\"\n class=\"button images-view__container__boxAction__delBtn danger\"\n @insertRemoveAnnim\n >\n <i class=\"fal fa-times\"></i>{{ 'ImgManager.ImgLib.delMlt' | translate }} ({{nbImgToDelSelected}})\n <span btnLoadingAnim *ngIf=\"delListImgLoader\" class=\"btnLoadingAnnimation\"></span>\n </button>\n\n <!-- Confirm action -->\n <div\n class=\"images-view__container__boxAction__confirmSup\"\n [ngClass]=\"{'images-view__container__boxAction__confirmSup--visible': confirmImgSup}\">\n <p *ngIf=\"nbImgToDelSelected > 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestions' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <p *ngIf=\"nbImgToDelSelected === 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestion' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <div>\n <button\n class=\"button images-view__container__boxAction__confirmSup__cancel\"\n (click)=\"cancelSup()\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <button\n (click)=\"removeListImg()\"\n class=\"button images-view__container__delBtn danger\"\n >\n {{ 'ImgManager.ImgLib.confirm' | translate }}\n </button>\n </div>\n </div>\n\n </div>\n\n\n <!-- Swith mosaic/list forma -->\n <div class=\"field has-addons images-view__container__buttonBox\">\n <div class=\"control\">\n <div\n class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': !listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(false)\"\n >\n <span class=\"icon is-small\">\n <i class=\"far fa-th\"></i>\n </span>\n </div>\n </div>\n\n <div class=\"control\">\n <div class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(true)\"\n >\n <span class=\"icon is-small\">\n <i class=\"fas fa-bars\"></i>\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n <!-- Images section -->\n<perfect-scrollbar\n [config]=\"{ suppressScrollX: true }\"\n class=\"images-view__scroll\"\n [ngClass]=\"{\n 'images-view__scroll--hide--mosaic': displayPexelsResults && !listDisplayed,\n 'images-view__scroll--hide--mosaic--small': displayPexelsResults && !listDisplayed && stateDisplayed === 'small',\n 'images-view__scroll--hide--table': displayPexelsResults && listDisplayed,\n 'images-view__scroll--full': stateDisplayed === 'full',\n 'images-view__scroll--smallDisplay' : stateDisplayed === 'small' && tabDisplayed !== 'img-upload',\n 'images-view__scroll--smallUploadDisplay' : stateDisplayed === 'small' && tabDisplayed === 'img-upload',\n 'images-view__scroll--window': stateDisplayed === 'window'\n}\"\n>\n <div #imgLibContainer class=\"images-view__wrapper\">\n <div *ngIf=\"!listDisplayed || stateDisplayed === 'small'\" [@easeInOut]=\"'in'\">\n <mosaic-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowMosaic()\"\n [nbFakeImg]=\"nbFakeImg\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [isLoading]=\"isLoading\"\n [fullSize]=\"fullSize\"\n >\n </mosaic-view>\n </div>\n\n <div *ngIf=\"listDisplayed && stateDisplayed !== 'small'\" [@easeInOut]=\"'in'\">\n <table-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [stateDisplayed]=\"stateDisplayed\"\n [isLoading]=\"isLoading\"\n >\n </table-view>\n </div>\n\n </div>\n</perfect-scrollbar>\n\n<!-- Pexels Section - When no img found -->\n<div\n *ngIf=\"displayPexelsResults\"\n class=\"images-view--pexels\"\n [@easeInOut]=\"'in'\">\n <pexels-lib\n [searchValue]=\"tableFilters.searchValue\"\n (showImgUploaded)=\"onShowImgUploaded()\"\n [disableSearch]=\"true\"\n >\n </pexels-lib>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "component", type: PexelLibComponent, selector: "pexels-lib", inputs: ["stateDisplayed", "searchValue", "disableSearch"], outputs: ["showImgUploaded"] }, { kind: "component", type: MosaicViewComponent, selector: "mosaic-view", inputs: ["tabDisplayed", "fullSize", "nbFakeImg"], outputs: ["switchDisplayWindow"] }, { kind: "component", type: TableViewComponent, selector: "table-view" }, { kind: "directive", type: LoadingDirective, selector: "[btnLoadingAnim]" }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }], animations: [
|
|
3454
|
+
easeInOut,
|
|
3455
|
+
insertRemove
|
|
3456
|
+
] });
|
|
3457
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImagesViewComponent, decorators: [{
|
|
3458
|
+
type: Component,
|
|
3459
|
+
args: [{ selector: 'images-view', animations: [
|
|
3460
|
+
easeInOut,
|
|
3461
|
+
insertRemove
|
|
3462
|
+
], template: "<div class=\"images-view\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n <!-- Subheader : Img number and actions btn (sup img list, switch forma display) -->\n <div\n *ngIf=\"(stateDisplayed !== 'small' || tabDisplayed === 'img-upload')\"\n class=\"images-view__container\"\n [ngClass]=\"{'images-view__container--uploadTab': tabDisplayed === 'img-upload', 'images-view__container--window': stateDisplayed === 'window'}\"\n >\n\n <div *ngIf=\"tabDisplayed !== 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.nbImg' | translate }} : {{length}}</p>\n </div>\n <div *ngIf=\"tabDisplayed === 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.lastImgs' | translate }}</p>\n </div>\n\n <div class=\"field has-addons subHeaderActions\" *ngIf=\"tabDisplayed !== 'img-upload'\">\n\n <!-- For listforma : Display btn del multiple img & Confirm action -->\n <div class=\"images-view__container__boxAction\">\n\n\n <!-- S\u00E9lectionner -->\n <button\n class=\"button success images-view__container__boxAction__import\"\n @insertRemoveAnnim\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup && !delListImgLoader && multipleImgMode\"\n (click)=\"selectImgChosen()\"\n >\n <i class=\"fal fa-check\"></i>\n {{ 'ImgManager.ImgLib.select' | translate }} ({{nbImgToDelSelected}})\n </button>\n\n <!-- Display btn del multiple img -->\n <button\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup\"\n (click)=\"displayConfirmImgSup()\"\n class=\"button images-view__container__boxAction__delBtn danger\"\n @insertRemoveAnnim\n >\n <i class=\"fal fa-times\"></i>{{ 'ImgManager.ImgLib.delMlt' | translate }} ({{nbImgToDelSelected}})\n <span btnLoadingAnim *ngIf=\"delListImgLoader\" class=\"btnLoadingAnnimation\"></span>\n </button>\n\n <!-- Confirm action -->\n <div\n class=\"images-view__container__boxAction__confirmSup\"\n [ngClass]=\"{'images-view__container__boxAction__confirmSup--visible': confirmImgSup}\">\n <p *ngIf=\"nbImgToDelSelected > 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestions' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <p *ngIf=\"nbImgToDelSelected === 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestion' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <div>\n <button\n class=\"button images-view__container__boxAction__confirmSup__cancel\"\n (click)=\"cancelSup()\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <button\n (click)=\"removeListImg()\"\n class=\"button images-view__container__delBtn danger\"\n >\n {{ 'ImgManager.ImgLib.confirm' | translate }}\n </button>\n </div>\n </div>\n\n </div>\n\n\n <!-- Swith mosaic/list forma -->\n <div class=\"field has-addons images-view__container__buttonBox\">\n <div class=\"control\">\n <div\n class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': !listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(false)\"\n >\n <span class=\"icon is-small\">\n <i class=\"far fa-th\"></i>\n </span>\n </div>\n </div>\n\n <div class=\"control\">\n <div class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(true)\"\n >\n <span class=\"icon is-small\">\n <i class=\"fas fa-bars\"></i>\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n <!-- Images section -->\n<perfect-scrollbar\n [config]=\"{ suppressScrollX: true }\"\n class=\"images-view__scroll\"\n [ngClass]=\"{\n 'images-view__scroll--hide--mosaic': displayPexelsResults && !listDisplayed,\n 'images-view__scroll--hide--mosaic--small': displayPexelsResults && !listDisplayed && stateDisplayed === 'small',\n 'images-view__scroll--hide--table': displayPexelsResults && listDisplayed,\n 'images-view__scroll--full': stateDisplayed === 'full',\n 'images-view__scroll--smallDisplay' : stateDisplayed === 'small' && tabDisplayed !== 'img-upload',\n 'images-view__scroll--smallUploadDisplay' : stateDisplayed === 'small' && tabDisplayed === 'img-upload',\n 'images-view__scroll--window': stateDisplayed === 'window'\n}\"\n>\n <div #imgLibContainer class=\"images-view__wrapper\">\n <div *ngIf=\"!listDisplayed || stateDisplayed === 'small'\" [@easeInOut]=\"'in'\">\n <mosaic-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowMosaic()\"\n [nbFakeImg]=\"nbFakeImg\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [isLoading]=\"isLoading\"\n [fullSize]=\"fullSize\"\n >\n </mosaic-view>\n </div>\n\n <div *ngIf=\"listDisplayed && stateDisplayed !== 'small'\" [@easeInOut]=\"'in'\">\n <table-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [stateDisplayed]=\"stateDisplayed\"\n [isLoading]=\"isLoading\"\n >\n </table-view>\n </div>\n\n </div>\n</perfect-scrollbar>\n\n<!-- Pexels Section - When no img found -->\n<div\n *ngIf=\"displayPexelsResults\"\n class=\"images-view--pexels\"\n [@easeInOut]=\"'in'\">\n <pexels-lib\n [searchValue]=\"tableFilters.searchValue\"\n (showImgUploaded)=\"onShowImgUploaded()\"\n [disableSearch]=\"true\"\n >\n </pexels-lib>\n</div>\n" }]
|
|
3463
|
+
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgEventService }, { type: ImgSelectionService }, { type: AlertService }, { type: UserSettingsService }, { type: RenamePictureService }]; }, propDecorators: { stateDisplayed: [{
|
|
3464
|
+
type: Input
|
|
3465
|
+
}], tabDisplayed: [{
|
|
3466
|
+
type: Input
|
|
3467
|
+
}], fullSize: [{
|
|
3468
|
+
type: Input
|
|
3469
|
+
}], maxLengthCardShow: [{
|
|
3470
|
+
type: Input
|
|
3471
|
+
}], nbRowToShow: [{
|
|
3472
|
+
type: Input
|
|
3473
|
+
}], listDisplayed: [{
|
|
3474
|
+
type: Input
|
|
3475
|
+
}], multipleImgMode: [{
|
|
3476
|
+
type: Input
|
|
3477
|
+
}], switchDisplayWindow: [{
|
|
3478
|
+
type: Output
|
|
3479
|
+
}], imgLibContainer: [{
|
|
3480
|
+
type: ViewChild,
|
|
3481
|
+
args: ['imgLibContainer']
|
|
3482
|
+
}] } });
|
|
3483
|
+
|
|
3484
|
+
class ZindexToggleDirective {
|
|
3485
|
+
constructor(currentElement, renderer) {
|
|
3486
|
+
this.currentElement = currentElement;
|
|
3487
|
+
this.renderer = renderer;
|
|
3488
|
+
this.isActived = false;
|
|
3489
|
+
}
|
|
3490
|
+
set isActive(value) {
|
|
3491
|
+
this.isActived = value;
|
|
3492
|
+
this.switchToggle();
|
|
3493
|
+
}
|
|
3494
|
+
get isActive() {
|
|
3495
|
+
return this.isActived;
|
|
3496
|
+
}
|
|
3497
|
+
ngOnInit() {
|
|
3498
|
+
}
|
|
3499
|
+
switchToggle() {
|
|
3500
|
+
if (this.isActived) {
|
|
3501
|
+
this.renderer.addClass(this.currentElement.nativeElement.parentElement.parentNode, 'zindexToggle');
|
|
3502
|
+
}
|
|
3503
|
+
else {
|
|
3504
|
+
this.renderer.removeClass(this.currentElement.nativeElement.parentElement.parentNode, 'zindexToggle');
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
ngOnDestroy() {
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
ZindexToggleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ZindexToggleDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3511
|
+
ZindexToggleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: ZindexToggleDirective, selector: "[zIndexToggle]", inputs: { isActive: ["zIndexToggle", "isActive"] }, outputs: { onEventChange: "onEventChange" }, ngImport: i0 });
|
|
3512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ZindexToggleDirective, decorators: [{
|
|
3513
|
+
type: Directive,
|
|
3514
|
+
args: [{
|
|
3515
|
+
selector: '[zIndexToggle]'
|
|
3516
|
+
}]
|
|
3517
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { onEventChange: [{
|
|
3518
|
+
type: Output
|
|
3519
|
+
}], isActive: [{
|
|
3520
|
+
type: Input,
|
|
3521
|
+
args: ['zIndexToggle']
|
|
3522
|
+
}] } });
|
|
3523
|
+
|
|
3524
|
+
class SelectFiltersPipe {
|
|
3525
|
+
transform(items, filterName) {
|
|
3526
|
+
return items.filter(item => {
|
|
3527
|
+
const regexp = new RegExp(filterName, 'i');
|
|
3528
|
+
return regexp.test(item.name);
|
|
3529
|
+
});
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
SelectFiltersPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SelectFiltersPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
3533
|
+
SelectFiltersPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SelectFiltersPipe, name: "selectFilters" });
|
|
3534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SelectFiltersPipe, decorators: [{
|
|
3535
|
+
type: Pipe,
|
|
3536
|
+
args: [{
|
|
3537
|
+
name: 'selectFilters'
|
|
3538
|
+
}]
|
|
3539
|
+
}] });
|
|
3540
|
+
|
|
3541
|
+
class SelectComponent {
|
|
3542
|
+
constructor(translateService) {
|
|
3543
|
+
this.translateService = translateService;
|
|
3544
|
+
this.search = false;
|
|
3545
|
+
this.type = 'default';
|
|
3546
|
+
this.maxWidth = '100%';
|
|
3547
|
+
this.disabled = false;
|
|
3548
|
+
this.selectValue = new EventEmitter();
|
|
3549
|
+
this.clickOnCallToAction = new EventEmitter();
|
|
3550
|
+
this.openCategories = false;
|
|
3551
|
+
this.searchValue = '';
|
|
3552
|
+
this.indexItemSelected = -1;
|
|
3553
|
+
// ControlValueAccessor methods
|
|
3554
|
+
this.onChange = () => { };
|
|
3555
|
+
this.onTouch = () => { };
|
|
3556
|
+
}
|
|
3557
|
+
ngOnInit() {
|
|
3558
|
+
this.indexItemSelected = this.items.findIndex(item => item.selected);
|
|
3559
|
+
}
|
|
3560
|
+
onClose() {
|
|
3561
|
+
this.openCategories = false;
|
|
3562
|
+
}
|
|
3563
|
+
customTB(item, index) {
|
|
3564
|
+
return `${item.id}-${index}`;
|
|
3565
|
+
}
|
|
3566
|
+
onSelectItem(id) {
|
|
3567
|
+
this.unselectAll();
|
|
3568
|
+
this.setIndexItemSelected(id);
|
|
3569
|
+
const itemSelected = this.getItemSelected();
|
|
3570
|
+
itemSelected.selected = true;
|
|
3571
|
+
this.selectValue.emit(this.indexItemSelected);
|
|
3572
|
+
this.onChange(itemSelected);
|
|
3573
|
+
}
|
|
3574
|
+
onClickCallToAction() {
|
|
3575
|
+
this.onClose();
|
|
3576
|
+
this.clickOnCallToAction.emit(this.callToAction.value);
|
|
3577
|
+
}
|
|
3578
|
+
getItemSelected() {
|
|
3579
|
+
return this.items[this.indexItemSelected];
|
|
3580
|
+
}
|
|
3581
|
+
showCategories() {
|
|
3582
|
+
this.openCategories = true;
|
|
3583
|
+
setTimeout(() => {
|
|
3584
|
+
this.searchElement.nativeElement.focus();
|
|
3585
|
+
}, 0);
|
|
3586
|
+
}
|
|
3587
|
+
unselectAll() {
|
|
3588
|
+
this.items.forEach(item => item.selected = false);
|
|
3589
|
+
}
|
|
3590
|
+
setIndexItemSelected(id) {
|
|
3591
|
+
this.indexItemSelected = this.items.findIndex(item => item.id === id);
|
|
3592
|
+
}
|
|
3593
|
+
writeValue(selectItem) {
|
|
3594
|
+
if (!selectItem) {
|
|
3595
|
+
return;
|
|
3596
|
+
}
|
|
3597
|
+
this.unselectAll();
|
|
3598
|
+
selectItem.selected = true;
|
|
3599
|
+
this.setIndexItemSelected(selectItem.id);
|
|
3600
|
+
}
|
|
3601
|
+
registerOnChange(fn) {
|
|
3602
|
+
this.onChange = fn;
|
|
3603
|
+
}
|
|
3604
|
+
registerOnTouched(fn) {
|
|
3605
|
+
this.onTouch = fn;
|
|
3606
|
+
}
|
|
3607
|
+
}
|
|
3608
|
+
SelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SelectComponent, deps: [{ token: i7.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3609
|
+
SelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SelectComponent, selector: "wac-select", inputs: { items: "items", placeholder: "placeholder", label: "label", maxWidthItems: "maxWidthItems", search: "search", type: "type", callToAction: "callToAction", maxWidth: "maxWidth", disabled: "disabled" }, outputs: { selectValue: "selectValue", clickOnCallToAction: "clickOnCallToAction" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }], viewQueries: [{ propertyName: "searchElement", first: true, predicate: ["search"], descendants: true }], ngImport: i0, template: "<p *ngIf=\"label\" [innerHTML]=\"label\" class=\"wac-select__label\"></p>\n\n<div class=\"wac-select\" wzAutoHide (clickOutside)=\"onClose()\" [ngStyle]=\"{ 'max-width': maxWidth }\" [zIndexToggle]=\"openCategories\">\n\n <div class=\"wac-select__current\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && openCategories = !openCategories\" *ngIf=\"!search\">\n <span *ngIf=\"indexItemSelected !== -1\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span [innerHTML]=\"(indexItemSelected !== -1 ? items[indexItemSelected].name : placeholder) | translate\"></span><span><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__current wac-select__current--withSearch\" [ngClass]=\"{ 'select-disabled' : disabled, 'open-search': openCategories }\" *ngIf=\"search\">\n <div class=\"wac-select__current__search\" *ngIf=\"openCategories && !disabled\">\n <i class=\"far fa-search\"></i>\n <input #search type=\"text\" [(ngModel)]=\"searchValue\" />\n </div>\n <span (click)=\"openCategories = !openCategories;\" *ngIf=\"items[indexItemSelected]?.icon && !openCategories\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span (click)=\"showCategories()\" [innerHTML]=\"items[indexItemSelected]?.name ? items[indexItemSelected].name : placeholder\"></span>\n <span (click)=\"openCategories = !openCategories;\"><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openCategories, open: type === 'open' }\" [ngStyle]=\"{ 'max-width': maxWidthItems }\">\n <div [perfectScrollbar]=\"{ suppressScrollX: true }\" *ngIf=\"items.length\">\n\n <div *ngIf=\"callToAction\" class=\"wac-select__content__cta\">\n <div (click)=\"onClickCallToAction()\">\n <i *ngIf=\"callToAction.icon\" [classList]=\"callToAction.icon\"></i><strong *ngIf=\"callToAction.boldText\">{{ callToAction.boldText }}</strong\n ><span>{{ callToAction?.name }}</span>\n </div>\n </div>\n\n <div\n *ngFor=\"let item of items | selectFilters: searchValue; let index = index;\"\n (click)=\"onClose()\"\n class=\"wac-select__content__item\"\n >\n <div *ngIf=\"!item.hide\" [ngClass]=\"{ selected: item.selected }\" (click)=\"onSelectItem(item.id)\">\n <span class=\"icon\" [innerHTML]=\"item.icon\" *ngIf=\"item.icon\"></span>{{ item.name | translate }}\n </div>\n </div>\n\n </div>\n\n <div *ngIf=\"!(items | selectFilters: searchValue)?.length\" class=\"wac-select__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3$1.PerfectScrollbarDirective, selector: "[perfectScrollbar]", inputs: ["disabled", "perfectScrollbar"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "directive", type: AutoHideDirective, selector: "[wzAutoHide]", inputs: ["triggerElement", "forceOn"], outputs: ["clickOutside"] }, { kind: "directive", type: ZindexToggleDirective, selector: "[zIndexToggle]", inputs: ["zIndexToggle"], outputs: ["onEventChange"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }, { kind: "pipe", type: SelectFiltersPipe, name: "selectFilters" }] });
|
|
3610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SelectComponent, decorators: [{
|
|
3611
|
+
type: Component,
|
|
3612
|
+
args: [{ selector: 'wac-select', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }], template: "<p *ngIf=\"label\" [innerHTML]=\"label\" class=\"wac-select__label\"></p>\n\n<div class=\"wac-select\" wzAutoHide (clickOutside)=\"onClose()\" [ngStyle]=\"{ 'max-width': maxWidth }\" [zIndexToggle]=\"openCategories\">\n\n <div class=\"wac-select__current\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && openCategories = !openCategories\" *ngIf=\"!search\">\n <span *ngIf=\"indexItemSelected !== -1\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span [innerHTML]=\"(indexItemSelected !== -1 ? items[indexItemSelected].name : placeholder) | translate\"></span><span><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__current wac-select__current--withSearch\" [ngClass]=\"{ 'select-disabled' : disabled, 'open-search': openCategories }\" *ngIf=\"search\">\n <div class=\"wac-select__current__search\" *ngIf=\"openCategories && !disabled\">\n <i class=\"far fa-search\"></i>\n <input #search type=\"text\" [(ngModel)]=\"searchValue\" />\n </div>\n <span (click)=\"openCategories = !openCategories;\" *ngIf=\"items[indexItemSelected]?.icon && !openCategories\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span (click)=\"showCategories()\" [innerHTML]=\"items[indexItemSelected]?.name ? items[indexItemSelected].name : placeholder\"></span>\n <span (click)=\"openCategories = !openCategories;\"><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openCategories, open: type === 'open' }\" [ngStyle]=\"{ 'max-width': maxWidthItems }\">\n <div [perfectScrollbar]=\"{ suppressScrollX: true }\" *ngIf=\"items.length\">\n\n <div *ngIf=\"callToAction\" class=\"wac-select__content__cta\">\n <div (click)=\"onClickCallToAction()\">\n <i *ngIf=\"callToAction.icon\" [classList]=\"callToAction.icon\"></i><strong *ngIf=\"callToAction.boldText\">{{ callToAction.boldText }}</strong\n ><span>{{ callToAction?.name }}</span>\n </div>\n </div>\n\n <div\n *ngFor=\"let item of items | selectFilters: searchValue; let index = index;\"\n (click)=\"onClose()\"\n class=\"wac-select__content__item\"\n >\n <div *ngIf=\"!item.hide\" [ngClass]=\"{ selected: item.selected }\" (click)=\"onSelectItem(item.id)\">\n <span class=\"icon\" [innerHTML]=\"item.icon\" *ngIf=\"item.icon\"></span>{{ item.name | translate }}\n </div>\n </div>\n\n </div>\n\n <div *ngIf=\"!(items | selectFilters: searchValue)?.length\" class=\"wac-select__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>" }]
|
|
3613
|
+
}], ctorParameters: function () { return [{ type: i7.TranslateService }]; }, propDecorators: { items: [{
|
|
3614
|
+
type: Input
|
|
3615
|
+
}], placeholder: [{
|
|
3616
|
+
type: Input
|
|
3617
|
+
}], label: [{
|
|
3618
|
+
type: Input
|
|
3619
|
+
}], maxWidthItems: [{
|
|
3620
|
+
type: Input
|
|
3621
|
+
}], search: [{
|
|
3622
|
+
type: Input
|
|
3623
|
+
}], type: [{
|
|
3624
|
+
type: Input
|
|
3625
|
+
}], callToAction: [{
|
|
3626
|
+
type: Input
|
|
3627
|
+
}], maxWidth: [{
|
|
3628
|
+
type: Input
|
|
3629
|
+
}], disabled: [{
|
|
3630
|
+
type: Input
|
|
3631
|
+
}], selectValue: [{
|
|
3632
|
+
type: Output
|
|
3633
|
+
}], clickOnCallToAction: [{
|
|
3634
|
+
type: Output
|
|
3635
|
+
}], searchElement: [{
|
|
3636
|
+
type: ViewChild,
|
|
3637
|
+
args: ['search']
|
|
3638
|
+
}] } });
|
|
3639
|
+
|
|
3640
|
+
class ImgTabsComponent {
|
|
3641
|
+
constructor(imgEventEditService, alertService, route) {
|
|
3642
|
+
this.imgEventEditService = imgEventEditService;
|
|
3643
|
+
this.alertService = alertService;
|
|
3644
|
+
this.route = route;
|
|
3645
|
+
this.multipleImgMode = false;
|
|
3646
|
+
this.listDisplayed = false;
|
|
3647
|
+
this.imgManagerClosed = new EventEmitter();
|
|
3648
|
+
this.currentTab = new EventEmitter();
|
|
3649
|
+
this.switchDisplayWindow = new EventEmitter();
|
|
3650
|
+
this.tabs = [
|
|
3651
|
+
{
|
|
3652
|
+
name: 'ImgManager.Tabs.addImg',
|
|
3653
|
+
value: 'img-upload',
|
|
3654
|
+
selected: true,
|
|
3655
|
+
id: 0
|
|
3656
|
+
},
|
|
3657
|
+
{
|
|
3658
|
+
name: 'ImgManager.Tabs.imgLib',
|
|
3659
|
+
value: 'images-view',
|
|
3660
|
+
id: 1
|
|
3661
|
+
},
|
|
3662
|
+
{
|
|
3663
|
+
name: 'ImgManager.Tabs.freeImgLib',
|
|
3664
|
+
value: 'pexels-lib',
|
|
3665
|
+
id: 2
|
|
3666
|
+
},
|
|
3667
|
+
{
|
|
3668
|
+
name: 'ImgManager.Tabs.Editor',
|
|
3669
|
+
value: 'img-edition',
|
|
3670
|
+
hide: true,
|
|
3671
|
+
id: 3
|
|
3672
|
+
}
|
|
3673
|
+
];
|
|
3674
|
+
this.tabActive = this.tabs[0];
|
|
3675
|
+
/* tabActive = 'images-view';
|
|
3676
|
+
tabs: string[] = ['img-upload', 'images-view', 'pexels-lib', 'img-edition']; */
|
|
3677
|
+
this.editTab = false;
|
|
3678
|
+
this.imgUpload = false;
|
|
3679
|
+
this.snackBarNewVersionConfig = {
|
|
3680
|
+
message: '',
|
|
3681
|
+
duration: 3000
|
|
3682
|
+
};
|
|
3683
|
+
}
|
|
3684
|
+
ngOnInit() {
|
|
3685
|
+
this.imgEventEditService.getImgToEditEventListner().subscribe(imgToEdit => {
|
|
3686
|
+
this.tabActive = this.tabs[3];
|
|
3687
|
+
this.imgToEdit = imgToEdit;
|
|
3688
|
+
this.editTab = true;
|
|
3689
|
+
this.currentTab.emit(this.tabs[3]);
|
|
3690
|
+
});
|
|
3691
|
+
}
|
|
3692
|
+
toggleTabs(item) {
|
|
3693
|
+
this.imgUpload = false;
|
|
3694
|
+
this.editTab = false;
|
|
3695
|
+
this.tabActive = item;
|
|
3696
|
+
}
|
|
3697
|
+
onImgUploaded(img) {
|
|
3698
|
+
this.imgUpload = true;
|
|
3699
|
+
this.imgUploadedComponent.onImgUploaded(img);
|
|
3700
|
+
}
|
|
3701
|
+
onEditClosed(msgKey) {
|
|
3702
|
+
this.editTab = false;
|
|
3703
|
+
this.toggleTabs(this.tabs[1]);
|
|
3704
|
+
if (msgKey) {
|
|
3705
|
+
this.alertService.openAlert(msgKey);
|
|
3706
|
+
}
|
|
3707
|
+
this.currentTab.emit('close');
|
|
3708
|
+
}
|
|
3709
|
+
onShowImgUploaded() {
|
|
3710
|
+
this.tabActive = this.tabs[1];
|
|
3711
|
+
}
|
|
3712
|
+
switchDisplayWindowImgView() {
|
|
3713
|
+
this.switchDisplayWindow.emit(true);
|
|
3714
|
+
}
|
|
3715
|
+
switchRouterLink(event) {
|
|
3716
|
+
}
|
|
3717
|
+
onImgManagerClosed() {
|
|
3718
|
+
this.imgManagerClosed.emit();
|
|
3719
|
+
}
|
|
3720
|
+
}
|
|
3721
|
+
ImgTabsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgTabsComponent, deps: [{ token: ImgEventService }, { token: AlertService }, { token: i3$2.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
3722
|
+
ImgTabsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ImgTabsComponent, selector: "img-tabs", inputs: { multipleImgMode: "multipleImgMode", stateDisplayed: "stateDisplayed", listDisplayed: "listDisplayed" }, outputs: { imgManagerClosed: "imgManagerClosed", currentTab: "currentTab", switchDisplayWindow: "switchDisplayWindow" }, viewQueries: [{ propertyName: "imgUploadedComponent", first: true, predicate: ["imgUploadedImg"], descendants: true }], ngImport: i0, template: "<div\n class=\"img-tabs\" [ngClass]=\"{'small': stateDisplayed === 'small'}\">\n <div class=\"wrapper-tabs\">\n <div\n class=\"tabs\"\n [ngClass]=\"\n {\n 'tabs--notWindow': stateDisplayed !== 'window',\n 'tabs--notDisplayed': stateDisplayed === 'window' && tabActive.value === tabs[3].value\n }\">\n\n <ul>\n <li class=\"is-active\" [ngClass]=\"{'is-active': tabActive.value === tabs[0].value}\" (click)=\"toggleTabs(tabs[0])\"><a>{{ tabs[0].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[1].value}\" (click)=\"toggleTabs(tabs[1])\"><a>{{ tabs[1].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[2].value}\" (click)=\"toggleTabs(tabs[2])\"><a>{{ tabs[2].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[3].value}\" *ngIf=\"editTab\"><a>{{ tabs[3].name | translate }}</a></li>\n </ul>\n <div\n class=\"img-tabs__canva\"\n [ngClass]=\"{'img-tabs__canva--window': stateDisplayed === 'window'}\">\n <canva-btn\n (showImgUploaded)=\"onShowImgUploaded()\"\n [stateDisplayed]=\"stateDisplayed\">\n </canva-btn>\n </div>\n </div>\n <div class=\"select-mobile-page\">\n <wac-select\n [(ngModel)]=\"tabActive\"\n name=\"tabs\"\n [items]=\"tabs\"\n ></wac-select>\n </div>\n </div>\n\n <!-- Upload section -->\n <div\n class=\"columns img-tabs__tabsFirst\"\n [ngClass]=\"{\n 'img-tabs__tabsFirst--small': stateDisplayed === 'small',\n 'img-tabs__tabsFirst--window': stateDisplayed === 'window'\n }\"\n *ngIf=\"tabActive.value === tabs[0].value\">\n <div class=\"column img-tabs__tabsFirst__upload\">\n <img-upload\n [stateDisplayed]=\"stateDisplayed\"\n (imgUploaded)=\"onImgUploaded($event)\"\n ></img-upload>\n </div>\n <div class=\"column img-tabs__tabsFirst__list\" [ngClass]=\"{\n 'img-tabs__tabsFirst__list--upload': imgUpload\n }\">\n <images-view\n *ngIf=\"!imgUpload\"\n [stateDisplayed]=\"stateDisplayed\"\n [listDisplayed]=\"false\"\n [multipleImgMode]=\"multipleImgMode\"\n [tabDisplayed]=\"tabActive.value\"\n [nbRowToShow]=\"2\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n [fullSize]=\"false\">\n </images-view>\n\n\n <div [hidden]=\"!imgUpload\">\n <upload-list\n #imgUploadedImg\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabActive.value\"\n [multipleImgMode]=\"multipleImgMode\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n >\n </upload-list>\n </div>\n </div>\n </div>\n\n <!-- Images section -->\n <div class=\"columns img-tabs__tabsSecond\" *ngIf=\"tabActive.value === tabs[1].value\">\n <div class=\"column\">\n\n <images-view\n [stateDisplayed]=\"stateDisplayed\"\n [listDisplayed]=\"listDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [tabDisplayed]=\"tabActive.value\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n [fullSize]=\"true\">\n </images-view>\n\n </div>\n </div>\n\n <!-- Pexel img section -->\n <div class=\"columns img-tabs__tabsThird\" *ngIf=\"tabActive.value === tabs[2].value\">\n <div class=\"column\">\n <pexels-lib\n [stateDisplayed]=\"stateDisplayed\"\n (showImgUploaded)=\"onShowImgUploaded()\">\n </pexels-lib>\n </div>\n </div>\n\n <!--Edition section -->\n <div class=\"columns img-tabs__tabsEdit\" *ngIf=\"tabActive.value === tabs[3].value\">\n <div class=\"column\">\n <img-editor\n [stateDisplayed]=\"stateDisplayed\"\n [imgToEdit]=\"imgToEdit\"\n (editClosed)=\"onEditClosed($event)\">\n </img-editor>\n </div>\n </div>\n\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ImgUploadComponent, selector: "img-upload", inputs: ["stateDisplayed"], outputs: ["imgUploaded"] }, { kind: "component", type: PexelLibComponent, selector: "pexels-lib", inputs: ["stateDisplayed", "searchValue", "disableSearch"], outputs: ["showImgUploaded"] }, { kind: "component", type: UploadListComponent, selector: "upload-list", inputs: ["stateDisplayed", "tabDisplayed", "multipleImgMode"], outputs: ["switchDisplayWindow"] }, { kind: "component", type: ImgEditorComponent, selector: "img-editor", inputs: ["stateDisplayed", "imgToEdit"], outputs: ["editClosed"] }, { kind: "component", type: CanvaBtnComponent, selector: "canva-btn", inputs: ["stateDisplayed"], outputs: ["showImgUploaded"] }, { kind: "component", type: ImagesViewComponent, selector: "images-view", inputs: ["stateDisplayed", "tabDisplayed", "fullSize", "maxLengthCardShow", "nbRowToShow", "listDisplayed", "multipleImgMode"], outputs: ["switchDisplayWindow"] }, { kind: "component", type: SelectComponent, selector: "wac-select", inputs: ["items", "placeholder", "label", "maxWidthItems", "search", "type", "callToAction", "maxWidth", "disabled"], outputs: ["selectValue", "clickOnCallToAction"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
|
|
3723
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgTabsComponent, decorators: [{
|
|
3724
|
+
type: Component,
|
|
3725
|
+
args: [{ selector: 'img-tabs', template: "<div\n class=\"img-tabs\" [ngClass]=\"{'small': stateDisplayed === 'small'}\">\n <div class=\"wrapper-tabs\">\n <div\n class=\"tabs\"\n [ngClass]=\"\n {\n 'tabs--notWindow': stateDisplayed !== 'window',\n 'tabs--notDisplayed': stateDisplayed === 'window' && tabActive.value === tabs[3].value\n }\">\n\n <ul>\n <li class=\"is-active\" [ngClass]=\"{'is-active': tabActive.value === tabs[0].value}\" (click)=\"toggleTabs(tabs[0])\"><a>{{ tabs[0].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[1].value}\" (click)=\"toggleTabs(tabs[1])\"><a>{{ tabs[1].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[2].value}\" (click)=\"toggleTabs(tabs[2])\"><a>{{ tabs[2].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[3].value}\" *ngIf=\"editTab\"><a>{{ tabs[3].name | translate }}</a></li>\n </ul>\n <div\n class=\"img-tabs__canva\"\n [ngClass]=\"{'img-tabs__canva--window': stateDisplayed === 'window'}\">\n <canva-btn\n (showImgUploaded)=\"onShowImgUploaded()\"\n [stateDisplayed]=\"stateDisplayed\">\n </canva-btn>\n </div>\n </div>\n <div class=\"select-mobile-page\">\n <wac-select\n [(ngModel)]=\"tabActive\"\n name=\"tabs\"\n [items]=\"tabs\"\n ></wac-select>\n </div>\n </div>\n\n <!-- Upload section -->\n <div\n class=\"columns img-tabs__tabsFirst\"\n [ngClass]=\"{\n 'img-tabs__tabsFirst--small': stateDisplayed === 'small',\n 'img-tabs__tabsFirst--window': stateDisplayed === 'window'\n }\"\n *ngIf=\"tabActive.value === tabs[0].value\">\n <div class=\"column img-tabs__tabsFirst__upload\">\n <img-upload\n [stateDisplayed]=\"stateDisplayed\"\n (imgUploaded)=\"onImgUploaded($event)\"\n ></img-upload>\n </div>\n <div class=\"column img-tabs__tabsFirst__list\" [ngClass]=\"{\n 'img-tabs__tabsFirst__list--upload': imgUpload\n }\">\n <images-view\n *ngIf=\"!imgUpload\"\n [stateDisplayed]=\"stateDisplayed\"\n [listDisplayed]=\"false\"\n [multipleImgMode]=\"multipleImgMode\"\n [tabDisplayed]=\"tabActive.value\"\n [nbRowToShow]=\"2\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n [fullSize]=\"false\">\n </images-view>\n\n\n <div [hidden]=\"!imgUpload\">\n <upload-list\n #imgUploadedImg\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabActive.value\"\n [multipleImgMode]=\"multipleImgMode\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n >\n </upload-list>\n </div>\n </div>\n </div>\n\n <!-- Images section -->\n <div class=\"columns img-tabs__tabsSecond\" *ngIf=\"tabActive.value === tabs[1].value\">\n <div class=\"column\">\n\n <images-view\n [stateDisplayed]=\"stateDisplayed\"\n [listDisplayed]=\"listDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [tabDisplayed]=\"tabActive.value\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n [fullSize]=\"true\">\n </images-view>\n\n </div>\n </div>\n\n <!-- Pexel img section -->\n <div class=\"columns img-tabs__tabsThird\" *ngIf=\"tabActive.value === tabs[2].value\">\n <div class=\"column\">\n <pexels-lib\n [stateDisplayed]=\"stateDisplayed\"\n (showImgUploaded)=\"onShowImgUploaded()\">\n </pexels-lib>\n </div>\n </div>\n\n <!--Edition section -->\n <div class=\"columns img-tabs__tabsEdit\" *ngIf=\"tabActive.value === tabs[3].value\">\n <div class=\"column\">\n <img-editor\n [stateDisplayed]=\"stateDisplayed\"\n [imgToEdit]=\"imgToEdit\"\n (editClosed)=\"onEditClosed($event)\">\n </img-editor>\n </div>\n </div>\n\n</div>\n" }]
|
|
3726
|
+
}], ctorParameters: function () { return [{ type: ImgEventService }, { type: AlertService }, { type: i3$2.Router }]; }, propDecorators: { multipleImgMode: [{
|
|
3727
|
+
type: Input
|
|
3728
|
+
}], stateDisplayed: [{
|
|
3729
|
+
type: Input
|
|
3730
|
+
}], listDisplayed: [{
|
|
3731
|
+
type: Input
|
|
3732
|
+
}], imgManagerClosed: [{
|
|
3733
|
+
type: Output
|
|
3734
|
+
}], currentTab: [{
|
|
3735
|
+
type: Output
|
|
3736
|
+
}], switchDisplayWindow: [{
|
|
3737
|
+
type: Output
|
|
3738
|
+
}], imgUploadedComponent: [{
|
|
3739
|
+
type: ViewChild,
|
|
3740
|
+
args: ['imgUploadedImg']
|
|
3741
|
+
}] } });
|
|
3742
|
+
|
|
3743
|
+
class ImgSelectionComponent {
|
|
3744
|
+
constructor(imgSelectionService) {
|
|
3745
|
+
this.imgSelectionService = imgSelectionService;
|
|
3746
|
+
this.imgManagerClosed = new EventEmitter();
|
|
3747
|
+
this.imgSelectedList = [];
|
|
3748
|
+
this.removingAll = false;
|
|
3749
|
+
this.cancellingAll = false;
|
|
3750
|
+
this.importingAll = false;
|
|
3751
|
+
this.dragStart = false;
|
|
3752
|
+
this.isLoading = false;
|
|
3753
|
+
this.trashPositionIndex = 0;
|
|
3754
|
+
this.trashPositionLeft = '-5px';
|
|
3755
|
+
}
|
|
3756
|
+
ngOnInit() {
|
|
3757
|
+
this.getImgSelected();
|
|
3758
|
+
this.imgSelectionService.getImgListLoadingEventListner().subscribe(loading => {
|
|
3759
|
+
this.isLoading = loading;
|
|
3760
|
+
});
|
|
3761
|
+
}
|
|
3762
|
+
init() {
|
|
3763
|
+
this.removingAll = false;
|
|
3764
|
+
this.cancellingAll = false;
|
|
3765
|
+
this.importingAll = false;
|
|
3766
|
+
}
|
|
3767
|
+
getImgSelected() {
|
|
3768
|
+
this.imgSelectedList = this.imgSelectionService.getImgSelection();
|
|
3769
|
+
}
|
|
3770
|
+
removeImg(index) {
|
|
3771
|
+
this.imgSelectionService.removeImgSelectedByIndex(index);
|
|
3772
|
+
}
|
|
3773
|
+
drop(event) {
|
|
3774
|
+
if (event.previousIndex !== event.currentIndex) {
|
|
3775
|
+
this.imgSelectionService.moveImgOrder(event);
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
removeImgFromSelection(event) {
|
|
3779
|
+
this.imgSelectionService.removeImgSelectedByIndex(event.previousIndex);
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
ImgSelectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgSelectionComponent, deps: [{ token: ImgSelectionService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3783
|
+
ImgSelectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ImgSelectionComponent, selector: "img-selection", inputs: { tabDisplayed: "tabDisplayed" }, outputs: { imgManagerClosed: "imgManagerClosed" }, ngImport: i0, template: "<div\n class=\"trash\"\n cdkDropList\n #unSelectList=\"cdkDropList\"\n (cdkDropListDropped)=\"removeImgFromSelection($event)\">\n <p>{{'ImgManager.ImgSelection.unselect' | translate}}</p>\n</div>\n\n<div\n class=\"img-selection\"\n [ngClass]=\"{'img-selection--visible' : imgSelectedList && imgSelectedList.length}\"\n *ngIf=\"!isLoading\">\n\n <div\n cdkDropList\n #selectionList=\"cdkDropList\"\n cdkDropListOrientation=\"horizontal\"\n class=\"list_img_selection\"\n (cdkDropListDropped)=\"drop($event)\"\n [cdkDropListConnectedTo]=\"[unSelectList]\"\n >\n\n <div\n class=\"img_box\"\n *ngFor=\"let picture of imgSelectedList; let index = index\"\n cdkDrag\n (cdkDragStarted)=\"dragStart = true;\"\n (cdkDragEnded)=\"dragStart = false;\"\n >\n\n <img\n *ngIf=\"index < 1\"\n class=\"drag__img\"\n [src]=\"picture.file_name | imgSrc : '400'\"\n [title]=\"picture.display_name\"\n />\n\n <img\n *ngIf=\"index > 0\"\n class=\"drag__img\"\n [src]=\"picture.file_name | imgSrc : '200'\"\n [title]=\"picture.display_name\"\n />\n\n <div class=\"delete-btn\" (click)=\"removeImg(index)\">{{'ImgManager.ImgSelection.deleteImg' | translate}}</div>\n\n <span class=\"drag__tooltips\">{{'ImgManager.ImgSelection.tooltips' | translate}}</span>\n\n </div>\n </div>\n</div>\n\n<!-- Loader -->\n<ng-container *ngIf=\"isLoading\">\n <wz-loader></wz-loader>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$3.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i3$3.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: LoaderComponent, selector: "wz-loader", inputs: ["text", "small", "position"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }, { kind: "pipe", type: ImageSrcPipe, name: "imgSrc" }] });
|
|
3784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ImgSelectionComponent, decorators: [{
|
|
3785
|
+
type: Component,
|
|
3786
|
+
args: [{ selector: 'img-selection', template: "<div\n class=\"trash\"\n cdkDropList\n #unSelectList=\"cdkDropList\"\n (cdkDropListDropped)=\"removeImgFromSelection($event)\">\n <p>{{'ImgManager.ImgSelection.unselect' | translate}}</p>\n</div>\n\n<div\n class=\"img-selection\"\n [ngClass]=\"{'img-selection--visible' : imgSelectedList && imgSelectedList.length}\"\n *ngIf=\"!isLoading\">\n\n <div\n cdkDropList\n #selectionList=\"cdkDropList\"\n cdkDropListOrientation=\"horizontal\"\n class=\"list_img_selection\"\n (cdkDropListDropped)=\"drop($event)\"\n [cdkDropListConnectedTo]=\"[unSelectList]\"\n >\n\n <div\n class=\"img_box\"\n *ngFor=\"let picture of imgSelectedList; let index = index\"\n cdkDrag\n (cdkDragStarted)=\"dragStart = true;\"\n (cdkDragEnded)=\"dragStart = false;\"\n >\n\n <img\n *ngIf=\"index < 1\"\n class=\"drag__img\"\n [src]=\"picture.file_name | imgSrc : '400'\"\n [title]=\"picture.display_name\"\n />\n\n <img\n *ngIf=\"index > 0\"\n class=\"drag__img\"\n [src]=\"picture.file_name | imgSrc : '200'\"\n [title]=\"picture.display_name\"\n />\n\n <div class=\"delete-btn\" (click)=\"removeImg(index)\">{{'ImgManager.ImgSelection.deleteImg' | translate}}</div>\n\n <span class=\"drag__tooltips\">{{'ImgManager.ImgSelection.tooltips' | translate}}</span>\n\n </div>\n </div>\n</div>\n\n<!-- Loader -->\n<ng-container *ngIf=\"isLoading\">\n <wz-loader></wz-loader>\n</ng-container>\n" }]
|
|
3787
|
+
}], ctorParameters: function () { return [{ type: ImgSelectionService }]; }, propDecorators: { tabDisplayed: [{
|
|
3788
|
+
type: Input
|
|
3789
|
+
}], imgManagerClosed: [{
|
|
3790
|
+
type: Output
|
|
3791
|
+
}] } });
|
|
3792
|
+
|
|
3793
|
+
class WzImgManagerComponent {
|
|
3794
|
+
constructor(imgSelectionService, externalConfigService, userSettingsService, canvaService, imgEventService, domService) {
|
|
3795
|
+
this.imgSelectionService = imgSelectionService;
|
|
3796
|
+
this.externalConfigService = externalConfigService;
|
|
3797
|
+
this.userSettingsService = userSettingsService;
|
|
3798
|
+
this.canvaService = canvaService;
|
|
3799
|
+
this.imgEventService = imgEventService;
|
|
3800
|
+
this.domService = domService;
|
|
3801
|
+
this.showSelection = false;
|
|
3802
|
+
this.imgManagerClosed = new EventEmitter();
|
|
3803
|
+
this._multipleImgMode = false;
|
|
3804
|
+
this._showImgManagerModule = false;
|
|
3805
|
+
this.close = false;
|
|
3806
|
+
this.listDisplayed = false;
|
|
3807
|
+
this.hideTab = false;
|
|
3808
|
+
}
|
|
3809
|
+
// If forceToOpenCanva is true : Canva will open with the canvaService.expectedImgSizesChange
|
|
3810
|
+
// If forceToOpenCanva is a WiziBlockMediaDto, Canva open immediatly
|
|
3811
|
+
set forceToOpenCanva(forceToOpenCanva) {
|
|
3812
|
+
this.canvaService.forceToOpenCanva = !!forceToOpenCanva;
|
|
3813
|
+
if (typeof forceToOpenCanva === 'boolean') {
|
|
3814
|
+
return;
|
|
3815
|
+
}
|
|
3816
|
+
this.canvaService.expectedImgSizesChange(forceToOpenCanva);
|
|
3817
|
+
}
|
|
3818
|
+
set multipleImgMode(activate) {
|
|
3819
|
+
this._multipleImgMode = activate;
|
|
3820
|
+
this.imgSelectionService.setMultipleImgMode(this._multipleImgMode);
|
|
3821
|
+
}
|
|
3822
|
+
get multipleImgMode() {
|
|
3823
|
+
return this._multipleImgMode;
|
|
3824
|
+
}
|
|
3825
|
+
set showImgManagerModule(activate) {
|
|
3826
|
+
this._showImgManagerModule = activate;
|
|
3827
|
+
if (activate) {
|
|
3828
|
+
this.displaySmall();
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
get showImgManagerModule() {
|
|
3832
|
+
return this._multipleImgMode;
|
|
3833
|
+
}
|
|
3834
|
+
onKeydownHandler(event) {
|
|
3835
|
+
if (this.stateDisplayed && this.stateDisplayed !== 'window') {
|
|
3836
|
+
this.onClose();
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
ngOnInit() {
|
|
3840
|
+
this.externalConfigService.setExternalConfig(this.externalConfig);
|
|
3841
|
+
this.imgSelectionService.setMultipleImgMode(this._multipleImgMode);
|
|
3842
|
+
this.imgSelectionService.initImgSelectedList(null);
|
|
3843
|
+
this.selectImgEvent = this.imgSelectionService.getImgSelectionChange().subscribe(imgSlection => {
|
|
3844
|
+
if (imgSlection && imgSlection.length && this.checkCloseImgManager()) {
|
|
3845
|
+
// Close the img manager
|
|
3846
|
+
this.onClose();
|
|
3847
|
+
}
|
|
3848
|
+
});
|
|
3849
|
+
this.checkUserDisplayPreference();
|
|
3850
|
+
// Use when the img manager is full open or open in page. This display the user preference display, mosaic or list.
|
|
3851
|
+
this.listDisplayedEvent = this.imgEventService.getlistDisplayedChange().subscribe(value => this.listDisplayed = value);
|
|
3852
|
+
// Register dom service to listen on all event on the body to avoid having multiple instance of the same thing every where
|
|
3853
|
+
this.domService.setDocumentEventListener();
|
|
3854
|
+
}
|
|
3855
|
+
checkUserDisplayPreference() {
|
|
3856
|
+
if (this.stateDisplayed === 'window' || this.stateDisplayed === 'full') {
|
|
3857
|
+
this.listDisplayed = this.userSettingsService.getUserDisplayPreference();
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
setCurrentTab(event) {
|
|
3861
|
+
if (event === 'img-edition') {
|
|
3862
|
+
this.hideTab = true;
|
|
3863
|
+
return;
|
|
3864
|
+
}
|
|
3865
|
+
this.hideTab = false;
|
|
3866
|
+
}
|
|
3867
|
+
displaySmall() {
|
|
3868
|
+
if (this.stateDisplayed !== 'window') {
|
|
3869
|
+
setTimeout(() => {
|
|
3870
|
+
this.stateDisplayed = 'small';
|
|
3871
|
+
this.addBodyBottomPaddingForModule();
|
|
3872
|
+
}, 10);
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
openSmall() {
|
|
3876
|
+
this.stateDisplayed = 'small';
|
|
3877
|
+
this.setBodyMainScroll();
|
|
3878
|
+
this.listDisplayed = false;
|
|
3879
|
+
}
|
|
3880
|
+
openFull() {
|
|
3881
|
+
this.stateDisplayed = 'full';
|
|
3882
|
+
this.checkUserDisplayPreference();
|
|
3883
|
+
this.hideBodyMainScroll();
|
|
3884
|
+
}
|
|
3885
|
+
onClose() {
|
|
3886
|
+
this.stateDisplayed = 'closed';
|
|
3887
|
+
this.hideTab = false;
|
|
3888
|
+
this.setBodyMainScroll();
|
|
3889
|
+
this.removeBodyBottomPaddingForModule();
|
|
3890
|
+
// Wait the end of the closing annimation
|
|
3891
|
+
setTimeout(() => {
|
|
3892
|
+
this.imgManagerClosed.emit();
|
|
3893
|
+
}, 250);
|
|
3894
|
+
}
|
|
3895
|
+
onImgManagerClosed() {
|
|
3896
|
+
this.onClose();
|
|
3897
|
+
}
|
|
3898
|
+
/**
|
|
3899
|
+
* Close the img manager after one img is selected, if not in multiple img to select
|
|
3900
|
+
*/
|
|
3901
|
+
checkCloseImgManager() {
|
|
3902
|
+
return !this.multipleImgMode && this.stateDisplayed !== 'window' ? true : false;
|
|
3903
|
+
}
|
|
3904
|
+
hideBodyMainScroll() {
|
|
3905
|
+
const html = document.getElementsByTagName('html')[0];
|
|
3906
|
+
if (!this.overflowHTML) {
|
|
3907
|
+
this.overflowHTML = html.style.overflowY;
|
|
3908
|
+
}
|
|
3909
|
+
html.style.overflowY = "hidden";
|
|
3910
|
+
}
|
|
3911
|
+
setBodyMainScroll() {
|
|
3912
|
+
const html = document.getElementsByTagName('html')[0];
|
|
3913
|
+
html.style.overflowY = this.overflowHTML ? this.overflowHTML : "scroll";
|
|
3914
|
+
}
|
|
3915
|
+
addBodyBottomPaddingForModule() {
|
|
3916
|
+
const body = document.getElementsByTagName('body')[0];
|
|
3917
|
+
this.bodyPadding = this.bodyPadding ? parseInt(body.style.paddingBottom) : 0;
|
|
3918
|
+
body.style.paddingBottom = this.bodyPadding + 300 + 'px';
|
|
3919
|
+
}
|
|
3920
|
+
removeBodyBottomPaddingForModule() {
|
|
3921
|
+
if (typeof this.bodyPadding !== 'undefined') {
|
|
3922
|
+
const body = document.getElementsByTagName('body')[0];
|
|
3923
|
+
body.style.paddingBottom = this.bodyPadding + 'px';
|
|
3924
|
+
this.bodyPadding = 0;
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
changeDisplayTab() {
|
|
3928
|
+
this.stateDisplayed = 'full';
|
|
3929
|
+
}
|
|
3930
|
+
ngOnDestroy() {
|
|
3931
|
+
this.selectImgEvent.unsubscribe();
|
|
3932
|
+
this.canvaService.expectedImgSizesChange(null);
|
|
3933
|
+
this.listDisplayedEvent.unsubscribe();
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
WzImgManagerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: WzImgManagerComponent, deps: [{ token: ImgSelectionService }, { token: ImgManagerConfigService }, { token: UserSettingsService }, { token: CanvaService }, { token: ImgEventService }, { token: DomService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3937
|
+
WzImgManagerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: WzImgManagerComponent, selector: "wz-img-manager", inputs: { stateDisplayed: "stateDisplayed", showSelection: "showSelection", externalConfig: "externalConfig", forceToOpenCanva: "forceToOpenCanva", multipleImgMode: "multipleImgMode", showImgManagerModule: "showImgManagerModule" }, outputs: { imgManagerClosed: "imgManagerClosed" }, host: { listeners: { "document:keydown.escape": "onKeydownHandler($event)" } }, ngImport: i0, template: "<div class=\"wz-img-manager\">\n <!-- Img slection handler -->\n <div class=\"wz-img-manager__selectionHandler\" *ngIf=\"showSelection\">\n <img-selection></img-selection>\n </div>\n\n <!-- Img manager module -->\n <div\n *ngIf=\"_showImgManagerModule\"\n class=\"wz-img-manager__module\"\n [ngClass]=\"{\n 'wz-img-manager__module--small': stateDisplayed === 'small',\n 'wz-img-manager__module--full': stateDisplayed === 'full',\n 'wz-img-manager__module--window': stateDisplayed === 'window',\n 'wz-img-manager__module--edit': hideTab}\"\n >\n\n <div class=\"wz-img-manager__module__header\" *ngIf=\"stateDisplayed !== 'window'\">\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'full'\"><span>Expand</span><i class=\"fal fa-compress-alt\"></i></button>\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'closed'\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"openFull()\" *ngIf=\"stateDisplayed === 'small'\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"onClose()\" *ngIf=\"stateDisplayed !== 'closed'\"><span>Close</span><i class=\"fal fa-times\"></i></button>\n </div>\n\n <div\n class=\"wz-img-manager__module__content wz-block\"\n [ngClass]=\"{'wz-block--window': stateDisplayed === 'window'}\">\n <img-tabs\n [stateDisplayed]=\"stateDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [listDisplayed]=\"listDisplayed\"\n (imgManagerClosed)=\"onImgManagerClosed()\"\n (switchDisplayWindow)=\"changeDisplayTab()\"\n (currentTab)=\"setCurrentTab($event)\">\n </img-tabs>\n </div>\n </div>\n\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ImgTabsComponent, selector: "img-tabs", inputs: ["multipleImgMode", "stateDisplayed", "listDisplayed"], outputs: ["imgManagerClosed", "currentTab", "switchDisplayWindow"] }, { kind: "component", type: ImgSelectionComponent, selector: "img-selection", inputs: ["tabDisplayed"], outputs: ["imgManagerClosed"] }] });
|
|
3938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: WzImgManagerComponent, decorators: [{
|
|
3939
|
+
type: Component,
|
|
3940
|
+
args: [{ selector: 'wz-img-manager', template: "<div class=\"wz-img-manager\">\n <!-- Img slection handler -->\n <div class=\"wz-img-manager__selectionHandler\" *ngIf=\"showSelection\">\n <img-selection></img-selection>\n </div>\n\n <!-- Img manager module -->\n <div\n *ngIf=\"_showImgManagerModule\"\n class=\"wz-img-manager__module\"\n [ngClass]=\"{\n 'wz-img-manager__module--small': stateDisplayed === 'small',\n 'wz-img-manager__module--full': stateDisplayed === 'full',\n 'wz-img-manager__module--window': stateDisplayed === 'window',\n 'wz-img-manager__module--edit': hideTab}\"\n >\n\n <div class=\"wz-img-manager__module__header\" *ngIf=\"stateDisplayed !== 'window'\">\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'full'\"><span>Expand</span><i class=\"fal fa-compress-alt\"></i></button>\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'closed'\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"openFull()\" *ngIf=\"stateDisplayed === 'small'\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"onClose()\" *ngIf=\"stateDisplayed !== 'closed'\"><span>Close</span><i class=\"fal fa-times\"></i></button>\n </div>\n\n <div\n class=\"wz-img-manager__module__content wz-block\"\n [ngClass]=\"{'wz-block--window': stateDisplayed === 'window'}\">\n <img-tabs\n [stateDisplayed]=\"stateDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [listDisplayed]=\"listDisplayed\"\n (imgManagerClosed)=\"onImgManagerClosed()\"\n (switchDisplayWindow)=\"changeDisplayTab()\"\n (currentTab)=\"setCurrentTab($event)\">\n </img-tabs>\n </div>\n </div>\n\n</div>\n" }]
|
|
3941
|
+
}], ctorParameters: function () { return [{ type: ImgSelectionService }, { type: ImgManagerConfigService }, { type: UserSettingsService }, { type: CanvaService }, { type: ImgEventService }, { type: DomService }]; }, propDecorators: { stateDisplayed: [{
|
|
3942
|
+
type: Input
|
|
3943
|
+
}], showSelection: [{
|
|
3944
|
+
type: Input
|
|
3945
|
+
}], externalConfig: [{
|
|
3946
|
+
type: Input
|
|
3947
|
+
}], forceToOpenCanva: [{
|
|
3948
|
+
type: Input
|
|
3949
|
+
}], imgManagerClosed: [{
|
|
3950
|
+
type: Output
|
|
3951
|
+
}], multipleImgMode: [{
|
|
3952
|
+
type: Input
|
|
3953
|
+
}], showImgManagerModule: [{
|
|
3954
|
+
type: Input
|
|
3955
|
+
}], onKeydownHandler: [{
|
|
3956
|
+
type: HostListener,
|
|
3957
|
+
args: ['document:keydown.escape', ['$event']]
|
|
3958
|
+
}] } });
|
|
3959
|
+
|
|
3960
|
+
;
|
|
3961
|
+
const components = [
|
|
3962
|
+
WzImgManagerComponent,
|
|
3963
|
+
ImgTabsComponent,
|
|
3964
|
+
ImgUploadComponent,
|
|
3965
|
+
PexelLibComponent,
|
|
3966
|
+
ImgCardComponent,
|
|
3967
|
+
UploadListComponent,
|
|
3968
|
+
ImgEditorComponent,
|
|
3969
|
+
EditorInfoSectionComponent,
|
|
3970
|
+
CanvaBtnComponent,
|
|
3971
|
+
ImgSelectionComponent,
|
|
3972
|
+
LoaderComponent,
|
|
3973
|
+
DropdownComponent,
|
|
3974
|
+
CropperComponent,
|
|
3975
|
+
ImagesViewComponent,
|
|
3976
|
+
MosaicViewComponent,
|
|
3977
|
+
TableViewComponent,
|
|
3978
|
+
TableComponent,
|
|
3979
|
+
InputSearchComponent,
|
|
3980
|
+
PaginationComponent,
|
|
3981
|
+
CheckboxComponent,
|
|
3982
|
+
AlertComponent,
|
|
3983
|
+
PageSelectorComponent,
|
|
3984
|
+
SelectComponent
|
|
3985
|
+
];
|
|
3986
|
+
const directives = [
|
|
3987
|
+
DragDropDirective,
|
|
3988
|
+
LoadingDirective,
|
|
3989
|
+
AutoHideDirective,
|
|
3990
|
+
CopyClipboardDirective,
|
|
3991
|
+
TableColumn,
|
|
3992
|
+
CheckBoxRow,
|
|
3993
|
+
TableColumnHeader,
|
|
3994
|
+
TableRow,
|
|
3995
|
+
AbstractDebounceDirective,
|
|
3996
|
+
DebounceKeyupDirective,
|
|
3997
|
+
ZindexToggleDirective
|
|
3998
|
+
];
|
|
3999
|
+
const pipes = [
|
|
4000
|
+
PagniationArrayTotalPages,
|
|
4001
|
+
PagniationIsLastPage,
|
|
4002
|
+
PagniationText,
|
|
4003
|
+
ImageSrcPipe,
|
|
4004
|
+
NumberToArray,
|
|
4005
|
+
LargeNumberOfPagePipe,
|
|
4006
|
+
SelectFiltersPipe
|
|
4007
|
+
];
|
|
4008
|
+
class WzImgManagerModule {
|
|
4009
|
+
}
|
|
4010
|
+
WzImgManagerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: WzImgManagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4011
|
+
WzImgManagerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: WzImgManagerModule, declarations: [WzImgManagerComponent,
|
|
4012
|
+
ImgTabsComponent,
|
|
4013
|
+
ImgUploadComponent,
|
|
4014
|
+
PexelLibComponent,
|
|
4015
|
+
ImgCardComponent,
|
|
4016
|
+
UploadListComponent,
|
|
4017
|
+
ImgEditorComponent,
|
|
4018
|
+
EditorInfoSectionComponent,
|
|
4019
|
+
CanvaBtnComponent,
|
|
4020
|
+
ImgSelectionComponent,
|
|
4021
|
+
LoaderComponent,
|
|
4022
|
+
DropdownComponent,
|
|
4023
|
+
CropperComponent,
|
|
4024
|
+
ImagesViewComponent,
|
|
4025
|
+
MosaicViewComponent,
|
|
4026
|
+
TableViewComponent,
|
|
4027
|
+
TableComponent,
|
|
4028
|
+
InputSearchComponent,
|
|
4029
|
+
PaginationComponent,
|
|
4030
|
+
CheckboxComponent,
|
|
4031
|
+
AlertComponent,
|
|
4032
|
+
PageSelectorComponent,
|
|
4033
|
+
SelectComponent, DragDropDirective,
|
|
4034
|
+
LoadingDirective,
|
|
4035
|
+
AutoHideDirective,
|
|
4036
|
+
CopyClipboardDirective,
|
|
4037
|
+
TableColumn,
|
|
4038
|
+
CheckBoxRow,
|
|
4039
|
+
TableColumnHeader,
|
|
4040
|
+
TableRow,
|
|
4041
|
+
AbstractDebounceDirective,
|
|
4042
|
+
DebounceKeyupDirective,
|
|
4043
|
+
ZindexToggleDirective, PagniationArrayTotalPages,
|
|
4044
|
+
PagniationIsLastPage,
|
|
4045
|
+
PagniationText,
|
|
4046
|
+
ImageSrcPipe,
|
|
4047
|
+
NumberToArray,
|
|
4048
|
+
LargeNumberOfPagePipe,
|
|
4049
|
+
SelectFiltersPipe], imports: [CommonModule,
|
|
4050
|
+
HttpClientModule,
|
|
4051
|
+
FormsModule,
|
|
4052
|
+
NgScrollbarModule,
|
|
4053
|
+
NgScrollbarReachedModule,
|
|
4054
|
+
NwbAllModule,
|
|
4055
|
+
ImageCropperModule,
|
|
4056
|
+
CdkTableModule,
|
|
4057
|
+
DragDropModule,
|
|
4058
|
+
TranslateModule,
|
|
4059
|
+
PerfectScrollbarModule], exports: [WzImgManagerComponent] });
|
|
4060
|
+
WzImgManagerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: WzImgManagerModule, imports: [CommonModule,
|
|
4061
|
+
HttpClientModule,
|
|
4062
|
+
FormsModule,
|
|
4063
|
+
NgScrollbarModule,
|
|
4064
|
+
NgScrollbarReachedModule,
|
|
4065
|
+
NwbAllModule,
|
|
4066
|
+
ImageCropperModule,
|
|
4067
|
+
CdkTableModule,
|
|
4068
|
+
DragDropModule,
|
|
4069
|
+
TranslateModule,
|
|
4070
|
+
PerfectScrollbarModule] });
|
|
4071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: WzImgManagerModule, decorators: [{
|
|
4072
|
+
type: NgModule,
|
|
4073
|
+
args: [{
|
|
4074
|
+
declarations: [
|
|
4075
|
+
...components,
|
|
4076
|
+
...directives,
|
|
4077
|
+
...pipes
|
|
4078
|
+
],
|
|
4079
|
+
imports: [
|
|
4080
|
+
CommonModule,
|
|
4081
|
+
HttpClientModule,
|
|
4082
|
+
FormsModule,
|
|
4083
|
+
NgScrollbarModule,
|
|
4084
|
+
NgScrollbarReachedModule,
|
|
4085
|
+
NwbAllModule,
|
|
4086
|
+
ImageCropperModule,
|
|
4087
|
+
CdkTableModule,
|
|
4088
|
+
DragDropModule,
|
|
4089
|
+
TranslateModule,
|
|
4090
|
+
PerfectScrollbarModule
|
|
4091
|
+
],
|
|
4092
|
+
providers: [],
|
|
4093
|
+
exports: [
|
|
4094
|
+
WzImgManagerComponent
|
|
4095
|
+
]
|
|
4096
|
+
}]
|
|
4097
|
+
}] });
|
|
4098
|
+
|
|
4099
|
+
class CanvaButtonApi {
|
|
4100
|
+
}
|
|
4101
|
+
;
|
|
4102
|
+
|
|
4103
|
+
class ImgApiDto {
|
|
4104
|
+
constructor() {
|
|
4105
|
+
this.image_manager_route = '';
|
|
4106
|
+
this.pexels_route = '';
|
|
4107
|
+
this.canva_url = '';
|
|
4108
|
+
this.assets_route = 'assets/img-manager/';
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
class ImgManagerConfigDto {
|
|
4113
|
+
}
|
|
4114
|
+
|
|
4115
|
+
class ImgCDNConfigDTO {
|
|
4116
|
+
constructor() {
|
|
4117
|
+
this.url_raw_image = '';
|
|
4118
|
+
this.url_100_image = '';
|
|
4119
|
+
this.url_200_image = '';
|
|
4120
|
+
this.url_400_image = '';
|
|
4121
|
+
this.url_800_image = '';
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
/*
|
|
4126
|
+
* Public API Surface of wz-img-manager
|
|
4127
|
+
*/
|
|
4128
|
+
|
|
4129
|
+
/**
|
|
4130
|
+
* Generated bundle index. Do not edit.
|
|
4131
|
+
*/
|
|
4132
|
+
|
|
4133
|
+
export { CanvaButtonApi, CanvaService, ImgApiDto, ImgCDNConfigDTO, ImgManagerConfigDto, ImgManagerService, ImgSelectionService, RenamePictureService, WzImgManagerComponent, WzImgManagerModule };
|
|
4134
|
+
//# sourceMappingURL=wizishop-img-manager.mjs.map
|