@vcmap/ui 5.0.0-rc.15 → 5.0.0-rc.17

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.
Files changed (91) hide show
  1. package/build/buildHelpers.js +7 -1
  2. package/config/base.config.json +7 -45
  3. package/config/dev.config.json +5 -1
  4. package/config/www.config.json +14 -13
  5. package/dist/assets/{cesium.2e288a.js → cesium.41de56.js} +0 -0
  6. package/dist/assets/cesium.js +1 -1
  7. package/dist/assets/{core.8014d3.js → core.af84e3.js} +6077 -4544
  8. package/dist/assets/core.js +1 -1
  9. package/dist/assets/{index.3f74fa92.js → index.5b773cad.js} +1 -1
  10. package/dist/assets/{ol.31c3a5.js → ol.5c7490.js} +0 -0
  11. package/dist/assets/ol.js +1 -1
  12. package/dist/assets/ui.dffe32.css +1 -0
  13. package/dist/assets/{ui.36f84f.js → ui.dffe32.js} +7243 -6234
  14. package/dist/assets/ui.js +1 -1
  15. package/dist/assets/{vue.a39c10.js → vue.25da17.js} +0 -0
  16. package/dist/assets/vue.js +2 -2
  17. package/dist/assets/{vuetify.378637.css → vuetify.e4ece7.css} +1 -1
  18. package/dist/assets/{vuetify.378637.js → vuetify.e4ece7.js} +5 -2
  19. package/dist/assets/vuetify.js +2 -2
  20. package/dist/index.html +1 -1
  21. package/index.html +77 -0
  22. package/index.js +18 -3
  23. package/package.json +4 -2
  24. package/plugins/@vcmap/create-link/fallbackCreateLink.vue +4 -1
  25. package/plugins/@vcmap/create-link/index.js +4 -1
  26. package/plugins/@vcmap/pluginExample/exampleActions.js +45 -0
  27. package/plugins/@vcmap/pluginExample/index.js +26 -2
  28. package/plugins/@vcmap/pluginExample/pluginExampleComponent.vue +77 -42
  29. package/plugins/@vcmap/search-nominatim/nominatim.js +1 -1
  30. package/plugins/@vcmap/theme-changer/ThemeChangerComponent.vue +4 -2
  31. package/plugins/categoryTest/Categories.vue +27 -13
  32. package/plugins/categoryTest/Category.vue +7 -1
  33. package/plugins/categoryTest/index.js +1 -1
  34. package/plugins/notifier/index.js +31 -0
  35. package/plugins/notifier/notifierTester.vue +88 -0
  36. package/plugins/package.json +1 -1
  37. package/plugins/test/allIconsComponent.vue +5 -5
  38. package/plugins/test/emptyComponent.vue +1 -1
  39. package/plugins/test/index.js +27 -3
  40. package/plugins/test/myCustomHeader.vue +9 -1
  41. package/plugins/test/testList.vue +290 -0
  42. package/plugins/test/vcsContent.vue +1 -1
  43. package/plugins/test/windowManagerExample.vue +12 -7
  44. package/plugins/wizardExample/index.js +41 -0
  45. package/plugins/wizardExample/wizardExample.vue +77 -0
  46. package/src/actions/actionHelper.js +10 -9
  47. package/src/application/VcsApp.vue +43 -34
  48. package/src/components/form-inputs-controls/VcsCheckbox.vue +1 -0
  49. package/src/components/form-inputs-controls/VcsFormSection.vue +23 -15
  50. package/src/components/form-inputs-controls/VcsSelect.vue +33 -1
  51. package/src/components/form-inputs-controls/VcsTextField.vue +11 -3
  52. package/src/components/form-inputs-controls/VcsWizard.vue +133 -0
  53. package/src/components/imageElementInjector.vue +22 -0
  54. package/src/components/lists/VcsList.vue +468 -0
  55. package/src/components/lists/VcsTreeview.vue +1 -2
  56. package/src/components/lists/VcsTreeviewLeaf.vue +18 -50
  57. package/src/components/lists/VcsTreeviewSearchbar.vue +1 -23
  58. package/src/components/tables/VcsTable.vue +13 -1
  59. package/src/contentTree/LayerTree.vue +1 -1
  60. package/src/contentTree/contentTreeCollection.js +9 -0
  61. package/src/contentTree/contentTreeItem.js +13 -13
  62. package/src/contentTree/layerContentTreeItem.js +1 -1
  63. package/src/contentTree/subContentTreeItem.js +1 -1
  64. package/src/contentTree/vcsObjectContentTreeItem.js +1 -1
  65. package/src/featureInfo/BalloonComponent.vue +13 -8
  66. package/src/featureInfo/balloonFeatureInfoView.js +16 -22
  67. package/src/featureInfo/balloonHelper.js +26 -5
  68. package/src/featureInfo/featureInfo.js +14 -2
  69. package/src/featureInfo/featureInfoInteraction.js +1 -1
  70. package/src/i18n/de.js +13 -1
  71. package/src/i18n/en.js +13 -1
  72. package/src/icons/+all.js +4 -0
  73. package/src/icons/WandIcon.vue +63 -0
  74. package/src/manager/categoryManager/CategoryComponent.vue +115 -0
  75. package/src/manager/categoryManager/CategoryComponentList.vue +57 -0
  76. package/src/manager/categoryManager/CategoryManager.vue +35 -0
  77. package/src/manager/categoryManager/categoryManager.js +251 -165
  78. package/src/manager/contextMenu/contextMenuManager.js +8 -2
  79. package/src/manager/window/WindowComponent.vue +51 -70
  80. package/src/manager/window/WindowComponentHeader.vue +81 -13
  81. package/src/manager/window/WindowManager.vue +54 -30
  82. package/src/manager/window/windowHelper.js +341 -0
  83. package/src/manager/window/windowManager.js +173 -151
  84. package/src/navigation/overviewMap.js +10 -9
  85. package/src/notifier/notifier.js +120 -0
  86. package/src/notifier/notifierComponent.vue +84 -0
  87. package/src/styles/variables.scss +19 -3
  88. package/src/vcsUiApp.js +26 -2
  89. package/src/vuePlugins/vuetify.js +2 -0
  90. package/dist/assets/ui.36f84f.css +0 -1
  91. package/src/manager/categoryManager/ComponentsManager.vue +0 -30
