@dualbox/editor 1.0.85 → 1.0.87

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.
@@ -514,88 +514,6 @@
514
514
  </div>
515
515
  </div>
516
516
  </div>
517
-
518
- <div class="modal edit-value-modal" tabindex="-1" role="dialog">
519
- <div class="modal-dialog" role="document">
520
- <div class="modal-content">
521
- <div class="modal-header">
522
- <h5 class="modal-title">Edit value</h5>
523
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
524
- <span aria-hidden="true">&times;</span>
525
- </button>
526
- </div>
527
- <div class="modal-body">
528
- <div class="set-type">
529
- <div class="form-check">
530
- <input type="radio" class="form-check-input set-value unset-value" id="unset-value" name="set-value" value="unset-value" checked>
531
- <label class="form-check-label" for="unset-value">
532
- don't set a value
533
- </label>
534
- </div>
535
- <div class="form-check">
536
- <input type="radio" class="form-check-input set-value set-value-null" id="set-value-null" name="set-value" value="set-value-null">
537
- <label class="form-check-label" for="set-value-null">
538
- set null
539
- </label>
540
- </div>
541
- <div class="form-check">
542
- <input type="radio" class="form-check-input set-value set-value-type" id="set-value-type" name="set-value" value="set-value-type" aria-label="Set a value of type">
543
- <div class="form-inline form-check-label" style="height: 24px;">
544
- <label for="set-value-type">
545
- set a value of type:
546
- <select class="form-control choose-value-type d-inline-block form-control-sm ml-2">
547
- <option value="string">String</option>
548
- <option value="number">Number</option>
549
- <option value="boolean">Boolean</option>
550
- <option value="object">Object</option>
551
- <option value="file">File</option>
552
- </select>
553
- </label>
554
- </div>
555
- </div>
556
- </div>
557
- <hr class="separator"/>
558
- <div class="has-value" style="display: none;">
559
- <div class="define-value define-boolean" style="display: none;">
560
- <div class="form-inline">
561
- <label>Value: </label>
562
- <select class="form-control form-control-sm bool-value d-inline-block ml-2">
563
- <option value=true>True</option>
564
- <option value=false>False</option>
565
- </select>
566
- </div>
567
- </div>
568
- <div class="define-value define-file" style="display: none;">
569
- <div class="form-inline">
570
- <label>File input</label>
571
- <input type="file" class="form-control-file form-control-sm file-value">
572
- </div>
573
- </div>
574
- <div class="define-value define-number" style="display: none;">
575
- <div class="form-inline">
576
- <label>Value: </label>
577
- <input type="number" class="form-control form-control-sm number-value ml-2"/>
578
- </div>
579
- </div>
580
- <div class="define-value define-string" style="display: none;">
581
- <div class="form-inline">
582
- <label>Value: </label>
583
- <input type="text" class="form-control form-control-sm text-value ml-2"/>
584
- </div>
585
- </div>
586
- <div class="define-value define-object" style="display: none;">
587
- <label>Value: </label>
588
- <div class="json-editor" style="height: 400px;"></div>
589
- </div>
590
- </div>
591
- </div>
592
- <div class="modal-footer">
593
- <button type="button" class="btn btn-primary btn-save">Save changes</button>
594
- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
595
- </div>
596
- </div>
597
- </div>
598
- </div>
599
517
  </div>
600
518
  </template>
601
519
 
@@ -604,7 +522,6 @@ import _ from 'lodash-es';
604
522
  import DisplayTypeVue from './displayType.vue';
605
523
  import DisplayValueVue from './displayValue.vue';
606
524
  import GraphNodeVue from './graphNode.vue';
607
- import JSONEditor from '@dualbox/dualbox-lib-jsoneditor';
608
525
  import swal from 'sweetalert2';
609
526
 
