@kigi/components 1.5.9 → 1.5.10-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -4
- package/src/components/index.ts +2 -0
- package/src/components/mbg-image-upload/helpers/firebase.ts +79 -55
- package/src/components/mbg-image-upload-crop/image-upload-crop.html +24 -0
- package/src/components/mbg-image-upload-crop/image-upload-crop.scss +76 -0
- package/src/components/mbg-image-upload-crop/image-upload-crop.ts +50 -0
- package/src/components/mbg-image-upload-crop/index.ts +9 -0
- package/src/components/mbg-image-upload-crop/interfaces/config-image-upload-crop.interface.ts +9 -0
- package/src/components/mbg-image-upload-crop/modals/upload-image-crop-modal/index.ts +32 -0
- package/src/components/mbg-image-upload-crop/modals/upload-image-crop-modal/upload-image-crop-modal.html +70 -0
- package/src/components/mbg-image-upload-crop/modals/upload-image-crop-modal/upload-image-crop-modal.scss +140 -0
- package/src/components/mbg-image-upload-crop/modals/upload-image-crop-modal/upload-image-crop-modal.ts +151 -0
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.ts +154 -142
- package/src/components/mbg-text-area/mbg-text-area.html +11 -10
- package/src/components/mbg-text-area/mbg-text-area.ts +1 -0
- package/src/index.html +8 -1
- package/src/index.ts +14 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kigi/components",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.10-beta.2",
|
|
4
4
|
"description": "@kigi/components",
|
|
5
5
|
"main": "src/components/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@syncfusion/ej2-navigations": "^17.4.43",
|
|
39
39
|
"@syncfusion/ej2-splitbuttons": "^17.4.43",
|
|
40
40
|
"@types/node": "^10.10.1",
|
|
41
|
+
"ace-builds": "1.3.3",
|
|
41
42
|
"angular": "1.7.9",
|
|
42
43
|
"angular-animate": "^1.7.9",
|
|
43
44
|
"angular-bootstrap": "^0.12.2",
|
|
@@ -50,9 +51,10 @@
|
|
|
50
51
|
"angular-ui-bootstrap": "^2.5.6",
|
|
51
52
|
"angular-vs-repeat": "^2.0.14",
|
|
52
53
|
"cep-promise": "^3.0.3",
|
|
54
|
+
"cropperjs": "^1.5.12",
|
|
53
55
|
"croppie": "^2.6.2",
|
|
54
56
|
"detect-browser": "^3.0.1",
|
|
55
|
-
"firebase": "
|
|
57
|
+
"firebase": "7.16.0",
|
|
56
58
|
"fuse.js": "^3.4.6",
|
|
57
59
|
"grpc": "1.20.2",
|
|
58
60
|
"highcharts": "^6.1.0",
|
|
@@ -71,8 +73,7 @@
|
|
|
71
73
|
"progressbar.js": "^1.0.1",
|
|
72
74
|
"raphael": "^2.2.8",
|
|
73
75
|
"sugarss": "^2.0.0",
|
|
74
|
-
"webcamjs": "^1.0.25"
|
|
75
|
-
"ace-builds": "1.3.3"
|
|
76
|
+
"webcamjs": "^1.0.25"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@types/angular": "^1.6.27",
|
package/src/components/index.ts
CHANGED
|
@@ -84,6 +84,7 @@ import { mbgTextEditorModule } from './mbg-text-editor'
|
|
|
84
84
|
import 'jodit/src/langs/pt_br.js'
|
|
85
85
|
import { NgMaskIe } from '../helpers/ie-directive/ie-directive'
|
|
86
86
|
import { mbgAceEditorModule } from './mbg-ace-editor'
|
|
87
|
+
import { mbgImageUploadCropModule } from './mbg-image-upload-crop'
|
|
87
88
|
|
|
88
89
|
if (!window['$']) {
|
|
89
90
|
window['$'] = $
|
|
@@ -100,6 +101,7 @@ const mbgComponentsModule = angular
|
|
|
100
101
|
ngSanitize,
|
|
101
102
|
ngAnimate,
|
|
102
103
|
mbgImageUploadModule,
|
|
104
|
+
mbgImageUploadCropModule,
|
|
103
105
|
mbgInputCnpjModule,
|
|
104
106
|
mbgInputCpfModule,
|
|
105
107
|
mbgInputCpfCnpjModule,
|
|
@@ -2,66 +2,90 @@ import firebase from 'firebase/app'
|
|
|
2
2
|
import 'firebase/storage'
|
|
3
3
|
|
|
4
4
|
export namespace ImageUploadFirebase {
|
|
5
|
-
|
|
5
|
+
const URL_FIREBASE = 'https://firebasestorage.googleapis.com/v0/b/bucket/o/id?alt=media'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export function getStorage(): any {
|
|
8
|
+
return window['firebase'] ? window['firebase'].storage() : firebase.storage()
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export function guid() {
|
|
12
|
+
const s4 = () =>
|
|
13
|
+
Math.floor((1 + Math.random()) * 0x10000)
|
|
14
|
+
.toString(16)
|
|
15
|
+
.substring(1)
|
|
16
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4()
|
|
17
|
+
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
export async function removeFiles(files) {
|
|
20
|
+
files.forEach((file) => {
|
|
21
|
+
if (file) {
|
|
22
|
+
const storageRef = getStorage().ref().child(file.idStorage)
|
|
23
|
+
storageRef.delete()
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const storageRef = getStorage().ref().child(folder ? `${folder}/${imageID}` : imageID)
|
|
31
|
-
const response = await storageRef.putString(base64, 'data_url')
|
|
32
|
-
const imageURL = folder ? URL_FIREBASE.replace(/bucket/g, response.metadata.bucket).replace(/id/g, `${folder}%2F${response.metadata.name}`)
|
|
33
|
-
: URL_FIREBASE.replace(/bucket/g, response.metadata.bucket).replace(/id/g, response.metadata.name)
|
|
34
|
-
const image = { url: imageURL, idStorage: imageID }
|
|
35
|
-
return image
|
|
36
|
-
}))
|
|
37
|
-
}
|
|
38
|
-
export function uploadFile(file: File, config: { onProgress, onPause, onResume, onError, onSuccess }, folder = '') {
|
|
28
|
+
export async function upload(files: Array<string>, folder = '') {
|
|
29
|
+
return await Promise.all(
|
|
30
|
+
files.map(async (base64) => {
|
|
39
31
|
const imageID = this.guid()
|
|
40
|
-
const storageRef = getStorage()
|
|
41
|
-
|
|
32
|
+
const storageRef = getStorage()
|
|
33
|
+
.ref()
|
|
34
|
+
.child(folder ? `${folder}/${imageID}` : imageID)
|
|
35
|
+
const response = await storageRef.putString(base64, 'data_url')
|
|
36
|
+
const imageURL = folder
|
|
37
|
+
? URL_FIREBASE.replace(/bucket/g, response.metadata.bucket).replace(
|
|
38
|
+
/id/g,
|
|
39
|
+
`${folder}%2F${response.metadata.name}`,
|
|
40
|
+
)
|
|
41
|
+
: URL_FIREBASE.replace(/bucket/g, response.metadata.bucket).replace(
|
|
42
|
+
/id/g,
|
|
43
|
+
response.metadata.name,
|
|
44
|
+
)
|
|
45
|
+
const image = { url: imageURL, idStorage: imageID }
|
|
46
|
+
return image
|
|
47
|
+
}),
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
export function uploadFile(
|
|
51
|
+
file: File,
|
|
52
|
+
config: { onProgress; onPause; onResume; onError; onSuccess },
|
|
53
|
+
folder = '',
|
|
54
|
+
) {
|
|
55
|
+
const imageID = this.guid()
|
|
56
|
+
const storageRef = getStorage()
|
|
57
|
+
.ref()
|
|
58
|
+
.child(folder ? `${folder}/${imageID}` : imageID)
|
|
59
|
+
const uploadTask = storageRef.put(file)
|
|
42
60
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
uploadTask.on(
|
|
62
|
+
'state_changed',
|
|
63
|
+
(snapshot) => {
|
|
64
|
+
const progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100
|
|
65
|
+
config.onProgress(progress)
|
|
66
|
+
switch (snapshot.state) {
|
|
67
|
+
case firebase.storage.TaskState.PAUSED:
|
|
68
|
+
config.onPause()
|
|
69
|
+
break
|
|
70
|
+
case firebase.storage.TaskState.RUNNING:
|
|
71
|
+
config.onResume()
|
|
72
|
+
break
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
(e) => {
|
|
76
|
+
config.onError()
|
|
77
|
+
},
|
|
78
|
+
() => {
|
|
79
|
+
uploadTask.snapshot.ref
|
|
80
|
+
.getDownloadURL()
|
|
81
|
+
.then((downloadURL) => {
|
|
82
|
+
config.onSuccess({ fileName: file.name, fileURL: downloadURL, fileSize: file.size })
|
|
83
|
+
})
|
|
84
|
+
.catch(() => {
|
|
55
85
|
config.onError()
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.catch(() => {
|
|
62
|
-
config.onError()
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
return uploadTask
|
|
66
|
-
}
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
return uploadTask
|
|
90
|
+
}
|
|
67
91
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div class="image-upload-crop-wrapper"
|
|
2
|
+
ng-style="{ 'width': $ctrl.config.width ? $ctrl.config.width : '200px', 'height': $ctrl.config.height ? $ctrl.config.height : '84px'}">
|
|
3
|
+
<div class="upload-item"
|
|
4
|
+
ng-style="{'cursor': $ctrl.ngModel ? 'default' : 'pointer'}"
|
|
5
|
+
ng-click="!$ctrl.ngModel && $ctrl.openModal()">
|
|
6
|
+
<div class="preview-image-crop"
|
|
7
|
+
ng-show="$ctrl.ngModel"
|
|
8
|
+
ng-click="$ctrl.openModal()">
|
|
9
|
+
<img ng-show="$ctrl.ngModel"
|
|
10
|
+
ng-style="{ 'object-fit': 'contain', 'width': '100%'}"
|
|
11
|
+
src="{{$ctrl.ngModel}}">
|
|
12
|
+
</div>
|
|
13
|
+
<div class="icon-upload-image-crop">
|
|
14
|
+
<i ng-show="!$ctrl.ngModel"
|
|
15
|
+
class="fas fa-cloud-upload-alt"></i>
|
|
16
|
+
<div class="buttons"
|
|
17
|
+
ng-class="{'remove': $ctrl.ngModel}">
|
|
18
|
+
<a ng-click="$ctrl.removeImage($event)">{{$ctrl.ngModel ? 'Remover' : ''}}</a>
|
|
19
|
+
<a ng-click="$ctrl.openModal()">{{$ctrl.ngModel ? 'Alterar' : 'Fazer upload'}}</a>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
.image-upload-crop-wrapper {
|
|
2
|
+
.upload-item {
|
|
3
|
+
padding: 4px;
|
|
4
|
+
border: 1px dashed #9c9c9c;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
width: 100%;
|
|
9
|
+
transition: all 300ms ease-in-out;
|
|
10
|
+
height: 100%;
|
|
11
|
+
margin-top: 10px;
|
|
12
|
+
position: relative;
|
|
13
|
+
text-align: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
|
|
17
|
+
i {
|
|
18
|
+
font-size: 24px;
|
|
19
|
+
margin-top: 4px;
|
|
20
|
+
margin-bottom: 4px;
|
|
21
|
+
color: #4d4d4d;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
label {
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: -17px;
|
|
27
|
+
left: 0;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
a {
|
|
33
|
+
text-align: center;
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
margin-top: 2px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.preview-image-crop {
|
|
39
|
+
height: calc(100% - 24px);
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
|
|
42
|
+
img {
|
|
43
|
+
width: auto;
|
|
44
|
+
height: 100%;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.icon-upload-image-crop {
|
|
49
|
+
width: 100%;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
|
|
55
|
+
.buttons {
|
|
56
|
+
width: 100%;
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
|
|
60
|
+
a {
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.remove {
|
|
66
|
+
justify-content: space-around;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
&:hover {
|
|
70
|
+
background: #e4e4e4;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
.gap-12 {
|
|
74
|
+
gap: 12px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import './image-upload-crop.scss'
|
|
2
|
+
import template from './image-upload-crop.html'
|
|
3
|
+
import { IConfigImageUploadCrop } from './interfaces/config-image-upload-crop.interface'
|
|
4
|
+
import { UploadImageCropModal } from './modals/upload-image-crop-modal'
|
|
5
|
+
|
|
6
|
+
class ImageUploadCropController {
|
|
7
|
+
public config: IConfigImageUploadCrop
|
|
8
|
+
public ngModel: string
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
public $scope,
|
|
12
|
+
public $element,
|
|
13
|
+
public $timeout,
|
|
14
|
+
public uploadImageCropModal: UploadImageCropModal,
|
|
15
|
+
) {}
|
|
16
|
+
|
|
17
|
+
$onInit() {
|
|
18
|
+
this.config = this.config || {
|
|
19
|
+
aspectRatio: 1 / 1,
|
|
20
|
+
minCropBoxWidth: 200,
|
|
21
|
+
minCropBoxHeight: 200,
|
|
22
|
+
minCanvasHeight: 100,
|
|
23
|
+
minContainerHeight: 100,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
removeImage(e) {
|
|
28
|
+
e.stopPropagation()
|
|
29
|
+
this.ngModel = ''
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
openModal() {
|
|
33
|
+
this.uploadImageCropModal.open(this.config, this.ngModel).then((url) => {
|
|
34
|
+
if (url) {
|
|
35
|
+
this.ngModel = url
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const imageUploadCrop = {
|
|
42
|
+
bindings: {
|
|
43
|
+
ngModel: '=?',
|
|
44
|
+
config: '=?',
|
|
45
|
+
},
|
|
46
|
+
controller: ImageUploadCropController,
|
|
47
|
+
template,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { imageUploadCrop }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as angular from 'angular'
|
|
2
|
+
import { imageUploadCrop } from './image-upload-crop'
|
|
3
|
+
import { uploadImageCropModalModule } from './modals/upload-image-crop-modal'
|
|
4
|
+
|
|
5
|
+
const mbgImageUploadCropModule = angular
|
|
6
|
+
.module('mbg.components.imageUploadCrop', [uploadImageCropModalModule])
|
|
7
|
+
.component('mbgImageUploadCrop', imageUploadCrop).name
|
|
8
|
+
|
|
9
|
+
export { mbgImageUploadCropModule }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as angular from 'angular'
|
|
2
|
+
import './upload-image-crop-modal.scss'
|
|
3
|
+
import { UploadImageCropModalController } from './upload-image-crop-modal'
|
|
4
|
+
import UploadImageCropModalTemplate from './upload-image-crop-modal.html'
|
|
5
|
+
import { IConfigImageUploadCrop } from '../../interfaces/config-image-upload-crop.interface'
|
|
6
|
+
|
|
7
|
+
export class UploadImageCropModal {
|
|
8
|
+
constructor(public $uibModal) {}
|
|
9
|
+
|
|
10
|
+
open(cropOptions: IConfigImageUploadCrop, image: string) {
|
|
11
|
+
const modalInstance = this.$uibModal.open({
|
|
12
|
+
template: UploadImageCropModalTemplate,
|
|
13
|
+
controller: UploadImageCropModalController,
|
|
14
|
+
controllerAs: '$ctrl',
|
|
15
|
+
animation: true,
|
|
16
|
+
backdrop: 'static',
|
|
17
|
+
windowClass: 'reward-e-vendi-modal',
|
|
18
|
+
size: 'md',
|
|
19
|
+
resolve: {
|
|
20
|
+
cropOptions: () => cropOptions,
|
|
21
|
+
image: () => image,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
return modalInstance.result
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const uploadImageCropModalModule = angular
|
|
29
|
+
.module(`mbg.modals.uploadImageCropModal`, [])
|
|
30
|
+
.service('uploadImageCropModal', UploadImageCropModal).name
|
|
31
|
+
|
|
32
|
+
export { uploadImageCropModalModule }
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<div class="upload-image-crop-modal-wrapper">
|
|
2
|
+
<div class="head-logo">
|
|
3
|
+
<h1>Imagem</h1>
|
|
4
|
+
|
|
5
|
+
</div>
|
|
6
|
+
<div class="body-logo">
|
|
7
|
+
<div class="image-container-crop">
|
|
8
|
+
<input type="file"
|
|
9
|
+
multiple="false"
|
|
10
|
+
onchange="angular.element(this).scope().$ctrl.onSelectFiles(event)"
|
|
11
|
+
id="chooseFileLogo" />
|
|
12
|
+
|
|
13
|
+
<div ng-show="!$ctrl.file"
|
|
14
|
+
ng-click="$ctrl.chooseFileLogo()"
|
|
15
|
+
ondrop="angular.element(this).scope().$ctrl.onDropFile(event)"
|
|
16
|
+
ondragover="angular.element(this).scope().$ctrl.onDragOver(event)"
|
|
17
|
+
class="flex flex-column justify-center align-center image-drap-drop-container">
|
|
18
|
+
<div class="flex flex-column align-center justify-center">
|
|
19
|
+
<i ng-show="!$ctrl.image"
|
|
20
|
+
class="fas fa-cloud-upload-alt"></i>
|
|
21
|
+
<label ng-show="$ctrl.image"
|
|
22
|
+
style="font-weight: 500;">Imagem atual</label>
|
|
23
|
+
<img ng-if="$ctrl.image"
|
|
24
|
+
style="max-height: 200px;max-width: 400px; object-fit: contain;"
|
|
25
|
+
class="m-b-24"
|
|
26
|
+
src="{{$ctrl.image}}"></i>
|
|
27
|
+
|
|
28
|
+
<label ng-show="$ctrl.image">Arraste e solte uma imagem ou clique aqui para editar</label>
|
|
29
|
+
<label ng-show="!$ctrl.image">Arraste e solte uma imagem ou clique aqui para adicionar</label>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="relative-content"
|
|
33
|
+
ng-if="$ctrl.file">
|
|
34
|
+
<button type="button"
|
|
35
|
+
class="stop-upload"
|
|
36
|
+
ng-click="$ctrl.resetFile()">
|
|
37
|
+
<i class="fas fa-times"></i>
|
|
38
|
+
</button>
|
|
39
|
+
<img ng-src="{{ $ctrl.file }}"
|
|
40
|
+
class="crop-image-original"
|
|
41
|
+
ng-init="$ctrl.createCropier()"
|
|
42
|
+
alt="Logo" />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<div class="row">
|
|
46
|
+
<div class="col-md-12">
|
|
47
|
+
<p style="margin-bottom: 0px">Tamanho ideal em pixels: ({{$ctrl.cropOptions.minCropBoxWidth}} x
|
|
48
|
+
{{$ctrl.cropOptions.minCropBoxHeight}})px
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="row m-t-24">
|
|
53
|
+
<div class="col-md-12 flex flex-column align-center justify-center">
|
|
54
|
+
<mbg-btn-form ng-click="$ctrl.save()"
|
|
55
|
+
ng-disabled="$ctrl.loading"
|
|
56
|
+
loading="$ctrl.loading"
|
|
57
|
+
label="Confirmar"></mbg-btn-form>
|
|
58
|
+
<label class="error-label"
|
|
59
|
+
ng-class="{'active': $ctrl.activeError}">{{$ctrl.labelError}}</label>
|
|
60
|
+
<div class="flex align-center">
|
|
61
|
+
<a class="cancel-link"
|
|
62
|
+
target="_self"
|
|
63
|
+
ng-disabled="$ctrl.loading"
|
|
64
|
+
ng-click="$ctrl.closeModal()">Cancelar</a>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
.upload-image-crop-modal-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
|
|
6
|
+
.relative-content {
|
|
7
|
+
position: relative;
|
|
8
|
+
max-height: 400px;
|
|
9
|
+
|
|
10
|
+
.stop-upload {
|
|
11
|
+
z-index: 1000;
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 4px;
|
|
14
|
+
right: 4px;
|
|
15
|
+
background: #fff;
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
font-size: 21px;
|
|
18
|
+
width: 34px;
|
|
19
|
+
height: 34px;
|
|
20
|
+
border: 2px solid #595959;
|
|
21
|
+
color: #666;
|
|
22
|
+
transform: scale(0.8);
|
|
23
|
+
transition: all 300ms ease;
|
|
24
|
+
|
|
25
|
+
&:hover {
|
|
26
|
+
transform: scale(0.9);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cropper-container {
|
|
32
|
+
width: 100% !important;
|
|
33
|
+
height: 368px !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.head-logo {
|
|
37
|
+
padding: 0 24px;
|
|
38
|
+
h1 {
|
|
39
|
+
color: var(--neutral1);
|
|
40
|
+
font-size: 24px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
.body-logo {
|
|
44
|
+
flex: 1;
|
|
45
|
+
position: relative;
|
|
46
|
+
padding: 0 24px;
|
|
47
|
+
padding-bottom: 24px;
|
|
48
|
+
}
|
|
49
|
+
.image-container-crop {
|
|
50
|
+
width: 100%;
|
|
51
|
+
background: #f5f5f5;
|
|
52
|
+
height: 368px;
|
|
53
|
+
border-radius: 5px;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
}
|
|
57
|
+
#chooseFileLogo {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
.crop-image-original {
|
|
61
|
+
display: block;
|
|
62
|
+
max-width: 100%;
|
|
63
|
+
}
|
|
64
|
+
.image-drap-drop-container {
|
|
65
|
+
height: 100%;
|
|
66
|
+
|
|
67
|
+
i {
|
|
68
|
+
font-size: 68px;
|
|
69
|
+
color: #666;
|
|
70
|
+
}
|
|
71
|
+
label {
|
|
72
|
+
font-size: 16px;
|
|
73
|
+
margin: 14px 4px;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
}
|
|
76
|
+
button {
|
|
77
|
+
margin-top: 18px;
|
|
78
|
+
height: 44px;
|
|
79
|
+
padding: 0 24px;
|
|
80
|
+
border-radius: 41px;
|
|
81
|
+
background: var(--contrast);
|
|
82
|
+
color: #fff;
|
|
83
|
+
border: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.flex {
|
|
88
|
+
display: flex;
|
|
89
|
+
.flex-1 {
|
|
90
|
+
flex: 1;
|
|
91
|
+
}
|
|
92
|
+
.fit-content {
|
|
93
|
+
min-height: fit-content;
|
|
94
|
+
}
|
|
95
|
+
&.flex-row {
|
|
96
|
+
flex-direction: row;
|
|
97
|
+
}
|
|
98
|
+
&.flex-column {
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
}
|
|
101
|
+
&.align-center {
|
|
102
|
+
align-items: center;
|
|
103
|
+
}
|
|
104
|
+
&.align-end {
|
|
105
|
+
align-items: flex-end;
|
|
106
|
+
}
|
|
107
|
+
&.align-start {
|
|
108
|
+
align-items: flex-start;
|
|
109
|
+
}
|
|
110
|
+
&.align-between {
|
|
111
|
+
align-items: space-between;
|
|
112
|
+
}
|
|
113
|
+
&.justify-center {
|
|
114
|
+
justify-content: center;
|
|
115
|
+
}
|
|
116
|
+
&.justify-end {
|
|
117
|
+
justify-content: flex-end;
|
|
118
|
+
}
|
|
119
|
+
&.justify-start {
|
|
120
|
+
justify-content: flex-start;
|
|
121
|
+
}
|
|
122
|
+
&.justify-between {
|
|
123
|
+
justify-content: space-between;
|
|
124
|
+
}
|
|
125
|
+
&.justify-around {
|
|
126
|
+
justify-content: space-around;
|
|
127
|
+
}
|
|
128
|
+
&.wrap {
|
|
129
|
+
flex-wrap: wrap;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
.m-t-24 {
|
|
133
|
+
margin-top: 24px;
|
|
134
|
+
}
|
|
135
|
+
.cancel-link {
|
|
136
|
+
margin: 18px 24px 0px 24px;
|
|
137
|
+
color: var(--neutral2);
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// import { MobiEVendiService } from 'modules/mobi-store/services/mobi-e-vendi-service'
|
|
2
|
+
import 'cropperjs/dist/cropper.css'
|
|
3
|
+
// import Cropper from 'cropperjs'
|
|
4
|
+
import Cropper from 'cropperjs/dist/cropper.esm'
|
|
5
|
+
import { UtilMbgFunctions } from '../../../../helpers/util-mbg-functions'
|
|
6
|
+
import { UtilUID } from '../../../../helpers/util-uid'
|
|
7
|
+
import { MbgImageUploadService } from '../../../mbg-image-upload/services/mbg-image-upload-service'
|
|
8
|
+
import firebase from 'firebase/app'
|
|
9
|
+
import 'firebase/storage'
|
|
10
|
+
// import { UtilUID } from 'modules/helpers/namespaces/util-uid'
|
|
11
|
+
// import { SessionStorage } from 'modules/helpers/namespaces/sessionstorage'
|
|
12
|
+
// import { HelperNotificationService } from 'modules/helpers/services/notification.service'
|
|
13
|
+
|
|
14
|
+
class UploadImageCropModalController {
|
|
15
|
+
private file
|
|
16
|
+
private cropper: Cropper
|
|
17
|
+
private loading
|
|
18
|
+
private activeError: boolean
|
|
19
|
+
private labelError: string
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
public $timeout,
|
|
23
|
+
public $scope,
|
|
24
|
+
public $uibModalInstance,
|
|
25
|
+
public cropOptions,
|
|
26
|
+
public image,
|
|
27
|
+
public mbgImageUploadService: MbgImageUploadService,
|
|
28
|
+
) {}
|
|
29
|
+
|
|
30
|
+
$onInit() {
|
|
31
|
+
this.$scope.$on('$destroy', () => {
|
|
32
|
+
this.destroyCropier()
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
closeModal() {
|
|
37
|
+
this.$uibModalInstance.close()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async onFileSelect(file) {
|
|
41
|
+
const base64 = await this.toBase64(file)
|
|
42
|
+
this.$timeout(() => {
|
|
43
|
+
this.file = base64
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
createCropier() {
|
|
48
|
+
this.$timeout(() => {
|
|
49
|
+
const image: any = document.querySelector('.crop-image-original')
|
|
50
|
+
this.cropper = new Cropper(
|
|
51
|
+
image,
|
|
52
|
+
Object.assign(
|
|
53
|
+
{
|
|
54
|
+
dragMode: 'move',
|
|
55
|
+
},
|
|
56
|
+
this.cropOptions,
|
|
57
|
+
),
|
|
58
|
+
)
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
toBase64 = (file) => {
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
const reader = new FileReader()
|
|
65
|
+
reader.readAsDataURL(file)
|
|
66
|
+
reader.onload = () => resolve(reader.result)
|
|
67
|
+
reader.onerror = (error) => reject(error)
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
onDropFile(ev) {
|
|
72
|
+
ev.preventDefault()
|
|
73
|
+
const dataTransfer = ev.dataTransfer
|
|
74
|
+
if (dataTransfer.files && dataTransfer.files.length > 0) {
|
|
75
|
+
const file = dataTransfer.files[0]
|
|
76
|
+
this.onFileSelect(file)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onDragOver(ev) {
|
|
81
|
+
ev.preventDefault()
|
|
82
|
+
ev.dataTransfer.dropEffect = 'move'
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
chooseFileLogo() {
|
|
86
|
+
const input: any = document.querySelector('#chooseFileLogo')
|
|
87
|
+
input.value = ''
|
|
88
|
+
input.click()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
resetFile() {
|
|
92
|
+
this.file = null
|
|
93
|
+
const input: any = document.querySelector('#chooseFileLogo')
|
|
94
|
+
input.value = ''
|
|
95
|
+
this.destroyCropier()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
onSelectFiles(ev) {
|
|
99
|
+
const files = ev.target.files
|
|
100
|
+
if (files && files.length > 0) {
|
|
101
|
+
this.onFileSelect(files[0])
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
destroyCropier() {
|
|
106
|
+
if (this.cropper) {
|
|
107
|
+
this.cropper.destroy()
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
dismiss() {
|
|
112
|
+
this.$uibModalInstance.close(false)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async save() {
|
|
116
|
+
try {
|
|
117
|
+
this.loading = true
|
|
118
|
+
this.activeError = false
|
|
119
|
+
const URL_FIREBASE = 'https://firebasestorage.googleapis.com/v0/b/bucket/o/id?alt=media'
|
|
120
|
+
const base64 = this.cropper.getCroppedCanvas().toDataURL()
|
|
121
|
+
const imageID = UtilUID.generete()
|
|
122
|
+
|
|
123
|
+
const storageRef = (window['firebase'] ? window['firebase'].storage() : firebase.storage())
|
|
124
|
+
.ref()
|
|
125
|
+
.child(imageID)
|
|
126
|
+
const response = await storageRef.putString(base64, 'data_url')
|
|
127
|
+
const imageURL = URL_FIREBASE.replace(/bucket/g, response.metadata.bucket).replace(
|
|
128
|
+
/id/g,
|
|
129
|
+
response.metadata.name,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
this.$uibModalInstance.close(imageURL)
|
|
133
|
+
} catch (e) {
|
|
134
|
+
console.log(e)
|
|
135
|
+
this.loading = false
|
|
136
|
+
this.activeError = true
|
|
137
|
+
this.labelError = 'Erro ao salvar a imagem, tente novamente!'
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
UploadImageCropModalController[`$inject`] = [
|
|
143
|
+
'$timeout',
|
|
144
|
+
'$scope',
|
|
145
|
+
'$uibModalInstance',
|
|
146
|
+
'cropOptions',
|
|
147
|
+
'image',
|
|
148
|
+
'mbgImageUploadService',
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
export { UploadImageCropModalController }
|
|
@@ -5,157 +5,169 @@ import * as Fuse from 'fuse.js'
|
|
|
5
5
|
import { UtilUID } from '../../helpers/util-uid'
|
|
6
6
|
|
|
7
7
|
export class MbgSelectMultiListController {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
$
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
executeFetch() {
|
|
61
|
-
this.$timeout(() => {
|
|
62
|
-
this.fetch({ query: (this.inputValue || '') })
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
afterFetchData(data) {
|
|
67
|
-
this.$timeout(() => {
|
|
68
|
-
this.data = (data || []).filter((row) => this.ngModel.filter((model) => angular.equals(row, model)).length === 0)
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
selectRow(row) {
|
|
73
|
-
const copyRow = JSON.parse(JSON.stringify(row))
|
|
74
|
-
const index = this.findIndexRow(this.data, row)
|
|
75
|
-
if (index !== -1) {
|
|
76
|
-
copyRow._uid = UtilUID.generete()
|
|
77
|
-
this.ngModel.push(copyRow)
|
|
78
|
-
this.dataModel.push(copyRow)
|
|
79
|
-
this.data.splice(index, 1)
|
|
80
|
-
this.$timeout(() => {
|
|
81
|
-
(this.ngModel || []).forEach((model) => {
|
|
82
|
-
delete model._uid
|
|
83
|
-
})
|
|
84
|
-
}, 500)
|
|
8
|
+
private data: Array<any>
|
|
9
|
+
private ngModel: any
|
|
10
|
+
private dataModel: Array<any>
|
|
11
|
+
private fetch: Function
|
|
12
|
+
private label: string
|
|
13
|
+
private isLoading: boolean
|
|
14
|
+
private inputValue: string
|
|
15
|
+
private listRowTransclude: string
|
|
16
|
+
private listHeaderTransclude: string
|
|
17
|
+
private placeholderLeft: string
|
|
18
|
+
private placeholderRight: string
|
|
19
|
+
private inputValueResult: string
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
public $scope,
|
|
23
|
+
public $element,
|
|
24
|
+
public $attrs,
|
|
25
|
+
public $timeout,
|
|
26
|
+
public $compile,
|
|
27
|
+
public $transclude,
|
|
28
|
+
) {}
|
|
29
|
+
|
|
30
|
+
$onInit() {
|
|
31
|
+
this.placeholderLeft = this.placeholderLeft || ''
|
|
32
|
+
this.placeholderRight = this.placeholderRight || ''
|
|
33
|
+
this.$scope.$c = this.$scope.$parent
|
|
34
|
+
this.findTransclude()
|
|
35
|
+
this.findTranscludeHeader()
|
|
36
|
+
this.$scope.$watch(
|
|
37
|
+
'$ctrl.data',
|
|
38
|
+
(data) => {
|
|
39
|
+
this.afterFetchData(data)
|
|
40
|
+
},
|
|
41
|
+
true,
|
|
42
|
+
)
|
|
43
|
+
this.$timeout(() => {
|
|
44
|
+
this.ngModel = this.ngModel || []
|
|
45
|
+
this.dataModel = JSON.parse(JSON.stringify(this.ngModel)) || []
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
findTransclude() {
|
|
50
|
+
this.$transclude(this.$scope, (cloneEl) => {
|
|
51
|
+
angular.forEach(cloneEl, (cl) => {
|
|
52
|
+
let element = angular.element(cl)[0]
|
|
53
|
+
if (element.nodeName && element.nodeName === 'MBG-ROW-CONTENT') {
|
|
54
|
+
this.listRowTransclude = element.innerHTML
|
|
85
55
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
findTranscludeHeader() {
|
|
61
|
+
this.$transclude(this.$scope, (cloneEl) => {
|
|
62
|
+
angular.forEach(cloneEl, (cl) => {
|
|
63
|
+
let element = angular.element(cl)[0]
|
|
64
|
+
if (element.nodeName && element.nodeName === 'MBG-HEADER-CONTENT') {
|
|
65
|
+
this.listHeaderTransclude = element.innerHTML
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
executeFetch() {
|
|
72
|
+
this.$timeout(() => {
|
|
73
|
+
this.fetch({ query: this.inputValue || '' })
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
afterFetchData(data) {
|
|
78
|
+
this.$timeout(() => {
|
|
79
|
+
this.data = (data || []).filter(
|
|
80
|
+
(row) => this.ngModel.filter((model) => angular.equals(row, model)).length === 0,
|
|
81
|
+
)
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
selectRow(row) {
|
|
86
|
+
const copyRow = JSON.parse(JSON.stringify(row))
|
|
87
|
+
const index = this.findIndexRow(this.data, row)
|
|
88
|
+
if (index !== -1) {
|
|
89
|
+
copyRow._uid = UtilUID.generete()
|
|
90
|
+
this.ngModel.push(copyRow)
|
|
91
|
+
this.dataModel.push(copyRow)
|
|
92
|
+
this.data.splice(index, 1)
|
|
93
|
+
this.$timeout(() => {
|
|
94
|
+
;(this.ngModel || []).forEach((model) => {
|
|
95
|
+
delete model._uid
|
|
115
96
|
})
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
findIndexRow(array: Array<any>, row) {
|
|
120
|
-
return array.findIndex((data) => angular.equals(data, row))
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
async addEvent(row) {
|
|
124
|
-
const target: any = angular.element('.result-multi-list-wrapper')
|
|
125
|
-
await target.animate({ scrollTop: this.dataModel.length * 44 }, 500)
|
|
126
|
-
this.$timeout(() => {
|
|
127
|
-
const element = angular.element(`div[id="${row['_uid']}"]`)
|
|
128
|
-
element.addClass('active')
|
|
129
|
-
this.$timeout(() => element.removeClass('active'), 300)
|
|
130
|
-
}, 100)
|
|
97
|
+
}, 500)
|
|
131
98
|
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
removeRow(row) {
|
|
102
|
+
this.$timeout(() => {
|
|
103
|
+
const index = this.findIndexRow(this.ngModel, row)
|
|
104
|
+
const indexData = this.findIndexRow(this.dataModel, row)
|
|
105
|
+
if (index !== -1) {
|
|
106
|
+
this.ngModel.splice(index, 1)
|
|
107
|
+
this.dataModel.splice(indexData, 1)
|
|
108
|
+
this.executeFetch()
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
searchNgModel() {
|
|
114
|
+
this.$timeout(() => {
|
|
115
|
+
const dataModel = JSON.parse(JSON.stringify(this.ngModel))
|
|
116
|
+
const options = {
|
|
117
|
+
shouldSort: true,
|
|
118
|
+
threshold: 0.3,
|
|
119
|
+
location: 0,
|
|
120
|
+
distance: 100,
|
|
121
|
+
maxPatternLength: 32,
|
|
122
|
+
minMatchCharLength: 1,
|
|
123
|
+
keys: [this.label],
|
|
124
|
+
}
|
|
125
|
+
const fuse = new Fuse(dataModel, options)
|
|
126
|
+
const result = fuse.search(this.inputValueResult)
|
|
127
|
+
this.dataModel = result.length > 0 ? result : dataModel
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
findIndexRow(array: Array<any>, row) {
|
|
132
|
+
return array.findIndex((data) => angular.equals(data, row))
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async addEvent(row) {
|
|
136
|
+
const target: any = angular.element('.result-multi-list-wrapper')
|
|
137
|
+
await target.animate({ scrollTop: this.dataModel.length * 44 }, 500)
|
|
138
|
+
this.$timeout(() => {
|
|
139
|
+
const element = angular.element(`div[id="${row['_uid']}"]`)
|
|
140
|
+
element.addClass('active')
|
|
141
|
+
this.$timeout(() => element.removeClass('active'), 300)
|
|
142
|
+
}, 100)
|
|
143
|
+
}
|
|
132
144
|
}
|
|
133
145
|
|
|
134
146
|
MbgSelectMultiListController.$inject = [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
147
|
+
'$scope',
|
|
148
|
+
'$element',
|
|
149
|
+
'$attrs',
|
|
150
|
+
'$timeout',
|
|
151
|
+
'$compile',
|
|
152
|
+
'$transclude',
|
|
141
153
|
]
|
|
142
154
|
|
|
143
155
|
const mbgSelectMultiList = {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
transclude: true,
|
|
157
|
+
bindings: {
|
|
158
|
+
ngModel: '=?',
|
|
159
|
+
fetch: '&?',
|
|
160
|
+
label: '@?',
|
|
161
|
+
count: '=?',
|
|
162
|
+
placeholderLeft: '@?',
|
|
163
|
+
placeholderRight: '@?',
|
|
164
|
+
titleLeft: '@?',
|
|
165
|
+
titleRight: '@?',
|
|
166
|
+
data: '=?',
|
|
167
|
+
isLoading: '=?',
|
|
168
|
+
},
|
|
169
|
+
template,
|
|
170
|
+
controller: MbgSelectMultiListController,
|
|
159
171
|
}
|
|
160
172
|
|
|
161
173
|
export { mbgSelectMultiList }
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<div class="mbg-text-wrapper mb-text-area-wrapper">
|
|
2
2
|
<textarea type="text"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
ng-model="$ctrl.ngModel"
|
|
4
|
+
ng-change="$ctrl.onChange()"
|
|
5
|
+
ng-required="$ctrl.ngRequired"
|
|
6
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
7
|
+
ng-blur="$ctrl.ngBlur({ $event })"
|
|
8
|
+
ng-focus="$ctrl.ngFocus({ $event })"
|
|
9
|
+
ng-keyup="$ctrl.ngKeyup({ $event })"
|
|
10
|
+
ng-keypress="$ctrl.ngKeypress({ $event })"
|
|
11
|
+
ng-keydown="$ctrl.ngKeydown({ $event })"
|
|
12
|
+
placeholder="{{ $ctrl.placeholder }}"
|
|
13
|
+
maxlength="{{$ctrl.maxLength}}">
|
|
13
14
|
</textarea>
|
|
14
15
|
</div>
|
package/src/index.html
CHANGED
|
@@ -982,7 +982,8 @@
|
|
|
982
982
|
{{teste}}
|
|
983
983
|
</div> -->
|
|
984
984
|
<div style="padding: 100px">
|
|
985
|
-
|
|
985
|
+
|
|
986
|
+
<!-- <div class="panel panel-default">
|
|
986
987
|
<div class="panel-heading">Ace Editor</div>
|
|
987
988
|
<div class="panel-body">
|
|
988
989
|
<mbg-ace-editor ng-model="aceEditor"
|
|
@@ -999,8 +1000,14 @@
|
|
|
999
1000
|
<mbg-input-text ng-model="asdasdasd"
|
|
1000
1001
|
ng-change="hhhsss($event)"></mbg-input-text>
|
|
1001
1002
|
</div>
|
|
1003
|
+
</div> -->
|
|
1004
|
+
|
|
1005
|
+
<div>
|
|
1006
|
+
<mbg-image-upload-crop ng-model="imgCrop"
|
|
1007
|
+
config="configImgCrop"></mbg-image-upload-crop>
|
|
1002
1008
|
</div>
|
|
1003
1009
|
|
|
1010
|
+
|
|
1004
1011
|
</div>
|
|
1005
1012
|
</body>
|
|
1006
1013
|
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as angular from 'angular'
|
|
4
4
|
import components from './components'
|
|
5
|
-
import
|
|
5
|
+
import * as firebase from 'firebase'
|
|
6
|
+
import 'firebase/firestore'
|
|
6
7
|
import './assets/angular-locale_pt-br.js'
|
|
7
8
|
import * as dataDocument from './assets/data-default.json'
|
|
8
9
|
import { MbgAlert } from './helpers/services/mbg-alert'
|
|
@@ -13,7 +14,7 @@ const sizeJson = require('./json/sizes.json')
|
|
|
13
14
|
const genderJson = require('./json/gender.json')
|
|
14
15
|
const mockData = require('./json/MOCK_DATA.json')
|
|
15
16
|
|
|
16
|
-
initializeApp({
|
|
17
|
+
firebase.initializeApp({
|
|
17
18
|
apiKey: 'AIzaSyB0aH7e6XjWJ-xViji3CuXHBbLuWRALC78',
|
|
18
19
|
authDomain: 'app-kigi.firebaseapp.com',
|
|
19
20
|
databaseURL: 'https://app-kigi-default-rtdb.firebaseio.com',
|
|
@@ -30,6 +31,17 @@ const module = angular.module('demo', ['ngLocale', components]).controller('demo
|
|
|
30
31
|
'$http',
|
|
31
32
|
'mbgAlert',
|
|
32
33
|
($scope, $timeout, $http, mbgAlert: MbgAlert) => {
|
|
34
|
+
$scope.imgCrop = 'https://i.pinimg.com/originals/c3/a5/b3/c3a5b332f9716abb1c67da38a12595e8.jpg'
|
|
35
|
+
$scope.configImgCrop = {
|
|
36
|
+
aspectRatio: 16 / 9,
|
|
37
|
+
minCropBoxWidth: 200,
|
|
38
|
+
minCropBoxHeight: 100,
|
|
39
|
+
minCanvasHeight: 200,
|
|
40
|
+
minContainerHeight: 100,
|
|
41
|
+
height: '124px',
|
|
42
|
+
// width: '300px',
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
$scope.configDocument = {
|
|
34
46
|
document: dataDocument,
|
|
35
47
|
preview: true,
|