Skip to content

Commit ec6e0f1

Browse files
aleksei-semikozovAleksei SemikozovAleksei Semikozovmarker-dao
authored
Editors and Overlays: remove deprecated options (DevExpress#30201)
Signed-off-by: Aleksei Semikozov <[email protected]> Co-authored-by: Aleksei Semikozov <[email protected]> Co-authored-by: Aleksei Semikozov <[email protected]> Co-authored-by: marker dao ® <[email protected]>
1 parent b0c603a commit ec6e0f1

File tree

16 files changed

+310
-501
lines changed

16 files changed

+310
-501
lines changed

packages/devextreme/js/__internal/ui/context_menu/m_context_menu.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,6 @@ class ContextMenu extends MenuBase {
153153
}]);
154154
}
155155

156-
_setDeprecatedOptions(): void {
157-
super._setDeprecatedOptions();
158-
extend(this._deprecatedOptions, {
159-
closeOnOutsideClick: { since: '22.2', alias: 'hideOnOutsideClick' },
160-
});
161-
}
162-
163156
_initActions(): void {
164157
this._actions = {};
165158

@@ -630,15 +623,13 @@ class ContextMenu extends MenuBase {
630623
}
631624

632625
_shouldHideOnOutsideClick(e) {
633-
// @ts-expect-error
634-
const { closeOnOutsideClick, hideOnOutsideClick } = this.option();
626+
const hideOnOutsideClick = this.option('hideOnOutsideClick');
635627

636628
if (isFunction(hideOnOutsideClick)) {
637629
return hideOnOutsideClick(e);
638-
} if (isFunction(closeOnOutsideClick)) {
639-
return closeOnOutsideClick(e);
640630
}
641-
return hideOnOutsideClick || closeOnOutsideClick;
631+
632+
return hideOnOutsideClick;
642633
}
643634

644635
_hideOnOutsideClickHandler(e): boolean {

packages/devextreme/js/__internal/ui/drop_down_editor/m_drop_down_editor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,6 @@ class DropDownEditor<
635635
_renderPopup(): void {
636636
const popupConfig = extend(this._popupConfig(), this._options.cache('dropDownOptions'));
637637

638-
delete popupConfig.closeOnOutsideClick;
639638
// @ts-expect-error ts-error
640639
this._popup = this._createComponent(this._$popup, Popup, popupConfig);
641640

packages/devextreme/js/__internal/ui/html_editor/modules/m_toolbar.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -241,24 +241,6 @@ if (Quill) {
241241
return $container;
242242
}
243243

244-
_detectRenamedOptions(item) {
245-
const optionsInfo = [{
246-
newName: 'name',
247-
oldName: 'formatName',
248-
}, {
249-
newName: 'acceptedValues',
250-
oldName: 'formatValues',
251-
}];
252-
253-
if (isObject(item)) {
254-
each(optionsInfo, (index, optionName) => {
255-
if (Object.prototype.hasOwnProperty.call(item, optionName.oldName)) {
256-
errors.log('W1016', optionName.oldName, optionName.newName);
257-
}
258-
});
259-
}
260-
}
261-
262244
_subscribeFormatHotKeys() {
263245
this.quill.keyboard.addBinding({
264246
which: KEY_CODES.b,
@@ -299,7 +281,6 @@ if (Quill) {
299281

300282
each(this.options.items, (index, item) => {
301283
let newItem;
302-
this._detectRenamedOptions(item);
303284
if (isObject(item)) {
304285
newItem = this._handleObjectItem(item);
305286
} else if (item === TOOLBAR_AI_ITEM_NAME) {

packages/devextreme/js/__internal/ui/m_lookup.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ class Lookup extends DropDownList<LookupProperties> {
154154
};
155155
}
156156

157-
_setDeprecatedOptions() {
158-
super._setDeprecatedOptions();
159-
extend(this._deprecatedOptions, {
160-
valueChangeEvent: { since: '22.1', alias: 'searchStartEvent' },
161-
});
162-
}
163-
164157
_defaultOptionsRules() {
165158
const themeName = current();
166159

@@ -710,8 +703,7 @@ class Lookup extends DropDownList<LookupProperties> {
710703
// @ts-expect-error ts-error
711704
shading: dropDownOptions.shading,
712705
// @ts-expect-error ts-error
713-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
714-
hideOnOutsideClick: dropDownOptions.hideOnOutsideClick || dropDownOptions.closeOnOutsideClick,
706+
hideOnOutsideClick: dropDownOptions.hideOnOutsideClick,
715707
_loopFocus: shouldLoopFocusInsidePopup,
716708
});
717709

packages/devextreme/js/__internal/ui/m_select_box.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ class SelectBox<
206206
placeholder: messageLocalization.format('Select'),
207207
fieldTemplate: null,
208208
customItemCreateEvent: 'change',
209-
valueChangeEvent: 'change',
210209
acceptCustomValue: false,
211210
onCustomItemCreating(e): void {
212211
if (!isDefined(e.customItem)) {
@@ -248,13 +247,6 @@ class SelectBox<
248247
return `${super._popupWrapperClass()} ${SELECTBOX_POPUP_WRAPPER_CLASS}`;
249248
}
250249

251-
_setDeprecatedOptions(): void {
252-
super._setDeprecatedOptions();
253-
extend(this._deprecatedOptions, {
254-
valueChangeEvent: { since: '22.2', alias: 'customItemCreateEvent' },
255-
});
256-
}
257-
258250
_cancelEditing(): void {
259251
if (!this.option('searchEnabled') && this._list) {
260252
this._focusListElement(null);

packages/devextreme/js/__internal/ui/overlay/m_overlay.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ class Overlay<
202202
},
203203
},
204204
},
205-
closeOnOutsideClick: false,
206205
hideOnOutsideClick: false,
207206
_ignorePreventScrollEventsDeprecation: false,
208207
onShowing: null,
@@ -257,13 +256,6 @@ class Overlay<
257256
return this._$content;
258257
}
259258

260-
_setDeprecatedOptions(): void {
261-
super._setDeprecatedOptions();
262-
extend(this._deprecatedOptions, {
263-
closeOnOutsideClick: { since: '22.1', alias: 'hideOnOutsideClick' },
264-
});
265-
}
266-
267259
ctor(element: Element, options: TProperties): void {
268260
super.ctor(element, options);
269261

@@ -1350,7 +1342,6 @@ class Overlay<
13501342
this._toggleHideOnParentsScrollSubscription(visible);
13511343
break;
13521344
}
1353-
case 'closeOnOutsideClick':
13541345
case 'hideOnOutsideClick':
13551346
case 'propagateOutsideClick':
13561347
break;

packages/devextreme/js/__internal/ui/speed_dial_action/m_speed_dial_main_item.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ const modifyActionOptions = (action) => {
7373

7474
export interface SpeedDialMainItemProperties extends SpeedDialItemProperties {
7575
maxSpeedDialActionCount: number;
76-
77-
closeOnOutsideClick?: boolean;
7876
}
7977

8078
class SpeedDialMainItem extends SpeedDialItem {
@@ -219,8 +217,6 @@ class SpeedDialMainItem extends SpeedDialItem {
219217

220218
const defaultOptions = this._getDefaultOptions();
221219

222-
delete defaultOptions.closeOnOutsideClick;
223-
224220
return visibleActions.length === 1
225221
? extend(modifyActionOptions(visibleActions[0]), { position: this._getPosition() })
226222
: extend(defaultOptions, { visible: visibleActions.length !== 0 });

packages/devextreme/js/ui/widget/ui.errors.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,6 @@ export default errorUtils(errors.ERROR_MESSAGES, {
316316
*/
317317
W1014: 'The Floating Action Button exceeds the recommended speed dial action count. If you need to display more speed dial actions, increase the maxSpeedDialActionCount option value in the global config.',
318318

319-
/**
320-
* @name ErrorsUIWidgets.W1016
321-
*/
322-
W1016: 'The \'{0}\' field in the HTML Editor toolbar item configuration was renamed to \'{1}\'. Please make a corresponding change in your code.',
323-
324319
/**
325320
* @name ErrorsUIWidgets.W1017
326321
*/

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/lookup.tests.js

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4680,43 +4680,24 @@ QUnit.module('searchStartEvent', {
46804680
init();
46814681
}
46824682
}, () => {
4683-
['valueChangeEvent', 'searchStartEvent'].forEach((propName) => {
4684-
QUnit.test(`${propName} specifies event to start search`, function(assert) {
4685-
this.reinit({ [propName]: 'change' });
4683+
QUnit.test('searchStartEvent specifies event to start search', function(assert) {
4684+
this.reinit({ searchStartEvent: 'change' });
46864685

4687-
this.keyboard.type('11');
4688-
assert.strictEqual(this.getItemsCount(), 3, 'items are not filtered');
4686+
this.keyboard.type('11');
4687+
assert.strictEqual(this.getItemsCount(), 3, 'items are not filtered');
46894688

4690-
this.keyboard.change();
4691-
assert.strictEqual(this.getItemsCount(), 2, 'items are filtered after search start event is fired');
4692-
});
4693-
4694-
QUnit.test(`${propName} specifies event to start search (runtime change)`, function(assert) {
4695-
this.lookup.option(propName, 'change');
4696-
4697-
this.keyboard.type('11');
4698-
assert.strictEqual(this.getItemsCount(), 3, 'items are not filtered');
4699-
4700-
this.keyboard.change();
4701-
assert.strictEqual(this.getItemsCount(), 2, 'items are filtered after search start event is fired');
4702-
});
4689+
this.keyboard.change();
4690+
assert.strictEqual(this.getItemsCount(), 2, 'items are filtered after search start event is fired');
47034691
});
47044692

4705-
QUnit.test('valueChangeEvent prop using should raise a warning about deprecation', function(assert) {
4706-
sinon.spy(errors, 'log');
4693+
QUnit.test('searchStartEvent specifies event to start search (runtime change)', function(assert) {
4694+
this.lookup.option('searchStartEvent', 'change');
47074695

4708-
try {
4709-
this.lookup.option('valueChangeEvent', 'change');
4710-
assert.deepEqual(errors.log.lastCall.args, [
4711-
'W0001',
4712-
'dxLookup',
4713-
'valueChangeEvent',
4714-
'22.1',
4715-
'Use the \'searchStartEvent\' option instead'
4716-
], 'warning is raised with correct parameters');
4717-
} finally {
4718-
errors.log.restore();
4719-
}
4696+
this.keyboard.type('11');
4697+
assert.strictEqual(this.getItemsCount(), 3, 'items are not filtered');
4698+
4699+
this.keyboard.change();
4700+
assert.strictEqual(this.getItemsCount(), 2, 'items are filtered after search start event is fired');
47204701
});
47214702

47224703
QUnit.test('no warning should be logged on pure init', function(assert) {

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/selectBox.tests.js

Lines changed: 33 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ const KEY_SPACE = ' ';
8585

8686
const TIME_TO_WAIT = 500;
8787

88-
const VALUE_CHANGE_EVENT_OPTIONS = ['valueChangeEvent', 'customItemCreateEvent'];
89-
9088
const toSelector = (className) => {
9189
return '.' + className;
9290
};
@@ -4277,37 +4275,35 @@ QUnit.module('Scrolling', {
42774275
});
42784276

42794277
QUnit.module('Async tests', {}, () => {
4280-
VALUE_CHANGE_EVENT_OPTIONS.forEach(eventOptionName => {
4281-
QUnit.testInActiveWindow(`Value should be reset after on selectedItem after focusout when ${eventOptionName}='change'`, function(assert) {
4282-
const done = assert.async();
4283-
const items = [1, 2];
4284-
const $selectBox = $('#selectBox').dxSelectBox({
4285-
searchEnabled: true,
4286-
items: items,
4287-
value: items[0],
4288-
[eventOptionName]: 'change',
4289-
searchTimeout: 0
4290-
});
4291-
const selectBox = $selectBox.dxSelectBox('instance');
4292-
const $input = $selectBox.find(toSelector(TEXTEDITOR_INPUT_CLASS));
4293-
const keyboard = keyboardMock($input);
4278+
QUnit.testInActiveWindow('Value should be reset after on selectedItem after focusout when customItemCreateEvent=\'change\'', function(assert) {
4279+
const done = assert.async();
4280+
const items = [1, 2];
4281+
const $selectBox = $('#selectBox').dxSelectBox({
4282+
searchEnabled: true,
4283+
items: items,
4284+
value: items[0],
4285+
customItemCreateEvent: 'change',
4286+
searchTimeout: 0
4287+
});
4288+
const selectBox = $selectBox.dxSelectBox('instance');
4289+
const $input = $selectBox.find(toSelector(TEXTEDITOR_INPUT_CLASS));
4290+
const keyboard = keyboardMock($input);
42944291

4295-
$input.focus();
4292+
$input.focus();
42964293

4297-
keyboard
4298-
.press('end')
4299-
.press('backspace')
4300-
.type('2');
4294+
keyboard
4295+
.press('end')
4296+
.press('backspace')
4297+
.type('2');
43014298

4302-
$input.blur();
4299+
$input.blur();
43034300

4304-
setTimeout(() => {
4305-
assert.equal(selectBox.option('value'), items[0], 'value is not changed');
4306-
assert.equal(selectBox.option('selectedItem'), items[0], 'selectedItem is not changed');
4307-
assert.equal($input.val(), items[0], 'input is reset');
4308-
done();
4309-
}, 0);
4310-
});
4301+
setTimeout(() => {
4302+
assert.equal(selectBox.option('value'), items[0], 'value is not changed');
4303+
assert.equal(selectBox.option('selectedItem'), items[0], 'selectedItem is not changed');
4304+
assert.equal($input.val(), items[0], 'input is reset');
4305+
done();
4306+
}, 0);
43114307
});
43124308

43134309
QUnit.test('the selected item should be visible if the data source is loaded after the delay (T386513)', function(assert) {
@@ -6493,18 +6489,16 @@ QUnit.module('valueChanged handler should receive correct event', {
64936489
this.testProgramChange(assert);
64946490
});
64956491

6496-
VALUE_CHANGE_EVENT_OPTIONS.forEach(eventOptionName => {
6497-
QUnit.test(`on input if ${eventOptionName}=input and acceptCustomValue=true`, function(assert) {
6498-
this.reinit({
6499-
acceptCustomValue: true,
6500-
[eventOptionName]: 'input',
6501-
});
6492+
QUnit.test('on input if customItemCreateEvent=input and acceptCustomValue=true', function(assert) {
6493+
this.reinit({
6494+
acceptCustomValue: true,
6495+
customItemCreateEvent: 'input',
6496+
});
65026497

6503-
this.keyboard.type('1');
6498+
this.keyboard.type('1');
65046499

6505-
this.checkEvent(assert, 'input', this.$input);
6506-
this.testProgramChange(assert);
6507-
});
6500+
this.checkEvent(assert, 'input', this.$input);
6501+
this.testProgramChange(assert);
65086502
});
65096503

65106504
['del', 'backspace'].forEach(key => {
@@ -6567,63 +6561,6 @@ QUnit.module('displayExpr', moduleSetup, () => {
65676561
});
65686562
});
65696563

6570-
QUnit.module('The "customItemCreateEvent" option warning', {
6571-
beforeEach: function() {
6572-
this.$selectBox = $('#selectBox');
6573-
6574-
const defaultOptions = {
6575-
items: ['item 1'],
6576-
acceptCustomValue: true,
6577-
onCustomItemCreating: (e) => {
6578-
e.customItem = e.text;
6579-
}
6580-
};
6581-
6582-
const init = (options = {}) => {
6583-
this.selectBox = this.$selectBox
6584-
.dxSelectBox($.extend({}, defaultOptions, options))
6585-
.dxSelectBox('instance');
6586-
};
6587-
6588-
this.reinit = (options) => {
6589-
this.selectBox.dispose();
6590-
init(options);
6591-
};
6592-
6593-
init();
6594-
}
6595-
}, () => {
6596-
QUnit.test('valueChangeEvent prop using should raise a warning about deprecation', function(assert) {
6597-
const errorsSpy = sinon.spy(errors, 'log');
6598-
6599-
try {
6600-
this.selectBox.option('valueChangeEvent', 'change');
6601-
6602-
assert.deepEqual(errorsSpy.lastCall.args, [
6603-
'W0001',
6604-
'dxSelectBox',
6605-
'valueChangeEvent',
6606-
'22.2',
6607-
'Use the \'customItemCreateEvent\' option instead'
6608-
], 'warning is raised with correct parameters');
6609-
} finally {
6610-
errorsSpy.restore();
6611-
}
6612-
});
6613-
6614-
QUnit.test('no warning should be logged on pure init', function(assert) {
6615-
const errorsSpy = sinon.spy(errors, 'log');
6616-
6617-
try {
6618-
this.reinit();
6619-
this.selectBox.option('customItemCreateEvent', 'change');
6620-
} finally {
6621-
assert.strictEqual(errorsSpy.callCount, 0, 'no warning is logged');
6622-
errorsSpy.restore();
6623-
}
6624-
});
6625-
});
6626-
66276564
QUnit.module('the "customItemCreateEvent" option', {
66286565
beforeEach: function() {
66296566
this.$selectBox = $('#selectBox').dxSelectBox({

0 commit comments

Comments
 (0)