@mixd-id/web-scaffold 0.1.2301231362 → 0.1.2301231364

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.2301231362",
4
+ "version": "0.1.2301231364",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -188,8 +188,15 @@ export default {
188
188
  transformOrigin = 'bottom right'
189
189
  }
190
190
  }
191
+
192
+ if(top < 0){
193
+ top = 0
194
+ }
191
195
  }
192
196
 
197
+ maxHeight = this.$refs.contextMenu.clientHeight > window.innerHeight * .8 ?
198
+ Math.round(window.innerHeight * .8) : this.$refs.contextMenu.clientHeight + 24
199
+
193
200
  this.computedStyle = {
194
201
  left: left ? left + 'px' : left,
195
202
  right: right ? right + 'px' : right,
@@ -199,8 +206,6 @@ export default {
199
206
  transformOrigin: transformOrigin
200
207
  }
201
208
 
202
- console.log('width', this.computedStyle)
203
-
204
209
  this.onOpen()
205
210
  })
206
211
 
@@ -220,6 +225,7 @@ export default {
220
225
  window.removeEventListener('scroll', this.onDismiss)
221
226
  if(this.$refs.contextMenu){
222
227
  this.$refs.contextMenu.removeEventListener('transitionend', transitionEnd)
228
+ this.computedStyle = {}
223
229
  }
224
230
  this.computedStyle = null
225
231
  this.isOpen = false
@@ -248,16 +248,21 @@
248
248
 
249
249
  <div class="flex flex-col gap-3 py-8" v-else-if="layout.presetTab === 'summary'">
250
250
 
251
- <div class="flex flex-row items-center p-3">
251
+ <div class="flex flex-row items-center p-3 py-1">
252
252
  <label class="text-text-400 flex-1">Enabled</label>
253
253
  <Checkbox v-model="preset.summary.enabled" @change="load"/>
254
254
  </div>
255
255
 
256
- <div class="flex flex-row items-center p-3">
256
+ <div class="flex flex-row items-center p-3 py-1">
257
257
  <label class="text-text-400 flex-1">Hide Details</label>
258
258
  <Checkbox v-model="preset.summary.hideDetails" @change="load"/>
259
259
  </div>
260
260
 
261
+ <div class="flex flex-row items-center p-3 py-1">
262
+ <label class="text-text-400 flex-1">Hide Legend</label>
263
+ <Checkbox v-model="preset.summary.hideLegends" @change="load"/>
264
+ </div>
265
+
261
266
  <div class="p-3">
262
267
  <label class="text-text-400 flex-1">Type</label>
263
268
  <div class="mt-2">
@@ -453,7 +458,29 @@ export default{
453
458
  responsive: true,
454
459
  maintainAspectRatio: false,
455
460
  plugins: {
456
- legend: true
461
+ legend: !this.preset.summary.hideLegends,
462
+ tooltip: {
463
+ callbacks: {
464
+ label: function(context) {
465
+
466
+ const labels = []
467
+
468
+ labels.push(context.dataset.label + ': ' + context.parsed.y)
469
+
470
+ let total = 0
471
+ let percent = 0
472
+ for(let key in context.parsed._stacks.y){
473
+ if(!isNaN(parseInt(key))){
474
+ total += parseInt(context.parsed._stacks.y[key])
475
+ }
476
+ }
477
+ percent = Math.round(parseInt(context.parsed.y) / total * 100)
478
+ labels.push(`Total: ${total} (${percent}%)`)
479
+
480
+ return labels;
481
+ }
482
+ }
483
+ }
457
484
  },
458
485
  scales: {
459
486
  x: {
@@ -344,6 +344,11 @@ export default{
344
344
  const num = parseInt(value)
345
345
  text = !isNaN(num) ? num.toLocaleString() : ''
346
346
  break
347
+
348
+ case 'enum':
349
+ const enumObj = column.typeParams.filter((_) => _.value === value).pop()
350
+ text = enumObj ? enumObj.text : value
351
+ break
347
352
  }
348
353
 
349
354
  return text
@@ -2,7 +2,6 @@ const md5 = require("md5");
2
2
  const fs = require("fs");
3
3
 
4
4
 
5
-
6
5
  const ceil = (num, precision = 0) => {
7
6
  var p = Math.pow(10, precision)
8
7
  var n = (num * p) * (1 + Number.EPSILON)
@@ -159,6 +158,14 @@ const writeStorage = (path, content, append = false) => {
159
158
  }
160
159
  }
161
160
 
161
+ const bufferToStream = (buffer) => {
162
+ const { Duplex } = require('stream')
163
+ let stream = new Duplex()
164
+ stream.push(buffer)
165
+ stream.push(null)
166
+ return stream
167
+ }
168
+
162
169
 
163
170
  module.exports = {
164
171
  ceil,
@@ -173,5 +180,6 @@ module.exports = {
173
180
  sleep,
174
181
  strSlug,
175
182
  strVars,
176
- writeStorage
183
+ writeStorage,
184
+ bufferToStream
177
185
  }