@@ -13,9 +13,9 @@
13
13
  <span>
14
14
  <VcsButton icon="$vcsPlus" @click="newDialog = true" />
15
15
  <VcsButton icon="$vcsExport" @click="uploadDialog = true" />
16
- <VcsButton @click="addManagedCategories"> Add Categories To Manager </VcsButton>
16
+ <VcsButton @click="addManagedCategories">Add Categories To Manager</VcsButton>
17
+ <VcsButton @click="addFoobar">Add Foobar</VcsButton>
17
18
  </span>
18
-
19
19
  <v-dialog
20
20
  v-model="newDialog"
21
21
  >
@@ -121,17 +121,36 @@
121
121
  'viewpoints',
122
122
  'styles',
123
123
  ],
124
+ async addFoobar() {
125
+ if (!app.categories.hasKey('foobar')) {
126
+ const category = await app.categories.requestCategory({
127
+ name: 'foobar',
128
+ type: 'Category',
129
+ title: 'Foobar',
130
+ });
131
+ app.categoryManager.add({ categoryName: category.name }, '@vcmap/categoryTest');
132
+ app.categoryManager.addMappingFunction(() => true, (item, c, listItem) => {
133
+ listItem.title = item.name;
134
+ }, [category.name], '@vcmap/categoryTest');
135
+ for (let i = 0; i <= 12; i++) {
136
+ category.collection.add({
137
+ name: `foobar-${i}`,
138
+ });
139
+ }
140
+ }
141
+ },
124
142
  async add() {
125
143
  const { value: newCategoryValue } = newCategory;
126
144
  if (newCategoryValue.type === 'AppBackedCategory') {
127
145
  newCategoryValue.name = newCategoryValue.collectionName;
128
146
  }
129
- await app.categories.requestCategory(newCategoryValue);
147
+ const category = await app.categories.requestCategory(newCategoryValue);
130
148
  newCategory.value = {
131
149
  name: 'new',
132
- type: 'category.Category',
150
+ type: 'Category',
133
151
  collectionName: null,
134
152
  };
153
+ app.categoryManager.add({ categoryName: category.name }, '@vcmap/categoryTest');
135
154
  newDialog.value = false;
136
155
  },
