@mixd-id/web-scaffold 0.1.230406114 → 0.1.230406116

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.230406114",
4
+ "version": "0.1.230406116",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -99,6 +99,8 @@ export default{
99
99
  },
100
100
 
101
101
  onClick(){
102
+ if('edit-mode' in this.$route.query) return
103
+
102
104
  if(this.target){
103
105
  switch(this.targetType){
104
106
 
@@ -295,6 +295,75 @@ const hexToRgb = (hex) => {
295
295
  } : null;
296
296
  }
297
297
 
298
+ const compClasses = [
299
+ 'aspectRatio',
300
+ 'bdSize', 'bdColor', 'bdRadius', 'bdStyle',
301
+ 'bgColors', 'bgSize', 'bgPosition', 'bgRepeat',
302
+ 'gap',
303
+ 'padding', 'margin',
304
+ 'direction', 'columns', 'display',
305
+ 'width', 'minWidth', 'maxWidth',
306
+ 'height', 'minHeight', 'maxHeight',
307
+ 'fontFamily', 'fontSize', 'fontWeight', 'textColor', 'lineHeight', 'overflow',
308
+ 'boxShadow', 'opacity',
309
+ 'colSpan'
310
+ ]
311
+
312
+ const containerClasses = [
313
+ 'containerVariant', 'containerGridColumn', 'containerGap'
314
+ ]
315
+
316
+ const itemClasses = [
317
+ 'itemMinWidth', 'itemRatio', 'itemVariant'
318
+ ]
319
+
320
+ const createComponentInstance = function(component){
321
+
322
+ if(!component.instance)
323
+ component.instance = {}
324
+
325
+ const compUid = '_' + component.uid.substring(0, 4) + ' '
326
+
327
+ Object.assign(component.instance, {
328
+ type: component.type,
329
+ uid: component.uid,
330
+
331
+ class: compUid + compClasses.map(key => {
332
+ return Array.isArray(component.props[key]) ? component.props[key].join(' ') : ''
333
+ })
334
+ .filter(_ => _)
335
+ .join(' '),
336
+
337
+ containerClass: containerClasses.map(key => {
338
+ return Array.isArray(component.props[key]) ? component.props[key].join(' ') : ''
339
+ })
340
+ .filter(_ => _)
341
+ .join(' '),
342
+
343
+ itemClass: itemClasses.map(key => {
344
+ return Array.isArray(component.props[key]) ? component.props[key].join(' ') : ''
345
+ })
346
+ .filter(_ => _)
347
+ .join(' ')
348
+ })
349
+
350
+ for(let key in component.props){
351
+ if(!compClasses.includes(key) && ![ 'enabled' ].includes(key)){
352
+ component.instance[key] = component.props[key]
353
+ }
354
+ }
355
+
356
+ if(Array.isArray(component.items)){
357
+ component.instance.items = component.items.map((_) => createComponentInstance(_))
358
+ }
359
+
360
+ if(component.props && Array.isArray(component.props.items)){
361
+ component.instance.items = component.props.items
362
+ }
363
+
364
+ return component
365
+ }
366
+
298
367
 
299
368
  module.exports = {
300
369
  ceil,
@@ -316,5 +385,6 @@ module.exports = {
316
385
  unflatten,
317
386
  accessNestedObject,
318
387
  generateStylesheet,
319
- hexToRgb
388
+ hexToRgb,
389
+ createComponentInstance,
320
390
  }
@@ -245,7 +245,7 @@ export {
245
245
  mediaPrefixes,
246
246
  _applyClass,
247
247
  copyToClipboard,
248
- getComponentUids
248
+ getComponentUids,
249
249
  }
250
250
 
251
251
  function observeInit(){
@@ -230,6 +230,7 @@ let ListView = {
230
230
  }*/
231
231
 
232
232
  const { afterItem, itemsPerPage = this.itemsPerPage ?? 24 } = params
233
+
233
234
  const { preset = {} } = params
234
235
  let where = {}
235
236
  let replacements = []
@@ -1240,7 +1241,10 @@ let ListView = {
1240
1241
  order.push([ key, type ])
1241
1242
  }
1242
1243
  })
1243
- order.push([ 'id', 'desc' ])
1244
+
1245
+ if(order.filter((_) => _[0] === 'id').length === 0){
1246
+ order.push([ 'id', 'desc' ])
1247
+ }
1244
1248
 
1245
1249
  return {
1246
1250
  order