@syncfusion/ej2-layouts 29.2.4 → 30.1.37
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/dist/ej2-layouts.min.js +2 -2
- package/dist/ej2-layouts.umd.min.js +1 -1
- package/dist/global/ej2-layouts.min.js +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/dashboard-layout/dashboard-layout-model.d.ts +292 -0
- package/dist/ts/dashboard-layout/dashboard-layout.d.ts +706 -0
- package/dist/ts/dashboard-layout/dashboard-layout.ts +3468 -0
- package/dist/ts/dashboard-layout/index.d.ts +5 -0
- package/dist/ts/dashboard-layout/index.ts +5 -0
- package/dist/ts/index.d.ts +6 -0
- package/dist/ts/index.ts +6 -0
- package/dist/ts/splitter/index.d.ts +5 -0
- package/dist/ts/splitter/index.ts +5 -0
- package/dist/ts/splitter/splitter-model.d.ts +236 -0
- package/dist/ts/splitter/splitter.d.ts +595 -0
- package/dist/ts/splitter/splitter.ts +2871 -0
- package/dist/ts/timeline/index.d.ts +3 -0
- package/dist/ts/timeline/index.ts +3 -0
- package/dist/ts/timeline/timeline-model.d.ts +140 -0
- package/dist/ts/timeline/timeline.d.ts +239 -0
- package/dist/ts/timeline/timeline.ts +543 -0
- package/package.json +7 -8
- package/styles/material-dark-lite.css +1 -1
- package/styles/material-dark.css +1 -1
- package/styles/material-lite.css +1 -1
- package/styles/material.css +1 -1
- package/styles/timeline/_material-dark-definition.scss +1 -1
- package/styles/timeline/_material-definition.scss +1 -1
- package/styles/timeline/material-dark.css +1 -1
- package/styles/timeline/material.css +1 -1
@@ -0,0 +1,543 @@
|
|
1
|
+
import { Component, INotifyPropertyChanged, ChildProperty, Collection, BaseEventArgs, Event, EmitType, NotifyPropertyChanges, Property, getUniqueID, attributes, select, compile, remove, removeClass, append, isNullOrUndefined } from '@syncfusion/ej2-base';
|
2
|
+
import { TimelineModel, TimelineItemModel } from '../timeline';
|
3
|
+
|
4
|
+
const ITEMLISTCONTAINER: string = 'e-timeline-items';
|
5
|
+
const ITEMCONTAINER: string = 'e-timeline-item';
|
6
|
+
const OPPOSITECONTENT: string = 'e-opposite-content';
|
7
|
+
const DOTCONTAINER: string = 'e-dot-item';
|
8
|
+
const DOTCONTENT: string = 'e-dot';
|
9
|
+
const CONTENT: string = 'e-content';
|
10
|
+
const ITEMCONNECTOR: string = 'e-connector';
|
11
|
+
const VERTICAL: string = 'e-vertical';
|
12
|
+
const HORIZONTAL: string = 'e-horizontal';
|
13
|
+
const TIMELINEREVERSE: string = 'e-timeline-reverse';
|
14
|
+
const RTL: string = 'e-rtl';
|
15
|
+
const DISABLED: string = 'e-item-disabled';
|
16
|
+
const TEMPLATE: string = 'e-item-template';
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Defines the orientation type of the Timeline.
|
20
|
+
*/
|
21
|
+
export enum TimelineOrientation {
|
22
|
+
/**
|
23
|
+
* Items are displayed horizontally.
|
24
|
+
*/
|
25
|
+
Horizontal = 'Horizontal',
|
26
|
+
/**
|
27
|
+
* Items are displayed vertically.
|
28
|
+
*/
|
29
|
+
Vertical = 'Vertical'
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Specifies the alignment of item content within the Timeline.
|
34
|
+
*/
|
35
|
+
export enum TimelineAlign {
|
36
|
+
/**
|
37
|
+
* Aligns item content to the top and opposite content to the bottom when the Timeline is in a horizontal orientation, or the content to the left and opposite content to the right when the Timeline is in a vertical orientation.
|
38
|
+
*/
|
39
|
+
Before = 'Before',
|
40
|
+
/**
|
41
|
+
* Aligns item content to the bottom and opposite content to the top when the Timeline is in a horizontal orientation, or the content to the right and opposite content to the left when the Timeline is in a vertical orientation.
|
42
|
+
*/
|
43
|
+
After = 'After',
|
44
|
+
/**
|
45
|
+
* Aligns item content alternatively, regardless of the Timeline's orientation.
|
46
|
+
*/
|
47
|
+
Alternate = 'Alternate',
|
48
|
+
/**
|
49
|
+
* Aligns item content in alternate reverse, regardless of the Timeline's orientation.
|
50
|
+
*/
|
51
|
+
AlternateReverse = 'AlternateReverse'
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Specifies the items of the Timeline.
|
56
|
+
*/
|
57
|
+
export class TimelineItem extends ChildProperty<TimelineItem> {
|
58
|
+
/**
|
59
|
+
* Defines one or more CSS classes to include an icon or image in the Timeline item.
|
60
|
+
*
|
61
|
+
* @default ''
|
62
|
+
*/
|
63
|
+
@Property('')
|
64
|
+
public dotCss: string;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Defines the text content or template for the Timeline item. The current itemIndex passed as context to build the content.
|
68
|
+
*
|
69
|
+
* @default ''
|
70
|
+
* @angularType string | object
|
71
|
+
* @reactType string | function | JSX.Element
|
72
|
+
* @vueType string | function
|
73
|
+
* @aspType string
|
74
|
+
*/
|
75
|
+
@Property('')
|
76
|
+
public content: string | Function;
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Defines the additional text content or template to be displayed opposite side of the item. The current itemIndex passed as context to build the content.
|
80
|
+
*
|
81
|
+
* @default ''
|
82
|
+
* @angularType string | object
|
83
|
+
* @reactType string | function | JSX.Element
|
84
|
+
* @vueType string | function
|
85
|
+
* @aspType string
|
86
|
+
*/
|
87
|
+
@Property('')
|
88
|
+
public oppositeContent: string | Function;
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Defines whether to enable or disable the timeline item.
|
92
|
+
*
|
93
|
+
* @default false
|
94
|
+
*/
|
95
|
+
@Property(false)
|
96
|
+
public disabled: boolean;
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Defines the CSS class to customize the Timeline item appearance.
|
100
|
+
*
|
101
|
+
* @default ''
|
102
|
+
*/
|
103
|
+
@Property('')
|
104
|
+
public cssClass: string;
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Provides information about beforeItemRender event callback.
|
109
|
+
*/
|
110
|
+
export interface TimelineRenderingEventArgs extends BaseEventArgs {
|
111
|
+
/**
|
112
|
+
* Provides the timeline element.
|
113
|
+
*/
|
114
|
+
element: HTMLElement;
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Provides the index of the current item.
|
118
|
+
*/
|
119
|
+
index: number;
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* The Timeline component presents a series of events or activities in chronological order, allowing users to track the progression of time.
|
124
|
+
*
|
125
|
+
* ```html
|
126
|
+
* <div id="timeline"></div>
|
127
|
+
* ```
|
128
|
+
* ```typescript
|
129
|
+
* <script>
|
130
|
+
* let timelineObj: Timeline = new Timeline({items : [{}, {}, {}, {}, {}]});
|
131
|
+
* timelineObj.appendTo('#timeline');
|
132
|
+
* </script>
|
133
|
+
* ```
|
134
|
+
*/
|
135
|
+
@NotifyPropertyChanges
|
136
|
+
export class Timeline extends Component<HTMLElement> implements INotifyPropertyChanged {
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Defines the orientation type of the Timeline.
|
140
|
+
*
|
141
|
+
* The possible values are:
|
142
|
+
* * Horizontal
|
143
|
+
* * vertical
|
144
|
+
*
|
145
|
+
* {% codeBlock src='timeline/orientation/index.md' %}{% endcodeBlock %}
|
146
|
+
*
|
147
|
+
* @isenumeration true
|
148
|
+
* @default TimelineOrientation.Vertical
|
149
|
+
* @asptype TimelineOrientation
|
150
|
+
*/
|
151
|
+
@Property(TimelineOrientation.Vertical)
|
152
|
+
public orientation: string | TimelineOrientation;
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Defines the alignment of item content within the Timeline.
|
156
|
+
*
|
157
|
+
* The possible values are:
|
158
|
+
* * Before
|
159
|
+
* * After
|
160
|
+
* * Alternate
|
161
|
+
* * AlternateReverse
|
162
|
+
*
|
163
|
+
* {% codeBlock src='timeline/align/index.md' %}{% endcodeBlock %}
|
164
|
+
*
|
165
|
+
* @isenumeration true
|
166
|
+
* @default TimelineAlign.After
|
167
|
+
* @asptype TimelineAlign
|
168
|
+
*/
|
169
|
+
@Property(TimelineAlign.After)
|
170
|
+
public align: string | TimelineAlign;
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Defines the list of items.
|
174
|
+
*
|
175
|
+
* @default []
|
176
|
+
*/
|
177
|
+
@Collection<TimelineItemModel[]>([], TimelineItem)
|
178
|
+
public items: TimelineItemModel[];
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Defines the CSS class to customize the Timeline appearance.
|
182
|
+
*
|
183
|
+
* @default ''
|
184
|
+
*/
|
185
|
+
@Property('')
|
186
|
+
public cssClass: string;
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Defines whether to show the timeline items in reverse order or not.
|
190
|
+
*
|
191
|
+
* @default false
|
192
|
+
*/
|
193
|
+
@Property(false)
|
194
|
+
public reverse: boolean;
|
195
|
+
|
196
|
+
/**
|
197
|
+
* Defines the template content for each timeline item. The template context will contain the item model.
|
198
|
+
*
|
199
|
+
* {% codeBlock src='timeline/template/index.md' %}{% endcodeBlock %}
|
200
|
+
*
|
201
|
+
* @default ''
|
202
|
+
* @angularType string | object
|
203
|
+
* @reactType string | function | JSX.Element
|
204
|
+
* @vueType string | function
|
205
|
+
* @aspType string
|
206
|
+
*/
|
207
|
+
@Property('')
|
208
|
+
public template: string | Function;
|
209
|
+
|
210
|
+
/**
|
211
|
+
* Event callback that is raised after rendering the timeline.
|
212
|
+
*
|
213
|
+
* @event created
|
214
|
+
*/
|
215
|
+
@Event()
|
216
|
+
public created: EmitType<Event>;
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Event triggers before rendering each item.
|
220
|
+
*
|
221
|
+
* @event beforeItemRender
|
222
|
+
*/
|
223
|
+
@Event()
|
224
|
+
public beforeItemRender: EmitType<TimelineRenderingEventArgs>;
|
225
|
+
|
226
|
+
/* Private variables */
|
227
|
+
private timelineListEle: HTMLElement;
|
228
|
+
private templateFunction: Function;
|
229
|
+
|
230
|
+
/**
|
231
|
+
* * Constructor for creating the Timeline component.
|
232
|
+
*
|
233
|
+
* @param {TimelineModel} options - Specifies the Timeline model.
|
234
|
+
* @param {string | HTMLElement} element - Specifies the element to render as component.
|
235
|
+
* @private
|
236
|
+
*/
|
237
|
+
constructor(options?: TimelineModel, element?: string | HTMLElement) {
|
238
|
+
super(options, element);
|
239
|
+
}
|
240
|
+
|
241
|
+
protected preRender(): void {
|
242
|
+
if (!this.element.id) { this.element.id = getUniqueID('e-' + this.getModuleName()); }
|
243
|
+
}
|
244
|
+
|
245
|
+
/**
|
246
|
+
* To get component name.
|
247
|
+
*
|
248
|
+
* @returns {string} - It returns the current module name.
|
249
|
+
* @private
|
250
|
+
*/
|
251
|
+
public getModuleName(): string {
|
252
|
+
return 'timeline';
|
253
|
+
}
|
254
|
+
|
255
|
+
/**
|
256
|
+
* This method is abstract member of the Component<HTMLElement>.
|
257
|
+
*
|
258
|
+
* @private
|
259
|
+
* @returns {string} - It returns the persisted data.
|
260
|
+
*/
|
261
|
+
protected getPersistData(): string {
|
262
|
+
return this.addOnPersist([]);
|
263
|
+
}
|
264
|
+
|
265
|
+
protected render(): void {
|
266
|
+
attributes(this.element, { 'role': 'navigation', 'aria-label': this.element.id });
|
267
|
+
this.timelineListEle = this.createElement('ol', { className: ITEMLISTCONTAINER });
|
268
|
+
this.updateOrientation();
|
269
|
+
this.updateCssClass(this.cssClass);
|
270
|
+
this.updateAlign();
|
271
|
+
this.updateReverse();
|
272
|
+
this.updateRtl();
|
273
|
+
this.updateTemplateFunction();
|
274
|
+
this.renderItems();
|
275
|
+
this.element.appendChild(this.timelineListEle);
|
276
|
+
}
|
277
|
+
|
278
|
+
protected updateOrientation(): void {
|
279
|
+
if (!(isNullOrUndefined(this.orientation))) {
|
280
|
+
const orientation: string = this.orientation.toLowerCase();
|
281
|
+
if (orientation === 'horizontal' || orientation === 'vertical') {
|
282
|
+
this.element.classList.remove(HORIZONTAL, VERTICAL);
|
283
|
+
this.element.classList.add('e-' + orientation);
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
protected updateCssClass(addCss: string, removeCss: string = ''): void {
|
289
|
+
let cssClasses: string[];
|
290
|
+
if (removeCss) {
|
291
|
+
cssClasses = removeCss.trim().split(' ');
|
292
|
+
this.element.classList.remove(...cssClasses);
|
293
|
+
}
|
294
|
+
if (addCss) {
|
295
|
+
cssClasses = addCss.trim().split(' ');
|
296
|
+
this.element.classList.add(...cssClasses);
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
protected updateRtl(): void {
|
301
|
+
this.element.classList[this.enableRtl ? 'add' : 'remove'](RTL);
|
302
|
+
}
|
303
|
+
|
304
|
+
protected updateAlign(): void {
|
305
|
+
if (!(isNullOrUndefined(this.align))) {
|
306
|
+
const align: string = this.align.toLowerCase();
|
307
|
+
if (align === 'before' || align === 'after' || align === 'alternate' || align === 'alternatereverse') {
|
308
|
+
this.element.classList.remove('e-align-before', 'e-align-after', 'e-align-alternate', 'e-align-alternatereverse');
|
309
|
+
this.element.classList.add('e-align-' + align);
|
310
|
+
}
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
protected updateReverse(): void {
|
315
|
+
this.element.classList[this.reverse ? 'add' : 'remove'](TIMELINEREVERSE);
|
316
|
+
}
|
317
|
+
|
318
|
+
private renderItems(): void {
|
319
|
+
this.haveOneSidecontent();
|
320
|
+
for (let index: number = 0; index < this.items.length; index++) {
|
321
|
+
const item: TimelineItemModel = this.items[parseInt(index.toString(), 10)];
|
322
|
+
const timelineItem: HTMLElement = this.createElement('li', { className: ITEMCONTAINER + ' ' + ITEMCONNECTOR });
|
323
|
+
if (!this.template) {
|
324
|
+
const oppositeTextEle: HTMLElement = this.createElement('div', { className: OPPOSITECONTENT });
|
325
|
+
if (item.oppositeContent) { this.updateItemContent(false, item, index, oppositeTextEle); }
|
326
|
+
timelineItem.appendChild(oppositeTextEle);
|
327
|
+
const dotContainer: HTMLElement = this.createElement('div', { className: DOTCONTAINER });
|
328
|
+
const dotEleCss: string = item.dotCss ? DOTCONTENT + ' ' + item.dotCss.trim() : DOTCONTENT;
|
329
|
+
const dotEle: HTMLElement = this.createElement('div', { className: dotEleCss });
|
330
|
+
dotContainer.appendChild(dotEle);
|
331
|
+
timelineItem.appendChild(dotContainer);
|
332
|
+
const contentEle: HTMLElement = this.createElement('div', { className: CONTENT });
|
333
|
+
if (item.content){ this.updateItemContent(true, item, index, contentEle); }
|
334
|
+
timelineItem.appendChild(contentEle);
|
335
|
+
if (item.cssClass) { timelineItem.classList.add(...item.cssClass.trim().split(' ')); }
|
336
|
+
if (item.disabled) { timelineItem.classList.add(DISABLED); }
|
337
|
+
}
|
338
|
+
else {
|
339
|
+
this.renderItemContent(index, false, timelineItem);
|
340
|
+
}
|
341
|
+
const eventArgs: TimelineRenderingEventArgs = { element: timelineItem, index: index };
|
342
|
+
this.trigger('beforeItemRender', eventArgs, (args: TimelineRenderingEventArgs) => { this.timelineListEle.appendChild(args.element); });
|
343
|
+
}
|
344
|
+
}
|
345
|
+
|
346
|
+
private haveOneSidecontent(): void {
|
347
|
+
let haveContent: boolean = false;
|
348
|
+
let haveOppContent: boolean = false;
|
349
|
+
for (let index: number = 0; index < this.items.length; index++) {
|
350
|
+
const item: TimelineItemModel = this.items[parseInt(index.toString(), 10)];
|
351
|
+
if (!haveContent) { (haveContent = item.content.length > 0 || !isNullOrUndefined(item.content)); }
|
352
|
+
if (!haveOppContent) { (haveOppContent = item.oppositeContent.length > 0 || !isNullOrUndefined(item.content)); }
|
353
|
+
}
|
354
|
+
this.element.classList.remove('e-content-only', 'e-opposite-content-only');
|
355
|
+
if (haveContent && !haveOppContent) { this.element.classList.add('e-content-only'); }
|
356
|
+
if (haveOppContent && !haveContent) { this.element.classList.add('e-opposite-content-only'); }
|
357
|
+
}
|
358
|
+
|
359
|
+
private updateItemContent(isContent: boolean, item: TimelineItemModel, index: number, contentEle: HTMLElement): void {
|
360
|
+
const notCompile: boolean = !(this.isReact || this.isVue);
|
361
|
+
const ctn: string | Function = this.getTemplateFunction(isContent ? item.content : item.oppositeContent, notCompile);
|
362
|
+
if (typeof ctn === 'string') {
|
363
|
+
contentEle.innerText = ctn;
|
364
|
+
} else {
|
365
|
+
append(ctn({ item: item, itemIndex: index }, this), contentEle);
|
366
|
+
}
|
367
|
+
}
|
368
|
+
|
369
|
+
private updateTemplateFunction(): void {
|
370
|
+
this.templateFunction = this.template ? this.getTemplateFunction(this.template, false) as Function : null;
|
371
|
+
}
|
372
|
+
|
373
|
+
private renderItemContent(index: number, isrerender: boolean, timelineItem?: HTMLElement): void {
|
374
|
+
const listItems: NodeListOf<Element> = this.timelineListEle.querySelectorAll('li');
|
375
|
+
if (isrerender) {
|
376
|
+
this.removeItemContent(listItems[parseInt((index).toString(), 10)] as HTMLElement);
|
377
|
+
}
|
378
|
+
if (this.template) {
|
379
|
+
if (isrerender) { listItems[parseInt((index).toString(), 10)].classList.add(TEMPLATE); }
|
380
|
+
else { timelineItem.classList.add(TEMPLATE); }
|
381
|
+
const item: TimelineItemModel = this.items[parseInt(index.toString(), 10)];
|
382
|
+
append(this.templateFunction({ item: item, itemIndex: index }, this, 'timelineTemplate', (this.element.id + '_timelineTemplate'), this.isStringTemplate), isrerender ? listItems[parseInt((index).toString(), 10)] : timelineItem);
|
383
|
+
}
|
384
|
+
this.renderReactTemplates();
|
385
|
+
}
|
386
|
+
|
387
|
+
private removeItemContent(ele: HTMLElement): void {
|
388
|
+
ele.classList.remove(TEMPLATE);
|
389
|
+
const firstChild: HTMLElement = ele.firstElementChild as HTMLElement;
|
390
|
+
for (let i: number = 0; i < ele.childElementCount; i++) {
|
391
|
+
firstChild.remove();
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
/**
|
396
|
+
* Gets template content based on the template property value.
|
397
|
+
*
|
398
|
+
* @param {string | Function} template - Template property value.
|
399
|
+
* @param {boolean} notCompile - Compile property value.
|
400
|
+
* @returns {Function} - Return template function.
|
401
|
+
* @hidden
|
402
|
+
*/
|
403
|
+
private getTemplateFunction(template: string | Function, notCompile: boolean = true): string | Function {
|
404
|
+
if (typeof template === 'string') {
|
405
|
+
let content: string = '';
|
406
|
+
try {
|
407
|
+
const tempEle: HTMLElement = select(template);
|
408
|
+
if (tempEle) {
|
409
|
+
//Return innerHTML incase of jsrenderer script else outerHTML
|
410
|
+
content = tempEle.tagName === 'SCRIPT' ? tempEle.innerHTML : tempEle.outerHTML;
|
411
|
+
notCompile = false;
|
412
|
+
} else {
|
413
|
+
content = template;
|
414
|
+
}
|
415
|
+
} catch (e) {
|
416
|
+
content = template;
|
417
|
+
}
|
418
|
+
return notCompile ? content : compile(content);
|
419
|
+
} else {
|
420
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
421
|
+
return compile(template as any);
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
private removeItemElements(): void {
|
426
|
+
const listItems: NodeListOf<Element> = this.timelineListEle.querySelectorAll('li');
|
427
|
+
for (let i: number = 0; i < listItems.length; i++) {
|
428
|
+
remove(listItems[parseInt(i.toString(), 10)]);
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
432
|
+
private updateElementClassArray(): void {
|
433
|
+
const classArray: string[] = [RTL, 'e-align-before', 'e-align-after', 'e-outline', 'e-fill', 'e-align-alternate',
|
434
|
+
'e-align-alternatereverse', TIMELINEREVERSE, HORIZONTAL, VERTICAL];
|
435
|
+
removeClass([this.element], classArray);
|
436
|
+
}
|
437
|
+
|
438
|
+
private updateContent(): void {
|
439
|
+
if (this.isReact) { this.clearTemplate(['timelineTemplate']); }
|
440
|
+
for (let i: number = 0; i < this.items.length; i++) {
|
441
|
+
this.renderItemContent(i, true);
|
442
|
+
}
|
443
|
+
}
|
444
|
+
|
445
|
+
public destroy(): void {
|
446
|
+
super.destroy();
|
447
|
+
// unwires the events and detach the li elements
|
448
|
+
this.removeItemElements();
|
449
|
+
this.element.removeAttribute('role');
|
450
|
+
this.element.removeAttribute('aria-label');
|
451
|
+
this.clearTemplate();
|
452
|
+
if (this.timelineListEle) { remove(this.timelineListEle); }
|
453
|
+
this.timelineListEle = null;
|
454
|
+
this.updateElementClassArray();
|
455
|
+
}
|
456
|
+
|
457
|
+
private updateItems(newProp: string, oldPropItems: TimelineItemModel, index: number, item: TimelineItemModel): void {
|
458
|
+
const timelineItemElements: NodeListOf<Element> = this.timelineListEle.querySelectorAll('li');
|
459
|
+
let dotEle: HTMLElement;
|
460
|
+
let contentEle: HTMLElement;
|
461
|
+
let oppositeEle: HTMLElement;
|
462
|
+
switch (newProp) {
|
463
|
+
case 'dotCss':
|
464
|
+
dotEle = timelineItemElements[parseInt(index.toString(), 10)].querySelector('.' + DOTCONTENT);
|
465
|
+
if (oldPropItems.dotCss !== '') { dotEle.classList.remove(...oldPropItems.dotCss.trim().split(' ')); }
|
466
|
+
if (item.dotCss !== '') { dotEle.classList.add(...this.items[parseInt(index.toString(), 10)].dotCss.trim().split(' ')); }
|
467
|
+
break;
|
468
|
+
case 'content':
|
469
|
+
contentEle = timelineItemElements[parseInt(index.toString(), 10)].querySelector('.' + CONTENT);
|
470
|
+
contentEle.innerText = '';
|
471
|
+
this.updateItemContent(true, item, index, contentEle);
|
472
|
+
this.haveOneSidecontent();
|
473
|
+
break;
|
474
|
+
case 'oppositeContent':
|
475
|
+
oppositeEle = timelineItemElements[parseInt(index.toString(), 10)].querySelector('.' + OPPOSITECONTENT);
|
476
|
+
oppositeEle.innerText = '';
|
477
|
+
this.updateItemContent(false, item, index, oppositeEle);
|
478
|
+
this.haveOneSidecontent();
|
479
|
+
break;
|
480
|
+
case 'disabled':
|
481
|
+
timelineItemElements[parseInt(index.toString(), 10)].classList[this.items[parseInt(index.toString(), 10)].disabled ? 'add' : 'remove'](DISABLED);
|
482
|
+
break;
|
483
|
+
case 'cssClass':
|
484
|
+
if (oldPropItems.cssClass !== '') {
|
485
|
+
timelineItemElements[parseInt(index.toString(), 10)].classList.remove(...oldPropItems.cssClass.trim().split(' '));
|
486
|
+
}
|
487
|
+
if (item.cssClass !== '') {
|
488
|
+
timelineItemElements[parseInt(index.toString(), 10)].classList.add(...item.cssClass.trim().split(' '));
|
489
|
+
}
|
490
|
+
break;
|
491
|
+
}
|
492
|
+
}
|
493
|
+
|
494
|
+
/**
|
495
|
+
* Called internally if any of the property value changed.
|
496
|
+
*
|
497
|
+
* @param {TimelineModel} newProp - Specifies new properties
|
498
|
+
* @param {TimelineModel} oldProp - Specifies old properties
|
499
|
+
* @returns {void}
|
500
|
+
* @private
|
501
|
+
*/
|
502
|
+
public onPropertyChanged(newProp: TimelineModel, oldProp?: TimelineModel): void {
|
503
|
+
for (const prop of Object.keys(newProp)) {
|
504
|
+
switch (prop) {
|
505
|
+
case 'items':
|
506
|
+
if (Array.isArray(newProp.items)) {
|
507
|
+
this.removeItemElements();
|
508
|
+
this.renderItems();
|
509
|
+
} else {
|
510
|
+
const itemLength: number = Object.keys(newProp.items).length;
|
511
|
+
for (let i: number = 0; i < itemLength; i++) {
|
512
|
+
const itemPropLength: number = parseInt(Object.keys(newProp.items)[i as number], 10);
|
513
|
+
for (let j: number = 0; j < Object.keys(newProp.items[itemPropLength as number]).length; j++) {
|
514
|
+
const property: string = Object.keys(newProp.items[itemPropLength as number])[j as number];
|
515
|
+
this.updateItems(property, oldProp.items[itemPropLength as number], itemPropLength,
|
516
|
+
newProp.items[itemPropLength as number]);
|
517
|
+
}
|
518
|
+
}
|
519
|
+
}
|
520
|
+
break;
|
521
|
+
case 'orientation':
|
522
|
+
this.updateOrientation();
|
523
|
+
break;
|
524
|
+
case 'align':
|
525
|
+
this.updateAlign();
|
526
|
+
break;
|
527
|
+
case 'enableRtl':
|
528
|
+
this.updateRtl();
|
529
|
+
break;
|
530
|
+
case 'cssClass':
|
531
|
+
this.updateCssClass(newProp.cssClass, oldProp.cssClass);
|
532
|
+
break;
|
533
|
+
case 'reverse':
|
534
|
+
this.element.classList[this.reverse ? 'add' : 'remove'](TIMELINEREVERSE);
|
535
|
+
break;
|
536
|
+
case 'template':
|
537
|
+
this.updateTemplateFunction();
|
538
|
+
this.updateContent();
|
539
|
+
break;
|
540
|
+
}
|
541
|
+
}
|
542
|
+
}
|
543
|
+
}
|
package/package.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"_from": "@syncfusion/ej2-layouts@*",
|
3
|
-
"_id": "@syncfusion/ej2-layouts@
|
3
|
+
"_id": "@syncfusion/ej2-layouts@21.5.0",
|
4
4
|
"_inBundle": false,
|
5
|
-
"_integrity": "sha512-
|
5
|
+
"_integrity": "sha512-xp9BSQMvc9aLxb31wMY+1toY7loGkRTk1AJu/2JQTPS4YMArYymPozs+Gd/dsq+w33VvHHmMx0f9U2YxmLxakg==",
|
6
6
|
"_location": "/@syncfusion/ej2-layouts",
|
7
7
|
"_phantomChildren": {},
|
8
8
|
"_requested": {
|
@@ -18,7 +18,6 @@
|
|
18
18
|
},
|
19
19
|
"_requiredBy": [
|
20
20
|
"/",
|
21
|
-
"/@syncfusion/ej2",
|
22
21
|
"/@syncfusion/ej2-angular-layouts",
|
23
22
|
"/@syncfusion/ej2-filemanager",
|
24
23
|
"/@syncfusion/ej2-gantt",
|
@@ -26,16 +25,16 @@
|
|
26
25
|
"/@syncfusion/ej2-react-layouts",
|
27
26
|
"/@syncfusion/ej2-vue-layouts"
|
28
27
|
],
|
29
|
-
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-
|
30
|
-
"_shasum": "
|
28
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-development/@syncfusion/ej2-layouts/-/ej2-layouts-21.5.0.tgz",
|
29
|
+
"_shasum": "30d20f6bebb0402472cfe1682e88ec06405e9fda",
|
31
30
|
"_spec": "@syncfusion/ej2-layouts@*",
|
32
|
-
"_where": "
|
31
|
+
"_where": "D:\\SF3992\\WFH\\Nexus\\ej2-nexus-branch-switching-dev\\release",
|
33
32
|
"author": {
|
34
33
|
"name": "Syncfusion Inc."
|
35
34
|
},
|
36
35
|
"bundleDependencies": false,
|
37
36
|
"dependencies": {
|
38
|
-
"@syncfusion/ej2-base": "~
|
37
|
+
"@syncfusion/ej2-base": "~30.1.37"
|
39
38
|
},
|
40
39
|
"deprecated": false,
|
41
40
|
"description": "A package of Essential JS 2 layout pure CSS components such as card and avatar. The card is used as small container to show content in specific structure, whereas the avatars are icons, initials or figures representing particular person.",
|
@@ -75,7 +74,7 @@
|
|
75
74
|
"url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/layouts"
|
76
75
|
},
|
77
76
|
"typings": "index.d.ts",
|
78
|
-
"version": "
|
77
|
+
"version": "30.1.37",
|
79
78
|
"sideEffects": false,
|
80
79
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
81
80
|
}
|
package/styles/material-dark.css
CHANGED
@@ -1707,7 +1707,7 @@
|
|
1707
1707
|
}
|
1708
1708
|
.e-timeline .e-item-disabled .e-content,
|
1709
1709
|
.e-timeline .e-item-disabled .e-opposite-content {
|
1710
|
-
color:
|
1710
|
+
color: rgba(255, 255, 255, 0.38);
|
1711
1711
|
}
|
1712
1712
|
|
1713
1713
|
.e-bigger.e-timeline [class^="e-dot "]::before,
|
package/styles/material-lite.css
CHANGED
package/styles/material.css
CHANGED
@@ -15,4 +15,4 @@ $timeline-dot-background-color: $grey-900 !default;
|
|
15
15
|
$timeline-dot-border-color: $grey-700 !default;
|
16
16
|
$timeline-content-font-color: $grey-white !default;
|
17
17
|
$timeline-opposite-content-font-color: $grey-white !default;
|
18
|
-
$timeline-item-disabled-color:
|
18
|
+
$timeline-item-disabled-color: rgba($grey-white, .38) !default;
|
@@ -15,4 +15,4 @@ $timeline-dot-background-color: $primary-300-font !default;
|
|
15
15
|
$timeline-dot-border-color: $grey-200 !default;
|
16
16
|
$timeline-content-font-color: $base-font !default;
|
17
17
|
$timeline-opposite-content-font-color: $base-font !default;
|
18
|
-
$timeline-item-disabled-color:
|
18
|
+
$timeline-item-disabled-color: rgba($grey-black, .38) !default;
|