Merge branch 'master' of github.com:NativeScript/NativeScript

# Conflicts:
#	packages/core/package.json
#	packages/core/ui/tabs/index.android.ts
This commit is contained in:
Martin Guillon
2020-09-30 17:46:22 +02:00
34 changed files with 184 additions and 117 deletions

View File

@ -1,3 +1,33 @@
## [7.0.8](https://github.com/NativeScript/NativeScript/compare/7.0.7-core...7.0.8) (2020-09-29)
### Bug Fixes
* **core:** global index typing fix for unit testing framework ([#8915](https://github.com/NativeScript/NativeScript/issues/8915)) ([806fc88](https://github.com/NativeScript/NativeScript/commit/806fc880dd944a8808a0f407ae5d0c0d4be55d5d))
* **core:** Observable splice index > length ([#8900](https://github.com/NativeScript/NativeScript/issues/8900)) ([65b1cdb](https://github.com/NativeScript/NativeScript/commit/65b1cdbae0a9e873a3d2bc4636038423351b794e))
* **ios:** Utils.openFile ([#8914](https://github.com/NativeScript/NativeScript/issues/8914)) ([647926e](https://github.com/NativeScript/NativeScript/commit/647926ee281712a82238d5153522d9a07be5870c))
## [7.0.7](https://github.com/NativeScript/NativeScript/compare/7.0.6-core...7.0.7) (2020-09-26)
### Bug Fixes
* **ios:** preferredDatePickerStyle property ([#8899](https://github.com/NativeScript/NativeScript/issues/8899)) ([dbefc43](https://github.com/NativeScript/NativeScript/commit/dbefc43b9bb9b907883990f8d40c178fc7ecea9c))
## [7.0.6](https://github.com/NativeScript/NativeScript/compare/7.0.5-core...7.0.6) (2020-09-25)
### Bug Fixes
* **core:** delegate should be set on nativeTextViewProtected ([#8881](https://github.com/NativeScript/NativeScript/issues/8881)) ([021c0bb](https://github.com/NativeScript/NativeScript/commit/021c0bb9a24f15a9adf9d5e25a981ea53901e600))
* **core:** global handling with env.production flag ([#8903](https://github.com/NativeScript/NativeScript/issues/8903)) ([3437ed7](https://github.com/NativeScript/NativeScript/commit/3437ed7e1483cddf75aeca9bd8ff475e449f110f))
## [7.0.5](https://github.com/NativeScript/NativeScript/compare/7.0.4-core...7.0.5) (2020-09-23) ## [7.0.5](https://github.com/NativeScript/NativeScript/compare/7.0.4-core...7.0.5) (2020-09-23)

View File

@ -1,6 +1,6 @@
<p align="center"> <p align="center">
<a href="http://www.nativescript.org"> <a href="http://www.nativescript.org">
<img alt="NativeScript" src="https://i.imgur.com/YmNIMqS.png" /> <img alt="NativeScript" src="https://d1lfyz5kwt8vu9.cloudfront.net/nativescript-logo.png" width="100"/>
</a> </a>
</p> </p>
@ -11,7 +11,7 @@ NativeScript
[![Build Status](https://travis-ci.org/NativeScript/NativeScript.svg?branch=master)](https://travis-ci.org/NativeScript/NativeScript) [![Build Status](https://travis-ci.org/NativeScript/NativeScript.svg?branch=master)](https://travis-ci.org/NativeScript/NativeScript)
[NativeScript](http://www.nativescript.org) empowers you to access native api's from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile development and can be utilized in a number of diverse use cases. [NativeScript](http://www.nativescript.org) empowers you to access native APIs from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile development and can be utilized in a number of diverse use cases.
## Getting Started and Installation ## Getting Started and Installation

View File

@ -1,6 +1,6 @@
{ {
"name": "nativescript", "name": "nativescript",
"version": "7.0.5", "version": "7.0.8",
"license": "MIT", "license": "MIT",
"config": { "config": {
"npm_alias": "npm" "npm_alias": "npm"

View File

@ -30,6 +30,7 @@
} }
}, },
"include": [ "include": [
"../global-types.d.ts",
"./**/*.ts" "./**/*.ts"
], ],
"exclude": [ "exclude": [

View File

@ -494,7 +494,6 @@ function ensureBroadCastReceiverClass() {
} }
} }
BroadcastReceiverClass = BroadcastReceiver; BroadcastReceiverClass = BroadcastReceiver;
} }

View File

@ -1,4 +1,4 @@
import type {InstrumentationMode} from '../profiling' import type { InstrumentationMode } from '../profiling';
interface IConfigPlatform { interface IConfigPlatform {
/** /**
@ -144,4 +144,3 @@ export interface NativeScriptConfig {
*/ */
cssParser?: 'rework' | 'nativescript' | 'css-tree'; cssParser?: 'rework' | 'nativescript' | 'css-tree';
} }

View File

@ -246,7 +246,7 @@ export class ObservableArray<T> extends Observable {
eventName: CHANGE, eventName: CHANGE,
object: this, object: this,
action: ChangeType.Splice, action: ChangeType.Splice,
index: start, index: Math.min(start, this._array.length-1),
removed: result, removed: result,
addedCount: this._array.length + result.length - length, addedCount: this._array.length + result.length - length,
}); });

View File

@ -1,6 +1,6 @@
import { Observable } from '../data/observable'; import { Observable } from '../data/observable';
export declare class NativeScriptGlobalState { export declare class NativeScriptGlobalState {
events: Observable<any>; events: Observable;
launched: boolean; launched: boolean;
} }
export function installPolyfills(moduleName: string, exportNames: string[]): void; export function installPolyfills(moduleName: string, exportNames: string[]): void;

View File

@ -3,7 +3,7 @@
"main": "index", "main": "index",
"types": "index.d.ts", "types": "index.d.ts",
"description": "NativeScript Core Modules", "description": "NativeScript Core Modules",
"version": "7.0.6-alpha.2", "version": "7.0.8",
"homepage": "https://nativescript.org", "homepage": "https://nativescript.org",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -12,13 +12,7 @@ import {iOSNativeHelper, isFontIconURI, layout} from '../../utils';
import { CSSType, IOSHelper, View } from '../core/view'; import { CSSType, IOSHelper, View } from '../core/view';
import { Frame } from '../frame'; import { Frame } from '../frame';
import { Font } from '../styling/font'; import { Font } from '../styling/font';
import { import { getIconSpecSize, itemsProperty, selectedIndexProperty, TabNavigationBase, tabStripProperty } from '../tab-navigation-base/tab-navigation-base';
getIconSpecSize,
itemsProperty,
selectedIndexProperty,
TabNavigationBase,
tabStripProperty
} from '../tab-navigation-base/tab-navigation-base';
// TODO: // TODO:
// import { profile } from "../../profiling"; // import { profile } from "../../profiling";

View File

@ -13,6 +13,7 @@ export class DatePickerBase extends View implements DatePickerDefinition {
public maxDate: Date; public maxDate: Date;
public minDate: Date; public minDate: Date;
public date: Date; public date: Date;
public iosPreferredDatePickerStyle: number;
} }
DatePickerBase.prototype.recycleNativeView = 'auto'; DatePickerBase.prototype.recycleNativeView = 'auto';
@ -60,3 +61,10 @@ export const dateProperty = new Property<DatePickerBase, Date>({
valueConverter: (v) => new Date(v), valueConverter: (v) => new Date(v),
}); });
dateProperty.register(DatePickerBase); dateProperty.register(DatePickerBase);
export const iosPreferredDatePickerStyleProperty = new Property<DatePickerBase, number>({
name: 'iosPreferredDatePickerStyle',
defaultValue: 0,
valueConverter: (v) => parseInt(v),
});
iosPreferredDatePickerStyleProperty.register(DatePickerBase);

View File

@ -7,6 +7,7 @@ export const dayProperty: Property<DatePicker, number>;
export const dateProperty: Property<DatePicker, Date>; export const dateProperty: Property<DatePicker, Date>;
export const maxDate: Property<DatePicker, Date>; export const maxDate: Property<DatePicker, Date>;
export const minDate: Property<DatePicker, Date>; export const minDate: Property<DatePicker, Date>;
export const iosPreferredDatePickerStyleProperty: Property<DatePicker, number>;
/** /**
* Represents an date picker. * Represents an date picker.
@ -51,4 +52,14 @@ export class DatePicker extends View {
* Gets or sets the min date. * Gets or sets the min date.
*/ */
minDate: Date; minDate: Date;
/**
* Gets or set the UIDatePickerStyle of the date picker in iOS 13.4+. Defaults to 0.
* Valid values are numbers:
* - 0: automatic (system picks the concrete style based on the current platform and date picker mode)
* - 1: wheels (the date picker displays as a wheel picker)
* - 2: compact (the date picker displays as a label that when tapped displays a calendar-style editor)
* - 3: inline (the date pickers displays as an inline, editable field)
*/
iosPreferredDatePickerStyle: number;
} }

View File

@ -5,9 +5,8 @@ import { Device } from '../../platform';
export * from './date-picker-common'; export * from './date-picker-common';
const SUPPORT_DATE_PICKER_STYLE = parseFloat(Device.os) >= 14.0; const SUPPORT_DATE_PICKER_STYLE = parseFloat(Device.osVersion) >= 13.4;
const SUPPORT_TEXT_COLOR = parseFloat(Device.os) < 14.0; const SUPPORT_TEXT_COLOR = parseFloat(Device.osVersion) < 14.0;
const DEFAULT_DATE_PICKER_STYLE = 1;
export class DatePicker extends DatePickerBase { export class DatePicker extends DatePickerBase {
private _changeHandler: NSObject; private _changeHandler: NSObject;
@ -17,7 +16,7 @@ export class DatePicker extends DatePickerBase {
const picker = UIDatePicker.new(); const picker = UIDatePicker.new();
picker.datePickerMode = UIDatePickerMode.Date; picker.datePickerMode = UIDatePickerMode.Date;
if (SUPPORT_DATE_PICKER_STYLE) { if (SUPPORT_DATE_PICKER_STYLE) {
picker.preferredDatePickerStyle = DEFAULT_DATE_PICKER_STYLE; picker.preferredDatePickerStyle = this.iosPreferredDatePickerStyle;
} }
return picker; return picker;
} }

View File

@ -16,7 +16,7 @@ const FragmentClass = (<any>org.nativescript.widgets.FragmentBase).extend('com.t
}, },
onPause(): void { onPause(): void {
this._callbacks.onPause(this, superProto.onStop); this._callbacks.onPause(this, superProto.onPause);
}, },
onCreate(savedInstanceState: android.os.Bundle) { onCreate(savedInstanceState: android.os.Bundle) {

View File

@ -1,3 +1,4 @@
import '../../../globals';
import { isNullOrUndefined } from '../../../utils/types'; import { isNullOrUndefined } from '../../../utils/types';
import * as cssParser from '../../../css'; import * as cssParser from '../../../css';

View File

@ -54,6 +54,16 @@ export class TimePicker extends View {
* Gets or sets the minute interval. * Gets or sets the minute interval.
*/ */
minuteInterval: number; minuteInterval: number;
/**
* Gets or set the UIDatePickerStyle of the date picker in iOS 13.4+. Defaults to 0.
* Valid values are numbers:
* - 0: automatic (system picks the concrete style based on the current platform and date picker mode)
* - 1: wheels (the date picker displays as a wheel picker)
* - 2: compact (the date picker displays as a label that when tapped displays a calendar-style editor)
* - 3: inline (the date pickers displays as an inline, editable field)
*/
iosPreferredDatePickerStyle: number;
} }
export const hourProperty: Property<TimePicker, number>; export const hourProperty: Property<TimePicker, number>;
@ -66,3 +76,5 @@ export const minMinuteProperty: Property<TimePicker, number>;
export const timeProperty: Property<TimePicker, Date>; export const timeProperty: Property<TimePicker, Date>;
export const minuteIntervalProperty: Property<TimePicker, number>; export const minuteIntervalProperty: Property<TimePicker, number>;
export const iosPreferredDatePickerStyleProperty: Property<TimePicker, number>;

View File

@ -5,9 +5,8 @@ import { Device } from '../../platform';
export * from './time-picker-common'; export * from './time-picker-common';
const SUPPORT_DATE_PICKER_STYLE = parseFloat(Device.os) >= 14.0; const SUPPORT_DATE_PICKER_STYLE = parseFloat(Device.osVersion) >= 13.4;
const SUPPORT_TEXT_COLOR = parseFloat(Device.os) < 14.0; const SUPPORT_TEXT_COLOR = parseFloat(Device.osVersion) < 14.0;
const DEFAULT_DATE_PICKER_STYLE = 1;
function getDate(hour: number, minute: number): Date { function getDate(hour: number, minute: number): Date {
let components = NSDateComponents.alloc().init(); let components = NSDateComponents.alloc().init();
@ -36,7 +35,7 @@ export class TimePicker extends TimePickerBase {
const picker = UIDatePicker.new(); const picker = UIDatePicker.new();
picker.datePickerMode = UIDatePickerMode.Time; picker.datePickerMode = UIDatePickerMode.Time;
if (SUPPORT_DATE_PICKER_STYLE) { if (SUPPORT_DATE_PICKER_STYLE) {
picker.preferredDatePickerStyle = DEFAULT_DATE_PICKER_STYLE; picker.preferredDatePickerStyle = this.iosPreferredDatePickerStyle;
} }
return picker; return picker;
} }

View File

@ -98,6 +98,7 @@ export abstract class TimePickerBase extends View implements TimePickerDefinitio
public maxHour: number; public maxHour: number;
public minMinute: number; public minMinute: number;
public maxMinute: number; public maxMinute: number;
public iosPreferredDatePickerStyle: number;
} }
TimePickerBase.prototype.recycleNativeView = 'auto'; TimePickerBase.prototype.recycleNativeView = 'auto';
@ -204,3 +205,10 @@ export const timeProperty = new Property<TimePickerBase, Date>({
}, },
}); });
timeProperty.register(TimePickerBase); timeProperty.register(TimePickerBase);
export const iosPreferredDatePickerStyleProperty = new Property<TimePickerBase, number>({
name: 'iosPreferredDatePickerStyle',
defaultValue: 0,
valueConverter: (v) => parseInt(v),
});
iosPreferredDatePickerStyleProperty.register(TimePickerBase);

