glib-web 3.0.7 → 3.0.8

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.
@@ -2,7 +2,7 @@
2
2
  <common-badge v-if="spec.badge" :spec="spec">
3
3
  <internal-button :spec="spec" :disabled="$isBusy" />
4
4
  </common-badge>
5
- <internal-button v-else :spec="spec" :disable="$isBusy" />
5
+ <internal-button v-else :spec="spec" :disabled="$isBusy" />
6
6
  </template>
7
7
 
8
8
  <script>
@@ -5,7 +5,7 @@
5
5
  browsers where full-height makes field typing laggy.
6
6
  -->
7
7
  <v-row no-gutters :class="fullHeight ? 'full-height' : null">
8
- <!-- <v-row no-gutters> -->
8
+ <!-- <v-row no-gutters> -->
9
9
  <template v-for="(item, index) in spec.childViews" :key="viewKey(item, index)">
10
10
  <glib-component v-if="isColumn(item)" :spec="item" />
11
11
  <div v-else class="full-width" :style="innerStyles">
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <area-chart :style="genericStyles()" :class="$classes()" :data="series"></area-chart>
3
+ </template>
4
+
5
+ <script setup>
6
+ import { computed } from 'vue';
7
+ import { singleDataSeries } from './series';
8
+
9
+ const { spec } = defineProps({ spec: Object })
10
+
11
+ const series = computed(() => singleDataSeries(spec.dataSeries))
12
+ </script>
@@ -1,47 +1,15 @@
1
1
  <template>
2
- <column-chart
3
- :data="groups"
4
- :stacked="spec.stacked"
5
- :library="options"
6
- ></column-chart>
2
+ <column-chart :data="series" :stacked="spec.stacked"></column-chart>
7
3
  </template>
8
4
 
9
- <script>
10
- // https://chartkick.com/vue
5
+ <script setup>
11
6
 
12
- import annotation from "../mixins/chart/annotation.js";
13
- // import tooltip from "../mixins/chart/tooltip.js";
7
+ import { computed } from 'vue';
8
+ import { multipleDataSeries } from './series';
9
+
10
+ const { spec } = defineProps({ spec: Object })
11
+ const series = computed(() => multipleDataSeries(spec.dataGroups))
14
12
 
15
- export default {
16
- mixins: [annotation],
17
- props: {
18
- spec: { type: Object, required: true }
19
- },
20
- data: function() {
21
- return {
22
- groups: [],
23
- dataName: "dataGroups"
24
- };
25
- },
26
- methods: {
27
- $ready() {
28
- this.groups = this.spec.dataGroups.map(element => {
29
- let data;
30
- if (Array.isArray(element.points)) {
31
- data = element.points.reduce((prev, curr) => {
32
- let obj = {};
33
- obj[curr.x] = curr.y;
34
- return Object.assign(prev, obj);
35
- }, {});
36
- } else {
37
- // Support for legacy code
38
- data = element.points;
39
- }
40
- return { name: element.title, data: data };
41
- });
42
- }
43
- }
44
- };
45
13
  </script>
46
14
 
47
15
  <style scoped></style>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <line-chart :style="genericStyles()" :class="$classes()" :data="series"></line-chart>
