Skip to content

Commit 98a969c

Browse files
Merge branch '25_2' of https://github.com/DevExpress/DevExtreme into ng-new-syntax-form-html-editor
2 parents 1ccc9d9 + afd053c commit 98a969c

File tree

51 files changed

+1942
-1450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1942
-1450
lines changed

apps/demos/README.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
11
# DevExtreme Demos
22

3-
This repository contains technical DevExtreme demos for Angular, React, Vue, jQuery, ASP.NET MVC, and ASP.NET Core.
3+
This repository contains technical DevExtreme demos for Angular, React, Vue, and jQuery.
44

55
To run the demos on your machine, clone this repository, run `pnpm install`, and follow the instructions below.
66

77
## Prepare Demos for Development
8-
Before running you need execute in `monorepo/root`:
98

10-
```
11-
pnpm run all:build-dev
12-
```
9+
### Run demos locally
1310

14-
To prepare demos for development:
11+
In `monorepo/root`
1512

13+
Build all dependencies and prepare systemJS configs by executing:
1614
```
17-
pnpm run prepare-js
15+
pnpm run demos:prepare
1816
```
1917

20-
Angular, Vue, and React demos can use bundles instead of separate files from `node_modules`. With bundles, demos launch faster but become harder to debug. Run the following command to create the bundles and replace the SystemJS configuration:
21-
18+
Start webserver:
2219
```
23-
pnpm run prepare-bundles
20+
pnpm run demos:start
2421
```
22+
Navigate to http://localhost:8080/.
23+
24+
You can pass additional parameter to specify port. It can be useful when you need to fast switching between one demo on different frameworks.
25+
2526

26-
To return to using separate files from `node_modules`, run `pnpm run prepare-js`.
27+
### Bundled mode
2728

29+
Angular, Vue, and React demos can use bundles instead of separate files from `node_modules`. With bundles, demos launch faster but become harder to debug.
2830

29-
### Launch
31+
In `apps/demos`
32+
33+
Run the following command to create the bundles and replace the SystemJS configuration:
3034

31-
#### Option 1
3235
```
33-
pnpm run launch-demo
36+
pnpm run prepare-bundles
3437
```
3538

36-
#### Option 2
37-
1. Run ```pnpm run webserver ``` from `monorepo/root`
38-
2. Navigate to http://localhost:8080/apps/demos.
39+
To return to using separate files from `node_modules`, run:
3940

40-
You can pass additional parameter to specify port. It can be useful when you need to fast switching between one demo on different frameworks:
41+
```
42+
pnpm run prepare-js
43+
```
4144

42-
### Before Commiting Сhanges
45+
### Before Commiting Changes
4346

44-
For fix autofixed errors:
47+
Auto-fix lint errors:
4548

4649
```
4750
pnpm run fix-lint
4851
```
4952

50-
### Development
53+
### Adding new demo
5154

5255
1. Run the following script to add a new demo:
5356

