Skip to content

Commit

Permalink
Merge branch '20_2' into merge_preact
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyMartynov authored May 27, 2020
2 parents 1050bdd + b7cd90b commit 23c4ec7
Show file tree
Hide file tree
Showing 54 changed files with 438 additions and 1,588 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ matrix:
- { TARGET: test, PERF: true, JQUERY: true, NO_HEADLESS: true }
- { TARGET: test, MOBILE_UA: ios9, CONSTEL: ui }
- { TARGET: test, MOBILE_UA: ios9, CONSTEL: ui.editors, NO_HEADLESS: true }
- { TARGET: test, MOBILE_UA: ios9, CONSTEL: ui.grid }
- { TARGET: test, MOBILE_UA: ios9, CONSTEL: ui.grid, NO_HEADLESS: true }
- { TARGET: test, MOBILE_UA: ios9, CONSTEL: ui.scheduler }
- { TARGET: test, MOBILE_UA: ios9, CONSTEL: viz }
- { TARGET: test, MOBILE_UA: android6, JQUERY: true, CONSTEL: ui }
- { TARGET: test, MOBILE_UA: android6, JQUERY: true, CONSTEL: ui.editors, NO_HEADLESS: true }
- { TARGET: test, MOBILE_UA: android6, JQUERY: true, CONSTEL: ui.grid }
- { TARGET: test, MOBILE_UA: android6, JQUERY: true, CONSTEL: ui.grid, NO_HEADLESS: true }
- { TARGET: test, MOBILE_UA: android6, JQUERY: true, CONSTEL: ui.scheduler }
- { TARGET: test, MOBILE_UA: android6, JQUERY: true, CONSTEL: viz }
- { TARGET: test, BROWSER: firefox, JQUERY: true, CONSTEL: export }
Expand Down
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ env:
- TARGET=test PERF=true JQUERY=true NO_HEADLESS=true
- TARGET=test MOBILE_UA=ios9 CONSTEL=ui
- TARGET=test MOBILE_UA=ios9 CONSTEL=ui.editors NO_HEADLESS=true
- TARGET=test MOBILE_UA=ios9 CONSTEL=ui.grid
- TARGET=test MOBILE_UA=ios9 CONSTEL=ui.grid NO_HEADLESS=true
- TARGET=test MOBILE_UA=ios9 CONSTEL=ui.scheduler
- TARGET=test MOBILE_UA=ios9 CONSTEL=viz
- TARGET=test MOBILE_UA=android6 JQUERY=true CONSTEL=ui
- TARGET=test MOBILE_UA=android6 JQUERY=true CONSTEL=ui.editors NO_HEADLESS=true
- TARGET=test MOBILE_UA=android6 JQUERY=true CONSTEL=ui.grid
- TARGET=test MOBILE_UA=android6 JQUERY=true CONSTEL=ui.grid NO_HEADLESS=true
- TARGET=test MOBILE_UA=android6 JQUERY=true CONSTEL=ui.scheduler
- TARGET=test MOBILE_UA=android6 JQUERY=true CONSTEL=viz
- TARGET=test BROWSER=firefox JQUERY=true CONSTEL=export
Expand Down Expand Up @@ -74,6 +74,10 @@ script:
-e CONSTEL=$CONSTEL
-e COMPONENT=$COMPONENT
-e JQUERY=$JQUERY
-e PERF=$PERF
-e TZ=$TZ
-e MOBILE_UA=$MOBILE_UA
-e QUARANTINE_MODE=$QUARANTINE_MODE
-v $TRAVIS_BUILD_DIR:/devextreme
docker.io/devexpress/devextreme-build:20_2
./docker-ci.sh
5 changes: 0 additions & 5 deletions js/docEnums.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,6 @@
* @enum {'leftBottomRightTop'|'leftTopRightBottom'|'rightBottomLeftTop'|'rightTopLeftBottom'}
*/

/**
* @typedef {string} Enums.TreeMapResolveLabelOverflow
* @enum {'ellipsis'|'hide'}
*/

