glib-web 0.13.1 → 0.14.1

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 (44) hide show
  1. package/LICENSE +0 -0
  2. package/actions/auth/restart.js +0 -0
  3. package/actions/dialogs/oauth.js +0 -0
  4. package/actions/dialogs/options.js +0 -0
  5. package/actions/windows/openWeb.js +0 -0
  6. package/components/_badge.vue +29 -6
  7. package/components/_button.vue +19 -23
  8. package/components/_chip.vue +14 -14
  9. package/components/_icon.vue +5 -7
  10. package/components/_message.vue +0 -0
  11. package/components/avatar.vue +13 -11
  12. package/components/datetime.vue +0 -0
  13. package/components/fab.vue +0 -0
  14. package/components/fields/country/countries.js +0 -0
  15. package/components/fields/country/field.vue +0 -0
  16. package/components/fields/country/regions.js +0 -0
  17. package/components/fields/datetime.vue +0 -0
  18. package/components/fields/dynamicSelect.vue +0 -0
  19. package/components/fields/select.vue +0 -0
  20. package/components/fields/text.vue +9 -0
  21. package/components/fields/timeZone.vue +0 -0
  22. package/components/hr.vue +0 -0
  23. package/components/html.vue +0 -0
  24. package/components/image.vue +13 -12
  25. package/components/mixins/longClick.js +0 -0
  26. package/components/mixins/scrolling.js +0 -0
  27. package/components/mixins/table/export.js +0 -0
  28. package/components/mixins/table/import.js +0 -0
  29. package/components/mixins/tooltip.js +9 -0
  30. package/components/p.vue +0 -0
  31. package/components/panels/form.vue +21 -5
  32. package/components/tabBar.vue +4 -8
  33. package/keys.js +0 -0
  34. package/nav/drawerButton.vue +3 -2
  35. package/package.json +1 -1
  36. package/settings.json.example +0 -0
  37. package/styles/test.sass +0 -0
  38. package/styles/test.scss +0 -0
  39. package/templates/unsupported.vue +0 -0
  40. package/utils/dom.js +0 -0
  41. package/utils/public.js +0 -0
  42. package/utils/settings.js +0 -0
  43. package/utils/storage.js +0 -0
  44. package/utils/url.js +0 -0
package/LICENSE CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <v-badge
3
- v-if="spec.badgeContent"
4
- :color="spec.badgeColor || 'red'"
5
- :content="spec.badgeContent"
6
- :value="spec.badgeContent || false"
3
+ :color="badge.backgroundColor || 'red'"
4
+ overlap
5
+ :value="badgeExists()"
7
6
  >
7
+ <template v-slot:badge>{{ badge.text }}</template>
8
+ <slot />
8
9
  </v-badge>
9
10
  </template>
10
11
 
@@ -12,12 +13,34 @@
12
13
  export default {
13
14
  props: {
14
15
  spec: { type: Object, required: true }
16
+ },
17
+ data() {
18
+ return {
19
+ badge: {}
20
+ };
21
+ },
22
+ methods: {
23
+ $ready() {
24
+ this.badge = this.spec.badge || {};
25
+ },
26
+ badgeExists() {
27
+ var exists = false;
28
+ Utils.type.ifString(this.badge.text, text => {
29
+ exists = text.length > 0;
30
+ });
31
+ return exists;
32
+ }
15
33
  }
16
34
  };
17
35
  </script>
18
36
 
19
- <style scoped>
37
+ <style lang="scss" scoped>
20
38
  .v-badge {
21
- margin-left: 2px;
39
+ // So that it behaves like other components (e.g. v-btn). Without this, nav bar buttons will
40
+ // not align middle.
41
+ display: inline-flex;
42
+
43
+ // To support responsive v-img.
44
+ max-width: 100%;
22
45
  }
23
46
  </style>
@@ -1,31 +1,27 @@
1
1
  <template>