610
527
  export default {
@@ -644,10 +561,6 @@ export default {
644
561
 
645
562
  // allow tooltips
646
563
  this.activateTooltip();
647
-
648
- // bind the json editor
649
- this.editor = new JSONEditor($(this.$el).find('.json-editor')[0], { modes: ['tree', 'code', 'text' ]});
650
- this.editor.set({});
651
564
  },
652
565
  beforeUpdate: function() {
653
566
  //console.log('[Updating] node-settings');
@@ -669,11 +582,6 @@ export default {
669
582
  deactivate: function() {
670
583
  this.deactivateTooltip();
671
584
  },
672
- destroyed: function() {
673
- if( this.editor ) {
674
- this.editor.destroy();
675
- }
676
- },
677
585
  methods: {
678
586
  fixCardStyle: function() {
679
587
  var card = $(this.$el).find('.module-left-signature .card');
@@ -15,6 +15,11 @@
15
15
  .dragOver {
16
16
  border-bottom: 2px solid blue;
17
17
  }
18
+
19
+ .edit-input-value[type="text"] {
20
+ font-size: 75px;
21
+ }
22
+
18
23
  </style>
19
24
 
20
25
  <template>
@@ -22,7 +27,7 @@
22
27
  <p style="display: none;">{{cIndex}}</p>
23
28
  <template v-if="isBasicDataType()">
24
29
  <template v-if="dataType === 'string'">
25
- <input class="edit-value-input" type="text" @keyup.enter="setStringValue" @keyup.esc="setStringValue" @blur="setStringValueFromBlur" :value="v" @focus="$event.target.select()" />
30
+ <textarea rows=3 class="edit-value-input" type="text" @keyup.enter="setStringValue" @keyup.esc="setStringValue" @blur="setStringValueFromBlur" :value="v" @focus="$event.target.select()" />
26
31
  </template>
27
32
 
28
33
  <template v-else-if="dataType === 'boolean'">
@@ -44,8 +49,8 @@
44
49
  <div v-if="isArrayType()" class="row" style="background-color: rgba(0,0,0,.125);">Array Editor</div>
45
50
  <div v-else-if="isMapType()" class="row" style="background-color: rgba(0,0,0,.125);">Map Editor</div>
46
51
  <div class="row" style="1px solid rgba(0,0,0,.125);">
47
- <div class="col list-group-flush" :class="{ 'col-1' : isArrayType(), 'col-2' : isMapType()}" style="padding: 0; background-color: white; overflow-y: auto; border-right: 1px solid rgba(0, 0, 0, 0.125);">
48
- <button v-for="index in deserializedValue.keys()" :draggable="isArrayType()" @dragstart="arrayIndexDragStart(index, $event)" @dragover.prevent @dragenter="arrayIndexDragEnter" @dragleave="arrayIndexDragLeave" @drop="arrayIndexDrop(index, $event)" :key="index" :data-key="index" type="button" class="list-group-item list-group-item-action" :class="{ active: isSelectedIndex(index) }" style="text-align: center;" @click="selectIndex(index)">{{index}}</button>
52
+ <div class="col list-group-flush" :class="{ 'col-1' : isArrayType(), 'col-2' : isMapType()}" style="padding: 0; background-color: white; overflow-y: auto; border-right: 1px solid rgba(0, 0, 0, 0.125); max-height: 500px;">
53
+ <button v-for="index in deserializedValue.keys()" :draggable="isArrayType()" @dragstart="arrayIndexDragStart(index, $event)" @dragover.prevent @dragenter="arrayIndexDragEnter" @dragleave="arrayIndexDragLeave" @drop="arrayIndexDrop(index, $event)" :key="index" :data-key="index" type="button" class="list-group-item list-group-item-action" :class="{ active: isSelectedIndex(index) }" style="text-align: center; padding: 12px;" @click="selectIndex(index)">{{index}}</button>
49
54
  <button type="button" @click="addItem" class="list-group-item list-group-item-action add-item" style="text-align: center;"><i class="fas fa-plus-circle"></i></button>
50
55
  </div>
51
56
  <div class="col" style="padding: 10px">
@@ -77,6 +82,8 @@ import _ from "lodash-es";
77
82
  import swal from "sweetalert2";
78
83
  import JSONEditor from "@dualbox/dualbox-lib-jsoneditor";
79
84
 
85
+ var JSONEditorMode = "tree";
86
+
80
87
  String.prototype.hashCode = function() {
81
88
  var hash = 0,
82
89
  i,
@@ -189,8 +196,12 @@ export default {
189
196
  this.editor = new JSONEditor(
190
197
  $(this.$el).find(".field-editor")[0],
191
198
  {
199
+ mode: JSONEditorMode,
192
200
  modes: ["tree", "code", "text"],
193
- onChange: this.debouncedJsonEmit
201
+ onChange: this.debouncedJsonEmit,
202
+ onModeChange: (newMode) => {
203
+ JSONEditorMode = newMode;
204
+ }
194
205
  }
195
206
  );
196
207
  }
@@ -1164,7 +1164,7 @@ export default {
1164
1164
  }
1165
1165
  }
1166
1166
  ];
1167
- if (this.n.isModule() || this.n.isUI()) {
1167
+ if (this.n.isModule() || this.n.isUI() || this.n.isInput() || this.n.isOutput()) {
1168
1168
  contextOptions.push({
1169
1169
  name: "Duplicate this box",
1170
1170
  fn: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dualbox/editor",
3
- "version": "1.0.85",
3
+ "version": "1.0.87",
4
4
  "description": "Editor of Dualbox apps",
5
5
  "browser": "js/dist/GraphEditor.js",
6
6
  "main": "js/dist/GraphEditor.js",
@@ -1,109 +0,0 @@
1
- <style>
2
- .add-node-modal .modal-body {
3
- height: 70vh;
4
- }
5
-
6
- .h100 {
7
- height: 100%!important;
8
- min-height: 100%!important;
9
- }
10
-
11
- .table-desc th, .table-desc td {
12
- margin-right: 10px;
13
- }
14
-
15
- #add-node-modal .modal-dialog {
16
- min-width: calc(100% - 40px)!important;
17
- height: calc(100% - 40px);
18
- margin: 20px;
19
- padding: 0;
20
- }
21
-
22
- #add-node-modal .modal-content {
23
- height: auto;
24
- min-height: 100%;
25
- border-radius: 0;
26
- }
27
- </style>
28
-
29
- <template>
30
- <div class="modal fade add-node-modal" :class="{ 'hide' : !display }" id="add-node-modal" tabindex="-1" role="dialog">
31
- <div class="modal-dialog" role="document">
32
- <div class="modal-content h100">
33
- <div class="modal-header">
34
- <h5 class="modal-title">Add a new Input</h5>
35
-
36
- <div class="mx-auto">
37
- <input class="form-control mx-auto search-modules" type="text" placeholder="Search modules..." id="search-nodes" style="width: 300px;" @input="searchModules"/>
38
- </div>
39
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
40
- <span aria-hidden="true">&times;</span>
41
- </button>
42
- </div>
43
- <div class="modal-body">
44
- <div class="container-fluid h100">
45
- <div class="row">
46
- </div>
47
- </div>
48
- </div>
49
- <div class="modal-footer">
50
- <button type="button" class="btn btn-primary add-node-btn" v-on:click="addSelectedInput">Add Input</button>
51
- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
52
- </div>
53
- </div>
54
- </div>
55
- </div>
56
- </template>
57
-
58
- <script>
59
- import _ from 'lodash-es';
60
- import swal from 'sweetalert2';
61
-
62
- export default {
63
- props: [
64
- "display", // original state (true = show, false=hide) of the modal
65
- ],
66
- components: {
67
-
68
- },
69
- data: function () {
70
- return {
71
- error: null,
72
- results: [],
73
- selectedResult : null,
74
- }
75
- },
76
- created: function() {
77
- this.view = window.dualboxEditor.v;
78
- },
79
- updated: function() {
80
- console.log('AddNode updated !');
81
- this.updateVisibility();
82
- },
83
- mounted: function() {
84
- var self = this;
85
- this.updateVisibility(); // to init our modal
86
- $(this.$el).on("hide.bs.modal", () => {
87
- self.$emit('closed');
88
- });
89
- },
90
- methods: {
91
- updateVisibility : function() {
92
- if( this.display ) {
93
- $(this.$el).modal("show");
94
- }
95
- else {
96
- $(this.$el).modal("hide");
97
- }
98
- },
99
-
100
- addSelectedInput: function(e) {
101
-
102
- },
103
-
104
-
105
- }
106
- }
107
-
108
- </script>
109
-