How can i set vertical text on q-table header quasar? - vue-component

I'm trying to parse some excel sheets for my web project and in this q-table I need to set two columns with vertical text just like this example but when I try to rotate it changes all columns.

First, assign unique names for header cells. For example:
{
name: 'first',
align: 'center',
label: 'First col header',
field: row => row.value
},
{
name: 'second',
align: 'center',
label: 'Second col header',
field: row => row.value
},
{
name: 'third',
align: 'center',
label: 'Third col header',
field: row => row.value
},
{
name: 'fourth',
align: 'center',
label: 'Fourth col header',
field: row => row.value
},
]
Then. leverage the header-cell-[name] slot to target the headers by their names, and add CSS class .text-vertical to headers that need to be vertical.
Like this:
<q-table
:rows="rows"
:columns="columns"
row-key="name"
>
<template v-slot:header-cell-second="props">
<q-th :props="props">
<span class="text-vertical">
{{ props.col.label }}
</span>
</q-th>
</template>
<template v-slot:header-cell-third="props">
<q-th :props="props">
<span class="text-vertical">
{{ props.col.label }}
</span>
</q-th>
</template>
</q-table>
CSS:
.text-vertical{
writing-mode: vertical-rl;
transform: rotate(-180deg)
}
You could give a look to my implementation in codepen:
https://codepen.io/hoangdng-the-sans/pen/xxjNxgv

Related

Increase the height of Dropdown menu when using mat-expansion-panel

I have ng-select wrapped inside mat-expansion-panel. I would like to be able to increase the height of the dropdown list to go beyond the height of mat-expansion-panel but I cannot get that effect. I have tried to play around with z-index but still not working.
Stackblitz Example here for list of countries
My code:
HTML
<mat-accordion>
<mat-expansion-panel class="shadow">
<mat-expansion-panel-header>
<mat-panel-title>
<b>Location</b>
</mat-panel-title>
</mat-expansion-panel-header>
<div class="location">
Country
<ng-select class="m-t-10" [(ngModel)]="selectedCountry">
<ng-option *ngFor="let country of countries" value="country.value">
<div class="famfamfam-flags {{country?.value.toLowerCase()}}"></div>
{{country?.label}}
</ng-option>
</ng-select>
</div>
<mat-divider></mat-divider>
<div class="location">
Province
<ng-select class="m-t-10" [(ngModel)]="selectedProvince">
<ng-option *ngFor="let province of provinces" value="country.value">
{{province?.label}}
</ng-option>
</ng-select>
</div>
<mat-divider></mat-divider>
<div class="location">
District
<ng-select class="m-t-10" [(ngModel)]="selectedDistrict">
<ng-option *ngFor="let district of districts" value="district.value">
{{district?.label}}
</ng-option>
</ng-select>
</div>
</mat-expansion-panel>
</mat-accordion>
import { Component,ViewEncapsulation} from "#angular/core";
import { CountryListService } from "./../country.service";
#Component({
selector: "app-location",
templateUrl: "./location.component.html",
styleUrls: ["./location.component.css"],
encapsulation: ViewEncapsulation.None,
providers: [CountryListService]
})
export class LocationComponent {
constructor(private countryList: CountryListService) {}
selectedCountry = "Select";
selectedProvince = "Select";
selectedDistrict = "Select";
countries = this.countryList.getCountries();
provinces = [{ label: "province1", value: "province1" }];
districts = [{ label: "Dist1", value: "District1" }];
}
Countries Service
import {Injectable} from '#angular/core';
#Injectable()
export class CountryListService{
constructor(){}
getCountries(){
return CountryListService.COUNTRIES;
}
private static readonly COUNTRIES = [
{value: 'AF', label: 'Afghanistan'},
{value: 'AX', label: 'Ă…land Islands'},
{value: 'AL', label: 'Albania'},
{value: 'DZ', label: 'Algeria'},
{value: 'AS', label: 'American Samoa'},
{value: 'AD', label: 'Andorra'},
{value: 'AO', label: 'Angola'},
{value: 'AI', label: 'Anguilla'},
{value: 'AQ', label: 'Antarctica'},
{value: 'AG', label: 'Antigua and Barbuda'},
{value: 'AR', label: 'Argentina'}
];
}
I'm not sure about what your are trying to do but I think what you are looking for is :
.ng-dropdown-panel {
position: relative !important;
}
To expand the height of the mat-expansion-panel when you display the dropdown list options.

Apostrophe CMS align custom layout widget