2
- <v-btn
3
- :type="type"
4
- :disabled="disabled || $isBusy || spec.disabled"
5
- :style="styles()"
6
- :class="$classes()"
7
- :href="$href()"
8
- :rel="$rel()"
9
- :text="linkStyling || $classes().includes('text')"
10
- :small="linkStyling"
11
- :icon="$classes().includes('icon')"
12
- :outlined="$classes().includes('outlined')"
13
- :tile="$classes().includes('tile')"
14
- :rounded="$classes().includes('rounded')"
15
- :depressed="$classes().includes('depressed')"
16
- @click="type == 'submit' ? null : $onClick()"
17
- >
18
- <span><common-icon :spec="spec.icon || {}"/></span>
19
- <v-badge
20
- :color="spec.badgeColor || 'red'"
21
- :content="spec.badgeContent"
22
- :value="spec.badgeContent || false"
2
+ <common-badge :spec="spec">
3
+ <v-btn
4
+ :type="type"
5
+ :disabled="disabled || $isBusy || spec.disabled"
6
+ :style="styles()"
7
+ :class="$classes()"
8
+ :href="$href()"
9
+ :rel="$rel()"
10
+ :text="linkStyling || $classes().includes('text')"
11
+ :small="linkStyling"
12
+ :icon="$classes().includes('icon')"
13
+ :outlined="$classes().includes('outlined')"
14
+ :tile="$classes().includes('tile')"
15
+ :rounded="$classes().includes('rounded')"
16
+ :depressed="$classes().includes('depressed')"
17
+ @click="type == 'submit' ? null : $onClick()"
23
18
  >
19
+ <span><common-icon :spec="spec.icon || {}"/></span>
24
20
  <div :class="hideTextOnXs && spec.icon ? 'd-none d-sm-flex' : null">
25
21
  {{ spec.text }}
26
22
  </div>
27
- </v-badge>
28
- </v-btn>
23
+ </v-btn>
24
+ </common-badge>
29
25
  </template>
30
26
 
31
27
  <script>
@@ -8,20 +8,20 @@
8
8
  >
9
9
  <template v-slot:activator="{ on }">
10
10
  <span v-on="on">
11
- <v-chip
12
- v-if="spec.onClick"
13
- :style="genericStyles()"
14
- :class="$classes()"
15
- :href="$href()"
16
- @click="$onClick()"
17
- >
18
- {{ spec.text }}
19
- <common-badge :spec="spec" />
20
- </v-chip>
21
- <v-chip v-else :style="genericStyles()" :class="$classes()">
22
- {{ spec.text }}
23
- <common-badge :spec="spec" />
24
- </v-chip>
11
+ <common-badge :spec="spec">
12
+ <v-chip
13
+ v-if="spec.onClick"
14
+ :style="genericStyles()"
15
+ :class="$classes()"
16
+ :href="$href()"
17
+ @click="$onClick()"
18
+ >
19
+ {{ spec.text }}
20
+ </v-chip>
21
+ <v-chip v-else :style="genericStyles()" :class="$classes()">
22
+ {{ spec.text }}
23
+ </v-chip>
24
+ </common-badge>
25
25
  </span>
26
26
  </template>
27
27
  <span>{{ tooltip.text }}</span>
@@ -1,11 +1,9 @@
1
1
  <template>
2
- <v-badge v-if="badge.text" :color="badge.backgroundColor || 'red'" overlap>
3
- <template v-slot:badge>{{ badge.text }}</template>
4
- <v-icon :style="genericStyles()" :size="size">{{ value }}</v-icon>
5
- </v-badge>
6
- <v-icon v-else :style="genericStyles()" :size="size" :color="color">{{
7
- value
8
- }}</v-icon>
2
+ <common-badge :spec="spec">
3
+ <v-icon :style="genericStyles()" :size="size" :color="color">{{
4
+ value
5
+ }}</v-icon>
6
+ </common-badge>
9
7
  </template>
10
8
 
11
9
  <script>
File without changes
@@ -7,14 +7,17 @@
7
7
  :left="tooltipPositionMatches('left')"
