@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.
@@ -4,25 +4,26 @@
4
4
  }
5
5
 
6
6
  .h100 {
7
- height: 100%!important;
8
- min-height: 100%!important;
7
+ height: 100% !important;
8
+ min-height: 100% !important;
9
9
  }
10
10
 
11
- .table-desc th, .table-desc td {
11
+ .table-desc th,
12
+ .table-desc td {
12
13
  margin-right: 10px;
13
14
  }
14
15
 
15
16
  #add-node-modal .modal-dialog {
16
- min-width: calc(100% - 40px)!important;
17
- height: calc(100% - 40px);
18
- margin: 20px;
19
- padding: 0;
17
+ min-width: calc(100% - 40px) !important;
18
+ height: calc(100% - 40px);
19
+ margin: 20px;
20
+ padding: 0;
20
21
  }
21
22
 
22
23
  #add-node-modal .modal-content {
23
- height: auto;
24
- min-height: 100%;
25
- border-radius: 0;
24
+ height: auto;
25
+ min-height: 100%;
26
+ border-radius: 0;
26
27
  }
27
28
 
28
29
  .nav-item {
@@ -59,8 +60,8 @@
59
60
  display: none;
60
61
  width: 1px;
61
62
  height: 24px;
62
- box-shadow: none!important;
63
- border-color: rgba(0,0,0,0.3)!important;
63
+ box-shadow: none !important;
64
+ border-color: rgba(0, 0, 0, 0.3) !important;
64
65
  }
65
66
 
66
67
  .nav-link.active .input-search {
@@ -71,32 +72,35 @@
71
72
  width: 200px;
72
73
  }
73
74
  .nav-compute > a.active > input {
74
- background-color: rgba(0,0,0,0.3)!important;
75
+ background-color: rgba(0, 0, 0, 0.3) !important;
75
76
  }
76
77
 