5457
```
5558
pnpm run add-demo
5659
```
5760
58-
1. Use the built-in CLI to choose or enter the category, the demo name, and the technology for the new demo.
61+
2. Use the built-in CLI to choose or enter the category, the demo name, and the technology for the new demo.
5962
6063
### TS React Infrastructure
6164
62-
1. After you make any changes in React TypeScript sources, run the following command:
65+
After you make any changes in React TypeScript sources, run the following command:
6366
6467
```
6568
pnpm run convert-to-js split
@@ -71,9 +74,7 @@ If you want to run this script on specific folder you can pass it to the argumen
7174
pnpm run convert-to-js "JSDemos/Demos/Diagram/**/React"
7275
```
7376
74-
1. To ensure that React JavaScript and TypeScript sources are always in sync, the following GitHub action is used: "Check generated JS demos".
75-
76-
77+
The "Check generated JS demos" GitHub Action ensures that the React JavaScript and TypeScript sources remain in sync.
7778
## See Also
7879
7980
- [Technical demos online](https://js.devexpress.com/Demos/)

apps/demos/project.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@
102102
"{projectRoot}/**/*"
103103
],
104104
"cache": true
105+
},
106+
"prepare-js": {
107+
"executor": "nx:run-script",
108+
"options": {
109+
"script": "prepare-js"
110+
},
111+
"dependsOn": [
112+
{ "projects": ["devextreme"], "target": "build" },
113+
{ "projects": ["devextreme-angular", "devextreme-react", "devextreme-vue"], "target": "pack" }
114+
],
115+
"inputs": [
116+
"default",
117+
"{projectRoot}/gulpfile.js/**/*",
118+
"{projectRoot}/rollup.devextreme-angular.umd.config.mjs"
119+
],
120+
"outputs": [
121+
"{projectRoot}/Demos/**/config.js"
122+
],
123+
"cache": true
105124
}
106125
},
107126
"namedInputs": {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"all:build": "ts-node tools/scripts/build-all.ts",
2222
"all:build-dev": "pnpm run all:build --dev",
2323
"all:pack-and-copy": "nx run-many -t pack-and-copy",
24-
"webserver": "http-server --port 8080 -c-1"
24+
"demos:prepare": "nx run devextreme-demos:prepare-js",
25+
"demos:start": "http-server ./apps/demos --port 8080 -c-1"
2526
},
2627
"nx": {},
2728
"private": true,