8
8
  >
9
9
  <template v-slot:activator="{ on }">
10
- <v-avatar
11
- :style="genericStyles()"
12
- :class="$classes()"
13
- :size="spec.size"
14
- v-on="on"
15
- >
16
- <v-img :src="spec.url || spec.base64Data" @click="$onClick()"> </v-img>
17
- </v-avatar>
10
+ <common-badge :spec="spec">
11
+ <v-avatar
12
+ :style="genericStyles()"
13
+ :class="$classes()"
14
+ :size="spec.size"
15
+ v-on="on"
16
+ >
17
+ <v-img :src="spec.url || spec.base64Data" @click="$onClick()">
18
+ </v-img>
19
+ </v-avatar>
20
+ </common-badge>
18
21
  </template>
19
22
  <span>{{ tooltip.text }}</span>
20
23
  </v-tooltip>
@@ -30,13 +33,12 @@ export default {
30
33
  },
31
34
  data() {
32
35
  return {
33
- styles: {},
34
- tooltip: {}
36
+ styles: {}
35
37
  };
36
38
  },
37
39
  methods: {
38
40
  $ready() {
39
- this.tooltip = this.spec.tooltip || { disabled: true };
41
+ this.$initAccessories();
40
42
  }
41
43
  }
42
44
  };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -23,6 +23,7 @@
23
23
  :autofocus="spec.autoFocus || false"
24
24
  validate-on-blur
25
25
  @click:append="onRightIconClick"
26
+ @input="onChange"
26
27
  />
27
28
  <input
28
29
  v-if="spec.readOnly"
@@ -123,6 +124,14 @@ export default {
123
124
  },
124
125
  classes() {
125
126
  return this.$classes().concat("g-text-field--hintless");
127
+ },
128
+ // TODO: Consider using debounce to wait until user has finished typing.
129
+ onChange() {
130
+ Utils.type.ifObject(this.spec.onChange, onChange => {
131
+ this.$nextTick(() => {
132
+ GLib.action.execute(onChange, this);
133
+ });
134
+ });
126
135
  }
127
136
  }
128
137
  };
File without changes
package/components/hr.vue CHANGED
File without changes
File without changes
@@ -7,15 +7,17 @@
7
7
  :left="tooltipPositionMatches('left')"
8
8
  >
9
9
  <template v-slot:activator="{ on }">
10
- <!-- TODO: Add support for href and :rel="$rel()" -->
11
- <v-img
12
- :src="spec.url || spec.base64Data"
13
- :style="styles"
14
- v-on="on"
15
- @click="$onClick()"
16
- >
17
- <!-- <v-progress-circular v-if="$isBusy" indeterminate /> -->
18
- </v-img>
10
+ <common-badge :spec="spec">
11
+ <!-- TODO: Add support for href and :rel="$rel()" -->
12
+ <v-img
13
+ :src="spec.url || spec.base64Data"
14
+ :style="styles"
15
+ v-on="on"
16
+ @click="$onClick()"
17
+ >
18
+ <!-- <v-progress-circular v-if="$isBusy" indeterminate /> -->
19
+ </v-img>
20
+ </common-badge>
19
21
  </template>
20
22
  <span>{{ tooltip.text }}</span>
21
23
  </v-tooltip>
@@ -32,13 +34,12 @@ export default {
32
34
  },
33
35
  data() {
34
36
  return {
35
- styles: {},
36
- tooltip: {}
37
+ styles: {}
37
38
  };
38
39
  },
