@mixd-id/web-scaffold 0.1.230406067 → 0.1.230406069

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.230406067",
4
+ "version": "0.1.230406069",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -26,6 +26,8 @@
26
26
 
27
27
  export default{
28
28
 
29
+ emits: [ 'change', 'update:modelValue' ],
30
+
29
31
  props: {
30
32
 
31
33
  colors: Array,
@@ -40,6 +42,7 @@ export default{
40
42
 
41
43
  select(color){
42
44
  this.$emit('update:modelValue', color)
45
+ this.$emit('change')
43
46
  this.$refs.contextMenu.close()
44
47
  }
45
48
 
@@ -7,20 +7,13 @@
7
7
  @moveup="moveUp(item)"
8
8
  @movedown="moveDown(item)"
9
9
  @change="$emit('change')"
10
- @remove="modelValue.splice(index, 1);$emit('change')"
10
+ @remove="confirm($t('Remove this item?'), { onConfirm: () => { modelValue.splice(index, 1);$emit('change') }})"
11
11
  @add="(items) => $emit('add', items)">
12
12
  <template #default="{ item }">
13
13
  <slot :item="item"></slot>
14
14
  </template>
15
15
  </TreeViewItem>
16
16
 
17
- <div class="flex flex-row items-center justify-center">
18
- <button type="button" class="p-3 text-primary flex flex-row gap-1 items-center" @click="add">
19
- <svg width="14" height="14" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
20
- Add
21
- </button>
22
- </div>
23
-
24
17
  </div>
25
18
  </template>
26
19
 
@@ -34,6 +27,8 @@ export default{
34
27
 
35
28
  emits: [ 'add', 'change' ],
36
29
 
30
+ inject: [ 'confirm' ],
31
+
37
32
  props: {
38
33
 
39
34
  modelValue: Array
@@ -3,7 +3,7 @@
3
3
  <div ref="item" :class="$style.item"
4
4
  @mouseover="hoverMouseOver" @mouseout="hoverMouseOut">
5
5
  <div class="cursor-move" ref="drag" @mousedown="mouseDown">
6
- <svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"/></svg>
6
+ <svg width="14" height="14" class="fill-text-100" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
7
7
  </div>
8
8
  <div class="flex flex-col hidden">
9
9
  <button type="button" @click="$emit('moveup')">
@@ -29,7 +29,7 @@
29
29
  :parent="item.items"
30
30
  @moveup="moveUp(subItem)"
31
31
  @movedown="moveDown(subItem)"
32
- @remove="item.items.splice(index, 1);$emit('change')"
32
+ @remove="confirm($t('Remove this item?'), { onConfirm: () => { item.items.splice(index, 1);$emit('change') }})"
33
33
  @add="(items) => $emit('add', items)"
34
34
  @change="$emit('change')">
35
35
  <template #default="{ item }">
@@ -55,6 +55,8 @@ export default{
55
55
 
56
56
  emits: [ 'add', 'change', 'moveup', 'movedown', 'remove' ],
57
57
 
58
+ inject: [ 'confirm' ],
59
+
58
60
  props: {
59
61
  item: Object,
60
62
 
package/src/index.js CHANGED
@@ -143,6 +143,10 @@ const unregisterResizeEvent = (fn) => {
143
143
  }
144
144
  }
145
145
 
146
+ const consoleInfo = (text) => { console.info(text) }
147
+ const consoleLog = (text) => { console.log(text) }
148
+ const consoleWarn = (text) => { console.warn(text) }
149
+
146
150
  const util = {
147
151
 
148
152
  push: (arr, item, opt = { key:"id" }) => {
@@ -239,6 +243,9 @@ export default{
239
243
  app.config.globalProperties.$util = util
240
244
  app.config.globalProperties.$resize = registerResizeEvent
241
245
  app.config.globalProperties.$unresize = unregisterResizeEvent
246
+ app.config.globalProperties.log = consoleLog
247
+ app.config.globalProperties.warn = consoleWarn
248
+ app.config.globalProperties.info = consoleInfo
242
249
 
243
250
  app.component('Alert', defineAsyncComponent(() => import("./components/Alert.vue")))
244
251
  app.component('Button', defineAsyncComponent(() => import("./components/Button.vue")))
@@ -274,6 +274,27 @@ const accessNestedObject = function(obj, path) {
274
274
  return nestedObj;
275
275
  }
276
276
 
277
+ const cssDict = {
278
+ 'Global': '*',
279
+ 'Font': 'font-family',
280
+ 'Impact': "'Impact', 'Arial Black', 'Arial Bold', Gadget, sans-serif",
281
+ }
282
+
283
+ const generateStylesheet = (styleObj) => {
284
+
285
+ return `*{ font-family: Impact; }`
286
+
287
+ }
288
+
289
+ const hexToRgb = (hex) => {
290
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
291
+ return result ? {
292
+ r: parseInt(result[1], 16),
293
+ g: parseInt(result[2], 16),
294
+ b: parseInt(result[3], 16)
295
+ } : null;
296
+ }
297
+
277
298
 
278
299
  module.exports = {
279
300
  ceil,
@@ -293,5 +314,7 @@ module.exports = {
293
314
  sequelizeChunk,
294
315
  getPresetSortWhereParams,
295
316
  unflatten,
296
- accessNestedObject
317
+ accessNestedObject,
318
+ generateStylesheet,
319
+ hexToRgb
297
320
  }