@mixd-id/web-scaffold 0.1.230406293 → 0.1.230406295

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.230406293",
4
+ "version": "0.1.230406295",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -124,26 +124,28 @@
124
124
  <svg class="animate-spin" width="36" height="36" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
125
125
  </div>
126
126
 
127
- <VirtualTable v-else-if="presetView === 'table' || pivotEnabled"
128
- ref="table"
129
- :columns="columns"
130
- class="flex-1 rounded-lg panel-400"
131
- :items="data.items"
132
- :enumCache="enumCache"
133
- @scroll-end="loadNext"
134
- @item-click="onTableItemClick">
127
+ <div v-else-if="presetView === 'table' || pivotEnabled" class="flex-1 flex" :class="pivotEnabled ? 'p-3 panel-400 md:p-0' : ''">
128
+ <VirtualTable
129
+ ref="table"
130
+ :columns="columns"
131
+ class="flex-1 rounded-lg panel-400"
132
+ :items="data.items"
133
+ :enumCache="enumCache"
134
+ @scroll-end="loadNext"
135
+ @item-click="onTableItemClick">
136
+
137
+ <template v-for="(_, slot) in headerSlots" #[slot]="{ item, index }">
138
+ <div :class="getHeader(slot.replace('col-', ''))">
139
+ <slot :name="slot" :item="item" :index="index"></slot>
140
+ </div>
141
+ </template>
135
142
 
136
- <template v-for="(_, slot) in headerSlots" #[slot]="{ item, index }">
137
- <div :class="getHeader(slot.replace('col-', ''))">
143
+ <template v-for="(_, slot) in contentSlots" #[slot]="{ item, index }">
138
144
  <slot :name="slot" :item="item" :index="index"></slot>
139
- </div>
140
- </template>
145
+ </template>
141
146
 
142
- <template v-for="(_, slot) in contentSlots" #[slot]="{ item, index }">
143
- <slot :name="slot" :item="item" :index="index"></slot>
144
- </template>
145
-
146
- </VirtualTable>
147
+ </VirtualTable>
148
+ </div>
147
149
 
148
150
  <VirtualGrid v-else-if="presetView === 'grid'"
149
151
  ref="grid"
@@ -154,7 +156,7 @@
154
156
  :container-class="`${gridContainerClass}`"
155
157
  :config="config">
156
158
  <template #item="{ item }">
157
- <slot name="gridItem" :item="item" :enumCache="enumCache">
159
+ <slot name="gridItem" :item="item" :enumCache="enumCache" :getEnumText="getEnumText">
158
160
  <div class="flex flex-row panel-400 rounded-lg overflow-hidden md:rounded-lg overflow-hidden p-3 gap-3">
159
161
  <div>
160
162
  <Image :src="item.imageUrl" class="bg-text-50 w-[64px] h-[64px] rounded-lg" />
@@ -174,17 +176,6 @@
174
176
  <div v-if="extBar.open && pivotEnabled"
175
177
  :style="extStyle" class="border-t-[1px] border-text-50 flex flex-col relative md:p-5">
176
178
 
177
- <div :class="$style.resize2" class="group"
178
- @mousedown="(e) => $util.dragResize(e, resize2)">
179
- <button type="button" @click.prevent="extBar.open = false"
180
- :class="$style.extClose" class="group-hover:bg-primary">
181
- <svg width="14"
182
- height="14"
183
- class="fill-text-300 group-hover:fill-white cursor-pointer"
184
- xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432.6 209.3l-191.1 183.1C235.1 397.8 229.1 400 224 400s-11.97-2.219-16.59-6.688L15.41 209.3C5.814 200.2 5.502 184.1 14.69 175.4c9.125-9.625 24.38-9.938 33.91-.7187L224 342.8l175.4-168c9.5-9.219 24.78-8.906 33.91 .7187C442.5 184.1 442.2 200.2 432.6 209.3z"/></svg>
185
- </button>
186
- </div>
187
-
188
179
  <div v-if="readyState === 3" class="flex-1 flex items-center justify-center">
189
180
  <svg class="animate-spin" width="36" height="36" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
190
181
  </div>
@@ -218,7 +209,7 @@
218
209
  :container-class="`${gridContainerClass}`"
