@kigi/components 1.5.4 → 1.5.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.5.4",
3
+ "version": "1.5.7",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -46,6 +46,7 @@
46
46
  "angular-sanitize": "1.7.9",
47
47
  "angular-scroll-animate": "^0.9.9",
48
48
  "angular-timeline": "^1.7.0",
49
+ "angular-ui-ace": "^0.2.3",
49
50
  "angular-ui-bootstrap": "^2.5.6",
50
51
  "angular-vs-repeat": "^2.0.14",
51
52
  "cep-promise": "^3.0.3",
@@ -70,7 +71,8 @@
70
71
  "progressbar.js": "^1.0.1",
71
72
  "raphael": "^2.2.8",
72
73
  "sugarss": "^2.0.0",
73
- "webcamjs": "^1.0.25"
74
+ "webcamjs": "^1.0.25",
75
+ "ace-builds": "1.3.3"
74
76
  },
75
77
  "devDependencies": {
76
78
  "@types/angular": "^1.6.27",
@@ -8,6 +8,9 @@ import './common.scss'
8
8
  import '../helpers/locale'
9
9
  import 'progressbar.js/dist/progressbar.min.js'
10
10
  import 'angular-vs-repeat'
11
+ import 'ace-builds/src-min-noconflict/ace'
12
+ import 'ace-builds/src-min-noconflict/ext-language_tools'
13
+ import 'angular-ui-ace'
11
14
  import * as ngSanitize from 'angular-sanitize'
12
15
  import * as ngAnimate from 'angular-animate'
13
16
  import { MbgDynamicHTML } from '../helpers/dynamic-html/dynamic-html'
@@ -80,6 +83,7 @@ import { mbgRepasseModule } from './mbg-repasse'
80
83
  import { mbgTextEditorModule } from './mbg-text-editor'
81
84
  import 'jodit/src/langs/pt_br.js'
82
85
  import { NgMaskIe } from '../helpers/ie-directive/ie-directive'
86
+ import { mbgAceEditorModule } from './mbg-ace-editor'
83
87
 
84
88
  if (!window['$']) {
85
89
  window['$'] = $
@@ -88,6 +92,7 @@ if (!window['$']) {
88
92
 
89
93
  const mbgComponentsModule = angular
90
94
  .module('mbg.components', [
95
+ 'ui.ace',
91
96
  'ui.utils.masks',
92
97
  'ngEasyInfiniteScroll',
93
98
  'ui.bootstrap',
@@ -143,6 +148,7 @@ const mbgComponentsModule = angular
143
148
  mbgTimelineModule,
144
149
  mbgRepasseModule,
145
150
  mbgTextEditorModule,
151
+ mbgAceEditorModule,
146
152
  ])
147
153
  .config(appConfig)
148
154
  .service('mbgAlert', MbgAlert)
@@ -0,0 +1,8 @@
1
+ import * as angular from 'angular'
2
+ import { mbgAceEditor } from './mbg-ace-editor'
3
+
4
+ const mbgAceEditorModule = angular
5
+ .module('mbg.components.mbgAceEditor', [])
6
+ .component('mbgAceEditor', mbgAceEditor).name
7
+
8
+ export { mbgAceEditorModule }
@@ -0,0 +1,5 @@
1
+ export interface IMbgAceEditorVariables {
2
+ caption?: string
3
+ value?: string
4
+ meta?: string
5
+ }
@@ -0,0 +1,5 @@
1
+ <div class="mbg-ace-editor-wrapper"
2
+ ng-style="{'height': $ctrl.height || '84px'}">
3
+ <div ui-ace="$ctrl.aceConfig"
4
+ ng-model="$ctrl.ngModel"></div>
5
+ </div>
@@ -0,0 +1,16 @@
1
+ .mbg-ace-editor-wrapper {
2
+ border: 1px solid #ddd;
3
+ background: #fff;
4
+ border-radius: 5px;
5
+ padding: 8px 10px;
6
+
7
+ .ace_editor {
8
+ height: 100%;
9
+ border: none !important;
10
+
11
+ .ace_cursor {
12
+ border-left: 1px solid !important;
13
+ height: 20px !important;
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,66 @@
1
+ import './mbg-ace-editor.scss'
2
+ import template from './mbg-ace-editor.html'
3
+ import { IMbgAceEditorVariables } from './interface/mbg-ace-editor-variables.interface'
4
+
5
+ class MbgAceEditorController {
6
+ private aceConfig: any
7
+ private ngChange
8
+ private ngModel
9
+ private variables: IMbgAceEditorVariables[]
10
+ private editorRef
11
+
12
+ constructor(private $scope, private $element, private $attrs) {}
13
+
14
+ $onInit() {
15
+ this.aceConfig = {
16
+ onLoad: this.onLoadEditor,
17
+ }
18
+ }
19
+
20
+ onLoad(editor, variables) {
21
+ this.editorRef = editor
22
+ const ace = (<any>window).ace
23
+ const languageTools = ace.require('ace/ext/language_tools')
24
+ const customCompleter = {
25
+ getCompletions: (_, __, ___, ____, callback) => {
26
+ callback(null, variables)
27
+ },
28
+ }
29
+ languageTools.addCompleter(customCompleter)
30
+ this.editorRef.completers = [customCompleter]
31
+ this.editorRef.setOptions({
32
+ enableBasicAutocompletion: true,
33
+ fontSize: '14px',
34
+ enableSnippets: true,
35
+ enableLiveAutocompletion: false,
36
+ showLineNumbers: false,
37
+ showFoldWidgets: false,
38
+ printMarginColumn: -1,
39
+ showPrintMargin: false,
40
+ displayIndentGuides: false,
41
+ showGutter: false,
42
+ highlightActiveLine: false,
43
+ })
44
+ this.editorRef.$blockScrolling = Infinity
45
+ }
46
+
47
+ onLoadEditor = (editor) => {
48
+ const variables = this.variables
49
+ this.onLoad(editor, variables)
50
+ }
51
+ }
52
+
53
+ MbgAceEditorController['$inject'] = ['$scope', '$element', '$attrs']
54
+
55
+ const mbgAceEditor = {
56
+ bindings: {
57
+ ngModel: '=',
58
+ variables: '=?',
59
+ height: '@?',
60
+ editorRef: '=?',
61
+ },
62
+ template,
63
+ controller: MbgAceEditorController,
64
+ }
65
+
66
+ export { mbgAceEditor }
@@ -2,8 +2,7 @@ import * as angular from 'angular'
2
2
  import { mbgEditor } from './mbg-editor'
3
3
 
4
4
  const mbgEditorModule = angular
5
- .module('mbg.components.mbgEditor', [])
6
- .component('mbgEditor', mbgEditor)
7
- .name
5
+ .module('mbg.components.mbgEditor', [])
6
+ .component('mbgEditor', mbgEditor).name
8
7
 
9
8
  export { mbgEditorModule }
@@ -7,17 +7,15 @@ import { imageUploadNoImage } from './components/image-upload-no-image/image-upl
7
7
  import { imageUploadLoading } from './components/image-upload-loading/image-upload-loading'
8
8
  import { MbgImageUploadService } from './services/mbg-image-upload-service'
9
9
 
10
-
11
10
  const mbgImageUploadModule = angular
12
- .module('mbg.components.imageUpload', [])
13
- .service('mbgImageUploadService', MbgImageUploadService)
14
- .component('mbgImageUpload', imageUpload)
15
- .component('mbgImageUploadMain', imageUploadMain)
16
- .component('mbgImageUploadChildren', imageUploadChildren)
17
- .component('mbgImageUploadNoImage', imageUploadNoImage)
18
- .component('mbgImageUploadLoading', imageUploadLoading)
19
- .component('mbgImageCrop', imageCrop)
20
- .name
11
+ .module('mbg.components.imageUpload', [])
12
+ .service('mbgImageUploadService', MbgImageUploadService)
13
+ .component('mbgImageUpload', imageUpload)
14
+ .component('mbgImageUploadMain', imageUploadMain)
15
+ .component('mbgImageUploadChildren', imageUploadChildren)
16
+ .component('mbgImageUploadNoImage', imageUploadNoImage)
17
+ .component('mbgImageUploadLoading', imageUploadLoading)
18
+ .component('mbgImageCrop', imageCrop).name
21
19
 
22
20
  export * from './interfaces'
23
21
  export { mbgImageUploadModule }
package/src/index.html CHANGED
@@ -176,9 +176,6 @@
176
176
  label="Opções"></mbg-dropdown>
177
177
  </div> -->
178
178
 
179
- <!-- <mbg-input-text ng-model="asdasdasd"
180
- ng-change="hhhsss($event)"></mbg-input-text> -->
181
-
182
179
  <!-- <div style="padding: 24px;">
183
180
  <div class="container">
184
181
  <br />
@@ -795,7 +792,7 @@
795
792
  </div>
796
793
  </div> -->
797
794
 
798
- <div style="padding: 100px">
795
+ <!-- <div style="padding: 100px">
799
796
  <div class="panel panel-default">
800
797
  <div class="panel-heading">Email</div>
801
798
  <div class="panel-body">
@@ -809,7 +806,7 @@
809
806
  <mbg-address ng-model="address"></mbg-address>
810
807
  </div>
811
808
  </div>
812
- </div>
809
+ </div> -->
813
810
 
814
811
 
815
812
  <!-- <form>
@@ -984,6 +981,26 @@
984
981
  </div>
985
982
  {{teste}}
986
983
  </div> -->
984
+ <div style="padding: 100px">
985
+ <div class="panel panel-default">
986
+ <div class="panel-heading">Ace Editor</div>
987
+ <div class="panel-body">
988
+ <mbg-ace-editor ng-model="aceEditor"
989
+ height="104px"
990
+ editor-ref="uiAceRef"
991
+ variables="uiAceVariables"></mbg-ace-editor>
992
+ <button type="button"
993
+ ng-click="onPastEditor('Teste Label')"> Clique aqui!</button>
994
+ </div>
995
+ </div>
996
+ <div class="panel panel-default">
997
+ <div class="panel-heading">Text</div>
998
+ <div class="panel-body">
999
+ <mbg-input-text ng-model="asdasdasd"
1000
+ ng-change="hhhsss($event)"></mbg-input-text>
1001
+ </div>
1002
+ </div>
1003
+
987
1004
  </div>
988
1005
  </body>
989
1006
 
package/src/index.ts CHANGED
@@ -39,6 +39,8 @@ const module = angular.module('demo', ['ngLocale', components]).controller('demo
39
39
  onSave: (json) => {},
40
40
  }
41
41
 
42
+ $scope.uiAceRef = null
43
+
42
44
  $scope.addEvent = () => {
43
45
  $timeout(() => {
44
46
  $scope.events.push({
@@ -771,87 +773,6 @@ const module = angular.module('demo', ['ngLocale', components]).controller('demo
771
773
  $scope.columnQntHidden = !$scope.columnQntHidden
772
774
  }
773
775
 
774
- $scope.produtos = [
775
- {
776
- code: '0',
777
- product: 'Camiseta Adidas farm floral',
778
- qnt: 20,
779
- costValue: 200.0,
780
- },
781
- {
782
- code: '1',
783
- product: 'Blusa Adidas undeground',
784
- qnt: 37,
785
- costValue: 435.9,
786
- },
787
- {
788
- code: '2',
789
- product: 'Calça Nike undeground',
790
- qnt: 25,
791
- costValue: 348.9,
792
- },
793
- {
794
- code: '3',
795
- product: 'Shorts Nike undeground',
796
- qnt: 25,
797
- costValue: 348.9,
798
- },
799
- {
800
- code: '0',
801
- product: 'Camiseta Adidas farm floral',
802
- qnt: 20,
803
- costValue: 200.0,
804
- },
805
- {
806
- code: '1',
807
- product: 'Blusa Adidas undeground',
808
- qnt: 37,
809
- costValue: 435.9,
810
- },
811
- {
812
- code: '2',
813
- product: 'Calça Nike undeground',
814
- qnt: 25,
815
- costValue: 348.9,
816
- },
817
- {
818
- code: '3',
819
- product: 'Shorts Nike undeground',
820
- qnt: 25,
821
- costValue: 348.9,
822
- },
823
- {
824
- code: '0',
825
- product: 'Camiseta Adidas farm floral',
826
- qnt: 20,
827
- costValue: 200.0,
828
- },
829
- {
830
- code: '1',
831
- product: 'Blusa Adidas undeground',
832
- qnt: 37,
833
- costValue: 435.9,
834
- },
835
- {
836
- code: '2',
837
- product: 'Calça Nike undeground',
838
- qnt: 25,
839
- costValue: 348.9,
840
- },
841
- {
842
- code: '3',
843
- product: 'Shorts Nike undeground',
844
- qnt: 25,
845
- costValue: 348.9,
846
- },
847
- {
848
- code: '0',
849
- product: 'Camiseta Adidas farm floral',
850
- qnt: 20,
851
- costValue: 200.0,
852
- },
853
- ]
854
-
855
776
  $scope.lalala = () => {
856
777
  console.log('aspodasdpoasdoasd')
857
778
  }
@@ -8954,6 +8875,20 @@ const module = angular.module('demo', ['ngLocale', components]).controller('demo
8954
8875
  $scope.testecons = () => {
8955
8876
  console.log('asdihasoidashpid')
8956
8877
  }
8878
+
8879
+ $scope.uiAceVariables = [
8880
+ {
8881
+ caption: 'Teste 1',
8882
+ value: '{teste1}',
8883
+ meta: 'Variável',
8884
+ },
8885
+ ]
8886
+
8887
+ $scope.onPastEditor = (value) => {
8888
+ if ($scope.uiAceRef) {
8889
+ $scope.uiAceRef.insert(value)
8890
+ }
8891
+ }
8957
8892
  },
8958
8893
  ])
8959
8894
  angular.bootstrap(document, [module.name])