3
+ </template>
4
+
5
+ <script>
6
+ // import annotation from "../mixins/chart/annotation.js";
7
+ // import tooltip from "../mixins/chart/tooltip.js";
8
+
9
+ export default {
10
+ // mixins: [annotation],
11
+ props: {
12
+ spec: { type: Object, required: true }
13
+ },
14
+ data: function () {
15
+ return {
16
+ series: [],
17
+ dataName: "dataSeries"
18
+ };
19
+ },
20
+ methods: {
21
+ $ready() {
22
+ this.series.clear();
23
+ this.renderData(this.spec.dataSeries);
24
+ this.fetchNext(this.spec.nextPage);
25
+ },
26
+ fetchData(url) {
27
+ const vm = this;
28
+ Utils.type.ifString(url, val => {
29
+ Utils.http.execute({ url: val }, "GET", this, response => {
30
+ vm.renderData(response.dataSeries);
31
+ vm.fetchNext(response.nextPage);
32
+ });
33
+ });
34
+ },
35
+ fetchNext(nextPage) {
36
+ if (!Utils.type.isObject(nextPage)) {
37
+ return;
38
+ }
39
+ if (nextPage.autoload != "all") {
40
+ return;
41
+ }
42
+ this.fetchData(nextPage.url);
43
+ },
44
+ renderData(series) {
45
+ if (!Utils.type.isArray(series)) {
46
+ return;
47
+ }
48
+
49
+ const data = series.map(element => {
50
+ const dataPoints = {};
51
+ element.points.forEach(point => {
52
+ dataPoints[point.x] = point.y;
53
+ });
54
+ return { name: element.title, data: dataPoints };
55
+ });
56
+ this.series = this.series.concat(data);
57
+ }
58
+ }
59
+ };
60
+ </script>
61
+
62
+ <style scoped></style>
@@ -1,67 +1,12 @@
1
1
  <template>
2
- <line-chart
3
- :style="genericStyles()"
4
- :class="$classes()"
5
- :data="series"
6
- :library="options"
7
- ></line-chart>
2
+ <line-chart :style="genericStyles()" :class="$classes()" :data="series"></line-chart>
8
3
  </template>
9
4
 
10
- <script>
11
- import annotation from "../mixins/chart/annotation.js";
12
- // import tooltip from "../mixins/chart/tooltip.js";
5
+ <script setup>
6
+ import { computed } from 'vue';
7
+ import { multipleDataSeries } from './series';
13
8
 
14
- export default {
15
- mixins: [annotation],
16
- props: {
17
- spec: { type: Object, required: true }
18
- },
19
- data: function() {
20
- return {
21
- series: [],
22
- dataName: "dataSeries"
23
- };
24
- },
25
- methods: {
26
- $ready() {
27
- this.series.clear();
28
- this.renderData(this.spec.dataSeries);
29
- this.fetchNext(this.spec.nextPage);
30
- },
31
- fetchData(url) {
32
- const vm = this;
33
- Utils.type.ifString(url, val => {
34
- Utils.http.execute({ url: val }, "GET", this, response => {
35
- vm.renderData(response.dataSeries);
36
- vm.fetchNext(response.nextPage);
37
- });
38
- });
39
- },
40
- fetchNext(nextPage) {
41
- if (!Utils.type.isObject(nextPage)) {
42
- return;
43
- }
44
- if (nextPage.autoload != "all") {
45
- return;
46
- }
47
- this.fetchData(nextPage.url);
48
- },
49
- renderData(series) {
50
- if (!Utils.type.isArray(series)) {
51
- return;
52
- }
9
+ const { spec } = defineProps({ spec: Object })
53
10
 
54
- const data = series.map(element => {
55
- const dataPoints = {};
56
- element.points.forEach(point => {
57
- dataPoints[point.x] = point.y;
58
- });
59
- return { name: element.title, data: dataPoints };
60
- });
61
- this.series = this.series.concat(data);
62
- }
63
- }
64
- };
65
- </script>
66
-
67
- <style scoped></style>
11
+ const series = computed(() => multipleDataSeries(spec.dataSeries))
12
+ </script>
@@ -1,34 +1,14 @@
1
1
  <template>
2
- <pie-chart
3
- :style="genericStyles()"
4
- :class="$classes()"
5
- :data="series"
6
- :library="options"
7
- ></pie-chart>
2
+ <pie-chart :style="genericStyles()" :class="$classes()" :data="series"></pie-chart>
8
3
  </template>
9
4
 
10
- <script>
11
- export default {
12
- mixins: [],
13
- props: {
14
- spec: { type: Object, required: true }
15
- },
16
- data: function() {
17
- return {
18
- series: []
19
- };
20
- },
21
- methods: {
22
- $ready() {
23
- this.series = this.spec.dataSeries.reduce((prev, curr) => {
24
- let obj = {};
25
- obj[curr.title] = curr.value;
5
+ <script setup>
6
+ import { computed } from 'vue';
7
+ import { singleDataSeries } from './series';
8
+
9
+ const { spec } = defineProps({ spec: Object })
10
+ const series = computed(() => singleDataSeries(spec.dataSeries))
26
11
 
27
- return Object.assign(prev, obj);
28
- }, {});
29
- }
30
- }
31
- };
32
12
  </script>
