glib-web 4.25.0 → 4.26.0

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/app.vue CHANGED
@@ -375,6 +375,14 @@ body,
375
375
  }
376
376
  }
377
377
 
378
+ .v-btn--disabled {
379
+ pointer-events: auto;
380
+ }
381
+
382
+ .v-btn--disabled:active {
383
+ pointer-events: none;
384
+ }
385
+
378
386
  /******/
379
387
  </style>
380
388
 
@@ -63,14 +63,29 @@ export default defineComponent({
63
63
  }
64
64
  }
65
65
 
66
+ function processChildViewsIfExists(index, view, properties) {
67
+ if (view && view.childViews) {
68
+ view.childViews.forEach((childView) => processView(index, childView, properties));
69
+ }
70
+ }
71
+
72
+ function processViewPanelsSplit(index, view, properties) {
73
+ processChildViewsIfExists(index, view.left, properties);
74
+ processChildViewsIfExists(index, view.center, properties);
75
+ processChildViewsIfExists(index, view.right, properties);
76
+ }
77
+
66
78
  function processView(index, view, properties) {
67
79
  if (view.name && view.view.startsWith('fields')) {
68
80
  Object.assign(view, properties[view.name]);
69
81
  view.name = prefixFieldName(index, view.name);
70
82
  }
71
- if (view.childViews) {
83
+ else if (view.childViews) {
72
84
  view.childViews.forEach((childView) => processView(index, childView, properties));
73
85
  }
86
+ else if (view.center || view.left || view.right) {
87
+ processViewPanelsSplit(index, view, properties);
88
+ }
74
89
  }
75
90
 
76
91
  function removeGroupEntry(groupSpec) {
@@ -1,29 +1,19 @@
1
1
  <template>
2
2
  <div :style="$styles()" v-if="loadIf">
3
- <v-autocomplete ref="autocomplete" v-model="model" :items="allItems" v-model:search="search"
4
- :label="spec.label" hide-selected no-filter return-object
5
- chips closable-chips :clearable="spec.clearable"
6
- :variant="variant" :density="density"
7
- :placeholder="spec.placeholder" persistent-placeholder
8
- :multiple="spec.multiple" @update:focused="focused = $event"
9
- no-data-text="No result"
10
- >
3
+ <v-autocomplete ref="autocomplete" v-model="model" :items="allItems" v-model:search="search" :label="spec.label"
4
+ hide-selected no-filter return-object chips closable-chips :clearable="spec.clearable" :variant="variant"
5
+ :density="density" :placeholder="spec.placeholder" persistent-placeholder :multiple="spec.multiple"
6
+ @update:focused="focused = $event" no-data-text="No result">
11
7
 
12
8
  <template #item="{ item, index, props }">
13
- <v-list-item
14
- v-bind="props"
15
- dense
16
- >
9
+ <v-list-item v-bind="props" dense>
17
10
  <template #title>
18
11
  <div>
19
12
  {{ item.title ?? item.raw.title }}
20
13
  </div>
21
14
  </template>
22
15
  <template #default>
23
- <div
24
- v-if="item.raw.subtitle"
25
- style="opacity: 0.8"
26
- >
16
+ <div v-if="item.raw.subtitle" style="opacity: 0.8">
27
17
  {{ item.raw.subtitle }}
28
18
  </div>
29
19
  <!-- <div
@@ -95,8 +85,16 @@ export default {
95
85
  spec: { type: Object, required: true }
96
86
  },
97
87
  data() {
88
+ let model;
89
+ const selectedItems = this.spec.selectedOptions;
90
+ if (selectedItems) {
91
+ model = this.spec.multiple ? selectedItems : selectedItems[0];
92
+ } else {
93
+ model = this.spec.multiple ? [] : null;
94
+ }
95
+
98
96
  return {
99
- model: null,
97
+ model,
100
98
  search: null,
101
99
  nextPageUrl: null,
102
100
  keyword: "",
@@ -111,7 +109,7 @@ export default {
111
109
  if (this.model) {
112
110
  // Depends on whether the field is single or multiple
113
111
  if (this.$type.isArray(this.model)) {
114
- return this.model
112
+ return this.model;
115
113
  } else {
116
114
  return [this.model];
117
115
  }
@@ -173,12 +171,7 @@ export default {
173
171
  },
174
172
  methods: {
175
173
  $ready() {
176
- const selectedItems = this.spec.selectedOptions;
177
- if (selectedItems) {
178
- this.model = this.spec.multiple ? selectedItems : selectedItems[0];
179
- } else {
180
- this.model = this.spec.multiple ? [] : null;
181
- }
174
+
182
175
 
183
176
  this.updateAllItems();
184
177
  this.loadItems(this.spec.url, false);
@@ -5,7 +5,7 @@
5
5
  <input type="hidden" :name="key" :value="value" />
6
6
  </template>
7
7
 
8
- <panels-responsive :spec="augmentedSpec" />
8
+ <panels-responsive :spec="spec" />
9
9
 
10
10
  <!-- Used by app.vue -->
11
11
  <slot />
@@ -13,14 +13,14 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
- import { provide, ref } from "vue";
16
+ import { onMounted, provide, ref } from "vue";
17
17
  import { useGlibForm } from "../composable/form";
18
18
 
19
19
  export default {
20
20
  props: {
21
21
  spec: { type: Object, required: true },
22
22
  },
23
- setup() {
23
+ setup(props) {
24
24
  const formCtx = ref({ form: null });
25
25
 
26
26
  const form = ref(null);
@@ -28,6 +28,27 @@ export default {
28
28
 
29
29
  provide('formCtx', formCtx);
30
30
 
31
+ function firstInput() {
32
+ return form.value.$el.querySelector('input:not([type="hidden"]):not([disabled]):not([readonly]),textarea,select');
33
+ }
34
+
35
+ function firstInputPromise() {
36
+ return new Promise((resolve) => {
37
+ let intervalId = setInterval(() => {
38
+ if (firstInput()) {
39
+ clearInterval(intervalId);
40
+ resolve(firstInput());
41
+ }
42
+ }, 50);
43
+ });
44
+ }
45
+
46
+ onMounted(() => {
47
+ if (props.spec.autofocus) {
48
+ firstInputPromise().then((firstInput) => firstInput.focus());
49
+ }
50
+ });
51
+
31
52
  return { formCtx, glibForm, form };
32
53
  },
33
54
  data: () => ({
@@ -39,26 +60,26 @@ export default {
39
60
  // modifiedSpec: {},
40
61
  }),
41
62
  computed: {
42
- augmentedSpec() {
43
- const spec = this.spec;
44
-
45
- if (spec.autoFocus) {
46
- let firstAutoFocus = false;
47
-
48
- // TODO: Use map() instead for immutability
49
- spec.childViews.forEach(childView => {
50
- if (
51
- childView.view.startsWith("fields/") &&
52
- childView.view !== "fields/hidden-v1" &&
53
- !firstAutoFocus
54
- ) {
55
- childView.autoFocus = true;
56
- firstAutoFocus = true;
57
- }
58
- });
59
- }
60
- return spec;
61
- }
63
+ // augmentedSpec() {
64
+ // const spec = this.spec;
65
+
66
+ // if (spec.autoFocus) {
67
+ // let firstAutoFocus = false;
68
+
69
+ // // TODO: Use map() instead for immutability
70
+ // spec.childViews.forEach(childView => {
71
+ // if (
72
+ // childView.view.startsWith("fields/") &&
73
+ // childView.view !== "fields/hidden-v1" &&
74
+ // !firstAutoFocus
75
+ // ) {
76
+ // childView.autoFocus = true;
77
+ // firstAutoFocus = true;
78
+ // }
79
+ // });
80
+ // }
81
+ // return spec;
82
+ // }
62
83
  },
63
84
  watch: {
64
85
  spec: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glib-web",
3
- "version": "4.25.0",
3
+ "version": "4.26.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
Binary file