packages/devextreme-angular/src/ui/scheduler/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,10 @@ export class DxSchedulerComponent extends DxComponent implements OnDestroy, OnCh
393393
394394
*/
395395
@Input()
396-
get editing(): boolean | { allowAdding?: boolean, allowDeleting?: boolean, allowDragging?: boolean, allowResizing?: boolean, allowTimeZoneEditing?: boolean, allowUpdating?: boolean, form?: undefined | { iconsShowMode?: AppointmentFormIconsShowMode, items?: Array<dxFormButtonItem | dxFormEmptyItem | dxFormGroupItem | dxFormSimpleItem | dxFormTabbedItem>, onCanceled?: ((formData: any) => void), onSaved?: ((formData: any) => void) } } {
396+
get editing(): boolean | { allowAdding?: boolean, allowDeleting?: boolean, allowDragging?: boolean, allowResizing?: boolean, allowTimeZoneEditing?: boolean, allowUpdating?: boolean, form?: undefined | { iconsShowMode?: AppointmentFormIconsShowMode, items?: Array<dxFormButtonItem | dxFormEmptyItem | dxFormGroupItem | dxFormSimpleItem | dxFormTabbedItem>, onCanceled?: ((formData: any) => void), onSaved?: ((formData: any) => void) }, popup?: Record<string, any> } {
397397
return this._getOption('editing');
398398
}
399-
set editing(value: boolean | { allowAdding?: boolean, allowDeleting?: boolean, allowDragging?: boolean, allowResizing?: boolean, allowTimeZoneEditing?: boolean, allowUpdating?: boolean, form?: undefined | { iconsShowMode?: AppointmentFormIconsShowMode, items?: Array<dxFormButtonItem | dxFormEmptyItem | dxFormGroupItem | dxFormSimpleItem | dxFormTabbedItem>, onCanceled?: ((formData: any) => void), onSaved?: ((formData: any) => void) } }) {
399+
set editing(value: boolean | { allowAdding?: boolean, allowDeleting?: boolean, allowDragging?: boolean, allowResizing?: boolean, allowTimeZoneEditing?: boolean, allowUpdating?: boolean, form?: undefined | { iconsShowMode?: AppointmentFormIconsShowMode, items?: Array<dxFormButtonItem | dxFormEmptyItem | dxFormGroupItem | dxFormSimpleItem | dxFormTabbedItem>, onCanceled?: ((formData: any) => void), onSaved?: ((formData: any) => void) }, popup?: Record<string, any> }) {
400400
this._setOption('editing', value);
401401
}
402402

@@ -1202,7 +1202,7 @@ export class DxSchedulerComponent extends DxComponent implements OnDestroy, OnCh
12021202
* This member supports the internal infrastructure and is not intended to be used directly from your code.
12031203
12041204
*/
1205-
@Output() editingChange: EventEmitter<boolean | { allowAdding?: boolean, allowDeleting?: boolean, allowDragging?: boolean, allowResizing?: boolean, allowTimeZoneEditing?: boolean, allowUpdating?: boolean, form?: undefined | { iconsShowMode?: AppointmentFormIconsShowMode, items?: Array<dxFormButtonItem | dxFormEmptyItem | dxFormGroupItem | dxFormSimpleItem | dxFormTabbedItem>, onCanceled?: ((formData: any) => void), onSaved?: ((formData: any) => void) } }>;
1205+
@Output() editingChange: EventEmitter<boolean | { allowAdding?: boolean, allowDeleting?: boolean, allowDragging?: boolean, allowResizing?: boolean, allowTimeZoneEditing?: boolean, allowUpdating?: boolean, form?: undefined | { iconsShowMode?: AppointmentFormIconsShowMode, items?: Array<dxFormButtonItem | dxFormEmptyItem | dxFormGroupItem | dxFormSimpleItem | dxFormTabbedItem>, onCanceled?: ((formData: any) => void), onSaved?: ((formData: any) => void) }, popup?: Record<string, any> }>;
12061206

12071207
/**
12081208

packages/devextreme-angular/src/ui/scheduler/nested/editing.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ export class DxoSchedulerEditingComponent extends NestedOption implements OnDest
8989
this._setOption('form', value);
9090
}
9191

92+
@Input()
93+
get popup(): Record<string, any> {
94+
return this._getOption('popup');
95+
}
96+
set popup(value: Record<string, any>) {
97+
this._setOption('popup', value);
98+
}
99+
92100

93101
protected get _optionPath() {
94102
return 'editing';

packages/devextreme-metadata/make-angular-metadata.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Ng.makeMetadata({
5959
removeMembers(/\/grids:LoadPanel.indicatorOptions/),
6060
removeMembers(/\/scheduler:Toolbar/),
6161
removeMembers(/\/scheduler:dxSchedulerOptions\.editing\.form/),
62+
removeMembers(/\/scheduler:dxSchedulerOptions\.editing\.popup/),
6263
removeMembers(/\/scheduler:dxSchedulerOptions\.resources\.icon/),
6364
removeMembers(/\/stepper:/),
6465
removeMembers(/\/speech_to_text:/),

packages/devextreme-metadata/make-integration-metadata.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Imd.makeMetadata({
1212
replaceTypes('common/grids:ColumnAIOptions.popup', ['*'], ['object']),
1313
replaceTypes('ui/card_view:dxCardViewOptions.filterBuilderPopup', ['*'], ['object']),
1414
replaceTypes('ui/card_view:Editing.popup', ['*'], ['object']),
15+
replaceTypes('ui/scheduler:dxSchedulerOptions.editing.popup', ['*'], ['object']),
1516

1617
removeMembers('core/dom_component:DOMComponentOptions.bindingOptions'),
1718

packages/devextreme-react/src/scheduler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ type IEditingProps = React.PropsWithChildren<{
403403
onCanceled?: ((formData: any) => void);
404404
onSaved?: ((formData: any) => void);
405405
};
406+
popup?: Record<string, any>;
406407
}>
407408
const _componentEditing = (props: IEditingProps) => {
408409
return React.createElement(NestedOption<IEditingProps>, {

packages/devextreme-vue/src/scheduler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ const DxEditingConfig = {
667667
"update:allowTimeZoneEditing": null,
668668
"update:allowUpdating": null,
669669
"update:form": null,
670+
"update:popup": null,
670671
},
671672
props: {
672673
allowAdding: Boolean,
@@ -675,7 +676,8 @@ const DxEditingConfig = {
675676
allowResizing: Boolean,
676677
allowTimeZoneEditing: Boolean,
677678
allowUpdating: Boolean,
678-
form: Object as PropType<Record<string, any>>
679+
form: Object as PropType<Record<string, any>>,
680+
popup: Object as PropType<Record<string, any>>
679681
}
680682
};
681683

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { isFunction } from '@js/core/utils/type';
2+
3+
const CSS_TRANSITION_EASING_REGEX = /cubic-bezier\((\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\)/;
4+
5+
const TransitionTimingFuncMap = {
6+
linear: 'cubic-bezier(0, 0, 1, 1)',
7+
swing: 'cubic-bezier(0.445, 0.05, 0.55, 0.95)',
8+
ease: 'cubic-bezier(0.25, 0.1, 0.25, 1)',
9+
'ease-in': 'cubic-bezier(0.42, 0, 1, 1)',
10+
'ease-out': 'cubic-bezier(0, 0, 0.58, 1)',
11+
'ease-in-out': 'cubic-bezier(0.42, 0, 0.58, 1)',
12+
};
13+
14+
const polynomBezier = (x1: number, y1: number, x2: number, y2: number): ((t: number) => number) => {
15+
const Cx = 3 * x1;
16+
const Bx = 3 * (x2 - x1) - Cx;
17+
const Ax = 1 - Cx - Bx;
18+
19+
const Cy = 3 * y1;
20+
const By = 3 * (y2 - y1) - Cy;
21+
const Ay = 1 - Cy - By;
22+
23+
const bezierX = (t: number): number => t * (Cx + t * (Bx + t * Ax));
24+
25+
const bezierY = (t: number): number => t * (Cy + t * (By + t * Ay));
26+
27+
const derivativeX = (t: number): number => Cx + t * (2 * Bx + t * 3 * Ax);
28+
29+
const findXFor = (t: number): number => {
30+
let x = t;
31+
let i = 0;
32+
// eslint-disable-next-line no-undef-init
33+
let z: number | undefined = undefined;
34+
35+
while (i < 14) {
36+
z = bezierX(x) - t;
37+
if (Math.abs(z) < 1e-3) {
38+
break;
39+
}
40+
41+
x -= z / derivativeX(x);
42+
i += 1;
43+
}
44+
45+
return x;
46+
};
47+
48+
return (t: number): number => bezierY(findXFor(t));
49+
};
50+
51+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
52+
let easing: Record<string, any> = {};
53+
export const convertTransitionTimingFuncToEasing = (cssTransitionEasing: string): string => {
54+
// eslint-disable-next-line no-param-reassign
55+
cssTransitionEasing = TransitionTimingFuncMap[cssTransitionEasing] || cssTransitionEasing;
56+
57+
// eslint-disable-next-line @stylistic/max-len
58+
let coeffs: RegExpExecArray | string[] | null = CSS_TRANSITION_EASING_REGEX.exec(cssTransitionEasing);
59+
const numCoeffs: number[] = [];
60+
let forceName: string | null = null;
61+
62+
if (!coeffs) {
63+
forceName = 'linear';
64+
coeffs = TransitionTimingFuncMap[forceName].match(CSS_TRANSITION_EASING_REGEX);
65+
}
66+
67+
// @ts-expect-error
68+
coeffs = coeffs.slice(1, 5);
69+
for (let i = 0; i < coeffs.length; i += 1) {
70+
numCoeffs[i] = parseFloat(coeffs[i]);
71+
}
72+
73+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
74+
const easingName = forceName || `cubicbezier_${numCoeffs.join('_').replace(/\./g, 'p')}`;
75+
76+
if (!isFunction(easing[easingName])) {
77+
easing[easingName] = function (x: number, t: number, b: number, c: number, d: number): number {
78+
return c * polynomBezier(numCoeffs[0], numCoeffs[1], numCoeffs[2], numCoeffs[3])(t / d) + b;
79+
};
80+
}
81+
82+
return easingName;
83+
};
84+
85+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
86+
export function setEasing(value: Record<string, any>): void {
87+
easing = value;
88+
}
89+
90+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
91+
export function getEasing(name: string): any {
92+
return easing[name];
93+
}

0 commit comments

Comments
 (0)