@mixd-id/web-scaffold 0.1.230406248 → 0.1.230406250
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/package.json +5 -2
- package/src/components/Button.vue +4 -7
- package/src/components/Chart.vue +44 -15
- package/src/components/ContextMenu.vue +3 -3
- package/src/components/DGrid.vue +1 -1
- package/src/components/DGridItem.vue +1 -1
- package/src/components/Dropdown.vue +7 -2
- package/src/components/ErrorText.vue +1 -1
- package/src/components/List.vue +319 -124
- package/src/components/ListView.vue +7 -7
- package/src/components/MultilineText.vue +1 -1
- package/src/components/ObjectTree.vue +9 -6
- package/src/components/PresetSelectorFilterItem.vue +78 -56
- package/src/components/SearchButton.vue +1 -1
- package/src/components/Tabs.vue +23 -3
- package/src/components/Textbox.vue +6 -2
- package/src/components/VirtualScroll.vue +1 -1
- package/src/components/VirtualTable.vue +2 -2
- package/src/index.js +76 -49
- package/src/themes/default/index.js +33 -12
- package/src/utils/preset-selector.js +168 -10
- package/src/utils/preset-selector.mjs +47 -0
- package/src/widgets/ColumnSelector.vue +81 -0
- package/src/widgets/PresetBar.vue +592 -0
- package/src/widgets/PresetSelector.vue +156 -6
- package/src/widgets/Share.vue +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mixd-id/web-scaffold",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.230406250",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite serve",
|
|
7
7
|
"build": "vite build",
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
"./importer": "./src/utils/importer.js",
|
|
27
27
|
"./listpage1": "./src/utils/listpage1.js",
|
|
28
28
|
"./listview": "./src/utils/listview.js",
|
|
29
|
-
"./preset-selector":
|
|
29
|
+
"./preset-selector": {
|
|
30
|
+
"require": "./src/utils/preset-selector.js",
|
|
31
|
+
"import": "./src/utils/preset-selector.mjs"
|
|
32
|
+
},
|
|
30
33
|
"./web": "./src/utils/web.js"
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
@@ -155,7 +155,7 @@ export default{
|
|
|
155
155
|
.button-primary{
|
|
156
156
|
@apply bg-primary-500 text-white rounded-lg;
|
|
157
157
|
box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
|
|
158
|
-
border: solid 1px rgb(var(--primary-
|
|
158
|
+
border: solid 1px rgb(var(--primary-500));
|
|
159
159
|
}
|
|
160
160
|
.button-primary:focus{
|
|
161
161
|
border-color: rgb(var(--primary-600));
|
|
@@ -207,16 +207,13 @@ export default{
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
.button-secondary{
|
|
210
|
-
@apply bg-
|
|
211
|
-
box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
|
|
212
|
-
border: solid 1px rgb(var(--secondary-200));
|
|
210
|
+
@apply bg-primary-100 border-primary-100 text-primary-700 rounded-lg text-text;
|
|
213
211
|
}
|
|
214
212
|
.button-secondary:hover{
|
|
215
|
-
@apply bg-
|
|
216
|
-
border-color: rgb(var(--secondary-100));
|
|
213
|
+
@apply bg-primary-200 border-primary-200;
|
|
217
214
|
}
|
|
218
215
|
.button-secondary:disabled{
|
|
219
|
-
@apply bg-
|
|
216
|
+
@apply bg-primary-100 opacity-50 top-0 left-0 cursor-not-allowed;
|
|
220
217
|
}
|
|
221
218
|
.button-secondary *{
|
|
222
219
|
@apply text-text-500 fill-white;
|
package/src/components/Chart.vue
CHANGED
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
<div v-if="readyState === 1" :class="$style.comp">
|
|
3
3
|
|
|
4
4
|
<div class="p-3 flex flex-col items-start leading-tight">
|
|
5
|
-
<small class="text-text-400">{{ title ?? 'Untitled' }}</small>
|
|
6
|
-
<
|
|
5
|
+
<small class="text-text-400 text-xs">{{ title ?? 'Untitled' }}</small>
|
|
6
|
+
<h4 class="inline align-top cursor-pointer hover:text-primary group"
|
|
7
|
+
@click="openPreset">
|
|
7
8
|
{{ preset.name ?? 'Preset Name' }}
|
|
8
9
|
<span v-if="badgeCount > 0" class="mx-1 min-w-[19px] px-2 h-[19px] relative top-[-2px] rounded-full bg-primary text-white inline-flex items-center justify-center">
|
|
9
10
|
{{ badgeCount }}
|
|
10
11
|
</span>
|
|
11
|
-
<svg width="13" height="13" class="inline fill-text pointer-events-none group-hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/></svg>
|
|
12
|
-
</
|
|
12
|
+
<svg v-if="![ 'sidebar', 'external' ].includes(presetMode)" width="13" height="13" class="inline fill-text pointer-events-none group-hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/></svg>
|
|
13
|
+
</h4>
|
|
13
14
|
</div>
|
|
14
15
|
|
|
15
|
-
<Bar class="w-full"
|
|
16
|
+
<Bar v-if="preset.chart.type === 'bar'" class="w-full"
|
|
17
|
+
id="my-chart-id"
|
|
18
|
+
:options="chartOptions"
|
|
19
|
+
:data="chartData"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<Line v-if="preset.chart.type === 'line'" class="w-full"
|
|
16
23
|
id="my-chart-id"
|
|
17
24
|
:options="chartOptions"
|
|
18
25
|
:data="chartData"
|
|
@@ -31,16 +38,17 @@
|
|
|
31
38
|
|
|
32
39
|
<script>
|
|
33
40
|
|
|
34
|
-
import { Bar } from 'vue-chartjs'
|
|
35
|
-
import
|
|
41
|
+
import { Bar, Line } from 'vue-chartjs'
|
|
42
|
+
import Chart from 'chart.js/auto'
|
|
36
43
|
import PresetSelector from "../widgets/PresetSelector.vue";
|
|
37
44
|
import throttle from "lodash/throttle";
|
|
38
|
-
|
|
39
|
-
ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale)
|
|
45
|
+
import dayjs from "dayjs";
|
|
40
46
|
|
|
41
47
|
export default{
|
|
42
48
|
|
|
43
|
-
components: {Bar, PresetSelector},
|
|
49
|
+
components: {Bar, Line, PresetSelector},
|
|
50
|
+
|
|
51
|
+
emits: [ 'open-preset' ],
|
|
44
52
|
|
|
45
53
|
inject: [ 'alert', 'socket' ],
|
|
46
54
|
|
|
@@ -54,6 +62,7 @@ export default{
|
|
|
54
62
|
src: undefined,
|
|
55
63
|
title: String,
|
|
56
64
|
subscribeKey: String,
|
|
65
|
+
presetMode: String,
|
|
57
66
|
},
|
|
58
67
|
|
|
59
68
|
data(){
|
|
@@ -109,7 +118,7 @@ export default{
|
|
|
109
118
|
}
|
|
110
119
|
else{
|
|
111
120
|
for(let key in items[0] ?? {}){
|
|
112
|
-
if(key !==
|
|
121
|
+
if(key !== xAxis[0].key){
|
|
113
122
|
datasets.push({
|
|
114
123
|
label: key,
|
|
115
124
|
data: [],
|
|
@@ -122,7 +131,7 @@ export default{
|
|
|
122
131
|
|
|
123
132
|
const labels = []
|
|
124
133
|
for(let item of this.data.items ?? []){
|
|
125
|
-
labels.push(item[xAxis[0].key])
|
|
134
|
+
labels.push(dayjs(item[xAxis[0].key]).format('DD MMM'))
|
|
126
135
|
|
|
127
136
|
if((yAxis[0] ?? {}).aggregrate === 'count'){
|
|
128
137
|
datasets[0].data.push(item['count'])
|
|
@@ -153,7 +162,7 @@ export default{
|
|
|
153
162
|
animation: false,
|
|
154
163
|
plugins: {
|
|
155
164
|
legend: {
|
|
156
|
-
display: false, // Disable the legend
|
|
165
|
+
display: this.preset.chart.showLegend ?? false, // Disable the legend
|
|
157
166
|
},
|
|
158
167
|
},
|
|
159
168
|
scales: {
|
|
@@ -165,6 +174,7 @@ export default{
|
|
|
165
174
|
return `rgb(${gridColor2})`
|
|
166
175
|
}
|
|
167
176
|
},
|
|
177
|
+
stacked: this.preset.chart.type === 'bar' && this.preset.chart.stack
|
|
168
178
|
},
|
|
169
179
|
y: {
|
|
170
180
|
beginAtZero: true, // Adjust y-axis as needed
|
|
@@ -174,6 +184,7 @@ export default{
|
|
|
174
184
|
return `rgb(${gridColor})`
|
|
175
185
|
}
|
|
176
186
|
},
|
|
187
|
+
stacked: this.preset.chart.type === 'bar' && this.preset.chart.stack
|
|
177
188
|
},
|
|
178
189
|
},
|
|
179
190
|
}
|
|
@@ -248,6 +259,24 @@ export default{
|
|
|
248
259
|
}
|
|
249
260
|
|
|
250
261
|
},
|
|
262
|
+
|
|
263
|
+
openPreset(){
|
|
264
|
+
|
|
265
|
+
switch(this.presetMode){
|
|
266
|
+
|
|
267
|
+
case 'external':
|
|
268
|
+
this.$emit('open-preset')
|
|
269
|
+
break
|
|
270
|
+
|
|
271
|
+
case 'sidebar':
|
|
272
|
+
break
|
|
273
|
+
|
|
274
|
+
default:
|
|
275
|
+
this.$refs.presetSelector.open()
|
|
276
|
+
break
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
},
|
|
251
280
|
},
|
|
252
281
|
|
|
253
282
|
mounted() {
|
|
@@ -288,8 +317,8 @@ export default{
|
|
|
288
317
|
<style module>
|
|
289
318
|
|
|
290
319
|
.comp{
|
|
291
|
-
@apply flex flex-col;
|
|
292
|
-
@apply bg-base-
|
|
320
|
+
@apply flex flex-col p-2;
|
|
321
|
+
@apply bg-base-500;
|
|
293
322
|
padding-bottom: 50px;
|
|
294
323
|
}
|
|
295
324
|
|
|
@@ -301,8 +301,8 @@ export default {
|
|
|
301
301
|
<style module>
|
|
302
302
|
|
|
303
303
|
.contextMenu{
|
|
304
|
-
@apply fixed z-20 bg-base-400
|
|
305
|
-
@apply border-[2px] border-
|
|
304
|
+
@apply fixed z-20 bg-base-400 min-w-[150px] overflow-y-auto rounded-xl;
|
|
305
|
+
@apply border-[2px] border-border-50 shadow-2xl whitespace-nowrap;
|
|
306
306
|
transition: all 150ms cubic-bezier(0.25, 1, 0.5, 1);
|
|
307
307
|
opacity: 0;
|
|
308
308
|
}
|
|
@@ -315,7 +315,7 @@ export default {
|
|
|
315
315
|
@media screen(md){
|
|
316
316
|
|
|
317
317
|
.contextMenu{
|
|
318
|
-
@apply fixed z-20 bg-base-
|
|
318
|
+
@apply fixed z-20 bg-base-400 backdrop-blur-md min-w-[150px] overflow-y-auto rounded-lg;
|
|
319
319
|
@apply border-[1px] border-text-50 shadow-2xl whitespace-nowrap;
|
|
320
320
|
transition: all 150ms cubic-bezier(0.25, 1, 0.5, 1);
|
|
321
321
|
opacity: 0;
|
package/src/components/DGrid.vue
CHANGED
|
@@ -101,7 +101,7 @@ export default{
|
|
|
101
101
|
|
|
102
102
|
case 'bottom':
|
|
103
103
|
const distanceY = e.clientY - this.drag.y
|
|
104
|
-
if(Math.abs(distanceY) >
|
|
104
|
+
if(Math.abs(distanceY) > 30){
|
|
105
105
|
const match = this.class.match(/row-span-(\d+)/)
|
|
106
106
|
const rowSpan = match ? parseInt(match[1]) : 1
|
|
107
107
|
const nextRowSpan = distanceY > 0 ? rowSpan + 1 <= 12 ? rowSpan + 1 : 12 :
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div :class="computedClass">
|
|
4
4
|
|
|
5
5
|
<select v-if="[ 1 ].includes(mode)" class="flex-1" ref="select" @change="onChanged" :disabled="isDisabled"
|
|
6
|
-
:value="modelValue" @input="$emit('update:modelValue', $event.target.value)">
|
|
6
|
+
:value="modelValue" @input="$emit('update:modelValue', $event.target.value)" :class="containerClass">
|
|
7
7
|
<slot></slot>
|
|
8
8
|
</select>
|
|
9
9
|
|
|
@@ -33,6 +33,8 @@ export default {
|
|
|
33
33
|
|
|
34
34
|
props: {
|
|
35
35
|
|
|
36
|
+
containerClass: String,
|
|
37
|
+
|
|
36
38
|
mode: {
|
|
37
39
|
type: [ String, Number ],
|
|
38
40
|
default: 1
|
|
@@ -158,7 +160,6 @@ export default {
|
|
|
158
160
|
<style module>
|
|
159
161
|
|
|
160
162
|
.dropdown{
|
|
161
|
-
@apply min-h-[var(--h-cp)];
|
|
162
163
|
@apply flex items-center rounded-lg overflow-hidden cursor-pointer relative;
|
|
163
164
|
@apply border-[1px] border-text-200 bg-base-50;
|
|
164
165
|
}
|
|
@@ -174,6 +175,10 @@ export default {
|
|
|
174
175
|
@apply appearance-none outline-none p-2 bg-transparent cursor-pointer w-full;
|
|
175
176
|
}
|
|
176
177
|
|
|
178
|
+
.dropdown option{
|
|
179
|
+
@apply bg-base-50 text-text;
|
|
180
|
+
}
|
|
181
|
+
|
|
177
182
|
.dropdown option[disabled]{
|
|
178
183
|
@apply text-text-300;
|
|
179
184
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="$style.comp" v-if="error" @click="$emit('
|
|
2
|
+
<div :class="$style.comp" v-if="error" @click="$emit('dismiss')">
|
|
3
3
|
<div v-if="error.response && error.response.data && error.response.data.errors">
|
|
4
4
|
<div v-if="typeof error.response.data.errors === 'string'">{{ error.response.data.errors }}</div>
|
|
5
5
|
<div v-else v-for="(text, key) in error.response.data.errors">
|