219
210
  :config="config">
220
211
  <template #item="{ item }">
221
- <slot name="gridItem" :item="item">
212
+ <slot name="gridItem" :item="item" :getEnumText="getEnumText">
222
213
  <div class="flex flex-row panel-400 rounded-lg overflow-hidden md:rounded-lg overflow-hidden p-3 gap-3">
223
214
  <div>
224
215
  <Image :src="item.imageUrl" class="bg-text-50 w-[64px] h-[64px] rounded-lg" />
@@ -232,6 +223,17 @@
232
223
  </template>
233
224
  </VirtualGrid>
234
225
 
226
+ <div :class="$style.resize2" class="group"
227
+ @mousedown="(e) => $util.dragResize(e, resize2)">
228
+ <button type="button" @click.prevent="extBar.open = false"
229
+ :class="$style.extClose" class="group-hover:bg-primary">
230
+ <svg width="14"
231
+ height="14"
232
+ class="fill-text-300 group-hover:fill-white cursor-pointer"
233
+ xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432.6 209.3l-191.1 183.1C235.1 397.8 229.1 400 224 400s-11.97-2.219-16.59-6.688L15.41 209.3C5.814 200.2 5.502 184.1 14.69 175.4c9.125-9.625 24.38-9.938 33.91-.7187L224 342.8l175.4-168c9.5-9.219 24.78-8.906 33.91 .7187C442.5 184.1 442.2 200.2 432.6 209.3z"/></svg>
234
+ </button>
235
+ </div>
236
+
235
237
  </div>
236
238
 
237
239
  </div>