33
13
 
34
14
  <style scoped></style>
@@ -0,0 +1,18 @@
1
+ const multipleDataSeries = (dataSeries) => {
2
+ return dataSeries.map((value) => {
3
+ let points = null
4
+ if (Array.isArray(value.points)) {
5
+ points = value.points.reduce((prev, curr) => {
6
+ return Object.assign(prev, { [curr.x]: curr.y })
7
+ }, {})
8
+ } else {
9
+ points = value.points
10
+ }
11
+ return { name: value.title, data: points }
12
+ })
13
+ }
14
+
15
+ const singleDataSeries = (dataSeries) => dataSeries.reduce((prev, curr) => Object.assign(prev, { [curr.title]: curr.value }), {})
16
+
17
+
18
+ export { multipleDataSeries, singleDataSeries }
@@ -113,6 +113,7 @@ import SelectBanner from "./banners/select.vue";
113
113
  import LineChart from "./charts/line.vue";
114
114
  import ColumnChart from "./charts/column.vue";
115
115
  import PieChart from "./charts/pie.vue";
116
+ import AreaChart from "./charts/area.vue";
116
117
 
117
118
  import ShareButton from "./shareButton.vue";
118
119
  import Action from "../action";
@@ -206,6 +207,7 @@ export default {
206
207
  "charts-line": LineChart,
207
208
  "charts-column": ColumnChart,
208
209
  "charts-pie": PieChart,
210
+ "charts-area": AreaChart
209
211
  },