77
- .nav-compute > a.active, .nav-compute > a.active > input {
78
- background-color: rgba(0,0,0,0.3)!important;
79
- color: rgba(255,255,255,0.5);
78
+ .nav-compute > a.active,
79
+ .nav-compute > a.active > input {
80
+ background-color: rgba(0, 0, 0, 0.3) !important;
81
+ color: rgba(255, 255, 255, 0.5);
80
82
  }
81
83
 
82
- .nav-compute> a.active > .input-search::placeholder {
83
- color: rgba(255,255,255,0.5);
84
+ .nav-compute > a.active > .input-search::placeholder {
85
+ color: rgba(255, 255, 255, 0.5);
84
86
  }
85
87
 
86
- .nav-uis > a.active, .nav-uis > a.active > input {
87
- background-color: #bff2ca!important;
88
+ .nav-uis > a.active,
89
+ .nav-uis > a.active > input {
90
+ background-color: #bff2ca !important;
88
91
  }
89
92
 
90
93
  .nav-inputs > a.active {
91
- background-color: #f5d76e!important;
94
+ background-color: #f5d76e !important;
92
95
  }
93
96
 
94
97
  .nav-compute > a.active > input {
95
- background-color: rgba(0,0,0,0.8);
98
+ background-color: rgba(0, 0, 0, 0.8);
96
99
  }
97
100
 
98
- .nav-outputs > a.active, .nav-outputs > a.active > input {
99
- background-color: #ffb3a7!important;
101
+ .nav-outputs > a.active,
102
+ .nav-outputs > a.active > input {
103
+ background-color: #ffb3a7 !important;
100
104
  }
101
105
 
102
106
  .message-container {
@@ -115,7 +119,8 @@
115
119
  text-align: center;
116
120
  }
117
121
 
118
- .tab-content, .tab-pane {
122
+ .tab-content,
123
+ .tab-pane {
119
124
  width: 100%;
120
125
  height: 100%;
121
126
  }
@@ -126,7 +131,7 @@ label {
126
131
  }
127
132
 
128
133
  fieldset {
129
- border: 1px solid rgba(0,0,0,0.1);
134
+ border: 1px solid rgba(0, 0, 0, 0.1);
130
135
  margin: 10px;
131
136
  padding: 20px;
132
137
  min-width: 600px;
@@ -143,23 +148,23 @@ fieldset {
143
148
  <li class="nav-item nav-compute">
144
149
  <a class="nav-link active" href="#add-module-or-ui" data-toggle="pill" @click="selectType('module')" draggable="false">
145
150
  <span>Compute</span>
146
- <input class="form-control input-sm input-search search-modules" type="text" placeholder="Search modules..." id="search-modules" v-model="searchText['module']" @input="searchModules" autofocus/>
151
+ <input class="form-control input-sm input-search search-modules" type="text" placeholder="Search modules..." id="search-modules" v-model="searchText['module']" @input="searchModules" autofocus />
147
152
  </a>
148
153
  </li>
149
154
  <li class="nav-item nav-uis">
150
155
  <a class="nav-link" href="#add-module-or-ui" data-toggle="pill" @click="selectType('ui')" draggable="false">
151
156
  <span>UI</span>
152
- <input class="form-control input-sm input-search search-ui" type="text" placeholder="Search UIs..." id="search-uis" @input="searchModules" v-model="searchText['ui']" autofocus/>
157
+ <input class="form-control input-sm input-search search-ui" type="text" placeholder="Search UIs..." id="search-uis" @input="searchModules" v-model="searchText['ui']" autofocus />
153
158
  </a>
154
159
  </li>
155
- <li class="nav-item nav-inputs" @click="selectType('input')">
160
+ <li class="nav-item nav-inputs" @click="selectType('input')">
156
161
  <a class="nav-link" href="#add-input" data-toggle="pill" draggable="false"><span>Input</span></a>
157
162
  </li>
158
163
  <li class="nav-item nav-outputs" @click="selectType('output')">
159
- <a class="nav-link" href="#add-output"data-toggle="pill" draggable="false"><span>Output</span></a>
164
+ <a class="nav-link" href="#add-output" data-toggle="pill" draggable="false"><span>Output</span></a>
160
165
  </li>
161
166
  <li class="nav-item nav-outputs" @click="selectType('metanode')">
162
- <a class="nav-link" href="#add-metanode"data-toggle="pill" draggable="false"><span>Metabox</span></a>
167
+ <a class="nav-link" href="#add-metanode" data-toggle="pill" draggable="false"><span>Metabox</span></a>
163
168
  </li>
164
169
  </ul>
165
170
 
@@ -204,7 +209,7 @@ fieldset {
204
209
 
205
210
  <div class="form-group">
206
211
  <label for="input-name">Input type:</label>
207
- <input style="display: none;" required/>
212
+ <input style="display: none;" required />
208
213
  <edit-type ref="inputType" :type="inputType" :displayOKButton="false"></edit-type>
209
214
  </div>
210
215
 
@@ -228,7 +233,7 @@ fieldset {
228
233
 
229
234
  <div class="form-group">
230
235
  <label for="output-name">Output type:</label>
231
- <input style="display: none;" required/>
236
+ <input style="display: none;" required />
232
237
  <edit-type ref="outputType" :type="outputType" :displayOKButton="false"></edit-type>
233
238
  </div>
234
239
 
@@ -243,7 +248,9 @@ fieldset {
243
248
  <div class="tab-pane" id="add-metanode" role="tabpanel" aria-labelledby="add-metanode-tab">
244
249
  <div class="row">
245
250
  <fieldset class="mx-auto" style="margin-top: 50px;">
246
- <h2 class="mt-2">Add a new Metabox <!--<button class="btn btn-outline-secondary float-right" @click="importMetabox"><i class="fas fa-upload"></i></button>--></h2>
251
+ <h2 class="mt-2">Add a new Metabox
252
+ <!--<button class="btn btn-outline-secondary float-right" @click="importMetabox"><i class="fas fa-upload"></i></button>-->
253
+ </h2>
247
254
 
248
255
  <div class="form-group">
249
256
  <label for="metanode-name">Metabox name:</label>
@@ -276,11 +283,11 @@ fieldset {
276
283
  </template>
277
284
 
278
285
  <script>
279
- import _ from 'lodash-es';
280
- import swal from 'sweetalert2';
281
- import SearchResultsVue from './searchResults.vue';
282
- import DisplayResultVue from './displayResult.vue';
283
- import EditTypeVue from './editType.vue'
286
+ import _ from "lodash-es";
287
+ import swal from "sweetalert2";
288
+ import SearchResultsVue from "./searchResults.vue";
289
+ import DisplayResultVue from "./displayResult.vue";
290
+ import EditTypeVue from "./editType.vue";
284
291
 
285
292
  export default {
286
293
  props: [
@@ -288,35 +295,35 @@ export default {
288
295
  "mousePosition" // mouse position when this panel was opened
289
296
  ],
290
297
  components: {
291
- 'search-results' : SearchResultsVue,
292
- 'display-result' : DisplayResultVue,
293
- 'edit-type' : EditTypeVue
298
+ "search-results": SearchResultsVue,
299
+ "display-result": DisplayResultVue,
300
+ "edit-type": EditTypeVue
294
301
  },
295
- data: function () {
302
+ data: function() {
296
303
  return {
297
304
  error: null,
298
305
 
299
306
  searchText: {}, // the search text, indexed by selectedType
300
307
  results: {}, // dictionary of arrays, indexed by selectedType
301
- selectedResult : {}, // dictionary of string, indexed by selectedType
308
+ selectedResult: {}, // dictionary of string, indexed by selectedType
302
309
  selectedType: "module",
303
310
  inputType: "*",
304
311
  outputType: "*"
305
- }
312
+ };
306
313
  },
307
314
  created: function() {
308
315
  this.view = window.dualboxEditor.v;
309
316
  },
310
317
  updated: function() {
311
- console.log('AddNode updated !');
318
+ console.log("AddNode updated !");
312
319
  this.updateVisibility();
313
320
  this.setSearchFocus();
314
321
 
315
- if( !this.display ) {
322
+ if (!this.display) {
316
323
  // make sure the modal disappeared
317
- $(this.$el).modal('hide');
318
- $('body').removeClass('modal-open');
319
- $('.modal-backdrop').remove();
324
+ $(this.$el).modal("hide");
325
+ $("body").removeClass("modal-open");
326
+ $(".modal-backdrop").remove();
320
327
  }
321
328
  },
322
329
  mounted: function() {
@@ -327,23 +334,24 @@ export default {
327
334
  this.setSearchFocus();
328
335
  });
329
336
  $(this.$el).on("hide.bs.modal", () => {
330
- self.$emit('closed');
337
+ self.$emit("closed");
331
338
  });
332
339
 
333
- $(this.$el).find('[data-toggle="pill"]').on('shown.bs.tab', (e) => {
334
- this.setSearchFocus();
335
- var selectedResult = this.getSelectedResult();
336
- if( selectedResult ) {
337
- this.$refs.searchResults.selected = selectedResult.name;
338
- }
339
- });
340
+ $(this.$el)
341
+ .find('[data-toggle="pill"]')
342
+ .on("shown.bs.tab", e => {
343
+ this.setSearchFocus();
344
+ var selectedResult = this.getSelectedResult();
345
+ if (selectedResult) {
346
+ this.$refs.searchResults.selected = selectedResult.name;
347
+ }
348
+ });
340
349
  },
341
350
  methods: {
342
- updateVisibility : function() {
343
- if( this.display ) {
351
+ updateVisibility: function() {
352
+ if (this.display) {
344
353
  $(this.$el).modal("show");
345
- }
346
- else {
354
+ } else {
347
355
  $(this.$el).modal("hide");
348
356
  }
349
357
  },
@@ -351,11 +359,28 @@ export default {
351
359
  closeModal: function() {
352
360
  // don't mutate prop directly, mute the parent
353
361
  // this.display = false;
354
- this.$emit('closed');
362
+
363
+ return new Promise((resolve, reject) => {
364
+ this.$emit("closed");
365
+
366
+ let forceCloseModal = () => {
367
+ if (!this.display) {
368
+ resolve();
369
+ } else {
370
+ this.$emit("closed");
371
+ setTimeout(forceCloseModal, 100);
372
+ }
373
+ };
374
+
375
+ this.$nextTick(forceCloseModal);
376
+ });
355
377
  },
356
378
 
357
- setSearchFocus : function() {
358
- $(this.$el).find('.nav-link.active').find('input').focus();
379
+ setSearchFocus: function() {
380
+ $(this.$el)
381
+ .find(".nav-link.active")
382
+ .find("input")
383
+ .focus();
359
384
  },
360
385
 
361
386
  selectType(t) {
@@ -364,81 +389,100 @@ export default {
364
389
  this.searchText[t] = searchText;
365
390
  },
366
391
 
367
- addSelectedNode: function(e) {
368
- switch( this.selectedType ) {
369
- case "module":
370
- case "ui":
371
- var selectedNode = $('.node-result.selected')[0];
372
- if( selectedNode ) {
373
- this.closeModal();
374
- this.$nextTick(() => {
392
+ addSelectedNode: async function(e) {
393
+ switch (this.selectedType) {
394
+ case "module":
395
+ case "ui":
396
+ var selectedNode = $(".node-result.selected")[0];
397
+ if (selectedNode) {
398
+ await this.closeModal();
375
399
  // add node to the controller
376
- var packageName = $(selectedNode).data('package');
400
+ var packageName = $(selectedNode).data("package");
377
401
  this.view.c.addNewBox(packageName, this.mousePosition);
378
- });
379
- }
380
- else {
381
- swal('Please select a node', '', 'error');
382
- return;
383
- }
384
- break;
385
-
386
- case "input":
387
- var type = this.$refs.inputType.get();
388
- var name = $(this.$el).find('.input-name').val();
389
- var desc = $(this.$el).find('.input-description').val();
390
- if( type !== undefined && name ) {
391
- this.closeModal();
392
- this.$nextTick(() => {
393
- this.view.c.addInput(name, type, desc, this.mousePosition);
402
+ } else {
403
+ swal("Please select a node", "", "error");
404
+ return;
405
+ }
406
+ break;
407
+
408
+ case "input":
409
+ var type = this.$refs.inputType.get();
410
+ var name = $(this.$el)
411
+ .find(".input-name")
412
+ .val();
413
+ var desc = $(this.$el)
414
+ .find(".input-description")
415
+ .val();
416
+ if (type !== undefined && name) {
417
+ await this.closeModal();
418
+ this.view.c.addInput(
419
+ name,
420
+ type,
421
+ desc,
422
+ this.mousePosition
423
+ );
394
424
  // reset fields
395
425
  this.$refs.inputType.resetChanges();
396
- $(this.$el).find('.input-name').val("");
397
- $(this.$el).find('.input-description').val("");
398
- });
399
- }
400
- else {
401
- swal('Please complete all fields', '', 'error');
402
- return;
403
- }
404
- break;
405
-
406
- case "output":
407
- var name = $(this.$el).find('.output-name').val();
408
- var type = this.$refs.outputType.get();
409
- var desc = $(this.$el).find('.output-description').val();
410
- if( type !== undefined && name ) {
411
- this.closeModal();
412
- this.$nextTick(() => {
413
- this.view.c.addOutput(name, type, desc, this.mousePosition);
426
+ $(this.$el)
427
+ .find(".input-name")
428
+ .val("");
429
+ $(this.$el)
430
+ .find(".input-description")
431
+ .val("");
432
+ } else {
433
+ swal("Please complete all fields", "", "error");
434
+ return;
435
+ }
436
+ break;
437
+
438
+ case "output":
439
+ var name = $(this.$el)
440
+ .find(".output-name")
441
+ .val();
442
+ var type = this.$refs.outputType.get();
443
+ var desc = $(this.$el)
444
+ .find(".output-description")
445
+ .val();
446
+ if (type !== undefined && name) {
447
+ await this.closeModal();
448
+ this.view.c.addOutput(
449
+ name,
450
+ type,
451
+ desc,
452
+ this.mousePosition
453
+ );
414
454
  // reset fields
415
455
  this.$refs.outputType.resetChanges();
416
- $(this.$el).find('.output-name').val("");
417
- $(this.$el).find('.output-description').val("");
418
- });
419
- }
420
- else {
421
- swal('Please complete all fields', '', 'error');
422
- return;
423
- }
424
- break;
425
-
426
- case "metanode":
427
- var name = $(this.$el).find('.metanode-name').val();
428
- var desc = $(this.$el).find('.metanode-description').val();
429
- if( !name ) {
430
- swal('Please complete name field', '', 'error');
431
- return;
432
- }
433
-
434
- var json = this.metanodeJSON || {};
435
- json.description = desc;
436
-
437
- this.closeModal();
438
- this.$nextTick(() => {
456
+ $(this.$el)
457
+ .find(".output-name")
458
+ .val("");
459
+ $(this.$el)
460
+ .find(".output-description")
461
+ .val("");
462
+ } else {
463
+ swal("Please complete all fields", "", "error");
464
+ return;
465
+ }
466
+ break;
467
+
468
+ case "metanode":
469
+ var name = $(this.$el)
470
+ .find(".metanode-name")
471
+ .val();
472
+ var desc = $(this.$el)
473
+ .find(".metanode-description")
474
+ .val();
475
+ if (!name) {
476
+ swal("Please complete name field", "", "error");
477
+ return;
478
+ }
479
+
480
+ var json = this.metanodeJSON || {};
481
+ json.description = desc;
482
+
483
+ await this.closeModal();
439
484
  this.view.c.addNewMetabox(name, json, this.mousePosition);
440
- });
441
- default:
485
+ default:
442
486
  }
443
487
  },
444
488
 
@@ -447,12 +491,14 @@ export default {
447
491
  var text = this.searchText[this.selectedType];
448
492
  try {
449
493
  this.error = null;
450
- this.results[this.selectedType] = await this.view.e.search(text, this.selectedType);
494
+ this.results[this.selectedType] = await this.view.e.search(
495
+ text,
496
+ this.selectedType
497
+ );
451
498
  this.$forceUpdate();
452
- }
453
- catch(e) {
499
+ } catch (e) {
454
500
  this.error = e;
455
- swal('error searching packages', e.reason, "error");
501
+ swal("error searching packages", e.reason, "error");
456
502
  }
457
503
  },
458
504
 
@@ -463,14 +509,14 @@ export default {
463
509
  setSelectedResult: function(packageName) {
464
510
  // first, find the selected result in the list
465
511
  var selectedPackage = null;
466
- _.each(this.getResults(), (r) => {
467
- if( r.name == packageName ) {
512
+ _.each(this.getResults(), r => {
513
+ if (r.name == packageName) {
468
514
  selectedPackage = r;
469
515
  return false;
470
516
  }
471
517
  });
472
518
 
473
- if( !selectedPackage ) {
519
+ if (!selectedPackage) {
474
520
  throw "Could not find package named " + packageName;
475
521
  }
476
522
 
@@ -488,22 +534,23 @@ export default {
488
534
 
489
535
  getNbResults: function() {
490
536
  var results = this.getResults();
491
- return results && results.length ? results.length: 0;
537
+ return results && results.length ? results.length : 0;
492
538
  },
493
539
 
494
540
  onMetaboxFileSelect: function(e) {
495
541
  var file = e.target.files[0];
496
- const reader = new FileReader()
497
- reader.onload = (e) => {
542
+ const reader = new FileReader();
543
+ reader.onload = e => {
498
544
  this.metanodeJSON = JSON.parse(e.target.result);
499
- if( this.metanodeJSON.description ) {
500
- $(this.$el).find('.metanode-description').val(this.metanodeJSON.description);
545
+ if (this.metanodeJSON.description) {
546
+ $(this.$el)
547
+ .find(".metanode-description")
548
+ .val(this.metanodeJSON.description);
501
549
  }
502
- }
503
- reader.readAsText(file)
550
+ };
551
+ reader.readAsText(file);
504
552
  }
505
553
  }
506
- }
507
-
554
+ };
508
555
  </script>
509
556
 
@@ -140,6 +140,8 @@ i.fa, i.fas, i.far {
140
140
 
141
141
  .card-main-settings {
142
142
  border: 1px solid rgba(0,0,0,.125);
143
+ max-height: calc(100vh - 120px);
144
+ overflow: auto;
143
145
  }
144
146
 
145
147
  .card-main-settings > .card-header {