@mongoosejs/studio 0.0.9 → 0.0.11

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.
@@ -36,5 +36,5 @@ module.exports = ({ db }) => async function getDocument(params) {
36
36
  }
37
37
  removeSpecifiedPaths(schemaPaths, '.$*');
38
38
 
39
- return { doc, schemaPaths };
39
+ return { doc: doc.toJSON({ virtuals: false, getters: false, transform: false }), schemaPaths };
40
40
  };
@@ -65,5 +65,9 @@ module.exports = ({ db }) => async function getDocuments(params) {
65
65
  await Model.estimatedDocumentCount() :
66
66
  await Model.countDocuments(filter);
67
67
 
68
- return { docs, schemaPaths, numDocs: numDocuments };
68
+ return {
69
+ docs: docs.map(doc => doc.toJSON({ virtuals: false, getters: false, transform: false })),
70
+ schemaPaths,
71
+ numDocs: numDocuments
72
+ };
69
73
  };
@@ -47,6 +47,9 @@ module.exports = app => app.component('document', {
47
47
  if (path.instance == 'Number') {
48
48
  return 'edit-number';
49
49
  }
50
+ if (path.instance === 'Array') {
51
+ return 'edit-array';
52
+ }
50
53
  return 'edit-default';
51
54
  },
52
55
  getEditValueForPath({ path }) {
@@ -0,0 +1,3 @@
1
+ .edit-array button {
2
+ margin-top: 0.5em;
3
+ }
@@ -0,0 +1,9 @@
1
+ <div class="edit-array">
2
+ <div v-for="(el, i) in currentValue">
3
+ <input type="text" :value="el" @input="currentValue[i] = $event.target.value; onUpdate()">
4
+ <span style="cursor: pointer; color: #880000; font-weight: bold;" @click="removeValue(i)">&times;</span>
5
+ </div>
6
+ <div>
7
+ <button @click="currentValue.push(''); onUpdate();">Add</button>
8
+ </div>
9
+ </div>
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ const template = require('./edit-array.html');
4
+
5
+ const appendCSS = require('../appendCSS');
6
+ appendCSS(require('./edit-array.css'));
7
+
8
+ module.exports = app => app.component('edit-array', {
9
+ template: template,
10
+ props: ['value'],
11
+ data: () => ({ currentValue: null }),
12
+ mounted() {
13
+ this.currentValue = this.value;
14
+ },
15
+ methods: {
16
+ onUpdate() {
17
+ this.$emit('input', this.currentValue);
18
+ },
19
+ removeValue(i) {
20
+ this.currentValue.splice(i, 1);
21
+ this.$emit('input', this.currentValue);
22
+ }
23
+ },
24
+ emits: ['input']
25
+ });
@@ -8,6 +8,7 @@ require('./async-button/async-button')(app);
8
8
  require('./detail-array/detail-array')(app);
9
9
  require('./detail-default/detail-default')(app);
10
10
  require('./document/document')(app);
11
+ require('./edit-array/edit-array')(app);
11
12
  require('./edit-default/edit-default')(app);
12
13
  require('./edit-number/edit-number')(app);
13
14
  require('./edit-date/edit-date')(app);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "dependencies": {
5
5
  "archetype": "0.13.0",
6
6
  "csv-stringify": "6.3.0",