@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 +1 -1
- package/src/components/Button.vue +2 -0
- package/src/utils/helpers.js +71 -1
- package/src/utils/helpers.mjs +1 -1
- package/src/utils/listview.js +5 -1
package/package.json
CHANGED
package/src/utils/helpers.js
CHANGED
|
@@ -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
|
}
|
package/src/utils/helpers.mjs
CHANGED
package/src/utils/listview.js
CHANGED
|
@@ -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
|
-
|
|
1244
|
+
|
|
1245
|
+
if(order.filter((_) => _[0] === 'id').length === 0){
|
|
1246
|
+
order.push([ 'id', 'desc' ])
|
|
1247
|
+
}
|
|
1244
1248
|
|
|
1245
1249
|
return {
|
|
1246
1250
|
order
|