39
40
  methods: {
40
41
  $ready() {
41
- this.tooltip = this.spec.tooltip || { disabled: true };
42
+ this.$initAccessories();
42
43
 
43
44
  const styles = this.genericStyles(Object.assign({}, this.spec));
44
45
  this.styles = styles;
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,14 @@
1
+ // TODO: Make tooltip reusable component. See _badge.vue
1
2
  export default {
3
+ data() {
4
+ return {
5
+ tooltip: {}
6
+ };
7
+ },
2
8
  methods: {
9
+ $initAccessories() {
10
+ this.tooltip = this.spec.tooltip || { disabled: true };
11
+ },
3
12
  tooltipPositionMatches(position) {
4
13
  if (this.spec.tooltip && this.spec.tooltip.position) {
5
14
  return position == this.spec.tooltip.position;
package/components/p.vue CHANGED
File without changes
@@ -1,8 +1,19 @@
1
1
  <template>
2
- <v-form ref="form" :style="parentStyles" :action="url" :method="spec.method" :data-local="spec.local"
3
- @submit="onSubmit">
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
+ >
4
10
  <template v-for="(value, key, index) in params">
5
- <input :key="`hidden_${index}`" type="hidden" :name="key" :value="value" />
11
+ <input
12
+ :key="`hidden_${index}`"
13
+ type="hidden"
14
+ :name="key"
15
+ :value="value"
16
+ />
6
17
  </template>
7
18
 
8
19
  <panels-responsive :spec="modifiedSpec" />
@@ -25,19 +36,24 @@ export default {
25
36
  modifiedSpec: {}
26
37
  }),
27
38
  watch: {
28
- $isBusy: function (val, oldVal) {
39
+ $isBusy: function(val, oldVal) {
29
40
  for (const button of this.submitButtons) {
30
41
  button._isBusy = val;
31
42
  }
32
43
  }
33
44
  },
45
+ // Event registrations should not be in $ready() because they are not idempotent. $ready() might get executed
46
+ // On the other hand,
47
+ // logics that rely on `spec` should be in $ready() because they need to be up-to-date and they are
48
+ // idempotent.
49
+ // TODO: Check why $ready() gets called if URL hasn't changed.
34
50
  mounted() {
35
51
  this.$onEvent("forms/directSubmit", e => {
36
52
  this.directSubmit();
37
53
  });
38
54
  },
39
55
  methods: {
40
- $ready: function () {
56
+ $ready: function() {
41
57
  this.$onEvent("forms/addSubmit", e => {
42
58
  this.submitButtons.push(e.data);
43
59
  });
@@ -15,14 +15,10 @@
15
15
  :href="$href(item)"
16
16
  @click="$onClick($event, item)"
17
17
  >
18
- <v-badge
19
- :color="item.badgeColor || 'red'"
20
- :content="item.badgeContent"
21
- :value="item.badgeContent || false"
22
- >
18
+ <common-badge :spec="item">
23
19
  <common-icon v-if="item.icon" :spec="item.icon" />
24
20
  <span :style="{ color: spec.color }">{{ item.text }}</span>
25
- </v-badge>
21
+ </common-badge>
26
22
  </v-tab>
27
23
  </v-tabs>
28
24
  <v-divider />
@@ -61,8 +57,8 @@ export default {
61
57
  .no-divider .v-divider {
62
58
  display: none;
63
59
  }
64
- .v-badge {
60
+ /* .v-badge {
65
61
  top: 50%;
66
62
  transform: translate(0, -50%);
67
- }
63
+ } */
68
64
  </style>
package/keys.js CHANGED
File without changes
@@ -6,8 +6,9 @@
6
6
 
7
7
  <v-list-item-content>
8
8
  <v-list-item-title>
9
- {{ spec.text }}
10
- <common-badge :spec="spec" />
9
+ <common-badge :spec="spec">
10
+ {{ spec.text }}
11
+ </common-badge>
11
12
  </v-list-item-title>
12
13
  </v-list-item-content>
13
14
  </v-list-item>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glib-web",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
File without changes
package/styles/test.sass CHANGED
File without changes
package/styles/test.scss CHANGED
File without changes
File without changes
package/utils/dom.js CHANGED
File without changes
package/utils/public.js CHANGED
File without changes
package/utils/settings.js CHANGED
File without changes
package/utils/storage.js CHANGED
File without changes
package/utils/url.js CHANGED
File without changes