@syncfusion/ej2-inplace-editor 19.3.45 → 19.4.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +41 -0
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +27 -0
- package/CHANGELOG.md +6 -0
- package/dist/ej2-inplace-editor.umd.min.js +2 -2
- package/dist/ej2-inplace-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-inplace-editor.es2015.js +6 -4
- package/dist/es6/ej2-inplace-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-inplace-editor.es5.js +6 -4
- package/dist/es6/ej2-inplace-editor.es5.js.map +1 -1
- package/dist/global/ej2-inplace-editor.min.js +2 -2
- package/dist/global/ej2-inplace-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/inplace-editor/base/classes.ts +63 -0
- package/dist/ts/inplace-editor/base/events.ts +18 -0
- package/dist/ts/inplace-editor/base/inplace-editor.ts +1750 -0
- package/dist/ts/inplace-editor/base/interface.ts +129 -0
- package/dist/ts/inplace-editor/base/models.ts +49 -0
- package/dist/ts/inplace-editor/base/util.ts +106 -0
- package/dist/ts/inplace-editor/modules/auto-complete.ts +65 -0
- package/dist/ts/inplace-editor/modules/base-module.ts +74 -0
- package/dist/ts/inplace-editor/modules/color-picker.ts +55 -0
- package/dist/ts/inplace-editor/modules/combo-box.ts +63 -0
- package/dist/ts/inplace-editor/modules/date-range-picker.ts +55 -0
- package/dist/ts/inplace-editor/modules/multi-select.ts +88 -0
- package/dist/ts/inplace-editor/modules/rte.ts +72 -0
- package/dist/ts/inplace-editor/modules/slider.ts +59 -0
- package/dist/ts/inplace-editor/modules/time-picker.ts +54 -0
- package/package.json +16 -16
- package/src/inplace-editor/base/inplace-editor.d.ts +1 -0
- package/src/inplace-editor/base/inplace-editor.js +6 -4
- package/styles/bootstrap-dark.css +5 -0
- package/styles/bootstrap.css +5 -0
- package/styles/bootstrap4.css +10 -0
- package/styles/bootstrap5-dark.css +10 -4
- package/styles/bootstrap5.css +10 -4
- package/styles/fabric-dark.css +5 -0
- package/styles/fabric.css +5 -0
- package/styles/highcontrast-light.css +5 -0
- package/styles/highcontrast.css +5 -0
- package/styles/inplace-editor/_bootstrap-dark-definition.scss +1 -0
- package/styles/inplace-editor/_bootstrap-definition.scss +1 -0
- package/styles/inplace-editor/_bootstrap4-definition.scss +1 -0
- package/styles/inplace-editor/_bootstrap5-definition.scss +1 -0
- package/styles/inplace-editor/_fabric-dark-definition.scss +1 -0
- package/styles/inplace-editor/_fabric-definition.scss +1 -0
- package/styles/inplace-editor/_fluent-definition.scss +69 -0
- package/styles/inplace-editor/_highcontrast-definition.scss +1 -0
- package/styles/inplace-editor/_highcontrast-light-definition.scss +1 -0
- package/styles/inplace-editor/_layout.scss +3 -4
- package/styles/inplace-editor/_material-dark-definition.scss +1 -0
- package/styles/inplace-editor/_material-definition.scss +1 -0
- package/styles/inplace-editor/_tailwind-definition.scss +1 -0
- package/styles/inplace-editor/_theme.scss +4 -1
- package/styles/inplace-editor/bootstrap-dark.css +5 -0
- package/styles/inplace-editor/bootstrap.css +5 -0
- package/styles/inplace-editor/bootstrap4.css +10 -0
- package/styles/inplace-editor/bootstrap5-dark.css +10 -4
- package/styles/inplace-editor/bootstrap5.css +10 -4
- package/styles/inplace-editor/fabric-dark.css +5 -0
- package/styles/inplace-editor/fabric.css +5 -0
- package/styles/inplace-editor/highcontrast-light.css +5 -0
- package/styles/inplace-editor/highcontrast.css +5 -0
- package/styles/inplace-editor/icons/_fluent.scss +19 -0
- package/styles/inplace-editor/material-dark.css +5 -0
- package/styles/inplace-editor/material.css +5 -0
- package/styles/inplace-editor/tailwind-dark.css +5 -4
- package/styles/inplace-editor/tailwind.css +5 -4
- package/styles/material-dark.css +5 -0
- package/styles/material.css +5 -0
- package/styles/tailwind-dark.css +5 -4
- package/styles/tailwind.css +5 -4
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ButtonModel } from '@syncfusion/ej2-buttons';
|
|
2
|
+
import { ColorPicker, Slider } from '@syncfusion/ej2-inputs';
|
|
3
|
+
import { RichTextEditor } from '@syncfusion/ej2-richtexteditor';
|
|
4
|
+
import { DateRangePicker, TimePicker, DateRange } from '@syncfusion/ej2-calendars';
|
|
5
|
+
import { AutoComplete, ComboBox, MultiSelect, FieldSettingsModel } from '@syncfusion/ej2-dropdowns';
|
|
6
|
+
import { RenderMode } from './inplace-editor';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Defines component types that can be used in the In-place Editor.
|
|
10
|
+
*
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export type Component = AutoComplete | ColorPicker | ComboBox | DateRangePicker | MultiSelect | RichTextEditor | Slider | TimePicker;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Provides information about a Notify.
|
|
18
|
+
*/
|
|
19
|
+
export interface NotifyParams {
|
|
20
|
+
type?: string
|
|
21
|
+
module: string
|
|
22
|
+
target?: HTMLElement | HTMLInputElement
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provides information about a Component.
|
|
27
|
+
*/
|
|
28
|
+
export interface IComponent {
|
|
29
|
+
showPopup?(): void
|
|
30
|
+
compObj: Component
|
|
31
|
+
render(e: NotifyParams): void
|
|
32
|
+
focus(): void
|
|
33
|
+
updateValue(e: NotifyParams): void
|
|
34
|
+
refresh?(): void
|
|
35
|
+
getRenderValue?(): void
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Provides information about a Button.
|
|
40
|
+
*/
|
|
41
|
+
export interface IButton {
|
|
42
|
+
type: string
|
|
43
|
+
constant: string
|
|
44
|
+
// eslint-disable-next-line
|
|
45
|
+
title: object
|
|
46
|
+
className: string
|
|
47
|
+
model: ButtonModel
|
|
48
|
+
container: HTMLElement
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Provides information about a ActionBegin event.
|
|
53
|
+
*/
|
|
54
|
+
export interface ActionBeginEventArgs {
|
|
55
|
+
/** Defines the name of the field */
|
|
56
|
+
data: { [key: string]: string | number }
|
|
57
|
+
/** Prevent the submit action. */
|
|
58
|
+
cancel?: boolean
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Provides information about a Action event.
|
|
63
|
+
*/
|
|
64
|
+
export interface ActionEventArgs {
|
|
65
|
+
/** Prevents the current value render in the editor. */
|
|
66
|
+
cancel?: boolean
|
|
67
|
+
/** Defines the data manager action result. */
|
|
68
|
+
// eslint-disable-next-line
|
|
69
|
+
data: object
|
|
70
|
+
/** Defines the current editor value */
|
|
71
|
+
value: string
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Provides information about a Form event.
|
|
76
|
+
*/
|
|
77
|
+
export interface FormEventArgs {
|
|
78
|
+
inputName: string
|
|
79
|
+
message: string
|
|
80
|
+
element: HTMLInputElement
|
|
81
|
+
status?: string
|
|
82
|
+
errorElement?: HTMLElement
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Provides information about a Validate event.
|
|
87
|
+
*/
|
|
88
|
+
export interface ValidateEventArgs extends ActionBeginEventArgs {
|
|
89
|
+
/** Defines form validation error message. */
|
|
90
|
+
errorMessage: string
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Provides information about a BeginEdit event.
|
|
95
|
+
*/
|
|
96
|
+
export interface BeginEditEventArgs {
|
|
97
|
+
/** Specifies whether to cancel the open action of the editor. */
|
|
98
|
+
cancel?: boolean
|
|
99
|
+
/** Specifies whether to cancel the focus action, before open a editor. */
|
|
100
|
+
cancelFocus?: boolean
|
|
101
|
+
/** Defines the current editor mode. */
|
|
102
|
+
mode?: RenderMode
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Provides information about the EndEdit event.
|
|
107
|
+
*/
|
|
108
|
+
export interface EndEditEventArgs {
|
|
109
|
+
/** Defines the type of action ends the edit. */
|
|
110
|
+
action?: string
|
|
111
|
+
/** Specifies whether to cancel the end edit action. */
|
|
112
|
+
cancel?: boolean
|
|
113
|
+
/** Defines the current editor mode. */
|
|
114
|
+
mode?: RenderMode
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Provides information about the Change event.
|
|
119
|
+
*/
|
|
120
|
+
export interface ChangeEventArgs {
|
|
121
|
+
/** Returns the selected item as JSON Object from the AutoComplete/ComboBox/DropDownList data source. */
|
|
122
|
+
itemData?: FieldSettingsModel
|
|
123
|
+
/** Returns the previous selected item as JSON Object from the AutoComplete/ComboBox/DropDownList data source. */
|
|
124
|
+
previousItemData?: FieldSettingsModel
|
|
125
|
+
/** Returns the previous value of integrated component that renders based on the `type` property in the In-place editor. */
|
|
126
|
+
previousValue: string | string[] | number | number[] | boolean[] | Date | Date[] | DateRange
|
|
127
|
+
/** Returns the value of integrated component that renders based on the `type` property in the In-place editor. */
|
|
128
|
+
value: string | string[] | number | number[] | boolean[] | Date | Date[] | DateRange
|
|
129
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ChildProperty, Property } from '@syncfusion/ej2-base';
|
|
2
|
+
import { TooltipModel } from '@syncfusion/ej2-popups';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configures the popup settings of the In-place editor.
|
|
6
|
+
*/
|
|
7
|
+
export class PopupSettings extends ChildProperty<PopupSettings> {
|
|
8
|
+
/**
|
|
9
|
+
* Specifies title for the editor popup.
|
|
10
|
+
*
|
|
11
|
+
* @default ''
|
|
12
|
+
*/
|
|
13
|
+
@Property('')
|
|
14
|
+
public title: string;
|
|
15
|
+
/**
|
|
16
|
+
* Specifies model for editor popup customization like position, animation,etc.
|
|
17
|
+
*
|
|
18
|
+
* @default null
|
|
19
|
+
*/
|
|
20
|
+
@Property(null)
|
|
21
|
+
public model: TooltipModel;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
export let modulesList: { [key: string]: string } = {
|
|
27
|
+
/* eslint-disable */
|
|
28
|
+
'AutoComplete': 'auto-complete',
|
|
29
|
+
'Color': 'color-picker',
|
|
30
|
+
'ComboBox': 'combo-box',
|
|
31
|
+
'DateRange': 'date-range-picker',
|
|
32
|
+
'MultiSelect': 'multi-select',
|
|
33
|
+
'RTE': 'rte',
|
|
34
|
+
'Slider': 'slider',
|
|
35
|
+
'Time': 'time-picker'
|
|
36
|
+
/* eslint-enable */
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
// eslint-disable-next-line
|
|
43
|
+
export let localeConstant: { [key: string]: object } = {
|
|
44
|
+
/* eslint-disable */
|
|
45
|
+
'Click': { 'editAreaClick': 'Click to edit' },
|
|
46
|
+
'DblClick': { 'editAreaDoubleClick': 'Double click to edit' },
|
|
47
|
+
'EditIconClick': { 'editAreaClick': 'Click to edit' }
|
|
48
|
+
/* eslint-enable */
|
|
49
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { isNullOrUndefined as isNOU, Internationalization, isBlazor } from '@syncfusion/ej2-base';
|
|
2
|
+
import { RichTextEditorModel } from '@syncfusion/ej2-richtexteditor';
|
|
3
|
+
import { DatePickerModel } from '@syncfusion/ej2-calendars';
|
|
4
|
+
import { DateTimePickerModel, DateRangePickerModel, TimePickerModel } from '@syncfusion/ej2-calendars';
|
|
5
|
+
import { NumericTextBoxModel, TextBoxModel } from '@syncfusion/ej2-inputs';
|
|
6
|
+
import { ColorPickerModel, MaskedTextBoxModel, SliderModel } from '@syncfusion/ej2-inputs';
|
|
7
|
+
import { AutoCompleteModel, ComboBoxModel, DropDownListModel, MultiSelectModel } from '@syncfusion/ej2-dropdowns';
|
|
8
|
+
/**
|
|
9
|
+
* Exports util methods used by In-place editor.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const intl: Internationalization = new Internationalization();
|
|
13
|
+
/* eslint-disable */
|
|
14
|
+
type valueType = string | number | Date | string[] | Date[] | number[];
|
|
15
|
+
type modelType = AutoCompleteModel | ColorPickerModel | ComboBoxModel | DatePickerModel | DateRangePickerModel | DateTimePickerModel |
|
|
16
|
+
/* eslint-enable */
|
|
17
|
+
DropDownListModel | MaskedTextBoxModel | MultiSelectModel | NumericTextBoxModel | RichTextEditorModel | SliderModel | TextBoxModel |
|
|
18
|
+
TimePickerModel;
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} type - specifies the string type
|
|
21
|
+
* @param {valueType} val - specifies the value type
|
|
22
|
+
* @param {modelType} model - specifies the model type
|
|
23
|
+
* @returns {string} - returns the string
|
|
24
|
+
*/
|
|
25
|
+
export function parseValue(type: string, val: valueType, model: modelType): string {
|
|
26
|
+
if (isNOU(val) || val === '') {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
let result: string;
|
|
30
|
+
let tempFormat: string;
|
|
31
|
+
switch (type) {
|
|
32
|
+
case 'Color': {
|
|
33
|
+
const hex: string = <string>val;
|
|
34
|
+
result = (hex.length > 7) ? hex.slice(0, -2) : hex;
|
|
35
|
+
break; }
|
|
36
|
+
case 'Date':
|
|
37
|
+
tempFormat = (model as DatePickerModel).format as string;
|
|
38
|
+
result = intl.formatDate(<Date>val, { format: tempFormat, type: type, skeleton: isBlazor() ? 'd' : 'yMd' });
|
|
39
|
+
break;
|
|
40
|
+
case 'DateRange': {
|
|
41
|
+
tempFormat = (model as DateRangePickerModel).format as string;
|
|
42
|
+
const date: Date[] = <Date[]>val;
|
|
43
|
+
result = intl.formatDate(date[0], { format: tempFormat, type: type, skeleton: isBlazor() ? 'd' : 'yMd' }) + ' - '
|
|
44
|
+
+ intl.formatDate(date[1], { format: tempFormat, type: type, skeleton: isBlazor() ? 'd' : 'yMd' });
|
|
45
|
+
break; }
|
|
46
|
+
case 'DateTime':
|
|
47
|
+
tempFormat = (model as DateTimePickerModel).format as string;
|
|
48
|
+
if (isNOU(tempFormat) || tempFormat === '') {
|
|
49
|
+
result = intl.formatDate(<Date>val, { format: tempFormat, type: type, skeleton: isBlazor() ? 'd' : 'yMd' }) + ' '
|
|
50
|
+
+ intl.formatDate(<Date>val, { format: tempFormat, type: type, skeleton: isBlazor() ? 't' : 'hm' });
|
|
51
|
+
} else {
|
|
52
|
+
result = intl.formatDate(<Date>val, { format: tempFormat, type: type, skeleton: isBlazor() ? 'd' : 'yMd' });
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
case 'Time':
|
|
56
|
+
tempFormat = (model as TimePickerModel).format as string;
|
|
57
|
+
result = intl.formatDate(<Date>val, { format: tempFormat, type: type, skeleton: isBlazor() ? 't' : 'hm' });
|
|
58
|
+
break;
|
|
59
|
+
case 'Numeric': {
|
|
60
|
+
tempFormat = isNOU((model as NumericTextBoxModel).format) ? 'n2' :
|
|
61
|
+
(model as NumericTextBoxModel).format as string;
|
|
62
|
+
const tempVal: number = isNOU(<string>val) ? null : (typeof (val) === 'number' ? val : intl.parseNumber(<string>val));
|
|
63
|
+
result = intl.formatNumber(tempVal, { format: tempFormat });
|
|
64
|
+
break; }
|
|
65
|
+
default:
|
|
66
|
+
result = val.toString();
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @param {string} type - specifies the string value
|
|
75
|
+
* @param {valueType} val - specifies the value type
|
|
76
|
+
* @returns {valueType} - returns the value type
|
|
77
|
+
*/
|
|
78
|
+
export function getCompValue(type: string, val: valueType): valueType {
|
|
79
|
+
if (isNOU(val) || val === '') {
|
|
80
|
+
return val;
|
|
81
|
+
}
|
|
82
|
+
if ((type === 'Date' || type === 'Time' || type === 'DateTime') && typeof (val) === 'string') {
|
|
83
|
+
val = new Date(val);
|
|
84
|
+
} else if (type === 'DateRange') {
|
|
85
|
+
if (typeof (val) === 'object' && typeof ((<string[]>val)[0]) === 'string') {
|
|
86
|
+
val = [new Date((val as string[])[0]), new Date((val as string[])[1])];
|
|
87
|
+
} else if (typeof (val) === 'string') {
|
|
88
|
+
const temp: string[] = (<string>val).split('-');
|
|
89
|
+
val = [new Date(temp[0]), new Date(temp[1])];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return val;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @param {string} value - specifies the string value
|
|
97
|
+
* @returns {string} - returns the string
|
|
98
|
+
* @hidden
|
|
99
|
+
*/
|
|
100
|
+
export function encode(value: string): string {
|
|
101
|
+
var data = [];
|
|
102
|
+
for (var i = value.length - 1; i >= 0; i--) {
|
|
103
|
+
data.unshift(["&#", value[i].charCodeAt(0), ";"].join(""));
|
|
104
|
+
}
|
|
105
|
+
return data.join("");
|
|
106
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
import { AutoComplete as EJ2AutoComplete, AutoCompleteModel } from '@syncfusion/ej2-dropdowns';
|
|
3
|
+
import { Base } from './base-module';
|
|
4
|
+
import { InPlaceEditor } from '../base/inplace-editor';
|
|
5
|
+
import { NotifyParams, IComponent } from '../base/interface';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `AutoComplete` module is used configure the properties of Auto complete type editor.
|
|
9
|
+
*/
|
|
10
|
+
export class AutoComplete implements IComponent {
|
|
11
|
+
private base: Base;
|
|
12
|
+
protected parent: InPlaceEditor;
|
|
13
|
+
public compObj: EJ2AutoComplete = undefined;
|
|
14
|
+
|
|
15
|
+
public constructor(parent?: InPlaceEditor) {
|
|
16
|
+
this.parent = parent;
|
|
17
|
+
this.parent.atcModule = this;
|
|
18
|
+
this.base = new Base(this.parent, this);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public render(e: NotifyParams): void {
|
|
22
|
+
this.compObj = new EJ2AutoComplete(this.parent.model as AutoCompleteModel);
|
|
23
|
+
this.compObj.appendTo(e.target);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
* @returns {void}
|
|
29
|
+
*/
|
|
30
|
+
public showPopup(): void {
|
|
31
|
+
this.compObj.focusIn();
|
|
32
|
+
this.compObj.showPopup();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public focus(): void {
|
|
36
|
+
this.compObj.element.focus();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public updateValue(e: NotifyParams): void {
|
|
40
|
+
if (this.compObj && e.type === 'AutoComplete') {
|
|
41
|
+
this.parent.setProperties({ value: this.compObj.value }, true);
|
|
42
|
+
this.parent.extendModelValue(this.compObj.value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Destroys the module.
|
|
48
|
+
*
|
|
49
|
+
* @function destroy
|
|
50
|
+
* @returns {void}
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
|
+
public destroy(): void {
|
|
54
|
+
this.base.destroy();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* For internal use only - Get the module name.
|
|
59
|
+
*
|
|
60
|
+
* @returns {string} - returns the string
|
|
61
|
+
*/
|
|
62
|
+
private getModuleName(): string {
|
|
63
|
+
return 'auto-complete';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { InPlaceEditor } from '../base/inplace-editor';
|
|
2
|
+
import { isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
|
|
3
|
+
import * as events from '../base/events';
|
|
4
|
+
import { NotifyParams, IComponent } from '../base/interface';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `Base` module.
|
|
8
|
+
*/
|
|
9
|
+
export class Base {
|
|
10
|
+
protected parent: InPlaceEditor;
|
|
11
|
+
protected module: IComponent;
|
|
12
|
+
|
|
13
|
+
public constructor(parent: InPlaceEditor, module: IComponent) {
|
|
14
|
+
this.parent = parent;
|
|
15
|
+
this.module = module;
|
|
16
|
+
this.addEventListener();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private render(e: NotifyParams): void {
|
|
20
|
+
this.module.render(e);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private showPopup(): void {
|
|
24
|
+
this.module.showPopup();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private focus(): void {
|
|
28
|
+
this.module.focus();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private update(e: NotifyParams): void {
|
|
32
|
+
this.module.updateValue(e);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private getValue(): void {
|
|
36
|
+
this.module.getRenderValue();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private destroyComponent(): void {
|
|
40
|
+
if (isNOU(this.module.compObj)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.module.compObj.destroy();
|
|
44
|
+
this.module.compObj = undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public destroy(): void {
|
|
48
|
+
this.destroyComponent();
|
|
49
|
+
this.removeEventListener();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
protected addEventListener(): void {
|
|
53
|
+
this.parent.on(events.render, this.render, this);
|
|
54
|
+
this.parent.on(events.setFocus, this.focus, this);
|
|
55
|
+
this.parent.on(events.showPopup, this.showPopup, this);
|
|
56
|
+
this.parent.on(events.update, this.update, this);
|
|
57
|
+
this.parent.on(events.accessValue, this.getValue, this);
|
|
58
|
+
this.parent.on(events.destroyModules, this.destroyComponent, this);
|
|
59
|
+
this.parent.on(events.destroy, this.destroy, this);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
protected removeEventListener(): void {
|
|
63
|
+
if (this.parent.isDestroyed) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.parent.off(events.render, this.render);
|
|
67
|
+
this.parent.off(events.setFocus, this.focus);
|
|
68
|
+
this.parent.off(events.showPopup, this.showPopup);
|
|
69
|
+
this.parent.off(events.update, this.update);
|
|
70
|
+
this.parent.off(events.accessValue, this.getValue);
|
|
71
|
+
this.parent.off(events.destroyModules, this.destroyComponent);
|
|
72
|
+
this.parent.off(events.destroy, this.destroy);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ColorPicker as EJ2ColorPicker, ColorPickerModel } from '@syncfusion/ej2-inputs';
|
|
2
|
+
import { Base } from './base-module';
|
|
3
|
+
import { InPlaceEditor } from '../base/inplace-editor';
|
|
4
|
+
import { NotifyParams, IComponent } from '../base/interface';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `ColorPicker` module is used configure the properties of Color picker type editor.
|
|
8
|
+
*/
|
|
9
|
+
export class ColorPicker implements IComponent {
|
|
10
|
+
private base: Base;
|
|
11
|
+
protected parent: InPlaceEditor;
|
|
12
|
+
public compObj: EJ2ColorPicker = undefined;
|
|
13
|
+
|
|
14
|
+
public constructor(parent?: InPlaceEditor) {
|
|
15
|
+
this.parent = parent;
|
|
16
|
+
this.parent.colorModule = this;
|
|
17
|
+
this.base = new Base(this.parent, this);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public render(e: NotifyParams): void {
|
|
21
|
+
this.compObj = new EJ2ColorPicker(this.parent.model as ColorPickerModel);
|
|
22
|
+
this.compObj.appendTo(e.target as HTMLInputElement);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public focus(): void {
|
|
26
|
+
this.compObj.element.focus();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public updateValue(e: NotifyParams): void {
|
|
30
|
+
if (this.compObj && e.type === 'Color') {
|
|
31
|
+
this.parent.setProperties({ value: this.compObj.value }, true);
|
|
32
|
+
this.parent.extendModelValue(this.compObj.value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Destroys the module.
|
|
38
|
+
*
|
|
39
|
+
* @function destroy
|
|
40
|
+
* @returns {void}
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
public destroy(): void {
|
|
44
|
+
this.base.destroy();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* For internal use only - Get the module name.
|
|
49
|
+
*
|
|
50
|
+
* @returns {string} - retunrs the string
|
|
51
|
+
*/
|
|
52
|
+
private getModuleName(): string {
|
|
53
|
+
return 'color-picker';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ComboBox as EJ2ComboBox, ComboBoxModel } from '@syncfusion/ej2-dropdowns';
|
|
2
|
+
import { Base } from './base-module';
|
|
3
|
+
import { InPlaceEditor } from '../base/inplace-editor';
|
|
4
|
+
import { NotifyParams, IComponent } from '../base/interface';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `ComboBox` module is used configure the properties of Combo box type editor.
|
|
8
|
+
*/
|
|
9
|
+
export class ComboBox implements IComponent {
|
|
10
|
+
private base: Base;
|
|
11
|
+
protected parent: InPlaceEditor;
|
|
12
|
+
public compObj: EJ2ComboBox = undefined;
|
|
13
|
+
|
|
14
|
+
public constructor(parent?: InPlaceEditor) {
|
|
15
|
+
this.parent = parent;
|
|
16
|
+
this.parent.comboBoxModule = this;
|
|
17
|
+
this.base = new Base(this.parent, this);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public render(e: NotifyParams): void {
|
|
21
|
+
this.compObj = new EJ2ComboBox(this.parent.model as ComboBoxModel);
|
|
22
|
+
this.compObj.appendTo(e.target);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public focus(): void {
|
|
26
|
+
this.compObj.element.focus();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
* @returns {void}
|
|
32
|
+
*/
|
|
33
|
+
public showPopup(): void {
|
|
34
|
+
this.compObj.focusIn();
|
|
35
|
+
this.compObj.showPopup();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Destroys the module.
|
|
40
|
+
*
|
|
41
|
+
* @function destroy
|
|
42
|
+
* @returns {void}
|
|
43
|
+
* @hidden
|
|
44
|
+
*/
|
|
45
|
+
public destroy(): void {
|
|
46
|
+
this.base.destroy();
|
|
47
|
+
}
|
|
48
|
+
public updateValue(e: NotifyParams): void {
|
|
49
|
+
if (this.compObj && e.type === 'ComboBox') {
|
|
50
|
+
this.parent.setProperties({ value: this.compObj.value }, true);
|
|
51
|
+
this.parent.extendModelValue(this.compObj.value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* For internal use only - Get the module name.
|
|
57
|
+
*
|
|
58
|
+
* @returns {string} - returns the string
|
|
59
|
+
*/
|
|
60
|
+
private getModuleName(): string {
|
|
61
|
+
return 'combo-box';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DateRangePicker as EJ2DateRangePicker, DateRangePickerModel } from '@syncfusion/ej2-calendars';
|
|
2
|
+
import { Base } from './base-module';
|
|
3
|
+
import { InPlaceEditor } from '../base/inplace-editor';
|
|
4
|
+
import { NotifyParams, IComponent } from '../base/interface';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `DateRangePicker` module is used configure the properties of Date range picker type editor.
|
|
8
|
+
*/
|
|
9
|
+
export class DateRangePicker implements IComponent {
|
|
10
|
+
private base: Base;
|
|
11
|
+
public compObj: EJ2DateRangePicker = undefined;
|
|
12
|
+
protected parent: InPlaceEditor;
|
|
13
|
+
|
|
14
|
+
public constructor(parent?: InPlaceEditor) {
|
|
15
|
+
this.parent = parent;
|
|
16
|
+
this.parent.dateRangeModule = this;
|
|
17
|
+
this.base = new Base(this.parent, this);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public render(e: NotifyParams): void {
|
|
21
|
+
this.compObj = new EJ2DateRangePicker(this.parent.model as DateRangePickerModel);
|
|
22
|
+
this.compObj.appendTo(e.target as HTMLInputElement);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public focus(): void {
|
|
26
|
+
this.compObj.element.focus();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* For internal use only - Get the module name.
|
|
31
|
+
*
|
|
32
|
+
* @returns {string} - returns the string
|
|
33
|
+
*/
|
|
34
|
+
private getModuleName(): string {
|
|
35
|
+
return 'date-range-picker';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public updateValue(e: NotifyParams): void {
|
|
39
|
+
if (this.compObj && e.type === 'DateRange') {
|
|
40
|
+
this.parent.setProperties({ value: this.compObj.value }, true);
|
|
41
|
+
this.parent.extendModelValue(this.compObj.value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Destroys the module.
|
|
47
|
+
*
|
|
48
|
+
* @function destroy
|
|
49
|
+
* @returns {void}
|
|
50
|
+
* @hidden
|
|
51
|
+
*/
|
|
52
|
+
public destroy(): void {
|
|
53
|
+
this.base.destroy();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { closest, EmitType } from '@syncfusion/ej2-base';
|
|
2
|
+
import { MultiSelect as EJ2MultiSelect, MultiSelectModel, PopupEventArgs } from '@syncfusion/ej2-dropdowns';
|
|
3
|
+
import { Base } from './base-module';
|
|
4
|
+
import { InPlaceEditor } from '../base/inplace-editor';
|
|
5
|
+
import { NotifyParams, IComponent } from '../base/interface';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `MultiSelect` module is used configure the properties of Multi select type editor.
|
|
9
|
+
*/
|
|
10
|
+
export class MultiSelect implements IComponent {
|
|
11
|
+
private base: Base;
|
|
12
|
+
protected parent: InPlaceEditor;
|
|
13
|
+
private isPopOpen: boolean = false;
|
|
14
|
+
public compObj: EJ2MultiSelect = undefined;
|
|
15
|
+
private openEvent: EmitType<PopupEventArgs>;
|
|
16
|
+
private closeEvent: EmitType<PopupEventArgs>;
|
|
17
|
+
|
|
18
|
+
public constructor(parent?: InPlaceEditor) {
|
|
19
|
+
this.parent = parent;
|
|
20
|
+
this.parent.multiSelectModule = this;
|
|
21
|
+
this.base = new Base(this.parent, this);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public render(e: NotifyParams): void {
|
|
25
|
+
const compModel: MultiSelectModel = { ...this.parent.model as MultiSelectModel };
|
|
26
|
+
this.openEvent = compModel.open;
|
|
27
|
+
this.closeEvent = compModel.close;
|
|
28
|
+
compModel.open = this.openHandler.bind(this);
|
|
29
|
+
compModel.close = this.closeHandler.bind(this);
|
|
30
|
+
this.compObj = new EJ2MultiSelect(compModel);
|
|
31
|
+
this.compObj.appendTo(e.target);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private openHandler(e: PopupEventArgs): void {
|
|
35
|
+
this.isPopOpen = true;
|
|
36
|
+
if (this.openEvent) {
|
|
37
|
+
this.compObj.setProperties({ open: this.openEvent }, true);
|
|
38
|
+
this.compObj.trigger('open', e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private closeHandler(e: PopupEventArgs): void {
|
|
43
|
+
this.isPopOpen = false;
|
|
44
|
+
if (this.closeEvent) {
|
|
45
|
+
this.compObj.setProperties({ close: this.closeEvent }, true);
|
|
46
|
+
this.compObj.trigger('close', e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public focus(): void {
|
|
51
|
+
if (!this.isPopOpen) {
|
|
52
|
+
const evt: MouseEvent = document.createEvent('MouseEvent') as MouseEvent;
|
|
53
|
+
evt.initEvent('mousedown', true, true);
|
|
54
|
+
(closest(this.compObj.element, '.e-multi-select-wrapper') as HTMLElement).dispatchEvent(evt);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public updateValue(e: NotifyParams): void {
|
|
59
|
+
if (this.compObj && e.type === 'MultiSelect') {
|
|
60
|
+
this.parent.setProperties({ value: this.compObj.value }, true);
|
|
61
|
+
this.parent.extendModelValue(this.compObj.value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public getRenderValue(): void {
|
|
66
|
+
this.parent.printValue = this.compObj.text;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Destroys the module.
|
|
71
|
+
*
|
|
72
|
+
* @function destroy
|
|
73
|
+
* @returns {void}
|
|
74
|
+
* @hidden
|
|
75
|
+
*/
|
|
76
|
+
public destroy(): void {
|
|
77
|
+
this.base.destroy();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* For internal use only - Get the module name.
|
|
82
|
+
*
|
|
83
|
+
* @returns {string} - returns the string
|
|
84
|
+
*/
|
|
85
|
+
private getModuleName(): string {
|
|
86
|
+
return 'multi-select';
|
|
87
|
+
}
|
|
88
|
+
}
|