@mixd-id/web-scaffold 0.1.230406200 → 0.1.230406202

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.230406200",
4
+ "version": "0.1.230406202",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -1,10 +1,15 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
 
4
- <component v-for="(item, idx) in dataItems"
4
+ <component v-for="(item, idx) in computedItems"
5
5
  :is="item.type"
6
6
  :key="item.key"
7
7
  :="item" />
8
+
9
+ <div v-show="hasNext">
10
+ <button type="button" @click="loadNext" class="p-3 w-full text-primary">Load More</button>
11
+ </div>
12
+
8
13
  </div>
9
14
  </template>
10
15
 
@@ -14,36 +19,64 @@ import {componentMixin} from "../mixin/component";
14
19
 
15
20
  export default{
16
21
 
22
+ inject: [ 'pageLoad' ],
23
+
17
24
  mixins: [ componentMixin ],
18
25
 
19
26
  props: {
20
27
 
28
+ data: Object,
21
29
  datasource: Object,
22
30
 
23
31
  items: Array,
24
-
25
32
  },
26
33
 
27
34
  computed: {
28
35
 
36
+ computedData(){
37
+ return (this.pageData ?? {})[(this.datasource ?? {}).key] ?? {}
38
+ },
39
+
29
40
  dataItems(){
41
+ const dataItems = this.computedData.items ?? []
42
+ if(this.editMode === 1 && this.dataItems.length < 1) dataItems.push({})
43
+ return dataItems
44
+ },
45
+
46
+ computedItems(){
30
47
  if(this.items.length < 1) return []
31
48
 
32
49
  const items = []
33
-
34
- const dataItems = ((this.pageData ?? {})[(this.datasource ?? {}).key] ?? {}).items ?? []
35
-
36
50
  const itemJSON = JSON.stringify(this.items[0])
37
51
 
38
- for(let data of dataItems){
52
+ for(let data of this.dataItems){
39
53
  const item = JSON.parse(itemJSON)
40
54
  item.data = data
41
55
  items.push(item)
56
+
57
+ if(this.editMode === 1) break
42
58
  }
43
59
 
44
60
  return items
61
+ },
62
+
63
+ hasNext(){
64
+ return true
45
65
  }
46
66
 
67
+ },
68
+
69
+ methods: {
70
+
71
+ loadNext(){
72
+ if(!this.pageLoad) return
73
+
74
+ this.pageLoad({
75
+ ...this.datasource,
76
+ page: (this.computedData.page ?? 0) + 1
77
+ })
78
+ },
79
+
47
80
  }
48
81
 
49
82
  }
@@ -31,6 +31,7 @@
31
31
  <script>
32
32
 
33
33
  import { componentMixin } from "../mixin/component";
34
+ import { applyDatasourceReplacer } from "../utils/helpers";
34
35
 
35
36
  export default{
36
37
 
@@ -63,10 +64,12 @@ export default{
63
64
  const obj = {}
64
65
 
65
66
  if(this.route.hash)
66
- obj.hash = '#' + this.route.hash
67
+ obj.hash = '#' + (this.editMode === 1 ? this.route.hash :
68
+ applyDatasourceReplacer(this.route.hash, this.data))
67
69
 
68
70
  if(this.route.path)
69
- obj.path = this.route.path
71
+ obj.path = this.editMode === 1 ? this.route.path :
72
+ applyDatasourceReplacer(this.route.path, this.data)
70
73
 
71
74
  return obj
72
75
  }
@@ -419,18 +419,18 @@ export default{
419
419
  case 'create':
420
420
  case 'bulk-create':
421
421
  case 'update':
422
- if(items[0] && Object.keys(items[0]).length <= 1 && Object.keys(items[0])[0] === 'uid'){
422
+ if(items[0] && (items[0].id || items[0].uid)){
423
423
  this.socketEmit2(this.src, {
424
424
  columns:this.config.columns,
425
425
  preset:{
426
426
  ...this.preset,
427
427
  filters: [{
428
428
  enabled: true,
429
- key: "uid",
429
+ key: items[0].uid ? "uid" : "id",
430
430
  filters: [
431
431
  {
432
432
  operator: "in",
433
- value: items.map((_) => _.uid)
433
+ value: items.map((_) => _.uid ?? _.id)
434
434
  }
435
435
  ]
436
436
  }
@@ -1,48 +1,46 @@
1
1
  <template>
2
- <div>
3
- <Teleport to=".bW9k">
4
- <Transition :name="computedTransition"
5
- appear
6
- @after-leave="onAfterLeave(); $emit('hide')"
7
- @after-enter="$emit('show')">
8
- <div v-if="currentState"
9
- ref="modal"
10
- :class="computedClass"
11
- :style="computedStyle"
12
- :data-state="computedState ? 1 : 0">
13
- <component v-if="Array.isArray(items) && items.length > 0"
14
- v-for="(item, idx) in items"
15
- :is="item.type"
16
- :key="item.key"
17
- :="item" />
18
- <form v-else-if="useForm" @submit.prevent="$emit('submit')">
19
- <div class="modal-head">
20
- <slot name="head" :context="context"></slot>
21
- </div>
22
- <div :class="$style.modalBody">
23
- <slot :context="context"></slot>
24
- </div>
25
- <div class="modal-foot">
26
- <slot name="foot" :context="context"></slot>
27
- </div>
28
- <div v-if="isDisabled" :class="$style.overlay"></div>
29
- </form>
30
- <div v-else class="flex-1 min-h-0 flex flex-col relative">
31
- <div class="modal-head">
32
- <slot name="head" :context="context"></slot>
33
- </div>
34
- <div :class="$style.modalBody">
35
- <slot :context="context"></slot>
36
- </div>
37
- <div class="modal-foot">
38
- <slot name="foot" :context="context"></slot>
39
- </div>
40
- <div v-if="isDisabled" :class="$style.overlay"></div>
41
- </div>
2
+ <Teleport to=".bW9k">
3
+ <Transition :name="computedTransition"
4
+ appear
5
+ @after-leave="onAfterLeave(); $emit('hide')"
6
+ @after-enter="$emit('show')">
7
+ <div v-if="currentState"
8
+ ref="modal"
9
+ :class="computedClass"
10
+ :style="computedStyle"
11
+ :data-state="computedState ? 1 : 0">
12
+ <component v-if="Array.isArray(items) && items.length > 0"
13
+ v-for="(item, idx) in items"
14
+ :is="item.type"
15
+ :key="item.key"
16
+ :="item" />
17
+ <form v-else-if="useForm" @submit.prevent="$emit('submit')">
18
+ <div class="modal-head">
19
+ <slot name="head" :context="context"></slot>
20
+ </div>
21
+ <div :class="$style.modalBody">
22
+ <slot :context="context"></slot>
23
+ </div>
24
+ <div class="modal-foot">
25
+ <slot name="foot" :context="context"></slot>
26
+ </div>
27
+ <div v-if="isDisabled" :class="$style.overlay"></div>
28
+ </form>
29
+ <div v-else class="flex-1 min-h-0 flex flex-col relative">
30
+ <div class="modal-head">
31
+ <slot name="head" :context="context"></slot>
32
+ </div>
33
+ <div :class="$style.modalBody">
34
+ <slot :context="context"></slot>
35
+ </div>
36
+ <div class="modal-foot">
37
+ <slot name="foot" :context="context"></slot>
38
+ </div>
39
+ <div v-if="isDisabled" :class="$style.overlay"></div>
42
40
  </div>
43
- </Transition>
44
- </Teleport>
45
- </div>
41
+ </div>
42
+ </Transition>
43
+ </Teleport>
46
44
  </template>
47
45
 
48
46
  <script>
@@ -21,7 +21,7 @@ export default{
21
21
 
22
22
  tagName: {
23
23
  type: String,
24
- default: 'span'
24
+ default: 'div'
25
25
  }
26
26
 
27
27
  },
@@ -29,7 +29,7 @@ export default{
29
29
  computed: {
30
30
 
31
31
  computedText(){
32
- if(this.parentData){
32
+ if(this.parentData && this.editMode !== 1){
33
33
  return applyDatasourceReplacer(this.text, this.parentData)
34
34
  }
35
35
  return this.text
@@ -177,7 +177,6 @@ export const componentMixin = {
177
177
  data(){
178
178
  return {
179
179
  lastStyle: {},
180
- store: null,
181
180
  page: null,
182
181
  }
183
182
  },
@@ -371,6 +371,22 @@
371
371
  </div>
372
372
  </div>
373
373
 
374
+ <div>
375
+ <label class="text-text-400">Line Clamp</label>
376
+ <div v-for="(_, index) in viewTypes"
377
+ v-show="_.value === viewType">
378
+ <Dropdown v-model="lineClamp[index]">
379
+ <option value="">
380
+ {{ emptyComponentText('lineClamp', index) }}
381
+ </option>
382
+ <option v-for="opt in components.lineClamp"
383
+ :value="`${viewType}${opt[1]}`">
384
+ {{ opt[0] }}
385
+ </option>
386
+ </Dropdown>
387
+ </div>
388
+ </div>
389
+
374
390
  <div>
375
391
  <label class="text-text-400">Letter Spacing</label>
376
392
  <div v-for="(_, index) in viewTypes"
@@ -1428,6 +1444,12 @@ export default{
1428
1444
 
1429
1445
  return this.item.props.letterSpacing
1430
1446
  },
1447
+ lineClamp(){
1448
+ if(!Array.isArray(this.item.props.lineClamp))
1449
+ this.item.props.lineClamp = []
1450
+
1451
+ return this.item.props.lineClamp
1452
+ },
1431
1453
  lineHeight(){
1432
1454
  if(!Array.isArray(this.item.props.lineHeight))
1433
1455
  this.item.props.lineHeight = []
@@ -1872,6 +1894,15 @@ export default{
1872
1894
  [ 'Wider', 'tracking-wider' ],
1873
1895
  [ 'Widest', 'tracking-widest' ],
1874
1896
  ],
1897
+ lineClamp: [
1898
+ [ '1', 'line-clamp-1' ],
1899
+ [ '2', 'line-clamp-2' ],
1900
+ [ '3', 'line-clamp-3' ],
1901
+ [ '4', 'line-clamp-4' ],
1902
+ [ '5', 'line-clamp-5' ],
1903
+ [ '6', 'line-clamp-6' ],
1904
+ [ 'None', 'line-clamp-none' ],
1905
+ ],
1875
1906
  lineHeight: [
1876
1907
  [ 'None', 'leading-none' ],
1877
1908
  [ 'Tight', 'leading-tight' ],
@@ -1638,7 +1638,7 @@ export default{
1638
1638
  'zIndex',
1639
1639
 
1640
1640
  'autoFlow', 'alignItems', 'justifyContent',
1641
- 'letterSpacing',
1641
+ 'letterSpacing', 'lineClamp',
1642
1642
 
1643
1643
  'animate',
1644
1644
 
@@ -229,6 +229,9 @@ module.exports = {
229
229
  'underline', 'overline', 'line-through', 'no-underline',
230
230
  'truncate', 'text-ellipsis', 'text-clip',
231
231
 
232
+ 'line-clamp-1', 'line-clamp-2', 'line-clamp-3', 'line-clamp-4', 'line-clamp-5',
233
+ 'line-clamp-6', 'line-clamp-none',
234
+
232
235
  // // //
233
236
 
234
237
  'md:flex-wrap', 'md:flex-wrap-reverse', 'md:flex-nowrap',
@@ -447,6 +450,9 @@ module.exports = {
447
450
  'md:underline', 'md:overline', 'md:line-through', 'md:no-underline',
448
451
  'md:truncate', 'md:text-ellipsis', 'md:text-clip',
449
452
 
453
+ 'md:line-clamp-1', 'md:line-clamp-2', 'md:line-clamp-3', 'md:line-clamp-4', 'md:line-clamp-5',
454
+ 'md:line-clamp-6', 'md:line-clamp-none',
455
+
450
456
  ],
451
457
  theme: {
452
458
  extend: {