@mixd-id/web-scaffold 0.1.230406121 → 0.1.230406122

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.230406121",
4
+ "version": "0.1.230406122",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -284,13 +284,15 @@ export default{
284
284
  async load(){
285
285
  if(!this.src) return
286
286
 
287
- this.$refs.table1 ? this.$refs.table1.setState(3) : this.$refs.table2.setState(3)
287
+ this.$refs.table1 ? this.$refs.table1.setState(3) :
288
+ (this.$refs.table2 ? this.$refs.table2.setState(3) : null)
288
289
  this.socketEmit2(this.src, { columns:this.config.columns, preset:this.preset })
289
290
  .then((res) => {
290
291
  Object.assign(this.$data, res)
291
292
  })
292
293
  .finally(() => {
293
- this.$refs.table1 ? this.$refs.table1.setState(1) : this.$refs.table2.setState(1)
294
+ this.$refs.table1 ? this.$refs.table1.setState(1) :
295
+ (this.$refs.table2 ? this.$refs.table2.setState(1) : null)
294
296
  })
295
297
  },
296
298
 
@@ -379,12 +381,12 @@ export default{
379
381
  }
380
382
  })
381
383
  .then(({ items }) => {
382
- this.$util.unshift(this.items, ...items)
384
+ items.forEach(item => this.$util.unshift(this.items, item, { highlight: true }))
383
385
  })
384
386
  .catch((err) => console.error(err))
385
387
  }
386
388
  else{
387
- this.$util.unshift(this.items, ...items)
389
+ items.forEach(item => this.$util.unshift(this.items, item, { highlight: true }))
388
390
  }
389
391
  break
390
392
 
@@ -30,11 +30,12 @@
30
30
  <th :class="$style.spacer"></th>
31
31
  </tr>
32
32
  </thead>
33
- <tbody>
33
+ <tbody ref="tbody">
34
34
  <tr v-for="(item, index) in visibleItems" :key="item"
35
35
  @click="select(item, index)"
36
- :class="[ selectedIndex === ((item && item.id) ? item.id : visibleStartIndex + index) ? $style.trSelected : '', item._highlight ? $style.highlight : '' ].join(' ')">
37
- <td v-for="column in visibleColumns">
36
+ :class="trClass(item)">
37
+ <td v-for="column in visibleColumns"
38
+ :class="tdClass(item, column)">
38
39
  <slot v-if="$slots[column.key]" :name="column.key" :column="column" :item="item" :index="visibleStartIndex + index"></slot>
39
40
  <div v-else :class="columnClass(column)" v-html="formatColumn(item, column)"></div>
40
41
  </td>