210
212
  props: {
211
213
  spec: { type: Object, required: true },
@@ -3,18 +3,20 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
+ import { nextTick } from 'vue';
7
+
6
8
  export default {
7
9
  props: {
8
10
  spec: { type: Object, required: true }
9
11
  },
10
- data: function() {
12
+ data: function () {
11
13
  return {
12
14
  data: this.$data
13
15
  };
14
16
  },
15
17
  methods: {
16
- $ready() {
17
- this.$dispatchEvent("forms/addSubmit", this.$data);
18
+ $mounted() {
19
+ nextTick(() => this.$dispatchEvent("forms/addSubmit", this.$data))
18
20
  },
19
21
  action_merge(mergedSpec) {
20
22
  Object.assign(this.spec, mergedSpec);
@@ -182,6 +182,12 @@ a.panels-horizontal {
182
182
  // background: rgba(0, 0, 0, 0.4);
183
183
  // }
184
184
  }
185
+
186
+ .child-wrapper {
187
+ // This is to prevent inline components (e.g `avatar`) to be displayed with some invisible margins
188
+ // below the component.
189
+ line-height: 1;
190
+ }
185
191
  </style>
186
192
 
187
193
  <style>
package/index.js CHANGED
@@ -39,11 +39,10 @@ import "./styles/test.scss";
39
39
  import "./styles/test.sass";
40
40
 
41
41
 
42
- // import Chartkick from "vue-chartkick";
43
- // import Chart from "chart.js";
44
- // import annotationPlugin from "chartjs-plugin-annotation";
45
- // Chart.plugins.register(annotationPlugin);
46
- // Vue.use(Chartkick.use(Chart));
42
+ import VueChartkick from 'vue-chartkick'
43
+ import 'chartkick/chart.js'
44
+
45
+ Vue.use(VueChartkick)
47
46
 
48
47
  // import VueAnalytics from 'vue-analytics'
49
48
  // // TODO: Avoid hardcoding
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glib-web",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,8 +14,7 @@
14
14
  "@rails/activestorage": "^6.0.0-alpha",
15
15
  "@vueup/vue-quill": "^1.2.0",
16
16
  "awesome-phonenumber": "2.15.0",
17
- "chart.js": "^2.8.0",
18
- "chartjs-plugin-annotation": "^0.5.7",
17
+ "chart.js": "^4.3.1",
19
18
  "driver.js": "^0.9.8",
20
19
  "json-logic-js": "^2.0.0",
21
20
  "lodash.merge": "^4.6.2",
@@ -27,7 +26,7 @@
27
26
  "turndown": "^7.1.1",
28
27
  "turndown-plugin-gfm": "^1.0.2",
29
28
  "vue": "3.2.47",
30
- "vue-chartkick": "^0.6.1",
29
+ "vue-chartkick": "^1.1.0",
31
30
  "vue-social-sharing": "^4.0.0-alpha4",
32
31
  "vue2-gmap-custom-marker": "^6.1.1",
33
32
  "vue2-google-maps": "^0.10.6",
@@ -11,29 +11,17 @@
11
11
  </template>
12
12
  </div> -->
13
13
 
14
- <v-list-item
15
- v-longclick="$onLongPress"
16
- class="item-content"
17
- :style="columnStyles()"
18
-
19
- >
14
+ <v-list-item v-longclick="$onLongPress" class="item-content" :style="columnStyles()">
20
15
  <!-- <v-icon v-if="spec.onReorder" class="handle">drag_indicator</v-icon> -->
21
16
 
22
17
  <!-- Specify a key to prevent reuse which causes an issue where the checkbox would use the previous name. -->
23
- <fields-check
24
- v-if="checkSpec"
25
- :key="checkSpec.name"
26
- :spec="checkSpec"
27
- />
18
+ <fields-check v-if="checkSpec" :key="checkSpec.name" :spec="checkSpec" />
28
19
 
29
20
  <template v-slot:prepend>
30
21
  <div style="display: flex">
31
22
  <div v-if="spec.leftButtons">
32
23
  <template v-for="(item, index) in spec.leftButtons" :key="index">
33
- <glib-button
34
- :spec="buttonSpec(item)"
35
- :disabled="$isBusy"
36
- />
24
+ <glib-button :spec="buttonSpec(item)" :disabled="$isBusy" />
37
25
  </template>
38
26
  </div>
39
27
 
@@ -58,11 +46,7 @@
58
46
  </div> -->
59
47
 
60
48
  <div>
61
- <v-text-field
62
- v-if="spec.fieldTitleName"
63
- :name="spec.fieldTitleName"
64
- :value="spec.title"
65
- />
49
+ <v-text-field v-if="spec.fieldTitleName" :name="spec.fieldTitleName" :value="spec.title" />
66
50
  <v-list-item-title v-else>{{ spec.title }}</v-list-item-title>
67
51
 
68
52
  <v-list-item-subtitle v-if="spec.subtitle">{{
@@ -83,10 +67,7 @@
83
67
 
84
68
  <template v-slot:append>
85
69
  <template v-for="(item, index) in spec.rightButtons" :key="index">
86
- <glib-button
87
- :spec="buttonSpec(item)"
88
- :disabled="$isBusy"
89
- />
70
+ <glib-button :spec="buttonSpec(item)" :disabled="$isBusy" />
90
71
  </template>
91
72
  </template>
92
73
 
@@ -201,7 +182,7 @@ export default {
201
182
  </script>
202
183
 
203
184
  <style lang="scss">
204
- .chips > * {
185
+ .chips>* {
205
186
  margin-right: 10px;
206
187
  }
207
188
 
@@ -210,6 +191,7 @@ export default {
210
191
  }
211
192
 
212
193
  .thumbnail {
194
+
213
195
  // Override this when using the `right` property.
214
196
  .item-content {
215
197
  width: 100%;
@@ -239,10 +221,12 @@ a.thumbnail {
239
221
  width: 60px;
240
222
  height: 60px;
241
223
  }
224
+
242
225
  .left-icon {
243
226
  // margin-left: 16px;
244
227
  margin-left: 4px;
245
228
  }
229
+
246
230
  // .left-universal {
247
231
  // padding-left: 16px;
248
232
  // }