glib-web 2.6.7 → 3.0.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.
Files changed (110) hide show
  1. package/action.js +39 -17
  2. package/actions/analytics/logEvent.js +2 -2
  3. package/actions/auth/saveCsrfToken.js +6 -0
  4. package/actions/cables/push.js +4 -4
  5. package/actions/commands/enqueue.js +17 -0
  6. package/actions/fields/reset.js +2 -2
  7. package/actions/http/get.js +15 -27
  8. package/actions/panels/scrollTo.js +1 -1
  9. package/actions/panels/scrollToBottom.js +1 -1
  10. package/actions/popovers/close.js +5 -0
  11. package/actions/popovers/open.js +9 -0
  12. package/actions/windows/closeWithReload.js +1 -1
  13. package/actions/windows/refreshState.js +3 -1
  14. package/actions/ws/push.js +5 -3
  15. package/app.vue +59 -27
  16. package/components/_badge.vue +1 -6
  17. package/components/_button.vue +30 -30
  18. package/components/_chip.vue +27 -29
  19. package/components/_dropdownMenu.vue +10 -23
  20. package/components/_icon.vue +5 -5
  21. package/components/_responsive.vue +7 -21
  22. package/components/avatar.vue +11 -15
  23. package/components/banners/alert.vue +2 -7
  24. package/components/banners/select.vue +18 -30
  25. package/components/button.vue +4 -5
  26. package/components/component.vue +112 -133
  27. package/components/datetime.vue +2 -0
  28. package/components/fields/_patternText.vue +8 -19
  29. package/components/fields/_select.vue +9 -27
  30. package/components/fields/autocomplete.vue +8 -21
  31. package/components/fields/check.vue +5 -12
  32. package/components/fields/checkGroup.vue +3 -13
  33. package/components/fields/country/field.vue +9 -27
  34. package/components/fields/date.vue +5 -5
  35. package/components/fields/datetime.vue +6 -11
  36. package/components/fields/dynamicSelect.vue +8 -29
  37. package/components/fields/file.vue +10 -29
  38. package/components/fields/newRichText.vue +67 -54
  39. package/components/fields/otpField.vue +11 -31
  40. package/components/fields/phone/field.vue +60 -78
  41. package/components/fields/radio.vue +8 -44
  42. package/components/fields/radioGroup.vue +17 -19
  43. package/components/fields/rating.vue +9 -16
  44. package/components/fields/richText.vue +27 -45
  45. package/components/fields/select.vue +10 -7
  46. package/components/fields/stripe/stripeFields.vue +9 -2
  47. package/components/fields/stripe/stripeIndividualFields.vue +9 -7
  48. package/components/fields/stripeExternalAccount.vue +10 -24
  49. package/components/fields/text.vue +26 -50
  50. package/components/fields/textarea.vue +14 -27
  51. package/components/fields/timeZone.vue +9 -6
  52. package/components/fields/timer.vue +5 -11
  53. package/components/image.vue +12 -23
  54. package/components/label.vue +10 -18
  55. package/components/markdown.vue +45 -23
  56. package/components/mixins/events.js +24 -25
  57. package/components/mixins/generic.js +7 -4
  58. package/components/mixins/inputVariant.js +16 -0
  59. package/components/mixins/list/autoload.js +7 -5
  60. package/components/mixins/styles.js +16 -16
  61. package/components/mixins/table/autoload.js +6 -4
  62. package/components/mixins/ws/actionCable.js +6 -5
  63. package/components/mixins/ws/phoenixSocket.js +11 -9
  64. package/components/p.vue +10 -0
  65. package/components/panels/column.vue +8 -19
  66. package/components/panels/custom.vue +9 -13
  67. package/components/panels/flow.vue +19 -13
  68. package/components/panels/form.vue +26 -34
  69. package/components/panels/grid.vue +15 -9
  70. package/components/panels/horizontal.vue +58 -54
  71. package/components/panels/list.vue +37 -72
  72. package/components/panels/responsive.vue +2 -33
  73. package/components/panels/scroll.vue +3 -0
  74. package/components/panels/split.vue +2 -2
  75. package/components/panels/table.vue +32 -63
  76. package/components/panels/timeline.vue +20 -30
  77. package/components/panels/vertical.vue +8 -13
  78. package/components/popover.vue +39 -0
  79. package/components/progressCircle.vue +2 -8
  80. package/components/progressbar.vue +4 -14
  81. package/components/shareButton.vue +24 -30
  82. package/components/tabBar.vue +29 -28
  83. package/index.js +60 -94
  84. package/nav/appbar.vue +8 -6
  85. package/nav/dialog.vue +30 -49
  86. package/nav/drawer.vue +39 -51
  87. package/nav/drawerButton.vue +5 -7
  88. package/nav/drawerLabel.vue +2 -3
  89. package/nav/sheet.vue +21 -22
  90. package/nav/snackbar.vue +19 -30
  91. package/package.json +13 -16
  92. package/plugins/driverCustomBehavior.js +1 -1
  93. package/plugins/updatableComponent.js +2 -2
  94. package/plugins/vuetify.js +26 -0
  95. package/store.js +16 -0
  96. package/templates/comment.vue +42 -19
  97. package/templates/featured.vue +8 -9
  98. package/templates/thumbnail-old.vue +188 -0
  99. package/templates/thumbnail.vue +3 -208
  100. package/tsconfig.json +1 -1
  101. package/utils/component.js +18 -18
  102. package/utils/constant.js +4 -0
  103. package/utils/eventBus.js +9 -2
  104. package/utils/history.js +12 -8
  105. package/utils/http.js +29 -71
  106. package/utils/launch.js +89 -52
  107. package/utils/private/ws.js +5 -3
  108. package/utils/public.js +6 -0
  109. package/utils/queue.js +102 -0
  110. package/utils/settings.js +3 -9
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :style="genericStyles()">
2
+ <div :style="genericStyles()" :class="$classes()">
3
3
  <!--
