@kigi/components 1.5.2 → 1.5.5

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.2",
3
+ "version": "1.5.5",
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,15 @@
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
+
10
+ .ace_cursor {
11
+ border-left: 1px solid !important;
12
+ height: 20px !important;
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,63 @@
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
+
11
+ constructor(private $scope, private $element, private $attrs) {}
12
+
13
+ $onInit() {
14
+ this.aceConfig = {
15
+ onLoad: this.onLoadEditor,
16
+ }
17
+ }
18
+
19
+ onLoad(editor, variables) {
20
+ const ace = (<any>window).ace
21
+ const languageTools = ace.require('ace/ext/language_tools')
22
+ const customCompleter = {
23
+ getCompletions: (_, __, ___, ____, callback) => {
24
+ callback(null, variables)
25
+ },
26
+ }
27
+ languageTools.addCompleter(customCompleter)
28
+ editor.completers = [customCompleter]
29
+ editor.setOptions({
30
+ enableBasicAutocompletion: true,
31
+ fontSize: '14px',
32
+ enableSnippets: true,
33
+ enableLiveAutocompletion: false,
34
+ showLineNumbers: false,
35
+ showFoldWidgets: false,
36
+ printMarginColumn: -1,
37
+ showPrintMargin: false,
38
+ displayIndentGuides: false,
39
+ showGutter: false,
40
+ highlightActiveLine: false,
41
+ })
42
+ editor.$blockScrolling = Infinity
43
+ }
44
+
45
+ onLoadEditor = (editor) => {
46
+ const variables = this.variables
47
+ this.onLoad(editor, variables)
48
+ }
49
+ }
50
+
51
+ MbgAceEditorController['$inject'] = ['$scope', '$element', '$attrs']
52
+
53
+ const mbgAceEditor = {
54
+ bindings: {
55
+ ngModel: '=',
56
+ variables: '=?',
57
+ height: '@?',
58
+ },
59
+ template,
60
+ controller: MbgAceEditorController,
61
+ }
62
+
63
+ export { mbgAceEditor }
@@ -39,6 +39,7 @@ class MbgAddressController {
39
39
  public manualLabel
40
40
  public fullAddress
41
41
  private GOOGLE_API_KEY = 'AIzaSyB0aH7e6XjWJ-xViji3CuXHBbLuWRALC78'
42
+ private notFoundPremisse
42
43
 
43
44
  constructor(
44
45
  public $scope,
@@ -340,6 +341,13 @@ class MbgAddressController {
340
341
  formalCode,
341
342
  uf,
342
343
  }
344
+ if (!premisse) {
345
+ if (this.notFoundPremisse) {
346
+ this.notFoundPremisse()
347
+ }
348
+ this.openModalManual(false, this.address)
349
+ return
350
+ }
343
351
  this.updateSteps()
344
352
  this.createFullName()
345
353
  this.$timeout(() => this.focusInputNumber())
@@ -525,7 +533,7 @@ class MbgAddressController {
525
533
  return str
526
534
  }
527
535
 
528
- openModalManual(EX: boolean = false) {
536
+ openModalManual(EX: boolean = false, address?) {
529
537
  const modal = this.$uibModal.open({
530
538
  animation: true,
531
539
  template: MbgAddressManualTemplate,
@@ -533,6 +541,7 @@ class MbgAddressController {
533
541
  controllerAs: '$ctrl',
534
542
  size: 'md',
535
543
  resolve: {
544
+ address: () => address,
536
545
  EX,
537
546
  notFound: () => this.notFound,
538
547
  },
@@ -541,6 +550,7 @@ class MbgAddressController {
541
550
  if (response) {
542
551
  response.zipCode = response.zipCode || ''
543
552
  this.address.country = response.country || 'Brasil'
553
+ this.address.premisse = response.premisse || this.address.premisse
544
554
  this.ngModel = response
545
555
  if (!EX) {
546
556
  this.$timeout(() => this.searchAddressInfo(JSON.parse(JSON.stringify(response))))
@@ -566,6 +576,7 @@ const mbgAddress = {
566
576
  cepClass: '=?',
567
577
  onFinishFocusElement: '@?',
568
578
  manualLabel: '@?',
579
+ notFoundPremisse: '&?',
569
580
  },
570
581
  template,
571
582
  controller: MbgAddressController,
@@ -37,6 +37,7 @@ class MbgAddressManualController {
37
37
  public mbgAddressService,
38
38
  public EX,
39
39
  public notFound,
40
+ public address,
40
41
  ) {}
41
42
 
42
43
  $onInit() {
@@ -44,6 +45,9 @@ class MbgAddressManualController {
44
45
  this.createAutocompleteDisabled()
45
46
  this.loadStates()
46
47
  this.loadCountries()
48
+ if (this.address) {
49
+ this.entity = this.address
50
+ }
47
51
  }
48
52
 
49
53
  validateLenth() {
@@ -173,6 +177,7 @@ MbgAddressManualController['$inject'] = [
173
177
  'mbgAddressService',
174
178
  'EX',
175
179
  'notFound',
180
+ 'address',
176
181
  ]
177
182
 
178
183
  export { MbgAddressManualController }
@@ -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 }
@@ -56,7 +56,7 @@ class MbgRepasseController {
56
56
  handleNgModel() {
57
57
  this.$timeout(() => {
58
58
  this.ngModel['conditions'] = this.conditions
59
- .filter((cond) => cond.field && cond.operator && cond.selected)
59
+ .filter((cond) => cond.field && cond.operator && cond.selected !== undefined)
60
60
  .map((condition) => {
61
61
  return {
62
62
  field: condition.field.type,
@@ -65,7 +65,7 @@ class MbgRepasseController {
65
65
  }
66
66
  })
67
67
  this.ngModel['applies'] = this.applies
68
- .filter((app) => app.field && app.selected)
68
+ .filter((app) => app.field && app.selected !== undefined)
69
69
  .map((apply) => {
70
70
  return {
71
71
  field: apply.field.type,
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,23 @@
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
+ variables="uiAceVariables"></mbg-ace-editor>
991
+ </div>
992
+ </div>
993
+ <div class="panel panel-default">
994
+ <div class="panel-heading">Text</div>
995
+ <div class="panel-body">
996
+ <mbg-input-text ng-model="asdasdasd"
997
+ ng-change="hhhsss($event)"></mbg-input-text>
998
+ </div>
999
+ </div>
1000
+
987
1001
  </div>
988
1002
  </body>
989
1003
 
package/src/index.ts CHANGED
@@ -771,87 +771,6 @@ const module = angular.module('demo', ['ngLocale', components]).controller('demo
771
771
  $scope.columnQntHidden = !$scope.columnQntHidden
772
772
  }
773
773
 
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
774
  $scope.lalala = () => {
856
775
  console.log('aspodasdpoasdoasd')
857
776
  }
@@ -8954,6 +8873,14 @@ const module = angular.module('demo', ['ngLocale', components]).controller('demo
8954
8873
  $scope.testecons = () => {
8955
8874
  console.log('asdihasoidashpid')
8956
8875
  }
8876
+
8877
+ $scope.uiAceVariables = [
8878
+ {
8879
+ caption: 'Teste 1',
8880
+ value: '{teste1}',
8881
+ meta: 'Variável',
8882
+ },
8883
+ ]
8957
8884
  },
8958
8885
  ])
8959
8886
  angular.bootstrap(document, [module.name])