View File

@ -11,7 +11,7 @@ export function openFile(filePath: string): boolean {
let path = iOSNativeHelper.isRealDevice() ? filePath.replace('~', appPath) : filePath; let path = iOSNativeHelper.isRealDevice() ? filePath.replace('~', appPath) : filePath;
const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path)); const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path));
controller.delegate = <UIDocumentInteractionControllerDelegate>new iOSNativeHelper.UIDocumentInteractionControllerDelegateImpl(); controller.delegate = iOSNativeHelper.createUIDocumentInteractionControllerDelegate();
return controller.presentPreviewAnimated(true); return controller.presentPreviewAnimated(true);
} catch (e) { } catch (e) {

View File

@ -168,7 +168,10 @@ export namespace iOSNativeHelper {
*/ */
export function applyRotateTransform(transform: any /* CATransform3D*/, x: number, y: number, z: number): any; /* CATransform3D*/ export function applyRotateTransform(transform: any /* CATransform3D*/, x: number, y: number, z: number): any; /* CATransform3D*/
export class UIDocumentInteractionControllerDelegateImpl {} /**
* Create a UIDocumentInteractionControllerDelegate implementation for use with UIDocumentInteractionController
*/
export function createUIDocumentInteractionControllerDelegate(): any;
/** /**
* Checks whether the application is running on real device and not on simulator. * Checks whether the application is running on real device and not on simulator.

View File

@ -14,7 +14,7 @@ function openFileAtRootModule(filePath: string): boolean {
let path = iOSNativeHelper.isRealDevice() ? filePath.replace('~', appPath) : filePath; let path = iOSNativeHelper.isRealDevice() ? filePath.replace('~', appPath) : filePath;
const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path)); const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path));
controller.delegate = new iOSNativeHelper.UIDocumentInteractionControllerDelegateImpl(); controller.delegate = iOSNativeHelper.createUIDocumentInteractionControllerDelegate();
return controller.presentPreviewAnimated(true); return controller.presentPreviewAnimated(true);
} catch (e) { } catch (e) {
@ -127,8 +127,9 @@ export namespace iOSNativeHelper {
return transform; return transform;
} }
export function createUIDocumentInteractionControllerDelegate(): NSObject {
@NativeClass @NativeClass
export class UIDocumentInteractionControllerDelegateImpl extends NSObject implements UIDocumentInteractionControllerDelegate { class UIDocumentInteractionControllerDelegateImpl extends NSObject implements UIDocumentInteractionControllerDelegate {
public static ObjCProtocols = [UIDocumentInteractionControllerDelegate]; public static ObjCProtocols = [UIDocumentInteractionControllerDelegate];
public getViewController(): UIViewController { public getViewController(): UIViewController {
@ -149,6 +150,8 @@ export namespace iOSNativeHelper {
return this.getViewController().view.frame; return this.getViewController().view.frame;
} }
} }
return new UIDocumentInteractionControllerDelegateImpl();
}
export function isRealDevice() { export function isRealDevice() {
try { try {

View File

@ -1,6 +1,6 @@
{ {
"name": "@nativescript/webpack", "name": "@nativescript/webpack",
"version": "3.0.4", "version": "3.0.5",
"main": "index", "main": "index",
"description": "Webpack plugin for NativeScript", "description": "Webpack plugin for NativeScript",
"homepage": "https://nativescript.org", "homepage": "https://nativescript.org",