@@ -160,8 +161,6 @@ export default{
160
161
  const height = (this.items.length * this.itemHeight) + (this.state === 2 ? 48 : 0)
161
162
  const width = this.visibleColumns.reduce((r, item) => r + parseInt(item.width ?? _DEFAULT_COLUMN_WIDTH), 0)
162
163
 
163
- //console.log('scrollerStyle', { width, height, columns:this.columns })
164
-
165
164
  return {
166
165
  height: height + 'px',
167
166
  width: width + 'px'
@@ -176,7 +175,11 @@ export default{
176
175
 
177
176
  visibleColumns(){
178
177
  return (this.columns ?? []).filter(_ => _.visible)
179
- }
178
+ },
179
+
180
+ visibleColumnKeys(){
181
+ return this.visibleColumns.map(_ => _.key)
182
+ },
180
183
 
181
184
  },
182
185
 
@@ -194,6 +197,22 @@ export default{
194
197
 
195
198
  methods: {
196
199
 
200
+ trClass(item){
201
+ const highlight = !!item._highlight && (!Array.isArray(item._highlight) ||
202
+ this.visibleColumns.filter((_) => item._highlight.includes(_.key)).length <= 0)
203
+
204
+ return [
205
+ this.selectedIndex === ((item && item.id) ? item.id : this.visibleStartIndex + index) ? this.$style.trSelected : '',
206
+ highlight ? this.$style.highlight : ''
207
+ ].join(' ')
208
+ },
209
+
210
+ tdClass(item, column){
211
+ if(Array.isArray(item._highlight) && item._highlight.includes(column.key)){
212
+ return this.$style.highlight
213
+ }
214
+ },
215
+
197
216
  select(item, index){
198
217
  this.selectedIndex = (item && item.id) ? item.id : this.visibleStartIndex + index
199
218
  if(item._highlight){
@@ -462,17 +481,8 @@ export default{
462
481
  @apply bg-primary-200;
463
482
  }
464
483
 
465
- .table tbody tr.highlight{
466
- animation: highlight 1s 1 forwards;
467
- }
468
- @keyframes highlight {
469
- 0% {
470
- @apply bg-transparent;
471
- }
472
-
473
- 100% {
474
- @apply bg-primary-100;
475
- }
484
+ .highlight{
485
+ @apply bg-secondary-200 transition-all;
476
486
  }
477
487
 
478
488
  .tdDiv{
package/src/index.js CHANGED
@@ -181,12 +181,28 @@ const util = {
181
181
  }
182
182
  },
183
183
 
184
- unshift: (arr, item, opt = { key:"id" }) => {
184
+ unshift: (arr, item, opt = {}) => {
185
+ opt = Object.assign({ key:"id", highlight:false }, opt)
186
+
185
187
  const index = arr.findIndex((_) => _[opt.key] === item[opt.key])
186
188
  if(index >= 0){
189
+
190
+ const keys = []
191
+ for(let key in item){
192
+ if(!(key in arr[index]) || arr[index][key] !== item[key]){
193
+ keys.push(key)
194
+ }
195
+ }
196
+
197
+ if(opt.highlight){
198
+ item._highlight = keys
199
+ }
187
200
  Object.assign(arr[index], item)
188
201
  }
189
202
  else{
203
+ if(opt.highlight){
204
+ item._highlight = true
205
+ }
190
206
  arr.unshift(item)
191
207
  }
192
208
  },
@@ -45,7 +45,7 @@ const plugin = Plugin(function({ addBase, config, theme }) {
45
45
  "--secondary": '191, 219, 254',
46
46
  "--secondary-50": '248, 221, 159',
47
47
  "--secondary-100": '246, 214, 139',
48
- "--secondary-200": '245, 207, 120',
48
+ "--secondary-200": '170, 212, 238',
49
49
  "--secondary-300": '243, 200, 101',
50
50
  "--secondary-400": '174, 209, 252',
51
51
  "--secondary-500": '191, 219, 254',
@@ -76,6 +76,8 @@ const plugin = Plugin(function({ addBase, config, theme }) {
76
76
  "--primary-200": '27, 44, 74',
77
77
 
78
78
  "--secondary": '55, 59, 65',
79
+ "--secondary-100": '92, 72, 25',
80
+ "--secondary-200": '21, 74, 107',
79
81
  "--secondary-500": '55, 59, 65',
80
82
  "--secondary-600": '68, 74, 83',
81
83
  },
@@ -1,6 +1,12 @@
1
1
  <template>
2
2
  <div>
3
- <h1>Block Setting</h1>
3
+
4
+ <ComponentSetting :item="item"
5
+ :view-type="viewType"
6
+ :view-types="viewTypes"
7
+ defaultDisplay="flex"
8
+ @change="$emit('change')" />
9
+
4
10
  </div>
5
11
  </template>
6
12
 
@@ -25,7 +31,8 @@ export default{
25
31
 
26
32
  item: Object,
27
33
 
28
- viewTypes: Array
34
+ viewType: String,
35
+ viewTypes: Array,
29
36
 
30
37
  }
31
38
 
@@ -734,6 +734,9 @@ export default{
734
734
  return
735
735
  }*/
736
736
 
737
+ if(!Array.isArray(this.page.ldjson))
738
+ this.page.ldjson = []
739
+
737
740
  'index' in context ?
738
741
  this.page.ldjson[context.index] = context.code :
739
742
  this.page.ldjson.push(context.code);