/**
* @typedef {string} Enums.TreeMapColorizerType
* @enum {'discrete'|'gradient'|'none'|'range'}
Expand Down
12 changes: 8 additions & 4 deletions js/ui/file_manager/ui.file_manager.item_list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { extend } from '../../core/utils/extend';
import { when } from '../../core/utils/deferred';
import { name as dblClickName } from '../../events/double_click';
import { addNamespace } from '../../events/utils';
import eventsEngine from '../../events/core/events_engine';
Expand Down Expand Up @@ -81,10 +82,7 @@ class FileManagerItemListBase extends Widget {
}

_getItems() {
const itemsGetter = this.option('getItems');
const itemsResult = itemsGetter ? itemsGetter() : [];

return itemsResult.done(itemInfos => {
return this._getItemsInternal().done(itemInfos => {
this._itemCount = itemInfos.length;

const parentDirectoryItem = this._findParentDirectoryItem(itemInfos);
Expand All @@ -93,6 +91,12 @@ class FileManagerItemListBase extends Widget {
});
}

_getItemsInternal() {
const itemsGetter = this.option('getItems');
const itemsResult = itemsGetter ? itemsGetter() : [];
return when(itemsResult);
}

_raiseOnError(error) {
this._actions.onError({ error });
}
Expand Down
21 changes: 17 additions & 4 deletions js/ui/file_manager/ui.file_manager.item_list.thumbnails.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import $ from '../../core/renderer';
import { extend } from '../../core/utils/extend';
import { Deferred } from '../../core/utils/deferred';
import eventsEngine from '../../events/core/events_engine';
import { addNamespace } from '../../events/utils';
import { name as contextMenuEventName } from '../../events/contextmenu';
Expand Down Expand Up @@ -98,6 +99,14 @@ class FileManagerThumbnailsItemList extends FileManagerItemListBase {
}
}

_getItemsInternal() {
return super._getItemsInternal().then(items => {
const deferred = new Deferred();
setTimeout(() => deferred.resolve(items));
return deferred.promise();
});
}

_disableDragging() {
return false;
}
Expand All @@ -108,14 +117,18 @@ class FileManagerThumbnailsItemList extends FileManagerItemListBase {
});
}

_onItemListSelectionChanged({ addedItems, removedItems }) {
_onItemListSelectionChanged({ addedItemKeys, removedItemKeys }) {
const selectedItemInfos = this.getSelectedItems();
const selectedItems = selectedItemInfos.map(itemInfo => itemInfo.fileItem);
const selectedItemKeys = selectedItems.map(item => item.key);
const currentSelectedItemKeys = addedItems.map(itemInfo => itemInfo.fileItem.key);
const currentDeselectedItemKeys = removedItems.map(itemInfo => itemInfo.fileItem.key);

this._tryRaiseSelectionChanged({ selectedItemInfos, selectedItems, selectedItemKeys, currentSelectedItemKeys, currentDeselectedItemKeys });
this._tryRaiseSelectionChanged({
selectedItemInfos,
selectedItems,
selectedItemKeys,
currentSelectedItemKeys: addedItemKeys,
currentDeselectedItemKeys: removedItemKeys
});
}

_onItemListFocusedItemChanged({ item, itemElement }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import $ from '../../core/renderer';
import { extend } from '../../core/utils/extend';
import { find } from '../../core/utils/array';
import { isDefined } from '../../core/utils/type';
import { Deferred } from '../../core/utils/deferred';
import { Deferred, when } from '../../core/utils/deferred';

import holdEvent from '../../events/hold';
import { addNamespace } from '../../events/utils';
Expand All @@ -12,6 +12,7 @@ import { BindableTemplate } from '../../core/templates/bindable_template';

import ScrollView from '../scroll_view/ui.scroll_view';
import CollectionWidget from '../collection/ui.collection_widget.edit';
import Selection from '../selection/selection';

const FILE_MANAGER_THUMBNAILS_VIEW_PORT_CLASS = 'dx-filemanager-thumbnails-view-port';
const FILE_MANAGER_THUMBNAILS_ITEM_LIST_CONTAINER_CLASS = 'dx-filemanager-thumbnails-container';
Expand Down Expand Up @@ -260,19 +261,77 @@ class FileManagerThumbnailListBox extends CollectionWidget {
this._selection.changeItemSelection(index, options);
}

_updateSelection(addedSelection, removedSelection) {
for(let i = 0; i < removedSelection.length; i++) {
this._removeSelection(removedSelection[i]);
}
for(let i = 0; i < addedSelection.length; i++) {
this._addSelection(addedSelection[i]);
_initSelectionModule() {
super._initSelectionModule();

const options = extend(this._selection.options, {
selectedKeys: this.option('selectedItemKeys'),
onSelectionChanged: args => {
this.option('selectedItems', this._getItemsByKeys(args.selectedItemKeys, args.selectedItems));
this._updateSelectedItems(args);
}
});

this._selection = new Selection(options);
}

_updateSelectedItems(args) {
const addedItemKeys = args.addedItemKeys;
const removedItemKeys = args.removedItemKeys;

if(this._rendered && (addedItemKeys.length || removedItemKeys.length)) {
const selectionChangePromise = this._selectionChangePromise;
if(!this._rendering) {
const addedSelection = [];
let normalizedIndex;
const removedSelection = [];

this._editStrategy.beginCache();

for(let i = 0; i < removedItemKeys.length; i++) {
normalizedIndex = this._getIndexByKey(removedItemKeys[i]);
removedSelection.push(normalizedIndex);
this._removeSelection(normalizedIndex);
}

for(let i = 0; i < addedItemKeys.length; i++) {
normalizedIndex = this._getIndexByKey(addedItemKeys[i]);
addedSelection.push(normalizedIndex);
this._addSelection(normalizedIndex);
}

this._editStrategy.endCache();

this._updateSelection(addedSelection, removedSelection);
}

when(selectionChangePromise).done(() => this._fireSelectionChangeEvent(args));
}
}

_fireSelectionChangeEvent(args) {
this._createActionByOption('onSelectionChanged', {
excludeValidators: ['disabled', 'readOnly']
})(args);
}

_updateSelection(addedSelection, removedSelection) {
const selectedItemsCount = this.getSelectedItems().length;
if(selectedItemsCount === 0) {
this._isPreserveSelectionMode = false;
}
}

_normalizeSelectedItems() {
const newKeys = this._getKeysByItems(this.option('selectedItems'));
const oldKeys = this._selection.getSelectedItemKeys();
if(!this._compareKeys(oldKeys, newKeys)) {
this._selection.setSelection(newKeys);
}

return new Deferred().resolve().promise();
}

_focusOutHandler() {}

_getItems() {
Expand Down
4 changes: 3 additions & 1 deletion js/ui/file_manager/ui.file_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const FILE_MANAGER_EDITING_CONTAINER_CLASS = FILE_MANAGER_CLASS + '-editing-cont
const FILE_MANAGER_ITEMS_PANEL_CLASS = FILE_MANAGER_CLASS + '-items-panel';
const FILE_MANAGER_ITEM_CUSTOM_THUMBNAIL_CLASS = FILE_MANAGER_CLASS + '-item-custom-thumbnail';

const PARENT_DIRECTORY_KEY_PREFIX = '[*DXPDK*]$40F96F03-FBD8-43DF-91BE-F55F4B8BA871$';

class FileManager extends Widget {

_initTemplates() {
Expand Down Expand Up @@ -370,7 +372,7 @@ class FileManager extends Widget {
parentDirItem.isParentFolder = true;
parentDirItem.name = '..';
parentDirItem.relativeName = '..';
parentDirItem.key = [];
parentDirItem.key = `${PARENT_DIRECTORY_KEY_PREFIX}${selectedDir.fileItem.key}`;

const itemsCopy = [...items];
itemsCopy.unshift({
Expand Down
4 changes: 3 additions & 1 deletion js/ui/gantt/ui.gantt.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ class Gantt extends Widget {
this._setGanttViewOption(dataSourceName, mappedData);
if(dataSourceName === GANTT_TASKS) {
this._tasksRaw = data;
const expandedRowKeys = data.map(t => t.parentId).filter((value, index, self) => value && self.indexOf(value) === index);
this._setTreeListOption('expandedRowKeys', expandedRowKeys);
this._setTreeListOption('dataSource', data);
}
}
Expand Down Expand Up @@ -430,7 +432,7 @@ class Gantt extends Widget {
this._setTreeListOption('dataSource', treeDataSource);
}
_appendCustomFields(data) {
const modelData = this._tasksOption._getItems();
const modelData = this._tasksOption && this._tasksOption._getItems();
const keyGetter = dataCoreUtils.compileGetter(this.option(`${GANTT_TASKS}.keyExpr`));
return data.reduce((previous, item) => {
const modelItem = modelData && modelData.filter((obj) => keyGetter(obj) === keyGetter(item))[0];
Expand Down
2 changes: 1 addition & 1 deletion js/ui/number_box/number_box.mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ const NumberBoxMask = NumberBoxBase.inherit({
}

if(this._removeStubs(editedText) === '') {
parsedValue = this._parsedValue * 0;
parsedValue = Math.abs(this._parsedValue * 0);
}

if(isNaN(parsedValue)) {
Expand Down
4 changes: 3 additions & 1 deletion js/ui/pivot_grid/ui.pivot_grid.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ exports.findField = function(fields, id) {
};

exports.formatValue = function(value, options) {
// because isNaN function works incorrectly with strings and undefined (T889965)
const valueText = value === value && format(value, options.format);
const formatObject = {
value: value,
valueText: format(value, options.format) || ''
valueText: valueText || ''
};
return options.customizeText ? options.customizeText.call(options, formatObject) : formatObject.valueText;
};
Expand Down
61 changes: 40 additions & 21 deletions js/ui/scheduler/ui.scheduler.navigator.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
const $ = require('../../core/renderer');
const noop = require('../../core/utils/common').noop;
const isNumeric = require('../../core/utils/type').isNumeric;
const errors = require('../widget/ui.errors');
const dateUtils = require('../../core/utils/date');
const typeUtils = require('../../core/utils/type');
const extend = require('../../core/utils/extend').extend;
const registerComponent = require('../../core/component_registrator');
const devices = require('../../core/devices');
const Widget = require('../widget/ui.widget');
const Button = require('../button');
const Calendar = require('../calendar');
const Popover = require('../popover');
const Popup = require('../popup');
const publisherMixin = require('./ui.scheduler.publisher_mixin');
const dateLocalization = require('../../localization/date');
const isDefined = require('../../core/utils/type').isDefined;
import $ from '../../core/renderer';
import { noop } from '../../core/utils/common';
import { isNumeric } from '../../core/utils/type';
import errors from '../widget/ui.errors';
import dateUtils from '../../core/utils/date';
import typeUtils from '../../core/utils/type';
import { extend } from '../../core/utils/extend';
import registerComponent from '../../core/component_registrator';
import devices from '../../core/devices';
import Widget from '../widget/ui.widget';
import Button from '../button';
import Calendar from '../calendar';
import Popover from '../popover';
import Popup from '../popup';
import publisherMixin from './ui.scheduler.publisher_mixin';
import dateLocalization from '../../localization/date';
import { isDefined } from '../../core/utils/type';
import Scrollable from '../scroll_view/ui.scrollable';

const ELEMENT_CLASS = 'dx-scheduler-navigator';
const CALENDAR_CLASS = 'dx-scheduler-navigator-calendar';
Expand Down Expand Up @@ -95,7 +96,7 @@ const getWeekCaption = function(date, shift, rejectWeekend) {
};
};

function formatCaptionByMonths(lastDate, firstDate) {
const formatCaptionByMonths = function(lastDate, firstDate) {
const isDifferentMonthDates = firstDate.getMonth() !== lastDate.getMonth();
const isDifferentYears = firstDate.getFullYear() !== lastDate.getFullYear();
const useShortFormat = isDifferentMonthDates || this.option('_useShortDateFormat');
Expand All @@ -111,7 +112,7 @@ function formatCaptionByMonths(lastDate, firstDate) {
}

return firstDateText + '-' + lastDateText;
}
};

const getMonthCaption = function(date) {
const firstDate = new Date(dateUtils.getFirstMonthDate(date));
Expand Down Expand Up @@ -379,9 +380,12 @@ const SchedulerNavigator = Widget.inherit({
this._renderCaptionKeys();
},

_renderPopover: function() {
const overlayType = !devices.current().generic ? Popup : Popover;
_isMobileLayout: function() {
return !devices.current().generic;
},

_renderPopover: function() {
const overlayType = this._isMobileLayout() ? Popup : Popover;
const popoverContainer = $('<div>').addClass(CALENDAR_POPOVER_CLASS);
this._popover = this._createComponent(popoverContainer, overlayType, {
contentTemplate: () => this._createPopupContent(),
Expand Down Expand Up @@ -409,9 +413,24 @@ const SchedulerNavigator = Widget.inherit({
this._popover.$element().appendTo(this.$element());
},

_createScrollable: function(content) {
const result = this._createComponent($('<div>'), Scrollable, {
direction: 'vertical'
});
result.$content().append(content);

return result;
},

_createPopupContent: function() {
const result = $('<div>').addClass(CALENDAR_CLASS);
this._calendar = this._createComponent(result, Calendar, this._calendarOptions());

if(this._isMobileLayout()) {
const scrollable = this._createScrollable(result);
return scrollable.$element();
}

return result;
},

Expand Down
Loading

0 comments on commit 23c4ec7

Please sign in to comment.