Skip to content

Commit

Permalink
feat(IE11): base platform & cocs support for IE11 (#831)
Browse files Browse the repository at this point in the history
* feat(docs): home IE11 layout & icon flex fixes #199

* feat(navigation-drawer): remove unnecessary flex for IE11 support

* feat(styles): overflow-visible on notification button for IE11 support

* feat(docs): apply overflow-visible to notification button for IE11 support

* feat(docs): height for layout demos for IE11 support

* feat(docs): proper rows for inputs for IE11 support

* feat(chips): update flex layout for IE11 support

* feat(styles): height fix for logo for IE11 support

* feat(styles): layout align center overflow fix for IE11

* feat(messages): vertical center wrapper layout=column IE11 fix

* feat(docs): search demo layout fix for IE11 support

* feat(docs): additional polyfills for NGX-Charts IE11 support

* feat(docs): IE11 requirements & best practices

* chore(): update yarn.lock with latest dependencies

* fix(chips): fix autocomplete click selection for chips

* chore(build): add autoprefixer to build process to ensure all css is prefixed for every browser.

* chore(): point autoprefixer to IE11 specifically

* fix(chips): fix alignment between chips and input (bottom margin)

* fix(chips): make sure the template is wrapped in an element so it doesnt get spaced when stacked

* fix(): typo in /docs/IE11.md

* fix(): loading docs issue in IE11 with loading until boolean usage

* feat(prompt-dialog): proper flex layout for IE11 support

* feat(docs): proper layout for expansion demo form in IE11

* feat(docs): dynamic form correct responsive layout for IE11

* feat(docs): code-editor: proper demo select flex for IE11

* feat(docs): datatable template demo fix for IE11

* feat(data-table): column heading sorting wrapper to support IE11

* fix(): paging issue with select width
  • Loading branch information
kyleledbetter authored and emoralesb05 committed Aug 30, 2017
1 parent 3ab2fa0 commit fee4182
Show file tree
Hide file tree
Showing 35 changed files with 980 additions and 690 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ Covalent is built on a CSS Flexbox layout and all layouts and components heavily

#### Current version - 1 for the following:

| | Chrome | Firefox | Safari | Edge* | Mobile Chrome* | Mobile Safari* | IE11
| | Chrome | Firefox | Safari | Edge | Mobile Chrome | Mobile Safari | [IE11](docs/IE11.md)
|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| __Supported__ ||||| | | x |
| __Supported__ ||||| ~ | ~ | ~ |


*Indicates limited testing & lower priority
~ Indicates limited testing & lower priority

[More on flexbox browser support](http://caniuse.com/#feat=flexbox)
[IE11 requirements & best practices](docs/IE11.md)
155 changes: 155 additions & 0 deletions docs/IE11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# IE11 Support

Covalent currently offers experimental IE11 support, but there are some best practices and specific workarounds required in implementation that can't be fixed from the Covalent platform level.

Reference [philipwalton/flexbugs](https://github.com/philipwalton/flexbugs#flexbugs) for more detailed explanations.

## Polyfills

Ensure you uncomment and add these polyfills in the src/polyfills.ts file of your Angular app:

```typescript
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'web-animations-js';
import 'core-js/es7/array'; // Needed for NGX-Charts
import 'classlist.js'; // Needed for NGX-Charts
```

and add this shim to the bottom of src/polyfills.ts:

```typescript
// Needed for NGX-Charts
if (typeof SVGElement.prototype.contains === 'undefined') {
SVGElement.prototype.contains = HTMLDivElement.prototype.contains;
}
```

Next, edit your package.json and ensure you have these dependencies (NOTE: the versions will change):

```json
"core-js": "^2.4.1",
"web-animations-js": "2.2.5",
"classlist.js": "^1.1.20150312", // Needed for NGX-Charts
```

## IE11 Flexbox Workarounds & Best Practices:

### Column flex items overflow their container

You may have to add an extra `<div>` wrapper around child elements in a `layout="column"`

For example:

```
<div layout="column">
<div>
<section>
this was previously overflowing
</section>
</div>
</div>
```

ref: https://github.com/philipwalton/flexbugs#2-column-flex-items-set-to-align-itemscenter-overflow-their-container

---

### Column flex items may not align center vertically

For example, if the flex items in `layout="row" layout-align="start center"` aren't vertically centered, try adding an extra `layout="column"` wrapper

For example:

```
<div layout="column">
<div layout="row" layout-align="start center">
<span>
centered vertically
</span>
</div>
</div>
```

---

### Some components may need flex wrappers if you want flex widths

For example, `<component-name>` needs a flex wrapper inside a `layout="row"`

```
<div layout="row">
<div flex="40">
<component-name></component-name>
</div>
</div>
```

---

### Some HTML elements can't be flex containers

For example, don't use `layout="row"` on `<button md-button>`

ref: https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers

---

### Height:auto probably won't work on flex items

Try to add an explicit height px or % when possible

For example try this:

```
.class-name {
width: 90%;
height: 90%;
}
```

instead of:

```
.class-name {
width: 90%;
height: auto;
}
```

---

### Visible overflow may be necessary

IE11 will height the overflow of certain element children

For example, if a parent has a border-radius, the child may be cut off. Use a utility class to reveal the overflow:

```
<div class="overflow-visible"></div>
```

---

#### Find IE11 bugs?

Please submit an issue with detailed description and screenshots:

https://github.com/Teradata/covalent/issues

Prefix your issue title with: `[IE11] - `
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
"Ilsun Park <ilsun.park@teradata.com>",
"Steven Ov <steven.ov@teradata.com>"
],
"browserslist": [
"last 2 versions",
"ie 11"
],
"dependencies": {
"@angular/animations": "^4.2.0",
"@angular/cdk": "2.0.0-beta.8",
Expand All @@ -73,15 +77,16 @@
"@ngx-translate/core": "7.0.0",
"@ngx-translate/http-loader": "0.1.0",
"@swimlane/ngx-charts": "5.3.1",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"d3": "^4.4.0",
"hammerjs": "^2.0.8",
"highlight.js": "9.11.0",
"rxjs": "^5.2.0",
"showdown": "1.6.4",
"tslib": "^1.7.1",
"web-animations-js": "2.2.5",
"zone.js": "0.8.12",
"tslib": "^1.7.1"
"zone.js": "0.8.12"
},
"devDependencies": {
"@angular/cli": "1.2.7",
Expand All @@ -91,6 +96,7 @@
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"@types/selenium-webdriver": "^2.52.0",
"autoprefixer": "7.1.2",
"codelyzer": "~3.0.0",
"coveralls": "^2.12.0",
"fs-extra": "^4.0.0",
Expand All @@ -99,6 +105,7 @@
"gulp-bump": "2.1.0",
"gulp-help": "1.6.1",
"gulp-if": "2.0.1",
"gulp-postcss": "7.0.0",
"gulp-sass": "3.1.0",
"gulp-sourcemaps": "1.6.0",
"gulp-typescript": "3.1.4",
Expand All @@ -124,6 +131,6 @@
"ts-node": "^3.0.4",
"tslint": "5.2.0",
"typescript": "2.4.2",
"uglify-js": "^2.8.14"
"uglify-js": "^2.8.14"
}
}
10 changes: 9 additions & 1 deletion scripts/compile-sass.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@
var gulp = require('gulp-help')(require('gulp'));
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var config = require('../build.conf');
var sassImporter = require('./sass-importer');

gulp.task('compile-sass', 'Build the module styles', function() {
return gulp
.src(config.paths.styles)
//.pipe(sourcemaps.init()) // add later on when not using relative routes for node_modules scss
.pipe(sourcemaps.init())
.pipe(sass({
errLogToConsole: true,
importer: sassImporter,
}))
.pipe(postcss([autoprefixer({
browsers: [
'last 2 versions',
'ie 11'
]
})]))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('deploy/'));
});
3 changes: 3 additions & 0 deletions src/app/components/components/chips/chips.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@
placeholder="Enter any string"
(inputChange)="filterStackedStrings($event)"
stacked>
<ng-template td-chip let-chip="chip">
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.substring(0, 1).toUpperCase()}}</div> {{chip}}
</ng-template>
</td-chips>
</div>
</md-tab>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,23 @@
</md-card-content>
<md-divider></md-divider>
<md-card-actions>
<div class="pad-sm">
<span hide-xs class="md-body-1">Editor Language</span>
<div layout="row" layout-align="start center" class="pad-sm">
<span flex="none" hide-xs class="push-right md-body-1">Editor Language</span>
<md-select floatPlaceholder="never" [(ngModel)]="editorLanguage" (change)="changeLanguage()" placeholder="Editor Language">
<md-option value="sql">SQL</md-option>
<md-option value="javascript">JavaScript</md-option>
<md-option value="html">HTML</md-option>
</md-select>
</div>
<md-divider></md-divider>
<div class="pad-sm">
<span hide-xs class="md-body-1">Editor Theme</span>
<div layout="row" layout-align="start center" class="pad-sm">
<span flex="none" hide-xs class="push-right md-body-1">Editor Theme</span>
<md-select floatPlaceholder="never" [(ngModel)]="editorTheme" (change)="changeTheme()" placeholder="Editor Theme">
<md-option value="vs">Light</md-option>
<md-option value="vs-dark">Dark</md-option>
<md-option value="hc-black">High Contrast</md-option>
</md-select>
</div>
<md-divider></md-divider>
</md-card-actions>
</md-card>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ <h4 class="md-subhead">with nested data, formatting, and templates</h4>
[columns]="columns">
<ng-template tdDataTableTemplate="type" let-value="value" let-row="row" let-column="column">
<div layout="row">
<span flex>{{value}}</span>
<span>{{value}}</span>
<span flex></span>
<md-icon>star</md-icon>
</div>
</ng-template>
Expand All @@ -123,7 +124,8 @@ <h4 class="md-subhead">with nested data, formatting, and templates</h4>
[columns]="columns">
<ng-template tdDataTableTemplate="type" let-value="value" let-row="row" let-column="column">
<div layout="row">
<span flex>{ {value}}</span> // or <span flex>{ {row[column]}}</span>
<span>{ {value}}</span> // or <span flex>{ {row[column]}}</span>
<span flex></span>
<md-icon>star</md-icon>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</md-toolbar>
<md-divider hide show-gt-md></md-divider>
<div layout-gt-md="row">
<div layout="column" class="bgc-grey-100 pad-sm" flex-gt-md="50">
<div layout-gt-md="column" class="bgc-grey-100 pad-sm" flex-gt-md="50">
<md-card flex>
<md-card-title>
<div layout="row" layout-align="start center" flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,22 @@ <h4 md-line>Headquarters</h4>
</md-list-item>
</md-list>
</td-expansion-summary>
<form class="md-padding" layout="column">
<md-input-container flex>
<input mdInput placeholder="Company (disabled)" disabled value="Google"/>
</md-input-container>
<md-input-container flex>
<textarea mdInput placeholder="Description" rows="4"></textarea>
</md-input-container>
<form class="md-padding">
<div layout="row">
<md-input-container flex>
<input mdInput placeholder="Company (disabled)" disabled value="Google"/>
</md-input-container>
</div>
<div layout="row">
<md-input-container flex>
<textarea mdInput placeholder="Description" rows="4"></textarea>
</md-input-container>
</div>
</form>
<md-divider></md-divider>
<div layout="row" layout-margin layout-align="end center">
<button md-button class="text-upper">Cancel</button>
<div layout="row" class="pad-sm">
<button md-button color="accent" class="text-upper">Save</button>
<button md-button class="text-upper">Cancel</button>
</div>
</td-expansion-panel>
</md-tab>
Expand Down Expand Up @@ -194,18 +198,22 @@ <h4 md-line>Headquarters</h4>
</md-list-item>
</md-list>
</td-expansion-summary>
<form class="md-padding" layout="column">
<md-input-container flex>
<input mdInput placeholder="Company (disabled)" disabled value="Google"/>
</md-input-container>
<md-input-container flex>
<textarea mdInput placeholder="Description" rows="4"></textarea>
</md-input-container>
<form class="md-padding">
<div layout="row">
<md-input-container flex>
<input mdInput placeholder="Company (disabled)" disabled value="Google"/>
</md-input-container>
</div>
<div layout="row">
<md-input-container flex>
<textarea mdInput placeholder="Description" rows="4"></textarea>
</md-input-container>
</div>
</form>
<md-divider></md-divider>
<div layout="row" layout-margin layout-align="end center">
<button md-button class="text-upper">Cancel</button>
<div layout="row" class="pad-sm">
<button md-button color="accent" class="text-upper">Save</button>
<button md-button class="text-upper">Cancel</button>
</div>
</td-expansion-panel>
]]>
Expand Down

0 comments on commit fee4182

Please sign in to comment.