I'm sure there's a really simple solution to this but I can't seem to find it, and I haven't found the question asked here already.
I'm trying to align a layout widget (area) so that when another widget is added it appears to the right of the first widget and not below.
I was hoping i could sort this with flexbox and the artistContainer class but it doesn't seem to be possible.
Dev tools and desired outcome
home.html
<section class="bodysect--dark" id="artists">
<h2 class="body__heading">Artists</h2>
<div class="artistContainer">
{{
apos.area(data.page, 'artist', {
widgets: {
artist: {}
}
})
}}
</div>
</section>
Widget.html
<div class="artist">
<div class="artistImage">
{{ apos.singleton(data.widget, 'areaImage', 'apostrophe-images', {
widgets: {
'apostrophe-images': {}
}
}) }}
</div>
<div class="artistName">
{{ apos.singleton(data.widget, 'singletonName', 'apostrophe-rich-text', {
widgets: {
'apostrophe-rich-text': {}
}
}) }}
</div>
<div class="artistBio">
{{ apos.singleton(data.widget, 'singletonBio', 'apostrophe-rich-text', {
widgets: {
'apostrophe-rich-text': {}
}
}) }}
</div>
</div>
widget index.js
module.exports = {
extend: 'apostrophe-widgets',
label: 'Artist',
contextualOnly: true,
addFields: [
{
name: 'artistImage',
type: 'singleton',
label: 'Image Area',
required: true
},
{
name: 'artistName',
type: 'singleton',
label: 'Name Area',
required: true
},
{
name: 'artistBio',
type: 'singleton',
label: 'Bio Area',
required: true
},
]
};
Thanks in advance!
There is nothing preventing you from lining up horizontally, however, to maintain the proper flex contexts, you'll need to apply styles to apostrophe-generated markup instead of just your project level classes. Here is some sample code I just demo'd
.horizontal-area {
.apos-area-widgets, // proper context for logged-in user
.apos-area { // proper context for logged-out user
display: flex;
}
.apos-area-widget-wrapper {
flex-grow: 1;
flex-basis: 0;
}
}
http://g.recordit.co/IlOPYKRUo0.gif
You might want to provide additional UI changes to adjust the horizontal Add Content line within the horizontal area scope.

Responsive and dynamic background images in Vue.js

I'm trying to build a vue.js front-end and the design is calling for 100% width tiles with a dynamic background image that will be passed along the rest of the content to the page. I already have the payload passing to the component that renders each tile, but I need to render the background image for each of the tiles. I also need to mention that the images are actually 3 images for each tile that need to render for each of our 3 breakpoints. So far I was able to pass one image by using :style="'background-image: url(' + backgroundImage + ')'" but this only serves one image per tile. My question is, what would be the best way to pass all 3 images per tile and render them correctly?
I have heard online that I should just use srcset and pass all 3 to an <img> tag, and make that image the background by using CSS, but that just seems unorthodox.
Is there a more elegant way to deal with responsive background images in reusable components in vue.js?
Home Page
<template>
<div class="Home">
<HomePageTile v-for="tile in tiles" :key="tile.title" :tile-title="tile.title" :tile-desc="tile.description" :tile-type="tile.position" :background-image="tile.backgroundImage"/>
</div>
</template>
<script>
import HomePageTile from '#/components/HomePageTile'
import tileImage1 from '#/assets/optimized/image1.jpg'
import tileImage2 from '#/assets/optimized/image2.jpg'
import tileImage3 from '#/assets/optimized/image3.jpg'
import tileImage4 from '#/assets/optimized/image4.jpg'
export default {
name: 'Home',
components: {
HomePageTile: HomePageTile
},
data () {
return {
tiles: [
{
title: 'Title 1',
description: 'Content 1',
position: 'right',
backgroundImage: tileImage1
}, {
title: 'Title 2',
description: 'Content 2',
position: 'right',
backgroundImage: tileImage2
}, {
title: 'Title 3',
description: 'Content 3',
position: 'right',
backgroundImage: tileImage3
}, {
title: 'Title 4',
description: 'Content 4',
position: 'right',
backgroundImage: tileImage4
}
]
}
}
}
</script>
Tile Component
<template>
<div :class="tilePosition(tileType)" :style="'background-image: url(' + backgroundImage + ')'">
<template v-if="tileType">
<div class="home-page-tile--container home-page-tile--container__with-desc">
<h2 class="home-page-tile--container--title">{{ tileTitle }}</h2>
<p class="home-page-tile--container--description">{{ tileDesc }}</p>
</div>
<div class="home-page-tile--call-to-action" v-if="callToAction">
<p class="home-page-tile--call-to-action--text">{{ callToAction.text }}</p>
<Button class="home-page-tile--call-to-action--button" :button-route="callToAction.buttonPath" :button-text="callToAction.buttonText" :button-style="callToAction.buttonStyle" />
</div>
</template>
<template v-else>
<div class="home-page-tile--container">
<h2 class="home-page-tile--container--title">{{ tileTitle }}</h2>
<Button :button-route="buttonPath" :button-text="buttonText" button-style="pill"/>
</div>
</template>
</div>
</template>
<script>
import Button from './Button'
export default {
name: 'HomePageTile',
props: {
tileType: String,
tileTitle: String,
tileDesc: String,
backgroundImage: String,
buttonText: String,
buttonPath: String,
callToAction: Object
},
components: {
Button: Button
},
data () {
return {
tilePosition: function (el) {
if (el) {
return 'home-page-tile home-page-tile__' + el
} else {
return 'home-page-tile'
}
}
}
}
}
</script>

