mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c60588a290 | ||
|
|
77fcaef436 | ||
|
|
9c2181b8f9 | ||
|
|
4db20a648c | ||
|
|
f6d6596912 | ||
|
|
39e7da3840 | ||
|
|
9b3fb78a68 | ||
|
|
559f4d3bd5 | ||
|
|
f1a676e4c2 | ||
|
|
1573043f4e | ||
|
|
0a49648fe8 | ||
|
|
599bf3df5e | ||
|
|
fce5d8a04f | ||
|
|
108fc0fc3f | ||
|
|
521402b548 | ||
|
|
54cdf00454 | ||
|
|
5bb3e73296 | ||
|
|
ae94f5ecea | ||
|
|
b87d212829 |
44
CHANGELOG.md
44
CHANGELOG.md
@@ -1,3 +1,47 @@
|
||||
<a name="3.7.0"></a>
|
||||
# [3.7.0](https://github.com/ionic-team/ionic/compare/v3.6.1...v3.7.0) (2017-09-28)
|
||||
|
||||
### Notes
|
||||
This release adds support for the latest version of Angular (4.4.3) as well as the initial iteration of support for the iPhone X.
|
||||
|
||||
### Upgrade Instructions
|
||||
|
||||
These are the latest versions of `@angular`, `rxjs`, `zone.js` and `ionic-angular`. Update your `package.json` to match the following dependencies, remove the existing `node_modules` directory, and then run `npm install`:
|
||||
|
||||
```
|
||||
...
|
||||
"dependencies": {
|
||||
"@angular/common": "4.4.3",
|
||||
"@angular/compiler": "4.4.3",
|
||||
"@angular/compiler-cli": "4.4.3",
|
||||
"@angular/core": "4.4.3",
|
||||
"@angular/forms": "4.4.3",
|
||||
"@angular/http": "4.4.3",
|
||||
"@angular/platform-browser": "4.4.3",
|
||||
"@angular/platform-browser-dynamic": "4.4.3",
|
||||
"ionic-angular": "3.7.0",
|
||||
"rxjs": "5.4.3",
|
||||
"zone.js": "0.8.17"
|
||||
}
|
||||
"devDependencies": {
|
||||
"@ionic/app-scripts": "3.0.0"
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
If you're using a `package-lock.json` file, make sure that is updated as well.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **input:** mark ion-input touched on blur instead of changed ([#12812](https://github.com/ionic-team/ionic/issues/12812)) ([d0cad6b](https://github.com/ionic-team/ionic/commit/d0cad6b)), closes [#12102](https://github.com/ionic-team/ionic/issues/12102)
|
||||
* **swiper:** change var to let to avoid variable shadowing ([f5ef1ca](https://github.com/ionic-team/ionic/commit/f5ef1ca))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* initial iphoneX support ([112d4f5](https://github.com/ionic-team/ionic/commit/112d4f5))
|
||||
|
||||
|
||||
<a name="3.6.1"></a>
|
||||
## [3.6.1](https://github.com/ionic-team/ionic/compare/v3.6.0...v3.6.1) (2017-09-07)
|
||||
|
||||
|
||||
118
package-lock.json
generated
118
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic2",
|
||||
"version": "3.6.1",
|
||||
"version": "3.7.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -91,9 +91,9 @@
|
||||
}
|
||||
},
|
||||
"@ionic/app-scripts": {
|
||||
"version": "2.1.4-201709271749",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/app-scripts/-/app-scripts-2.1.4-201709271749.tgz",
|
||||
"integrity": "sha512-BNnU1wbxMcrHHD+TU9zjZSs3YHlSpuS1vwcBjhEQYvbhNKKh2mYrFMObh00bgT/BvXY4Sz6Cctf6/m94/rRViw==",
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/app-scripts/-/app-scripts-3.0.0.tgz",
|
||||
"integrity": "sha512-F3T6mOgBlaq97c3Jrl0L2Lk3VK3l7IYjfBlDAlzYvgXqXvSECnGHTlGwvK036NPvRvVf9F/ZXniYwNGJuXxL4w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@angular-devkit/build-optimizer": "0.0.21",
|
||||
@@ -368,20 +368,10 @@
|
||||
"@types/node": "6.0.88"
|
||||
}
|
||||
},
|
||||
"JSONStream": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz",
|
||||
"integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jsonparse": "1.3.1",
|
||||
"through": "2.3.8"
|
||||
}
|
||||
},
|
||||
"abbrev": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
|
||||
"integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
|
||||
"dev": true
|
||||
},
|
||||
"abstract-leveldown": {
|
||||
@@ -775,7 +765,7 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"browserslist": "2.4.0",
|
||||
"caniuse-lite": "1.0.30000738",
|
||||
"caniuse-lite": "1.0.30000739",
|
||||
"normalize-range": "0.1.2",
|
||||
"num2fraction": "1.2.2",
|
||||
"postcss": "6.0.12",
|
||||
@@ -1890,8 +1880,8 @@
|
||||
"integrity": "sha512-aM2Gt4x9bVlCUteADBS6JP0F+2tMWKM1jQzUulVROtdFWFIcIVvY76AJbr7GDqy0eDhn+PcnpzzivGxY4qiaKQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caniuse-lite": "1.0.30000738",
|
||||
"electron-to-chromium": "1.3.22"
|
||||
"caniuse-lite": "1.0.30000739",
|
||||
"electron-to-chromium": "1.3.23"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
@@ -2003,15 +1993,15 @@
|
||||
}
|
||||
},
|
||||
"caniuse-db": {
|
||||
"version": "1.0.30000738",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000738.tgz",
|
||||
"integrity": "sha1-hICavEmjkOWowiSrk2nT+NAaogI=",
|
||||
"version": "1.0.30000739",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000739.tgz",
|
||||
"integrity": "sha1-vnNN62vtTtimnXL7kHi8bqbXatA=",
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30000738",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000738.tgz",
|
||||
"integrity": "sha1-GCDDya25oRfjEaW9yh0lvDQojro=",
|
||||
"version": "1.0.30000739",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000739.tgz",
|
||||
"integrity": "sha1-nujHAW9cUi27DAhj1Vxh77RTrpU=",
|
||||
"dev": true
|
||||
},
|
||||
"canonical-path": {
|
||||
@@ -2742,8 +2732,8 @@
|
||||
"integrity": "sha512-8od6g684Fhi5Vpp4ABRv/RBsW1AY6wSHbJHEK6FGTv+8jvAAnlABniZu/FVmX9TcirkHepaEsa1QGkRvbg0CKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"JSONStream": "1.3.1",
|
||||
"is-text-path": "1.0.1",
|
||||
"JSONStream": "1.3.1",
|
||||
"lodash": "4.17.4",
|
||||
"meow": "3.7.0",
|
||||
"split2": "2.2.0",
|
||||
@@ -3231,7 +3221,7 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bn.js": "4.11.8",
|
||||
"miller-rabin": "4.0.0",
|
||||
"miller-rabin": "4.0.1",
|
||||
"randombytes": "2.0.5"
|
||||
}
|
||||
},
|
||||
@@ -3437,9 +3427,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.22",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.22.tgz",
|
||||
"integrity": "sha1-QyLVLBUUBuPq73StAmdog+hBZBg=",
|
||||
"version": "1.3.23",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.23.tgz",
|
||||
"integrity": "sha1-5maKsYy2mvuPV3yKn8I9ACeIvnQ=",
|
||||
"dev": true
|
||||
},
|
||||
"elliptic": {
|
||||
@@ -5330,6 +5320,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
@@ -5340,14 +5338,6 @@
|
||||
"strip-ansi": "3.0.1"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.5",
|
||||
"bundled": true,
|
||||
@@ -6005,7 +5995,7 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"browserslist": "1.7.7",
|
||||
"caniuse-db": "1.0.30000738",
|
||||
"caniuse-db": "1.0.30000739",
|
||||
"normalize-range": "0.1.2",
|
||||
"num2fraction": "1.2.2",
|
||||
"postcss": "5.2.17",
|
||||
@@ -6018,8 +6008,8 @@
|
||||
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caniuse-db": "1.0.30000738",
|
||||
"electron-to-chromium": "1.3.22"
|
||||
"caniuse-db": "1.0.30000739",
|
||||
"electron-to-chromium": "1.3.23"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8501,6 +8491,16 @@
|
||||
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
|
||||
"dev": true
|
||||
},
|
||||
"JSONStream": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz",
|
||||
"integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jsonparse": "1.3.1",
|
||||
"through": "2.3.8"
|
||||
}
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
||||
@@ -9482,7 +9482,7 @@
|
||||
"integrity": "sha1-bMzZd7gBMqB3MdbozljCyDA8+a8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"abbrev": "1.1.0"
|
||||
"abbrev": "1.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9664,9 +9664,9 @@
|
||||
}
|
||||
},
|
||||
"miller-rabin": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.0.tgz",
|
||||
"integrity": "sha1-SmL7HUKTPAVYOYL0xxb2+55sbT0=",
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz",
|
||||
"integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bn.js": "4.11.8",
|
||||
@@ -10158,7 +10158,7 @@
|
||||
"integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"abbrev": "1.1.0"
|
||||
"abbrev": "1.1.1"
|
||||
}
|
||||
},
|
||||
"normalize-package-data": {
|
||||
@@ -13210,6 +13210,15 @@
|
||||
"integrity": "sha1-76/unx4i01ke1949yqlcP1559zw=",
|
||||
"dev": true
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"string-range": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/string-range/-/string-range-1.2.2.tgz",
|
||||
@@ -13233,15 +13242,6 @@
|
||||
"strip-ansi": "3.0.1"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"stringmap": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/stringmap/-/stringmap-0.2.2.tgz",
|
||||
@@ -15060,9 +15060,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"zone.js": {
|
||||
"version": "0.8.17",
|
||||
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.17.tgz",
|
||||
"integrity": "sha1-TF5RhahX2o2nk9rzkZNxxaNrKgs="
|
||||
"version": "0.8.18",
|
||||
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.18.tgz",
|
||||
"integrity": "sha512-knKOBQM0oea3/x9pdyDuDi7RhxDlJhOIkeixXSiTKWLgs4LpK37iBc+1HaHwzlciHUKT172CymJFKo8Xgh+44Q=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "ionic2",
|
||||
"version": "3.6.1",
|
||||
"version": "3.7.0",
|
||||
"description": "A powerful framework for building mobile and progressive web apps with JavaScript and Angular",
|
||||
"keywords": [
|
||||
"ionic",
|
||||
@@ -36,10 +36,10 @@
|
||||
"@angular/platform-browser-dynamic": "4.4.3",
|
||||
"ionicons": "~3.0.0",
|
||||
"rxjs": "5.4.3",
|
||||
"zone.js": "0.8.17"
|
||||
"zone.js": "0.8.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ionic/app-scripts": "2.1.4-201709271749",
|
||||
"@ionic/app-scripts": "3.0.0",
|
||||
"@ionic/commit-hooks": "1.0.3",
|
||||
"@types/connect": "3.4.30",
|
||||
"@types/del": "2.2.31",
|
||||
|
||||
@@ -99,6 +99,10 @@ function buildDemo(filePath: string) {
|
||||
const appNgModulePath = join(dirname(filePath), 'app.module.ts');
|
||||
const distDir = join(distTestRoot, 'www');
|
||||
|
||||
const minifyCss = argv.noMinifyCss ? false : true;
|
||||
const minifyJs = argv.noMinifyJs ? false : true;
|
||||
const optimizeJs = argv.noOptimizeJs ? false : true;
|
||||
|
||||
return runAppScriptsBuild(
|
||||
appEntryPoint,
|
||||
appNgModulePath,
|
||||
@@ -107,7 +111,11 @@ function buildDemo(filePath: string) {
|
||||
pathToWriteFile,
|
||||
ionicAngularDir,
|
||||
sassConfigPath,
|
||||
copyConfigPath
|
||||
copyConfigPath,
|
||||
false,
|
||||
minifyCss,
|
||||
minifyJs,
|
||||
optimizeJs
|
||||
).then(() => {
|
||||
const end = Date.now();
|
||||
console.log(`${filePath} took a total of ${(end - start) / 1000} seconds to build`);
|
||||
|
||||
@@ -133,7 +133,11 @@ function buildTest(filePath: string) {
|
||||
const appNgModulePath = join(dirname(appEntryPoint), 'app.module.ts');
|
||||
const distDir = join(distTestRoot, 'www');
|
||||
|
||||
return runAppScriptsBuild(appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, sassConfigPath, copyConfigPath, argv.dev).then(() => {
|
||||
const minifyCss = argv.minifyCss ? true : false;
|
||||
const minifyJs = argv.minifyJs ? true : false;
|
||||
const optimizeJs = argv.optimizeJs ? true : false;
|
||||
|
||||
return runAppScriptsBuild(appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, sassConfigPath, copyConfigPath, argv.dev, minifyCss, minifyJs, optimizeJs).then(() => {
|
||||
const end = Date.now();
|
||||
console.log(`${filePath} took a total of ${(end - start) / 1000} seconds to build`);
|
||||
}).catch((err) => {
|
||||
|
||||
@@ -246,10 +246,10 @@ export function runAppScriptsServe(testOrDemoName: string, appEntryPoint: string
|
||||
});
|
||||
}
|
||||
|
||||
export function runAppScriptsBuild(appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string, isDev: boolean = false) {
|
||||
export function runAppScriptsBuild(appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string, isDev: boolean = false, minifyCss: boolean = true, minifyJs: boolean = true, optimizeJs: boolean = true) {
|
||||
const pathToAppScripts = join(NODE_MODULES_ROOT, '.bin', 'ionic-app-scripts');
|
||||
const debug: boolean = argv.debug;
|
||||
return runWorker(pathToAppScripts, debug, appEntryPoint, appNgModulePath, srcDir, distDir, tsConfig, ionicAngularDir, sassConfigPath, copyConfigPath, isDev);
|
||||
return runWorker(pathToAppScripts, debug, appEntryPoint, appNgModulePath, srcDir, distDir, tsConfig, ionicAngularDir, sassConfigPath, copyConfigPath, isDev, minifyCss, minifyJs, optimizeJs);
|
||||
}
|
||||
|
||||
/** Resolves the path for a node package executable. */
|
||||
|
||||
@@ -3,7 +3,7 @@ import { dirname, join } from 'path';
|
||||
|
||||
import { MessageToWorker, WorkerProcess } from './interfaces';
|
||||
|
||||
export function runWorker(pathToAppScripts: string, debug: boolean, appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string, isDev: boolean) {
|
||||
export function runWorker(pathToAppScripts: string, debug: boolean, appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string, isDev: boolean, minifyCss: boolean, minifyJs: boolean, optimizeJs: boolean) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const msgToWorker: MessageToWorker = {
|
||||
@@ -17,7 +17,10 @@ export function runWorker(pathToAppScripts: string, debug: boolean, appEntryPoin
|
||||
ionicAngularDir: ionicAngularDir,
|
||||
sassConfigPath: sassConfigPath,
|
||||
copyConfigPath: copyConfigPath,
|
||||
isDev: isDev
|
||||
isDev: isDev,
|
||||
minifyCss: minifyCss,
|
||||
minifyJs: minifyJs,
|
||||
optimizeJs: optimizeJs
|
||||
};
|
||||
|
||||
const worker = <ChildProcess>createWorker(msgToWorker);
|
||||
@@ -84,6 +87,18 @@ export function createWorker(msg: MessageToWorker): any {
|
||||
scriptArgs.push('--debug');
|
||||
}
|
||||
|
||||
if (msg.minifyJs) {
|
||||
scriptArgs.push('--minifyJs');
|
||||
}
|
||||
|
||||
if (msg.minifyCss) {
|
||||
scriptArgs.push('--minifyCss');
|
||||
}
|
||||
|
||||
if (msg.optimizeJs) {
|
||||
scriptArgs.push('--optimizeJs');
|
||||
}
|
||||
|
||||
const workerModule = join(process.cwd(), 'node_modules', '@ionic', 'app-scripts', 'bin', 'ionic-app-scripts.js');
|
||||
const worker = fork(workerModule, scriptArgs, {
|
||||
env: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
export interface WorkerProcess {
|
||||
appEntryPoint: string;
|
||||
worker: any;
|
||||
};
|
||||
}
|
||||
|
||||
export interface MessageToWorker {
|
||||
pathToAppScripts: string;
|
||||
@@ -16,4 +16,8 @@ export interface MessageToWorker {
|
||||
sassConfigPath: string;
|
||||
copyConfigPath: string;
|
||||
isDev: boolean;
|
||||
};
|
||||
minifyJs: boolean;
|
||||
minifyCss: boolean;
|
||||
optimizeJs: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { assert, clamp, deepCopy, isArray, isBlank, isObject, isPresent, isStrin
|
||||
import {
|
||||
DateTimeData,
|
||||
LocaleData,
|
||||
compareDates,
|
||||
convertDataToISO,
|
||||
convertFormatToKey,
|
||||
dateDataSortValue,
|
||||
@@ -321,6 +322,14 @@ export class DateTime extends BaseInput<DateTimeData> implements AfterContentIni
|
||||
*/
|
||||
@Input() displayFormat: string;
|
||||
|
||||
/**
|
||||
* @input {string} The default datetime selected in picker modal if field value is empty.
|
||||
* Value must be a date string following the
|
||||
* [ISO 8601 datetime format standard](https://www.w3.org/TR/NOTE-datetime),
|
||||
* `1996-12-19`.
|
||||
*/
|
||||
@Input() initialValue: string;
|
||||
|
||||
/**
|
||||
* @input {string} The format of the date and time picker columns the user selects.
|
||||
* A datetime input can have one or many datetime parts, each getting their
|
||||
@@ -510,6 +519,7 @@ export class DateTime extends BaseInput<DateTimeData> implements AfterContentIni
|
||||
if (this.isFocus() || this._disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.debug('datetime, open picker');
|
||||
|
||||
// the user may have assigned some options specifically for the alert
|
||||
@@ -598,7 +608,7 @@ export class DateTime extends BaseInput<DateTimeData> implements AfterContentIni
|
||||
|
||||
// cool, we've loaded up the columns with options
|
||||
// preselect the option for this column
|
||||
const optValue = getValueFromFormat(this.getValue(), format);
|
||||
const optValue = getValueFromFormat(this.getValueOrDefault(), format);
|
||||
const selectedIndex = column.options.findIndex(opt => opt.value === optValue);
|
||||
if (selectedIndex >= 0) {
|
||||
// set the select index for this column's options
|
||||
@@ -774,6 +784,51 @@ export class DateTime extends BaseInput<DateTimeData> implements AfterContentIni
|
||||
return this._value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
getValueOrDefault(): DateTimeData {
|
||||
if (this.hasValue()) {
|
||||
return this._value;
|
||||
}
|
||||
|
||||
const initialDateString = this.getDefaultValueDateString();
|
||||
const _default = {};
|
||||
updateDate(_default, initialDateString);
|
||||
return _default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default value as a date string
|
||||
* @hidden
|
||||
*/
|
||||
getDefaultValueDateString() {
|
||||
if (this.initialValue) {
|
||||
return this.initialValue;
|
||||
}
|
||||
|
||||
const nowString = (new Date).toISOString();
|
||||
if (this.max) {
|
||||
const now = parseDate(nowString);
|
||||
const max = parseDate(this.max);
|
||||
|
||||
let v;
|
||||
for (let i in max) {
|
||||
v = (<any>max)[i];
|
||||
if (v === null) {
|
||||
(<any>max)[i] = (<any>now)[i];
|
||||
}
|
||||
}
|
||||
|
||||
const diff = compareDates(now, max);
|
||||
// If max is before current time, return max
|
||||
if (diff > 0) {
|
||||
return this.max;
|
||||
}
|
||||
}
|
||||
return nowString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@@ -837,7 +892,6 @@ export class DateTime extends BaseInput<DateTimeData> implements AfterContentIni
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
|
||||
<ion-item>
|
||||
<ion-label>MM DD YY</ion-label>
|
||||
<ion-datetime displayFormat="MM DD YY" [(ngModel)]="placeholderDate" placeholder="Select Date"></ion-datetime>
|
||||
<ion-datetime pickerFormat="YYYY-MM-DDThh:mm" [(ngModel)]="placeholderDate" placeholder="Select Date"></ion-datetime>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>MM DD YY</ion-label>
|
||||
<ion-datetime displayFormat="MM DD YY" [(ngModel)]="placeholderDate" placeholder="Select Date" initialValue="1987-10-19"></ion-datetime>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
@@ -77,6 +82,11 @@
|
||||
<ion-datetime monthValues="6,7,8" yearValues="2014,2015" dayValues="01,02,03,04,05,06,08,09,10, 11, 12, 13, 14" displayFormat="DD/MMM/YYYY" [(ngModel)]="specificDaysMonthsYears"></ion-datetime>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Default value</ion-label>
|
||||
<ion-datetime max="2100" pickerDefault="2017-08-06" [(ngModel)]="defaultValue"></ion-datetime>
|
||||
</ion-item>
|
||||
|
||||
<p aria-hidden="true" padding>
|
||||
<code>monthOnly: {{monthOnly}}</code><br>
|
||||
<code>wwwInvented: {{wwwInvented}}</code><br>
|
||||
@@ -88,6 +98,7 @@
|
||||
<code>time: {{time}}</code><br>
|
||||
<code>Leap year, summer months: {{leapYearsSummerMonths}}</code><br>
|
||||
<code>Specific days/months/years: {{specificDaysMonthsYears}}</code><br>
|
||||
<code>Default value: {{defaultValue}}</code><br>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -17,6 +17,7 @@ export class RootPage {
|
||||
leapYearsSummerMonths = '';
|
||||
convertedDate = '';
|
||||
specificDaysMonthsYears = '';
|
||||
defaultValue: any;
|
||||
|
||||
leapYearsArray = [2020, 2016, 2008, 2004, 2000, 1996];
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { DateTime } from '../datetime';
|
||||
import { Form } from '../../../util/form';
|
||||
import { Picker } from '../../picker/picker';
|
||||
import { PickerController } from '../../picker/picker-controller';
|
||||
import * as datetime from '../../../util/datetime-util';
|
||||
import * as datetimeUtil from '../../../util/datetime-util';
|
||||
import { mockApp, mockConfig, mockElementRef, mockRenderer } from '../../../util/mock-providers';
|
||||
|
||||
|
||||
@@ -491,6 +491,53 @@ describe('DateTime', () => {
|
||||
|
||||
});
|
||||
|
||||
describe('defaultValue', () => {
|
||||
it('should default to now if no initial value or bounds supplied', () => {
|
||||
const now = datetimeUtil.parseDate(new Date().toISOString());
|
||||
datetime.pickerFormat = 'YYYY-MM-DDThh:mm';
|
||||
datetime.generate();
|
||||
var columns = picker.getColumns();
|
||||
expect(columns[0].options[columns[0].selectedIndex].value).toEqual(now.year);
|
||||
expect(columns[1].options[columns[1].selectedIndex].value).toEqual(now.month);
|
||||
expect(columns[2].options[columns[2].selectedIndex].value).toEqual(now.day);
|
||||
expect(columns[3].options[columns[3].selectedIndex].value).toEqual(now.hour % 12);
|
||||
expect(columns[4].options[columns[4].selectedIndex].value).toEqual(now.minute);
|
||||
});
|
||||
|
||||
it('should default to max if no initial value supplied but max specified and max before current', () => {
|
||||
datetime.max = '1987-10-19';
|
||||
datetime.generate();
|
||||
var columns = picker.getColumns();
|
||||
expect(columns[0].options[columns[0].selectedIndex].value).toEqual(10);
|
||||
expect(columns[1].options[columns[1].selectedIndex].value).toEqual(19);
|
||||
expect(columns[2].options[columns[2].selectedIndex].value).toEqual(1987);
|
||||
});
|
||||
|
||||
it('should default to current if no initial value supplied but max specified and max after current', () => {
|
||||
const now = datetimeUtil.parseDate(new Date().toISOString());
|
||||
datetime.max = '2100-10-19';
|
||||
datetime.generate();
|
||||
var columns = picker.getColumns();
|
||||
expect(columns[0].options[columns[0].selectedIndex].value).toEqual(now.month);
|
||||
expect(columns[1].options[columns[1].selectedIndex].value).toEqual(now.day);
|
||||
expect(columns[2].options[columns[2].selectedIndex].value).toEqual(now.year);
|
||||
});
|
||||
|
||||
it('should use pickerDefault if has no value', zoned(() => {
|
||||
datetime.max = '2100-12-31';
|
||||
datetime.pickerFormat = 'DD MMMM YYYY';
|
||||
datetime.initialValue = '2004-08-06';
|
||||
|
||||
datetime.generate();
|
||||
var columns = picker.getColumns();
|
||||
|
||||
expect(columns[0].options[columns[0].selectedIndex].value).toEqual(6);
|
||||
expect(columns[1].options[columns[1].selectedIndex].value).toEqual(8);
|
||||
expect(columns[2].options[columns[2].selectedIndex].value).toEqual(2004);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
describe('setValue', () => {
|
||||
|
||||
it('should update existing time value with 12-hour PM DateTimeData value', zoned(() => {
|
||||
@@ -683,7 +730,7 @@ describe('DateTime', () => {
|
||||
console.warn = function(){};
|
||||
|
||||
// pt-br
|
||||
var customLocale: datetime.LocaleData = {
|
||||
var customLocale: datetimeUtil.LocaleData = {
|
||||
dayNames: [
|
||||
'domingo',
|
||||
'segunda-feira',
|
||||
|
||||
@@ -116,7 +116,9 @@ import { isArray, isDefined, isFunction, isObject } from '../util/util';
|
||||
* | `pickerEnter` | `string` | The name of the transition to use while a picker is presented. |
|
||||
* | `pickerLeave` | `string` | The name of the transition to use while a picker is dismissed. |
|
||||
* | `popoverEnter` | `string` | The name of the transition to use while a popover is presented. |
|
||||
* | `popoverLeave` | `string` | The name of the transition to use while a popover is dismissed. |
|
||||
* | `popoverLeave` | `string` | The name of the transition to use while a popover is dismissed.
|
||||
* | `scrollAssist` | `boolean` | Used to avoid the input to be hidden by the keyboard if it's near the bottom of the page.
|
||||
* | `scrollPadding` | `boolean` | Used to remove the extra padding on ion-content when keyboard is displayed.
|
||||
* | `spinner` | `string` | The default spinner to use when a name is not defined. |
|
||||
* | `statusbarPadding` | `boolean` | Whether to hide extra padding for statusbar. |
|
||||
* | `swipeBackEnabled` | `boolean` | Whether native iOS swipe to go back functionality is enabled. |
|
||||
|
||||
@@ -3,7 +3,7 @@ export { IonicApp } from './components/app/app-root';
|
||||
export { MenuController } from './components/app/menu-controller';
|
||||
export { ActionSheet } from './components/action-sheet/action-sheet';
|
||||
export { ActionSheetController } from './components/action-sheet/action-sheet-controller';
|
||||
export { ActionSheetOptions } from './components/action-sheet/action-sheet-options';
|
||||
export { ActionSheetButton, ActionSheetOptions } from './components/action-sheet/action-sheet-options';
|
||||
export { ActionSheetCmp } from './components/action-sheet/action-sheet-component';
|
||||
export { Alert } from './components/alert/alert';
|
||||
export { AlertController } from './components/alert/alert-controller';
|
||||
|
||||
@@ -11,7 +11,7 @@ $cordova-ios-statusbar-padding-modal-max-width: $cordova-statusbar-paddi
|
||||
|
||||
// Cordova mixins are in the main cordova file
|
||||
.ios {
|
||||
@include statusbar-padding($toolbar-ios-height, $toolbar-ios-padding, $content-ios-padding, $cordova-ios-statusbar-padding, $cordova-ios-statusbar-padding-modal-max-width, true);
|
||||
@include statusbar-padding($toolbar-ios-height, $toolbar-ios-padding, $content-ios-padding, $cordova-ios-statusbar-padding, $cordova-ios-statusbar-padding-modal-max-width, true);
|
||||
|
||||
@include footer-safe-area($toolbar-ios-height, $toolbar-ios-padding);
|
||||
@include footer-safe-area($toolbar-ios-height, $toolbar-ios-padding);
|
||||
}
|
||||
|
||||
@@ -228,6 +228,12 @@ export function parseDate(val: any): DateTimeData {
|
||||
};
|
||||
}
|
||||
|
||||
export function compareDates(d1: DateTimeData, d2: DateTimeData): number {
|
||||
const date1 = new Date(d1.year, d1.month, d1.day, d1.hour, d1.minute, d1.second);
|
||||
const date2 = new Date(d2.year, d2.month, d2.day, d2.hour, d2.minute, d2.second);
|
||||
|
||||
return date1.getTime() - date2.getTime();
|
||||
}
|
||||
|
||||
export function updateDate(existingData: DateTimeData, newData: any): boolean {
|
||||
if (isPresent(newData) && newData !== '') {
|
||||
|
||||
Reference in New Issue
Block a user