@mixd-id/web-scaffold 0.1.230406387 → 0.1.230406389

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.230406387",
4
+ "version": "0.1.230406389",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <button :class="compClass" @click="onClick" :style="computedStyle"
3
- v-tooltip="disabledText">
3
+ v-tooltip="disabledText" :disabled="isDisabled">
4
4
  <slot>{{ text }}</slot>
5
5
  <div v-if="isLoading" :class="$style.loadingPane">
6
6
  <svg :class="$style.spinner" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
@@ -976,7 +976,7 @@ export default{
976
976
  if(!this.configParams.sidebar || !('open' in this.configParams.sidebar))
977
977
  this.configParams.sidebar = {
978
978
  open: false,
979
- width: 270
979
+ width: 380
980
980
  }
981
981
 
982
982
  return this.configParams.sidebar
@@ -8,7 +8,13 @@
8
8
  ref="modal"
9
9
  :class="computedClass"
10
10
  :style="computedStyle"
11
- :data-state="computedState ? 1 : 0">
11
+ :data-state="computedState ? 1 : 0"
12
+ @dragover.prevent="dragging = true"
13
+ @dragstart.prevent
14
+ @dragend.prevent
15
+ @dragenter.prevent
16
+ @dragleave.prevent
17
+ @drop.prevent="onDrop">
12
18
  <component v-if="Array.isArray(items) && items.length > 0"
13
19
  v-for="(item, idx) in items"
14
20
  :is="item.type"
@@ -38,6 +44,12 @@
38
44
  </div>
39
45
  <div v-if="isDisabled" :class="$style.overlay"></div>
40
46
  </div>
47
+
48
+ <div :class="$style.dropzone">
49
+ <div class="p-5 bg-text-50 border-text-200 border-[1px] rounded-lg">
50
+ <svg width="48" height="48" class="fill-text-300" 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="M448 416v-64c0-17.67-14.33-32-32-32s-32 14.33-32 32v64c0 17.67-14.33 32-32 32H96c-17.67 0-32-14.33-32-32v-64c0-17.67-14.33-32-32-32s-32 14.33-32 32v64c0 53.02 42.98 96 96 96h256C405 512 448 469 448 416zM246.6 342.6l128-128c12.51-12.51 12.49-32.76 0-45.25c-12.5-12.5-32.75-12.5-45.25 0L256 242.8V32c0-17.69-14.31-32-32-32S192 14.31 192 32v210.8L118.6 169.4c-12.5-12.5-32.75-12.5-45.25 0s-12.5 32.75 0 45.25l128 128C213.9 355.1 234.1 355.1 246.6 342.6z"/></svg>
51
+ </div>
52
+ </div>
41
53
  </div>
42
54
  </Transition>
43
55
  </Teleport>
@@ -70,7 +82,7 @@ export default{
70
82
 
71
83
  mixins: [ componentMixin ],
72
84
 
73
- emits: [ 'submit', 'apply', 'dismiss', 'show', 'hide' ],
85
+ emits: [ 'drop', 'submit', 'apply', 'dismiss', 'show', 'hide' ],
74
86
 
75
87
  props:{
76
88
  class:{ type: String, default: '' },
@@ -171,6 +183,11 @@ export default{
171
183
  }
172
184
  },
173
185
 
186
+ onDrop(e){
187
+ this.dragging = false
188
+ this.$emit('drop', e)
189
+ },
190
+
174
191
  onKeyDown(e){
175
192
  if(this.dismissable && this.$refs.modal && e.keyCode === 27){
176
193
  this.dismiss()
@@ -212,7 +229,8 @@ export default{
212
229
  this.$style['modal-' + (this.dock ?? this.position)],
213
230
  this.class,
214
231
  this.mode === 'v-show' ? this.$style['v-show'] : '',
215
- this.computedState ? this.$style.open : ''
232
+ this.computedState ? this.$style.open : '',
233
+ this.dragging ? this.$style['dragging'] : ''
216
234
  ]
217
235
  .join(' ')
218
236
  .trim()
@@ -261,7 +279,8 @@ export default{
261
279
  return {
262
280
  isDisabled: 0,
263
281
  _state: false,
264
- context: null
282
+ context: null,
283
+ dragging: false,
265
284
  }
266
285
  },
267
286
 
@@ -339,6 +358,16 @@ export default{
339
358
  html[data-theme='dark'] .modal{
340
359
  }
341
360
 
361
+ .dropzone{
362
+ @apply hidden;
363
+ @apply absolute left-0 top-0 right-0 bottom-0;
364
+ @apply bg-black/50;
365
+ @apply items-center justify-center;
366
+ }
367
+ .modal.dragging .dropzone{
368
+ @apply flex;
369
+ }
370
+
342
371
  .modal.v-show{
343
372
  transition: all 200ms cubic-bezier(0.25, 1, 0.5, 1);
344
373
  transform: scale(0);
@@ -168,13 +168,20 @@ export default{
168
168
  methods: {
169
169
 
170
170
  apply(){
171
-
172
- if((!this.valueRequired && this.value.operator) ||
173
- (this.value.operator && this.value.operator !== 'between' && this.value.value) ||
174
- (this.value.operator === 'between' && !!this.value.value && !!this.value.value2)){
175
- this.$emit('change')
171
+ switch(this.type){
172
+
173
+ case 'bool':
174
+ case 'boolean':
175
+ this.$emit('change')
176
+ break
177
+
178
+ default:
179
+ if((!this.valueRequired && this.value.operator) ||
180
+ (this.value.operator && this.value.operator !== 'between' && this.value.value) ||
181
+ (this.value.operator === 'between' && !!this.value.value && !!this.value.value2)){
182
+ this.$emit('change')
183
+ }
176
184
  }
177
-
178
185
  }
179
186
 
180
187
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Modal :state="isOpen" width="320" height="400">
2
+ <Modal :state="isOpen" width="360" height="480">
3
3
  <template v-slot:head>
4
4
  <div class="relative p-5">
5
5
  <h3>{{ $t('Select Column') }}</h3>
@@ -10,15 +10,28 @@
10
10
  </svg>
11
11
  </button>
12
12
  </div>
13
+
14
+ <div class="mt-5">
15
+ <Textbox placeholder="Cari..."
16
+ v-model="search"
17
+ :clearable="true"
18
+ @clear="search = ''">
19
+ <template #start>
20
+ <div class="pl-3">
21
+ <svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"/></svg>
22
+ </div>
23
+ </template>
24
+ </Textbox>
25
+ </div>
13
26
  </div>
14
27
  </template>
15
28
  <template #foot>
16
29
  <div class="pb-6"></div>
17
30
  </template>
18
- <div class="flex-1 px-3">
31
+ <div class="flex-1 px-5">
19
32
 
20
33
  <div class="flex flex-col divide-y divide-text-50 bg-base-400 border-[1px] border-text-50 rounded-lg overflow-hidden">
21
- <button v-for="column in columns"
34
+ <button v-for="column in viewedColumns"
22
35
  type="button" class="p-3 px-5 text-left hover:bg-primary hover:text-white"
23
36
  @click="select(column)">
24
37
  {{ column.label ? column.label : column.key }}
@@ -35,11 +48,22 @@ export default{
35
48
 
36
49
  emits: [ 'select' ],
37
50
 
51
+ computed: {
52
+
53
+ viewedColumns(){
54
+ if(this.search)
55
+ return this.columns.filter(column => column.label.toLowerCase().includes(this.search.toLowerCase()))
56
+ return this.columns
57
+ }
58
+
59
+ },
60
+
38
61
  data(){
39
62
  return {
40
63
  isOpen: false,
41
64
  context: null,
42
- columns: []
65
+ columns: [],
66
+ search: ''
43
67
  }
44
68
  },
45
69
 
@@ -90,8 +90,23 @@
90
90
 
91
91
  <div class="flex-1 overflow-y-auto">
92
92
 
93
- <div v-if="configParams.presetBarTabIndex === 1" class="flex-1 flex flex-col p-5">
94
- <ListItem :items="presetColumns"
93
+ <div v-if="configParams.presetBarTabIndex === 1" class="flex-1 flex flex-col gap-3 p-5">
94
+ <div>
95
+ <Textbox placeholder="Cari..."
96
+ v-model="configParams.columnSearchKey"
97
+ :clearable="true"
98
+ @clear="delete configParams.columnSearchKey">
99
+ <template #start>
100
+ <div class="pl-3">
101
+ <svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"/></svg>
102
+ </div>
103
+ </template>
104
+ </Textbox>
105
+ </div>
106
+
107
+ <ListItem v-if="presetColumns.length > 0"
108
+ :items="presetColumns"
109
+ class="flex-1"
95
110
  body-class="divide-y divide-text-50 rounded-lg border-[1px] border-text-50 bg-base-300"
96
111
  @reorder="(from, to) => { presetColumns.splice(to, 0, presetColumns.splice(from, 1)[0]); }">
97
112
  <template v-slot="{ item }">
@@ -695,6 +710,12 @@ export default{
695
710
  this.preset.columns = JSON.parse(JSON.stringify(this.config.columns))
696
711
  }
697
712
 
713
+ if(this.configParams.columnSearchKey){
714
+ return this.preset.columns.filter(_ => {
715
+ return _.label.toLowerCase().includes(this.configParams.columnSearchKey.toLowerCase()) ||
716
+ _.key.toLowerCase().includes(this.configParams.columnSearchKey.toLowerCase())
717
+ })
718
+ }
698
719
  return this.preset.columns
699
720
  },
700
721
 
@@ -706,7 +727,7 @@ export default{
706
727
  },
707
728
 
708
729
  sortColumns(){
709
- return this.presetColumns.filter(_ => _.key && !_.key.startsWith('_'))
730
+ return this.presetColumns.filter(_ => _.key && !_.key.startsWith('_') && (_.sortable ?? false) !== false)
710
731
  },
711
732
 
712
733
  xAxis(){
@@ -4,7 +4,7 @@
4
4
  <div>
5
5
  <Checkbox v-model="pivot.enabled"
6
6
  @change="apply()">
7
- Pivot Enabled
7
+ Enabled
8
8
  </Checkbox>
9
9
  </div>
10
10
 
@@ -13,7 +13,7 @@
13
13
  <div>
14
14
  <div class="flex flex-row items-center gap-2">
15
15
  <label>Groups</label>
16
- <button type="button" @click="$refs.columnSelector.open(obj => addPivot('rows', obj), columns)">
16
+ <button type="button" @click="$refs.columnSelector.open(obj => addPivot('rows', obj), pivotColumns)">
17
17
  <svg width="16" height="16" class="fill-primary" 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 256C432 269.3 421.3 280 408 280h-160v160c0 13.25-10.75 24.01-24 24.01S200 453.3 200 440v-160h-160c-13.25 0-24-10.74-24-23.99C16 242.8 26.75 232 40 232h160v-160c0-13.25 10.75-23.99 24-23.99S248 58.75 248 72v160h160C421.3 232 432 242.8 432 256z"/></svg>
18
18
  </button>
19
19
  </div>
@@ -147,6 +147,14 @@ export default{
147
147
 
148
148
  emits: [ 'apply' ],
149
149
 
150
+ computed: {
151
+
152
+ pivotColumns(){
153
+ return this.columns.filter(_ => _.filterable === true && (_.pivot ?? true) !== false)
154
+ },
155
+
156
+ },
157
+
150
158
  methods: {
151
159
 
152
160
  apply(){