How to put a title for check box column in Bootstrap Table

I am using bootstrap table and have a column of check box type.
$('#table').bootstrapTable({
columns: [{
field: 'GroupId',
title: 'Group ID'
}, {
field: 'IsActive',
title: 'Active',
checkbox: true
}]
});
When i am using 'checkbox:true' then the column comes with checkbox icon including the header. Can i keep the check box icons in rows but a title for header ?
You have to add two configurations:
First disable default checkbox header in table options adding:
checkboxHeader: false
Enable checkbox title & setup custom title in column options adding:
checkbox: true,
showSelectTitle: true,
field: 'IsActive',
title: 'Active'
In your example:
$('#table').bootstrapTable({
checkboxHeader: false,
columns: [{
field: 'GroupId',
title: 'Group ID'
}, {
checkbox: true,
showSelectTitle: true,
field: 'IsActive',
title: 'Active'
}]
});
<table class="table table-bordered" id="testbedsTable"
data-pagination="true"
data-search="true"
data-checkbox-header="false">
<thead>
<tr>
<th scope="col" data-field="State" data-checkbox="true" id="tableDefaultCheck" data-show-select-title="true">Validate</th>
whereas data-checkbox-header="false" and data-show-select-title="true">Validate solved my problem
I ran a sample of this and I was able to get it to work when adapting it to a sample I already have. I doubt it is populating the checkbox properly but I wasn't concerned with trying to make that work.
http://www.codeply.com/go/h7PZLLTY0b
{
field: 'price',
title: 'Item Price',
checkbox: true
}
{
field: 'ActionField',
title: '',
sortable: false,
width: '25',
halign: "center",
formatter: "CheckBoxFormat",
checkbox: false,
clickToSelect: true,
},
function CheckBoxFormat(value, row) {
return '<input type="checkbox" class="chk" data-ID="' + row.ID + '" onclick="AddRemoveItems(this);"/>';
}

TinyMCE editor in asp.net

I created following an asp.net page with tiny editor. It is Ok, good work.
<script type="text/javascript" src="../tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode: "textareas",
theme: "advanced",
plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
setup: function(ed) { ed.onKeyPress.add( function(ed, evt) { } );},
// Theme options
theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: true,
// Example content CSS (should be your site CSS)
content_css: "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url: "lists/template_list.js",
external_link_list_url: "lists/link_list.js",
external_image_list_url: "lists/image_list.js",
media_external_list_url: "lists/media_list.js",
// Style formats
style_formats: [
{ title: 'Bold text', inline: 'b' },
{ title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },
{ title: 'Red header', block: 'h1', styles: { color: '#ff0000'} },
{ title: 'Example 1', inline: 'span', classes: 'example1' },
{ title: 'Example 2', inline: 'span', classes: 'example2' },
{ title: 'Table styles' },
{ title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
]
// Replace values for the template plugin
//template_replace_values: { username: "zanhtet", staffid: "991234" }
});
</script>
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%" runat="server"></textarea>
And then I have added a following new textarea in this page.
<textarea id="elm2" name="elm1" rows="15" cols="80" style="width: 80%" runat="server">
At that time, the tinyMCE editor is two. I want to be one tiny editor and one textarea. How could I do that? Please, help me.
You can set the specific id of your textarea so only one textarea becomes a editor.
Do this:
tinyMCE.init({
...
elements : "elm1,elm2"
});
http://www.tinymce.com/wiki.php/Configuration:elements

Resources