137
156
  async upload() {
@@ -141,10 +160,11 @@
141
160
  console.error('must provide name');
142
161
  return;
143
162
  }
144
- await app.categories.requestCategory({ name: jsonUpload.name, type: 'Category' });
163
+ const category = await app.categories.requestCategory({ name: jsonUpload.name, type: 'Category' });
145
164
  if (jsonUpload?.items?.length > 0) {
146
165
  await app.categories.parseCategoryItems(jsonUpload.name, jsonUpload.items, app.dynamicContextId);
147
166
  }
167
+ app.categoryManager.add({ categoryName: category.name }, '@vcmap/categoryTest');
148
168
  uploadString.value = '';
149
169
  uploadDialog.value = false;
150
170
  } catch (e) {
@@ -209,10 +229,8 @@
209
229
  }));
210
230
  },
211
231
  }];
212
- app.categoryManager.addCategory(layersCat.name, '@vcmap/categoryTest', actions);
213
- app.categoryManager.addMappingFunction((item, category) => {
214
- return category.name === 'layers';
215
- }, (item, category, treeViewItem) => {
232
+ app.categoryManager.add({ categoryName: layersCat.name, actions }, '@vcmap/categoryTest');
233
+ app.categoryManager.addMappingFunction(() => true, (item, category, treeViewItem) => {
216
234
  // eslint-disable-next-line no-console
217
235
  const action = {
218
236
  name: 'mySuperAction',
@@ -222,10 +240,6 @@
222
240
  },
223
241
  };
224
242
  treeViewItem.actions.push(action);
225
- treeViewItem.clickable = true;
226
- treeViewItem.clicked = () => {
227
- if (!item.active) item.activate(); else item.deactivate();
228
- };
229
243
  const action2 = {
230
244
  name: 'mySuperAction3',
231
245
  icon: 'mdi-minus',
@@ -65,6 +65,8 @@
65
65
  VCard,
66
66
  VForm,
67
67
  VTextarea,
68
+ VSheet,
69
+ VBtn,
68
70
  } from 'vuetify/lib';
69
71
 
70
72
  export default {
@@ -80,6 +82,8 @@
80
82
  VCard,
81
83
  VForm,
82
84
  VTextarea,
85
+ VSheet,
86
+ VBtn,
83
87
  },
84
88
  props: {
85
89
  categoryName: {
@@ -95,6 +99,7 @@
95
99
  const category = ref([]);
96
100
  const downloadLink = ref('');
97
101
  const open = ref(true);
102
+ const link = ref(null);
98
103
  if (categoryObject) {
99
104
  category.value = [...categoryObject.collection].map(c => ({ name: c.name, type: c.className || 'Object' }));
100
105
  }
@@ -105,6 +110,7 @@
105
110
  jsonString,
106
111
  downloadLink,
107
112
  open,
113
+ link,
108
114
  async addItem() {
109
115
  try {
110
116
  const config = JSON.parse(jsonString.value);
@@ -126,7 +132,7 @@
126
132
  downloadLink.value = `data:text/json;charset=utf-8,${encodeURIComponent(stringObject)}`;
127
133
  if (downloadLink.value) {
128
134
  nextTick(() => {
129
- this.$refs.link.click();
135
+ link.value.click();
130
136
  });
131
137
  }
132
138
  },
@@ -7,7 +7,7 @@ import Categories from './Categories.vue';
7
7
  export default async function categoryTest() {
8
8
  return {
9
9
  name: '@vcmap/categoryTest',
10
- onVcsAppMounted(app) {
10
+ initialize(app) {
11
11
  const { action, destroy } = createToggleAction(
12
12
  {
13
13
  name: 'Category Editor',
@@ -0,0 +1,31 @@
1
+ import { WindowSlot, createToggleAction, ButtonLocation } from '@vcmap/ui';
2
+ import component from './notifierTester.vue';
3
+
4
+ export default function createNotifierPlugin() {
5
+ return {
6
+ name: 'notifier',
7
+ initialize(vcsApp) {
8
+ const { action, destroy } = createToggleAction(
9
+ {
10
+ name: 'Notifier',
11
+ },
12
+ {
13
+ id: 'notifier-editor',
14
+ state: {
15
+ headerTitle: 'Notifier Editor',
16
+ },
17
+ component,
18
+ slot: WindowSlot.DYNAMIC_LEFT,
19
+ },
20
+ vcsApp.windowManager,
21
+ 'notifier',
22
+ );
23
+ vcsApp.navbarManager.add(
24
+ { id: 'notifier', action },
25
+ 'notifier',
26
+ ButtonLocation.TOOL,
27
+ );
28
+ this.destroy = destroy;
29
+ },
30
+ };
31
+ }
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <v-sheet>
3
+ <v-text-field
4
+ v-model="message"
5
+ label="Message"
6
+ />
7
+ <v-text-field
8
+ v-model.number=timeout
9
+ label="Timeout"
10
+ />
11
+ <VcsCheckbox
12
+ v-model="hasTimeout"
13
+ label="Toggle Timeout"
14
+ />
15
+ <v-list>
16
+ <v-list-item
17
+ v-for="type in types"
18
+ :key="type"
19
+ >
20
+ {{ type }}
21
+ <v-list-item-action @click="notify(type)">
22
+ <v-icon>mdi-plus</v-icon>
23
+ </v-list-item-action>
24
+ </v-list-item>
25
+ </v-list>
26
+ <v-divider />
27
+ <v-card>
28
+ Current number of notifications: {{ notifications.length }}
29
+ </v-card>
30
+ </v-sheet>
31
+ </template>
32
+
33
+ <script>
34
+ import { VSheet, VList, VListItem, VListItemAction, VTextField, VIcon, VCard, VDivider } from 'vuetify/lib';
35
+ import { NotificationType, VcsCheckbox } from '@vcmap/ui';
36
+ import { computed, inject, ref } from 'vue';
37
+
38
+ export default {
39
+ name: 'NotifierTester',
40
+ components: {
41
+ VSheet,
42
+ VList,
43
+ VListItem,
44
+ VListItemAction,
45
+ VTextField,
46
+ VIcon,
47
+ VCard,
48
+ VDivider,
49
+ VcsCheckbox,
50
+ },
51
+ setup() {
52
+ const app = inject('vcsApp');
53
+ const message = ref('Message');
54
+ const timeout = ref(5000);
55
+
56
+ return {
57
+ types: NotificationType,
58
+ message,
59
+ notify(type) {
60
+ app.notifier.add({
61
+ type,
62
+ message: message.value,
63
+ timeout: timeout.value,
64
+ });
65
+ },
66
+ notifications: app.notifier.notifications,
67
+ timeout,
68
+ hasTimeout: computed({
69
+ get() {
70
+ return timeout.value === -1;
71
+ },
72
+ set(value) {
73
+ if (value && timeout.value !== -1) {
74
+ timeout.value = -1;
75
+ } else if (timeout.value === -1) {
76
+ timeout.value = 5000;
77
+ }
78
+ },
79
+ }),
80
+ };
81
+ },
82
+ };
83
+ </script>
84
+
85
+ <style scoped>
86
+
87
+ </style>
88
+
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@vcmap/hello-world": "^1.0.0",
3
+ "@vcmap/hello-world": "^1.0.7",
4
4
  "@vcmap/print": "^1.0.1"
5
5
  }
6
6
  }
@@ -27,14 +27,14 @@
27
27
 
28
28
  export default {
29
29
  name: 'AllIconsComponent',
30
- components: [
30
+ components: {
31
31
  VSheet,
32
32
  VList,
33
33
  VListItem,
34
34
  VListItemIcon,
35
35
  VIcon,
36
36
  VListItemTitle,
37
- ],
37
+ },
38
38
  computed: {
39
39
  icons() {
40
40
  return Object.keys(Icons).map(n => `$${n}`);
@@ -44,7 +44,7 @@
44
44
  </script>
45
45
 
46
46
  <style scoped>
47
- .icons-window {
48
- max-height: 600px;
49
- }
47
+ /*.icons-window {*/
48
+ /* max-height: 600px;*/
49
+ /*}*/
50
50
  </style>
@@ -11,6 +11,6 @@
11
11
 
12
12
  export default {
13
13
  name: 'EmptyComponent',
14
- components: [VSheet],
14
+ components: { VSheet },
15
15
  };
16
16
  </script>
@@ -7,6 +7,7 @@ import { toolboxData } from './toolbox-data.js';
7
7
  import editor from './editor.vue';
8
8
  import windowManagerExample from './windowManagerExample.vue';
9
9
  import AllIconsComponent from './allIconsComponent.vue';
10
+ import TestList from './testList.vue';
10
11
 
11
12
  let source;
12
13
 
@@ -72,7 +73,7 @@ export default async function () {
72
73
  app.windowManager,
73
74
  '@vcmap/test',
74
75
  );
75
- const { action: clipboardDialogAction, destroy: destroryClipboardDialogAction } = createModalAction(
76
+ const { action: clipboardDialogAction, destroy: destroyClipboardDialogAction } = createModalAction(
76
77
  {
77
78
  name: 'Create Link',
78
79
  },
@@ -85,7 +86,9 @@ export default async function () {
85
86
  };
86
87
  },
87
88
  async created() {
88
- this.url = setStateToUrl(await app.getState(true)).toString();
89
+ const url = new URL(window.location.href);
90
+ setStateToUrl(await app.getState(true), url);
91
+ this.url = url.toString();
89
92
  },
90
93
  },
91
94
  position: {
@@ -94,6 +97,21 @@ export default async function () {
94
97
  right: '8%',
95
98
  },
96
99
  },
100
+ app,
101
+ '@vcmap/test',
102
+ );
103
+ const { action: listAction, destroy: destroyList } = createToggleAction(
104
+ {
105
+ name: 'TestList',
106
+ },
107
+ {
108
+ id: 'testList',
109
+ state: {
110
+ headerTitle: 'Test List',
111
+ },
112
+ slot: WindowSlot.DYNAMIC_LEFT,
113
+ component: TestList,
114
+ },
97
115
  app.windowManager,
98
116
  '@vcmap/test',
99
117
  );
@@ -101,7 +119,8 @@ export default async function () {
101
119
  destroyConfigEditorAction,
102
120
  destroyWindowAction,
103
121
  destroyIconAction,
104
- destroryClipboardDialogAction,
122
+ destroyClipboardDialogAction,
123
+ destroyList,
105
124
  ];
106
125
  const alertAction = {
107
126
  name: 'VC Systems',
@@ -130,6 +149,11 @@ export default async function () {
130
149
  '@vcmap/test',
131
150
  ButtonLocation.TOOL,
132
151
  );
152
+ app.navbarManager.add(
153
+ { id: 'list', action: listAction },
154
+ '@vcmap/test',
155
+ ButtonLocation.TOOL,
156
+ );
133
157
  app.navbarManager.add(
134
158
  {
135
159
  id: 'createLink',
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div>
3
- Ha, this is a custom Header with a <span @click="clicked"> CLOSE thing </span>
3
+ <div>
4
+ Ha, this is a custom Header with a <span @click="clicked"> CLOSE thing. </span>
5
+ </div>
6
+ <div>And here is '<b>{{ sample }}</b>' passed through</div>
4
7
  </div>
5
8
  </template>
6
9
 
@@ -8,6 +11,11 @@
8
11
 
9
12
  export default {
10
13
  name: 'MyCustomHeader',
14
+ props: {
15
+ sample: {
16
+ type: String,
17
+ },
18
+ },
11
19
  setup(props, { emit }) {
12
20
  return {
13
21
  clicked: () => {
@@ -0,0 +1,290 @@
1
+ <template>
2
+ <v-sheet>
3
+ <v-sheet class="pa-2">
4
+ <v-switch
5
+ v-model="selectable"
6
+ label="Selectable"
7
+ />
8
+ <v-switch
9
+ :disabled="!selectable"
10
+ v-model="selectSingle"
11
+ label=" Single Select"
12
+ />
13
+ <v-switch
14
+ v-model="searchable"
15
+ label="Searchable"
16
+ />
17
+ <v-dialog
18
+ v-model="dialog"
19
+ width="400"
20
+ >
21
+ <template #activator="{ on }">
22
+ <vcs-button v-on="on">
23
+ Add An item
24
+ </vcs-button>
25
+ </template>
26
+ <v-card class="pa-2">
27
+ <v-form
28
+ @submit.prevent="add"
29
+ >
30
+ <vcs-text-field
31
+ v-model="newItem.name"
32
+ label="Name"
33
+ :rules="required"
34
+ />
35
+ <vcs-text-field
36
+ v-model="newItem.title"
37
+ label="Title"
38
+ :rules="required"
39
+ />
40
+ <v-switch label="visible" v-model="newItem.visible" />
41
+ <v-switch label="disabled" v-model="newItem.disabled" />
42
+ <v-switch label="random icon" v-model="newItem.icon" />
43
+ <v-switch label="console.log action" v-model="newItem.action" />
44
+ <v-switch label="console.log on clicked" v-model="newItem.clicked" />
45
+ <v-switch label="console.log selected state" v-model="newItem.selected" />
46
+ <vcs-button
47
+ type="submit"
48
+ >
49
+ Add
50
+ </vcs-button>
51
+ </v-form>
52
+ </v-card>
53
+ </v-dialog>
54
+ <v-divider class="ma-2" />
55
+ <v-switch
56
+ v-model="showTitle"
57
+ label="Show Title"
58
+ />
59
+ <vcs-text-field v-model="title" placeholder="Title" />
60
+ <v-switch
61
+ v-model="titleActions"
62
+ label="Title Actions"
63
+ />
64
+ <v-switch
65
+ v-model="titleIcon"
66
+ label="Title Icon"
67
+ />
68
+ <v-divider class="ma-2" />
69
+ <template v-if="selectable">
70
+ <vcs-button
71
+ @click="selected = []"
72
+ >
73
+ Clear Selection
74
+ </vcs-button>
75
+ <v-switch v-model="showSelection" label="Show Selection" />
76
+ <ul v-if="showSelection">
77
+ <li
78
+ v-for="(i, index) in selected"
79
+ :key="`item-${index}`"
80
+ >
81
+ {{ i.title }}
82
+ </li>
83
+ </ul>
84
+ </template>
85
+ <v-divider class="ma-2" />
86
+ </v-sheet>
87
+
88
+ <vcs-list
89
+ :items="items"
90
+ :selectable="selectable"
91
+ :single-select="selectSingle"
92
+ :searchable="searchable"
93
+ :show-title="showTitle"
94
+ :icon="titleIconSrc"
95
+ :actions="titleActionsArray"
96
+ :title="title"
97
+ v-model="selected"
98
+ />
99
+ </v-sheet>
100
+ </template>
101
+
102
+ <script>
103
+ import { VcsList, VcsButton, VcsTextField, Icons } from '@vcmap/ui';
104
+ import {
105
+ VSwitch,
106
+ VDivider,
107
+ VSheet,
108
+ VDialog,
109
+ VCard,
110
+ VForm,
111
+ } from 'vuetify/lib';
112
+ import { computed, ref } from 'vue';
113
+
114
+ function getRandomIcon() {
115
+ const keys = Object.keys(Icons);
116
+ const index = Math.floor(keys.length * Math.random());
117
+ return `$${keys[index]}`;
118
+ }
119
+
120
+ const defaultItems = [
121
+ {
122
+ name: 'foo',
123
+ title: 'Foo',
124
+ tooltip: 'this is the foo',
125
+ icon: 'mdi-pen',
126
+ selectionChanged: value => console.log('changed cb foo', value),
127
+ },
128
+ {
129
+ name: 'bar',
130
+ title: 'Bar',
131
+ tooltip: 'just a bar',
132
+ actions: [
133
+ {
134
+ name: 'console.log',
135
+ callback() {
136
+ console.log('bar action');
137
+ },
138
+ },
139
+ ],
140
+ selectionChanged: value => console.log('changed cb bar', value),
141
+ },
142
+ {
143
+ name: 'baz',
144
+ title: 'Baz',
145
+ tooltip: 'special baz',
146
+ selectionChanged: value => console.log('bchanged cb baz', value),
147
+ },
148
+ ];
149
+
150
+ export default {
151
+ name: 'TestList',
152
+ components: {
153
+ VcsList,
154
+ VcsButton,
155
+ VcsTextField,
156
+ VSwitch,
157
+ VDivider,
158
+ VSheet,
159
+ VDialog,
160
+ VCard,
161
+ VForm,
162
+ },
163
+ setup() {
164
+ const selectable = ref(true);
165
+ const searchable = ref(true);
166
+ const selectSingle = ref(false);
167
+ const showSelection = ref(false);
168
+ const showTitle = ref(true);
169
+ const title = ref('Title');
170
+ const titleActionsArray = ref([]);
171
+ const titleIconSrc = ref(null);
172
+ const selected = ref([]);
173
+ const items = ref(defaultItems);
174
+ const newItem = ref({
175
+ name: 'foo',
176
+ title: 'foo',
177
+ disabled: false,
178
+ visible: true,
179
+ icon: false,
180
+ action: false,
181
+ clicked: false,
182
+ selected: false,
183
+ });
184
+ const dialog = ref(false);
185
+
186
+ return {
187
+ selectable,
188
+ searchable,
189
+ selectSingle,
190
+ selected,
191
+ showSelection,
192
+ showTitle,
193
+ title,
194
+ titleActionsArray,
195
+ titleIconSrc,
196
+ items,
197
+ newItem,
198
+ dialog,
199
+ required: [
200
+ v => !!v || 'Input may not be null',
201
+ v => v.length > 0 || 'Input must have a length',
202
+ ],
203
+ add() {
204
+ const item = {
205
+ name: newItem.value.name,
206
+ title: newItem.value.title,
207
+ disabled: newItem.value.disabled,
208
+ visible: newItem.value.visible,
209
+ };
210
+
211
+ if (newItem.value.icon) {
212
+ item.icon = getRandomIcon();
213
+ }
214
+
215
+ if (newItem.value.action) {
216
+ item.actions = [
217
+ {
218
+ name: 'console.log',
219
+ callback() {
220
+ console.log('hi, i\'m: ', item.name);
221
+ },
222
+ },
223
+ ];
224
+ }
225
+
226
+ if (newItem.value.clicked) {
227
+ item.clicked = () => {
228
+ console.log(`${item.name} just got clicked`);
229
+ };
230
+ }
231
+
232
+ if (newItem.value.selected) {
233
+ item.selectionChanged = (selected) => {
234
+ if (selected) {
235
+ console.log(`${item.name} is selected`);
236
+ } else {
237
+ console.log(`${item.name} is no longer selected`);
238
+ }
239
+ };
240
+ }
241
+ items.value.push(item);
242
+ newItem.value = {
243
+ name: 'foo',
244
+ title: 'foo',
245
+ disabled: false,
246
+ visible: true,
247
+ icon: false,
248
+ action: false,
249
+ clicked: false,
250
+ selected: false,
251
+ };
252
+ dialog.value = false;
253
+ },
254
+ titleActions: computed({
255
+ get() {
256
+ return titleActionsArray.value.length > 0;
257
+ },
258
+ set(value) {
259
+ if (value) {
260
+ titleActionsArray.value = [{
261
+ name: 'console.log foo',
262
+ callback() {
263
+ console.log('foo');
264
+ },
265
+ }];
266
+ } else {
267
+ titleActionsArray.value = [];
268
+ }
269
+ },
270
+ }),
271
+ titleIcon: computed({
272
+ get() {
273
+ return !!titleIconSrc.value;
274
+ },
275
+ set(value) {
276
+ if (value) {
277
+ titleIconSrc.value = getRandomIcon();
278
+ } else {
279
+ titleIconSrc.value = null;
280
+ }
281
+ },
282
+ }),
283
+ };
284
+ },
285
+ };
286
+ </script>
287
+
288
+ <style lang="scss" scoped>
289
+
290
+ </style>
@@ -18,7 +18,7 @@
18
18
 
19
19
  export default {
20
20
  name: 'VcsContent',
21
- components: [VSheet],
21
+ components: { VSheet },
22
22
  setup() {
23
23
  return { };
24
24
  },