@@ -298,6 +300,24 @@ export default{
298
300
 
299
301
  methods: {
300
302
 
303
+ getEnumText(key, value){
304
+
305
+ let enumText
306
+
307
+ const column = this.config.columns.find(_ => _.key === key)
308
+
309
+ if(Array.isArray(column.typeParams)){
310
+ const typeParam = (column.typeParams ?? []).filter((_) => _.value === value).pop()
311
+ enumText = typeParam && typeParam.text ? typeParam.text : enumText
312
+ }
313
+
314
+ if(this.enumCache && this.enumCache[column.key] && this.enumCache[column.key][value]){
315
+ enumText = this.enumCache[column.key][value].text ?? enumText
316
+ }
317
+
318
+ return enumText ? enumText : value
319
+ },
320
+
301
321
  getHeader(column){
302
322
 
303
323
  return [
@@ -836,6 +856,12 @@ export default{
836
856
  }
837
857
  },
838
858
 
859
+ provide(){
860
+ return {
861
+ listStyle: this.$style
862
+ }
863
+ },
864
+
839
865
  watch: {
840
866
 
841
867
  config: {
@@ -865,4 +891,221 @@ export default{
865
891
  @apply w-[21px] h-[21px] rounded-full bg-text-50 flex items-center justify-center hover:bg-red-600;
866
892
  }
867
893
 
894
+ .pv-green1, .pv-green2, .pv-green3, .pv-green4, .pv-green5{
895
+ @apply rounded-lg text-center text-text cursor-pointer;
896
+ }
897
+ .pv-green1{
898
+ background-color: #d3f3df;
899
+ }
900
+ .pv-green2{
901
+ background-color: #bdeecf;
902
+ }
903
+ .pv-green3{
904
+ background-color: #a7e8bf;
905
+ }
906
+ .pv-green4{
907
+ background-color: #91e2af;
908
+ }
909
+ .pv-green5{
910
+ background-color: #7adc9e;
911
+ }
912
+ html[data-theme="dark"] .pv-green1{
913
+ @apply text-text;
914
+ background-color: #031409;
915
+ }
916
+ html[data-theme="dark"] .pv-green2{
917
+ @apply text-text;
918
+ background-color: #072713;
919
+ }
920
+ html[data-theme="dark"] .pv-green3{
921
+ @apply text-text;
922
+ background-color: #0a3b1c;
923
+ }
924
+ html[data-theme="dark"] .pv-green4{
925
+ @apply text-text;
926
+ background-color: #0e4f26;
927
+ }
928
+ html[data-theme="dark"] .pv-green5{
929
+ @apply text-text;
930
+ background-color: #11632f;
931
+ }
932
+
933
+ .pv-red1, .pv-red2, .pv-red3, .pv-red4, .pv-red5{
934
+ @apply rounded-lg text-center text-text cursor-pointer;
935
+ }
936
+ .pv-red1{
937
+ background-color: #fce9e9;
938
+ }
939
+ .pv-red2{
940
+ background-color: #f8d4d4;
941
+ }
942
+ .pv-red3{
943
+ background-color: #f5bebe;
944
+ }
945
+ .pv-red4{
946
+ background-color: #f1a8a8;
947
+ }
948
+ .pv-red5{
949
+ background-color: #ee9393;
950
+ }
951
+ html[data-theme="dark"] .pv-red1{
952
+ @apply text-text;
953
+ background-color: #160404;
954
+ }
955
+ html[data-theme="dark"] .pv-red2{
956
+ @apply text-text;
957
+ background-color: #2c0808;
958
+ }
959
+ html[data-theme="dark"] .pv-red3{
960
+ @apply text-text;
961
+ background-color: #420b0b;
962
+ }
963
+ html[data-theme="dark"] .pv-red4{
964
+ @apply text-text;
965
+ background-color: #580f0f;
966
+ }
967
+ html[data-theme="dark"] .pv-red5{
968
+ @apply text-text;
969
+ background-color: #6e1313;
970
+ }
971
+
972
+ .pv-blue1, .pv-blue2, .pv-blue3, .pv-blue4, .pv-blue5{
973
+ @apply rounded-lg text-center text-text cursor-pointer;
974
+ }
975
+ .pv-blue1{
976
+ background-color: #e9effd;
977
+ }
978
+ .pv-blue2{
979
+ background-color: #d3e0fb;
980
+ }
981
+ .pv-blue3{
982
+ background-color: #bed0f9;
983
+ }
984
+ .pv-blue4{
985
+ background-color: #a8c1f7;
986
+ }
987
+ .pv-blue5{
988
+ background-color: #92b1f5;
989
+ }
990
+ html[data-theme="dark"] .pv-blue1{
991
+ @apply text-text;
992
+ background-color: #040a17;
993
+ }
994
+ html[data-theme="dark"] .pv-blue2{
995
+ @apply text-text;
996
+ background-color: #07142f;
997
+ }
998
+ html[data-theme="dark"] .pv-blue3{
999
+ @apply text-text;
1000
+ background-color: #0b1e46;
1001
+ }
1002
+ html[data-theme="dark"] .pv-blue4{
1003
+ @apply text-text;
1004
+ background-color: #0f285e;
1005
+ }
1006
+ html[data-theme="dark"] .pv-blue5{
1007
+ @apply text-text;
1008
+ background-color: #133276;
1009
+ }
1010
+
1011
+ .pv-yellow1, .pv-yellow2, .pv-yellow3, .pv-yellow4, .pv-yellow5{
1012
+ @apply rounded-lg text-center text-text cursor-pointer;
1013
+ }
1014
+ .pv-yellow1{
1015
+ background-color: #fdf7e6;
1016
+ }
1017
+ .pv-yellow2{
1018
+ background-color: #fbf0ce;
1019
+ }
1020
+ .pv-yellow3{
1021
+ background-color: #f9e8b5;
1022
+ }
1023
+ .pv-yellow4{
1024
+ background-color: #f7e19c;
1025
+ }
1026
+ .pv-yellow5{
1027
+ background-color: #f5d984;
1028
+ }
1029
+ html[data-theme="dark"] .pv-yellow1{
1030
+ @apply text-text;
1031
+ background-color: #171201;
1032
+ }
1033
+ html[data-theme="dark"] .pv-yellow2{
1034
+ @apply text-text;
1035
+ background-color: #2f2402;
1036
+ }
1037
+ html[data-theme="dark"] .pv-yellow3{
1038
+ @apply text-text;
1039
+ background-color: #463602;
1040
+ }
1041
+ html[data-theme="dark"] .pv-yellow4{
1042
+ @apply text-text;
1043
+ background-color: #5e4803;
1044
+ }
1045
+ html[data-theme="dark"] .pv-yellow5{
1046
+ @apply text-text;
1047
+ background-color: #755a04;
1048
+ }
1049
+
1050
+ .pv-fuchsia1, .pv-fuchsia2, .pv-fuchsia3, .pv-fuchsia4, .pv-fuchsia5{
1051
+ @apply rounded-lg text-center text-text cursor-pointer;
1052
+ }
1053
+ .pv-fuchsia1{
1054
+ background-color: #f6e8f7;
1055
+ }
1056
+ .pv-fuchsia2{
1057
+ background-color: #edd2ef;
1058
+ }
1059
+ .pv-fuchsia3{
1060
+ background-color: #e3bbe7;
1061
+ }
1062
+ .pv-fuchsia4{
1063
+ background-color: #daa4df;
1064
+ }
1065
+ .pv-fuchsia5{
1066
+ background-color: #d18ed7;
1067
+ }
1068
+ html[data-theme="dark"] .pv-fuchsia1{
1069
+ @apply text-text;
1070
+ background-color: #100311;
1071
+ }
1072
+ html[data-theme="dark"] .pv-fuchsia2{
1073
+ @apply text-text;
1074
+ background-color: #210623;
1075
+ }
1076
+ html[data-theme="dark"] .pv-fuchsia3{
1077
+ @apply text-text;
1078
+ background-color: #310834;
1079
+ }
1080
+ html[data-theme="dark"] .pv-fuchsia4{
1081
+ @apply text-text;
1082
+ background-color: #410b46;
1083
+ }
1084
+ html[data-theme="dark"] .pv-fuchsia5{
1085
+ @apply text-text;
1086
+ background-color: #520e58;
1087
+ }
1088
+
1089
+ .pv-gradient1, .pv-gradient2, .pv-gradient3, .pv-gradient4, .pv-gradient5, .pv-default{
1090
+ @apply rounded-lg text-center text-text cursor-pointer;
1091
+ }
1092
+ .pv-gradient1{
1093
+ @apply bg-gradient-to-r from-cyan-500 to-blue-500;
1094
+ }
1095
+ .pv-gradient2{
1096
+ @apply bg-gradient-to-r from-sky-500 to-indigo-500;
1097
+ }
1098
+ .pv-gradient3{
1099
+ @apply bg-gradient-to-r from-violet-500 to-fuchsia-500;
1100
+ }
1101
+ .pv-gradient4{
1102
+ @apply bg-gradient-to-r from-purple-500 to-pink-500;
1103
+ }
1104
+ .pv-gradient5{
1105
+ @apply bg-gradient-to-r from-pink-500 to-teal-500;
1106
+ }
1107
+ .pv-default{
1108
+ @apply text-primary;
1109
+ }
1110
+
868
1111
  </style>
@@ -47,9 +47,9 @@ export default{
47
47
  default: ''
48
48
  },
49
49
 
50
- modelValue: [ String, Number ],
50
+ modelValue: undefined,
51
51
 
52
- value: String,
52
+ value: undefined,
53
53
 
54
54
  placeholder: String,
55
55
  readonly: undefined,
@@ -88,6 +88,8 @@ const _DEFAULT_COLUMN_WIDTH = '100px'
88
88
 
89
89
  export default{
90
90
 
91
+ inject: [ 'listStyle' ],
92
+
91
93
  emits: [ 'scroll-end', 'item-click' ],
92
94
 
93
95
  props:{
@@ -251,7 +253,7 @@ export default{
251
253
  const elHeight = parseInt(window.getComputedStyle(this.$el).height !== '0px' ?
252
254
  window.getComputedStyle(this.$el).height :
253
255
  window.getComputedStyle(this.$el).maxHeight)
254
- this.itemHeight = parseInt(window.getComputedStyle(this.$refs.calc).height)
256
+ this.itemHeight = Math.ceil(parseFloat(window.getComputedStyle(this.$refs.calc).height))
255
257
  this.maxVisibleItems = elHeight > 0 ? Math.ceil(elHeight / this.itemHeight) + 1 : this.items.length
256
258
 
257
259
  if(this.itemHeight <= 0 && import.meta.env.DEV){
@@ -433,8 +435,6 @@ export default{
433
435
  if(conditionMatched) break
434
436
  }
435
437
 
436
- console.log('value', value, conditionMatched)
437
-
438
438
  if(conditionMatched){
439
439
  appearanceClass = appearance.class
440
440
  break
@@ -445,7 +445,7 @@ export default{
445
445
  return [
446
446
  this.$style.tdDiv,
447
447
  this.$style['align-' + align],
448
- appearanceClass
448
+ this.listStyle ? this.listStyle[appearanceClass] : ''
449
449
  ]
450
450
  .join(' ')
451
451
  },
@@ -45,23 +45,44 @@
45
45
  <Textbox v-if="condition.operator !== 'none'" v-model.numberconditions="condition.value" class="w-[100px]"/>
46
46
  </div>
47
47
  </div>
48
- <div :class="item.class" class="px-2">
48
+ <div :class="listStyle[item.class]" class="px-2">
49
49
  Sample
50
50
  </div>
51
51
  <div>
52
52
  <Dropdown class="w-[120px]" v-model="item.class">
53
- <option value="text-primary cursor-pointer">Default</option>
54
- <option value="bg-red-100 text-red-600">Red 1</option>
55
- <option value="bg-red-200 text-red-600">Red 2</option>
56
- <option value="bg-red-300 text-red-600">Red 3</option>
57
- <option value="bg-red-400 text-white">Red 4</option>
58
- <option value="bg-red-500 text-white">Red 5</option>
59
- <option value="bg-green-100 text-green-700">Green 1</option>
60
- <option value="bg-green-200 text-green-700">Green 2</option>
61
- <option value="bg-green-300 text-green-700">Green 3</option>
62
- <option value="bg-green-400 text-white">Green 4</option>
63
- <option value="bg-green-500 border-[1px] border-green-600 text-white">Green 5</option>
64
- <option value="text-primary underline cursor-pointer">Underline</option>
53
+ <option value="pv-default">Default</option>
54
+ <option value="pv-red1">Red 1</option>
55
+ <option value="pv-red2">Red 2</option>
56
+ <option value="pv-red3">Red 3</option>
57
+ <option value="pv-red4">Red 4</option>
58
+ <option value="pv-red5">Red 5</option>
59
+ <option value="pv-green1">Green 1</option>
60
+ <option value="pv-green2">Green 2</option>
61
+ <option value="pv-green3">Green 3</option>
62
+ <option value="pv-green4">Green 4</option>
63
+ <option value="pv-green5">Green 5</option>
64
+ <option value="pv-blue5">Blue 5</option>
65
+ <option value="pv-blue1">Blue 1</option>
66
+ <option value="pv-blue2">Blue 2</option>
67
+ <option value="pv-blue3">Blue 3</option>
68
+ <option value="pv-blue4">Blue 4</option>
69
+ <option value="pv-blue5">Blue 5</option>
70
+ <option value="pv-yellow5">Yellow 5</option>
71
+ <option value="pv-yellow1">Yellow 1</option>
72
+ <option value="pv-yellow2">Yellow 2</option>
73
+ <option value="pv-yellow3">Yellow 3</option>
74
+ <option value="pv-yellow4">Yellow 4</option>
75
+ <option value="pv-yellow5">Yellow 5</option>
76
+ <option value="pv-fuchsia1">Fuchsia 1</option>
77
+ <option value="pv-fuchsia2">Fuchsia 2</option>
78
+ <option value="pv-fuchsia3">Fuchsia 3</option>
79
+ <option value="pv-fuchsia4">Fuchsia 4</option>
80
+ <option value="pv-fuchsia5">Fuchsia 5</option>
81
+ <option value="pv-gradient1">Gradient 1</option>
82
+ <option value="pv-gradient2">Gradient 2</option>
83
+ <option value="pv-gradient3">Gradient 3</option>
84
+ <option value="pv-gradient4">Gradient 4</option>
85
+ <option value="pv-gradient5">Gradient 5</option>
65
86
  </Dropdown>
66
87
  </div>
67
88
  <div>
@@ -83,7 +104,7 @@ export default{
83
104
 
84
105
  emits: [ 'apply' ],
85
106
 
86
- inject: [ 'socketEmit2' ],
107
+ inject: [ 'listStyle', 'socketEmit2' ],
87
108
 
88
109
  props: {
89
110