4
4
  NOTE: To make sure that the custom component gets updated, in the custom component,
5
5
  make sure to use one of the `spec` attributes directly or through a computed method.
@@ -11,20 +11,15 @@
11
11
  This should not be needed if a component (custom or not) uses $styles() or other mixin
12
12
  methods because those methods use `spec` attributes, which will force $ready() to be called.
13
13
  -->
14
- <component
15
- ref="ccomp"
16
- :is="template"
17
- v-if="customData"
18
- :name="spec.template"
19
- :spec="customData"
20
- />
14
+ <component ref="ccomp" :is="template" v-if="customData" :name="spec.template" :spec="customData" />
21
15
  </div>
22
16
  </template>
23
17
 
24
18
  <script>
25
- import UnsupportedTemplate from "../../templates/unsupported";
26
- import ThumbnailTemplate from "../../templates/thumbnail";
27
- import FeaturedTemplate from "../../templates/featured";
19
+ import UnsupportedTemplate from "../../templates/unsupported.vue";
20
+ import ThumbnailTemplate from "../../templates/thumbnail.vue";
21
+ import FeaturedTemplate from "../../templates/featured.vue";
22
+ import { getCurrentInstance } from 'vue';
28
23
 
29
24
  export default {
30
25
  components: {
@@ -42,12 +37,13 @@ export default {
42
37
  },
43
38
  computed: {
44
39
  template() {
40
+
45
41
  const name = `template-${this.spec.template.replace("/", "-")}`;
46
- const strict = false;
42
+ const strict = true;
47
43
  if (strict) {
48
44
  return name;
49
45
  } else {
50
- if (this.$options.components[name]) {
46
+ if (getCurrentInstance().appContext.components[name]) {
51
47
  return name;
52
48
  }
53
49
  return "template-unsupported";
@@ -1,11 +1,17 @@
1
1
  <template>
2
- <div :class="cssClasses" :style="cssStyles">
3
- <template v-for="(item, index) in spec.childViews">
2
+ <div
3
+ :class="cssClasses"
4
+ :style="cssStyles"
5
+ >
6
+ <template
7
+ v-for="(item, index) in spec.childViews"
8
+ :key="index"
9
+ >
4
10
  <!--
5
11
  The wrapper prevents its content (e.g. image component) from getting stretched to fill
6
12
  remaining space on the new line.
7
13
  -->
8
- <div :key="index" :style="innerStyles">
14
+ <div :style="innerStyles">
9
15
  <glib-component :spec="item" />
10
16
  </div>
11
17
  </template>
@@ -15,10 +21,10 @@
15
21
  <script>
16
22
  export default {
17
23
  props: {
18
- spec: { type: Object, required: true }
24
+ spec: { type: Object, required: true },
19
25
  },
20
26
  computed: {
21
- cssClasses: function() {
27
+ cssClasses: function () {
22
28
  const classes = this.$classes().concat("layouts-flow");
23
29
  // switch(this.spec.distribution) {
24
30
  // case 'fillEqually':
@@ -30,7 +36,7 @@ export default {
30
36
  // }
31
37
  return classes;
32
38
  },
33
- cssStyles: function() {
39
+ cssStyles: function () {
34
40
  const styles = this.$styles();
35
41
  // switch(this.spec.align) {
36
42
  // case 'middle':
@@ -46,27 +52,27 @@ export default {
46
52
  },
47
53
  innerStyles() {
48
54
  const styles = {};
49
- Utils.type.ifObject(this.spec.innerPadding, padding => {
55
+ Utils.type.ifObject(this.spec.innerPadding, (padding) => {
50
56
  Utils.type.ifNumber(
51
57
  padding.top,
52
- top => (styles["padding-top"] = `${top}px`)
58
+ (top) => (styles["padding-top"] = `${top}px`)
53
59
  );
54
60
  Utils.type.ifNumber(
55
61
  padding.bottom,
56
- bottom => (styles["padding-bottom"] = `${bottom}px`)
62
+ (bottom) => (styles["padding-bottom"] = `${bottom}px`)
57
63
  );
58
64
  Utils.type.ifNumber(
59
65
  padding.left,
60
- left => (styles["padding-left"] = `${left}px`)
66
+ (left) => (styles["padding-left"] = `${left}px`)
61
67
  );
62
68
  Utils.type.ifNumber(
63
69
  padding.right,
64
- right => (styles["padding-right"] = `${right}px`)
70
+ (right) => (styles["padding-right"] = `${right}px`)
65
71
  );
66
72
  });
67
73
  return styles;
68
- }
69
- }
74
+ },
75
+ },
70
76
  };
71
77
  </script>
72
78
 
@@ -1,19 +1,8 @@
1
1
  <template>
2
- <v-form
3
- ref="form"
4
- :style="parentStyles"
5
- :action="url"
6
- :method="spec.method"
7
- :data-local="spec.local"
8
- @submit="onSubmit"
9
- >
10
- <template v-for="(value, key, index) in params">
11
- <input
12
- :key="`hidden_${index}`"
13
- type="hidden"
14
- :name="key"
15
- :value="value"
16
- />
2
+ <v-form ref="form" :style="parentStyles" :action="url" :method="spec.method" :data-local="spec.local"
3
+ @submit="onSubmit">
4
+ <template v-for="(value, key, index) in params" :key="`hidden_${index}`">
5
+ <input type="hidden" :name="key" :value="value" />
17
6
  </template>
18
7
 
19
8
  <panels-responsive :spec="modifiedSpec" />
@@ -28,7 +17,7 @@
28
17
 
29
18
  export default {
30
19
  props: {
31
- spec: { type: Object, required: true }
20
+ spec: { type: Object, required: true },
32
21
  },
33
22
  data: () => ({
34
23
  url: null,
@@ -36,22 +25,22 @@ export default {
36
25
  parentStyles: {},
37
26
  formElement: null,
38
27
  submitButtons: [],
39
- modifiedSpec: {}
28
+ modifiedSpec: {},
40
29
  }),
41
30
  watch: {
42
- $isBusy: function(val, oldVal) {
31
+ $isBusy: function (val, oldVal) {
43
32
  for (const button of this.submitButtons) {
44
33
  button._isBusy = val;
45
34
  }
46
- }
35
+ },
47
36
  },
48
37
  methods: {
49
38
  $mounted() {
50
- this.$onEvent("forms/addSubmit", e => {
39
+ this.$onEvent("forms/addSubmit", (e) => {
51
40
  this.submitButtons.push(e.data);
52
41
  });
53
42
 
54
- this.$onEvent("forms/setBusy", e => {
43
+ this.$onEvent("forms/setBusy", (e) => {
55
44
  if (e.data.value) {
56
45
  Utils.http.startIndicator(this);
57
46
  } else {
@@ -59,11 +48,11 @@ export default {
59
48
  }
60
49
  });
61
50
 
62
- this.$onEvent("forms/submit", e => {
51
+ this.$onEvent("forms/submit", (e) => {
63
52
  this.submit();
64
53
  });
65
54
 
66
- this.$onEvent("forms/directSubmit", e => {
55
+ this.$onEvent("forms/directSubmit", (e) => {
67
56
  this.directSubmit(e.data.url);
68
57
  });
69
58
  },
@@ -104,10 +93,10 @@ export default {
104
93
  this.validate(() => {
105
94
  Utils.type.ifObject(
106
95
  this.spec.onSubmit,
107
- onSubmit => {
96
+ (onSubmit) => {
108
97
  const formData = Utils.url.toMap(new FormData(this.formElement));
109
98
  const params = {
110
- [this.spec.paramNameForFormData || "formData"]: formData
99
+ [this.spec.paramNameForFormData || "formData"]: formData,
111
100
  };
112
101
  const data = Object.assign({}, onSubmit, params);
113
102
  GLib.action.execute(data, this);
@@ -128,22 +117,25 @@ export default {
128
117
  }
129
118
  },
130
119
  validate(onPassed) {
131
- if (this.$refs.form.validate()) {
132
- // Remove focus from current input field to avoid double submit if the user presses ENTER again.
133
- document.activeElement.blur();
120
+ this.$refs.form.validate()
121
+ .then(({ valid, errors }) => {
122
+ if (valid && errors.length <= 0) {
123
+ // Remove focus from current input field to avoid double submit if the user presses ENTER again.
124
+ document.activeElement.blur();
134
125
 
135
- onPassed();
136
- } else {
137
- Utils.launch.dialog.alert("Make sure all fields are valid", this);
138
- }
126
+ onPassed();
127
+ } else {
128
+ Utils.launch.dialog.alert("Make sure all fields are valid", this);
129
+ }
130
+ })
139
131
  },
140
132
  action_clear() {
141
133
  this.formElement.reset();
142
- }
134
+ },
143
135
  // $dialogContainer() {
144
136
  // return this.formElement;
145
137
  // }
146
- }
138
+ },
147
139
  };
148
140
  </script>
149
141
 
@@ -1,7 +1,13 @@
1
1
  <template>
2
- <div :class="$classes()" :style="cssStyles">
3
- <template v-for="(item, index) in spec.childViews">
4
- <div :key="index">
2
+ <div
3
+ :class="$classes()"
4
+ :style="cssStyles"
5
+ >
6
+ <template
7
+ v-for="(item, index) in spec.childViews"
8
+ :key="index"
9
+ >
10
+ <div>
5
11
  <glib-component :spec="item" />
6
12
  </div>
7
13
  </template>
@@ -11,20 +17,20 @@
11
17
  <script>
12
18
  export default {
13
19
  props: {
14
- spec: { type: Object, required: true }
20
+ spec: { type: Object, required: true },
15
21
  },
16
22
  computed: {
17
- cssStyles: function() {
23
+ cssStyles: function () {
18
24
  const styles = this.$styles();
19
25
 
20
26
  styles["display"] = "grid";
21
27
  Utils.type.ifNumber(
22
28
  this.spec.columnGap,
23
- columnGap => (styles["columnGap"] = `${columnGap}px`)
29
+ (columnGap) => (styles["columnGap"] = `${columnGap}px`)
24
30
  );
25
31
  Utils.type.ifNumber(
26
32
  this.spec.rowGap,
27
- rowGap => (styles["rowGap"] = `${rowGap}px`)
33
+ (rowGap) => (styles["rowGap"] = `${rowGap}px`)
28
34
  );
29
35
  const boxMaxWidth = this.spec.boxMaxWidth
30
36
  ? `${this.spec.boxMaxWidth}px`
@@ -35,8 +41,8 @@ export default {
35
41
  ] = `repeat(auto-fit, minmax(${this.spec.boxMinWidth}px, ${boxMaxWidth}))`;
36
42
 
37
43
  return styles;
38
- }
39
- }
44
+ },
45
+ },
40
46
  };
41
47
  </script>
42
48
 
@@ -6,58 +6,46 @@
6
6
  :href="$href()"
7
7
  @click="$onClick()"
8
8
  >
9
- <template v-for="(item, index) in spec.childViews">
10
- <glib-component :key="index" :spec="item" />
9
+ <template
10
+ v-for="(item, index) in spec.childViews"
11
+ :key="index"
12
+ >
13
+ <glib-component :spec="item" />
11
14
  </template>
12
15
  </component> -->
13
- <component
14
- :is="componentName"
15
- :style="parentStyles"
16
- :class="parentClasses"
17
- :href="$href()"
18
- @click="$onClick()"
19
- >
20
- <draggable
21
- :style="childStyles"
22
- :class="childClasses"
23
- ghost-class="ghost"
24
- :group="dragSupport ? dragSupport.groupId || 'common' : 'common'"
25
- :data-dragPanelId="spec.id"
26
- :disabled="!$type.isObject(spec.dragSupport)"
27
- @start="onDragStart"
28
- @end="onDragEnd"
29
- >
30
- <!-- Using `item.id` as key is important to make sure the item gets updated
16
+ <component :is="componentName" :style="parentStyles" :class="parentClasses" :href="$href()" @click="$onClick()">
17
+ <!-- <draggable :style="childStyles" :class="childClasses" ghost-class="ghost" -->
18
+ <!-- :group="dragSupport ? dragSupport.groupId || 'common' : 'common'" :data-dragPanelId="spec.id"
19
+ :disabled="!$type.isObject(spec.dragSupport)" @start="onDragStart" @end="onDragEnd"> -->
20
+ <!-- Using `item.id` as key is important to make sure the item gets updated
31
21
  when dragging ends. -->
32
- <div
33
- v-for="(item, index) in childViews"
34
- :key="item.id || index"
35
- :data-dragItemId="item.id"
36
- >
22
+ <div :style="childStyles" :class="childClasses">
23
+ <template v-for="(item, index) in childViews" :key="item.id || index">
37
24
  <glib-component :spec="item" />
38
- </div>
39
- </draggable>
25
+ </template>
26
+ </div>
27
+ <!-- </draggable> -->
40
28
  </component>
41
29
  </template>
42
30
 
43
31
  <script>
44
- import draggable from "vuedraggable";
32
+ // import draggable from "vuedraggable";
45
33
 
46
34
  export default {
47
35
  components: {
48
- draggable
36
+ // draggable
49
37
  },
50
38
  props: {
51
- spec: { type: Object, required: true }
39
+ spec: { type: Object, required: true },
52
40
  },
53
- data: function() {
41
+ data: function () {
54
42
  return {
55
43
  dragSupport: null,
56
44
  childViews: []
57
45
  };
58
46
  },
59
47
  computed: {
60
- parentClasses: function() {
48
+ parentClasses: function () {
61
49
  return this.$classes();
62
50
  },
63
51
  childClasses() {
@@ -71,7 +59,7 @@ export default {
71
59
  classes.push("layouts-horizontal--space-equally");
72
60
  break;
73
61
  default:
74
- Utils.type.ifString(distribution, distribution => {
62
+ Utils.type.ifString(distribution, (distribution) => {
75
63
  // Uses Material Design spacings: https://vuetifyjs.com/en/styles/spacing/#how-it-works
76
64
  if (
77
65
  distribution.startsWith("overlap-") ||
@@ -124,14 +112,14 @@ export default {
124
112
  },
125
113
  onDragStart(event) {
126
114
  // This allows custom components to detect if something is being dragged.
127
- window.vueApp.draggedComponent = this;
115
+ vueApp.draggedComponent = this;
128
116
  },
129
117
  onDragEnd(event) {
130
- window.vueApp.draggedComponent = null;
118
+ vueApp.draggedComponent = null;
131
119
 
132
120
  const targetRowIndex = event.newIndex;
133
121
  if (event.from == event.to && event.oldIndex == targetRowIndex) {
134
- console.debug("Reordering canceled");
122
+ console.log("Reordering canceled");
135
123
  return;
136
124
  }
137
125
 
@@ -197,60 +185,76 @@ a.panels-horizontal {
197
185
  </style>
198
186
 
199
187
  <style>
200
- .layouts-horizontal--fill-equally > * {
188
+ .layouts-horizontal--fill-equally>* {
201
189
  flex: initial;
202
190
  width: 100%;
203
191
  }
204
- .layouts-horizontal--space-equally > * {
192
+
193
+ .layouts-horizontal--space-equally>* {
205
194
  flex: initial;
206
195
  }
207
- .layouts-horizontal--overlap-1 > *:not(:first-child) {
196
+
197
+ .layouts-horizontal--overlap-1>*:not(:first-child) {
208
198
  margin-left: -4px;
209
199
  }
210
- .layouts-horizontal--overlap-2 > *:not(:first-child) {
200
+
201
+ .layouts-horizontal--overlap-2>*:not(:first-child) {
211
202
  margin-left: -8px;
212
203
  }
213
- .layouts-horizontal--overlap-3 > *:not(:first-child) {
204
+
205
+ .layouts-horizontal--overlap-3>*:not(:first-child) {
214
206
  margin-left: -12px;
215
207
  }
216
- .layouts-horizontal--overlap-4 > *:not(:first-child) {
208
+
209
+ .layouts-horizontal--overlap-4>*:not(:first-child) {
217
210
  margin-left: -16px;
218
211
  }
219
- .layouts-horizontal--overlap-5 > *:not(:first-child) {
212
+
213
+ .layouts-horizontal--overlap-5>*:not(:first-child) {
220
214
  margin-left: -20px;
221
215
  }
222
- .layouts-horizontal--overlap-6 > *:not(:first-child) {
216
+
217
+ .layouts-horizontal--overlap-6>*:not(:first-child) {
223
218
  margin-left: -24px;
224
219
  }
225
- .layouts-horizontal--overlap-7 > *:not(:first-child) {
220
+
221
+ .layouts-horizontal--overlap-7>*:not(:first-child) {
226
222
  margin-left: -28px;
227
223
  }
228
- .layouts-horizontal--overlap-8 > *:not(:first-child) {
224
+
225
+ .layouts-horizontal--overlap-8>*:not(:first-child) {
229
226
  margin-left: -32px;
230
227
  }
231
228
 
232
- .layouts-horizontal--space-1 > *:not(:first-child) {
229
+ .layouts-horizontal--space-1>*:not(:first-child) {
233
230
  margin-left: 4px;
234
231
  }
235
- .layouts-horizontal--space-2 > *:not(:first-child) {
232
+
233
+ .layouts-horizontal--space-2>*:not(:first-child) {
236
234
  margin-left: 8px;
237
235
  }
238
- .layouts-horizontal--space-3 > *:not(:first-child) {
236
+
237
+ .layouts-horizontal--space-3>*:not(:first-child) {
239
238
  margin-left: 12px;
240
239
  }
241
- .layouts-horizontal--space-4 > *:not(:first-child) {
240
+
241
+ .layouts-horizontal--space-4>*:not(:first-child) {
242
242
  margin-left: 16px;
243
243
  }
244
- .layouts-horizontal--space-5 > *:not(:first-child) {
244
+
245
+ .layouts-horizontal--space-5>*:not(:first-child) {
245
246
  margin-left: 20px;
246
247
  }
247
- .layouts-horizontal--space-6 > *:not(:first-child) {
248
+
249
+ .layouts-horizontal--space-6>*:not(:first-child) {
248
250
  margin-left: 24px;
249
251
  }
250
- .layouts-horizontal--space-7 > *:not(:first-child) {
252
+
253
+ .layouts-horizontal--space-7>*:not(:first-child) {
251
254
  margin-left: 28px;
252
255
  }
253
- .layouts-horizontal--space-8 > *:not(:first-child) {
256
+
257
+ .layouts-horizontal--space-8>*:not(:first-child) {
254
258
  margin-left: 32px;
255
259
  }
256
260
  </style>