@furystack/shades-common-components 3.2.1 → 3.3.1
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/components/animations.js +38 -20
- package/dist/components/animations.js.map +1 -1
- package/dist/components/button.js +2 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/command-palette/command-palette-manager.js +12 -5
- package/dist/components/command-palette/command-palette-manager.js.map +1 -1
- package/dist/components/command-palette/command-palette-suggestion-list.js +2 -4
- package/dist/components/command-palette/command-palette-suggestion-list.js.map +1 -1
- package/dist/components/command-palette/index.js +18 -5
- package/dist/components/command-palette/index.js.map +1 -1
- package/dist/components/data-grid/body.js +2 -3
- package/dist/components/data-grid/body.js.map +1 -1
- package/dist/components/data-grid/data-grid-row.js +20 -17
- package/dist/components/data-grid/data-grid-row.js.map +1 -1
- package/dist/components/data-grid/data-grid.js +4 -6
- package/dist/components/data-grid/data-grid.js.map +1 -1
- package/dist/components/data-grid/header.js +2 -4
- package/dist/components/data-grid/header.js.map +1 -1
- package/dist/components/data-grid/index.js +16 -3
- package/dist/components/data-grid/index.js.map +1 -1
- package/dist/components/grid.js +4 -9
- package/dist/components/grid.js.map +1 -1
- package/dist/components/index.js +33 -19
- package/dist/components/index.js.map +1 -1
- package/dist/components/input.js +1 -2
- package/dist/components/input.js.map +1 -1
- package/dist/components/modal.js +19 -3
- package/dist/components/modal.js.map +1 -1
- package/dist/components/noty-list.js +3 -4
- package/dist/components/noty-list.js.map +1 -1
- package/dist/components/paper.js +1 -1
- package/dist/components/paper.js.map +1 -1
- package/dist/components/suggest/index.js +18 -5
- package/dist/components/suggest/index.js.map +1 -1
- package/dist/components/suggest/suggest-manager.js +12 -5
- package/dist/components/suggest/suggest-manager.js.map +1 -1
- package/dist/components/suggest/suggestion-list.js +2 -4
- package/dist/components/suggest/suggestion-list.js.map +1 -1
- package/dist/components/wizard/index.js +36 -0
- package/dist/components/wizard/index.js.map +1 -0
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/dist/services/collection-service.js +5 -3
- package/dist/services/collection-service.js.map +1 -1
- package/dist/services/index.js +21 -8
- package/dist/services/index.js.map +1 -1
- package/dist/services/noty-service.js +7 -2
- package/dist/services/noty-service.js.map +1 -1
- package/dist/services/theme-provider-service.js +7 -2
- package/dist/services/theme-provider-service.js.map +1 -1
- package/dist/utils/index.js +15 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/promisify-animation.js +6 -0
- package/dist/utils/promisify-animation.js.map +1 -1
- package/package.json +7 -8
- package/src/components/animations.ts +50 -28
- package/src/components/data-grid/body.tsx +8 -0
- package/src/components/data-grid/data-grid-row.tsx +22 -12
- package/src/components/data-grid/data-grid.tsx +38 -0
- package/src/components/index.ts +1 -0
- package/src/components/modal.tsx +30 -7
- package/src/components/wizard/index.tsx +62 -0
- package/src/utils/promisify-animation.ts +6 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/types/components/animations.d.ts +5 -8
- package/types/components/animations.d.ts.map +1 -1
- package/types/components/app-bar-link.d.ts +3 -2
- package/types/components/app-bar-link.d.ts.map +1 -1
- package/types/components/data-grid/body.d.ts +4 -0
- package/types/components/data-grid/body.d.ts.map +1 -1
- package/types/components/data-grid/data-grid-row.d.ts +4 -0
- package/types/components/data-grid/data-grid-row.d.ts.map +1 -1
- package/types/components/data-grid/data-grid.d.ts +34 -0
- package/types/components/data-grid/data-grid.d.ts.map +1 -1
- package/types/components/fab.d.ts +3 -2
- package/types/components/fab.d.ts.map +1 -1
- package/types/components/index.d.ts +1 -0
- package/types/components/index.d.ts.map +1 -1
- package/types/components/modal.d.ts +9 -4
- package/types/components/modal.d.ts.map +1 -1
- package/types/components/wizard/index.d.ts +14 -0
- package/types/components/wizard/index.d.ts.map +1 -0
- package/types/utils/promisify-animation.d.ts +6 -0
- package/types/utils/promisify-animation.d.ts.map +1 -1
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.ThemeProviderService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
10
|
const inject_1 = require("@furystack/inject");
|
|
6
11
|
const utils_1 = require("@furystack/utils");
|
|
7
12
|
const default_dark_theme_1 = require("./default-dark-theme");
|
|
@@ -64,7 +69,7 @@ let ThemeProviderService = class ThemeProviderService {
|
|
|
64
69
|
this.theme.dispose();
|
|
65
70
|
}
|
|
66
71
|
};
|
|
67
|
-
ThemeProviderService =
|
|
72
|
+
ThemeProviderService = __decorate([
|
|
68
73
|
(0, inject_1.Injectable)({ lifetime: 'singleton' })
|
|
69
74
|
], ThemeProviderService);
|
|
70
75
|
exports.ThemeProviderService = ThemeProviderService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider-service.js","sourceRoot":"","sources":["../../src/services/theme-provider-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme-provider-service.js","sourceRoot":"","sources":["../../src/services/theme-provider-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAA8C;AAC9C,4CAA0E;AAC1E,6DAAuD;AA8CvD;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;QAkDW,UAAK,GAAG,IAAI,uBAAe,CAAC,qCAAgB,CAAC,CAAA;IAS/D,CAAC;IA1DC;;;;;;OAMG;IACI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C,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;GACzB,oBAAoB,CA2DhC;AA3DY,oDAAoB"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./promisify-animation"), exports);
|
|
17
|
+
__exportStar(require("./promisify-animation"), exports);
|
|
5
18
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.promisifyAnimation = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @param el The element to animate
|
|
6
|
+
* @param keyframes A list of keyframe definitions
|
|
7
|
+
* @param options Animation options
|
|
8
|
+
* @returns A promise that resolves when the animation is complete or rejects if cancelled
|
|
9
|
+
*/
|
|
4
10
|
const promisifyAnimation = async (el, keyframes, options) => new Promise((resolve, reject) => {
|
|
5
11
|
if (!el) {
|
|
6
12
|
return reject();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promisify-animation.js","sourceRoot":"","sources":["../../src/utils/promisify-animation.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"promisify-animation.js","sourceRoot":"","sources":["../../src/utils/promisify-animation.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,MAAM,kBAAkB,GAAG,KAAK,EACrC,EAAkB,EAClB,SAAuD,EACvD,OAAuD,EACvD,EAAE,CACF,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,IAAI,CAAC,EAAE,EAAE;QACP,OAAO,MAAM,EAAE,CAAA;KAChB;IACD,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAChD,SAAS,CAAC,QAAQ,GAAG,OAAO,CAAA;IAC5B,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAA;AAC7B,CAAC,CAAC,CAAA;AAZS,QAAA,kBAAkB,sBAY3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furystack/shades-common-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"FuryStack",
|
|
@@ -17,16 +17,15 @@
|
|
|
17
17
|
"author": "gallay.lajos@gmail.com",
|
|
18
18
|
"license": "GPL-2.0",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"typescript": "4.
|
|
20
|
+
"typescript": "4.8.2"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@furystack/core": "^11.0.
|
|
24
|
-
"@furystack/inject": "^7.0.
|
|
25
|
-
"@furystack/shades": "^6.0.
|
|
26
|
-
"@furystack/utils": "^3.0.
|
|
23
|
+
"@furystack/core": "^11.0.10",
|
|
24
|
+
"@furystack/inject": "^7.0.4",
|
|
25
|
+
"@furystack/shades": "^6.0.6",
|
|
26
|
+
"@furystack/utils": "^3.0.8",
|
|
27
27
|
"path-to-regexp": "^6.2.1",
|
|
28
|
-
"semaphore-async-await": "^1.5.1"
|
|
29
|
-
"tslib": "^2.4.0"
|
|
28
|
+
"semaphore-async-await": "^1.5.1"
|
|
30
29
|
},
|
|
31
30
|
"typings": "types/index.d.ts",
|
|
32
31
|
"main": "dist/index.js",
|
|
@@ -1,46 +1,68 @@
|
|
|
1
1
|
import { promisifyAnimation } from '../utils/promisify-animation'
|
|
2
2
|
|
|
3
3
|
export const animations = {
|
|
4
|
-
showSlide: async (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
showSlide: async (element?: Element | null, options?: KeyframeAnimationOptions) => {
|
|
5
|
+
element &&
|
|
6
|
+
(await promisifyAnimation(
|
|
7
|
+
element,
|
|
8
|
+
[
|
|
9
|
+
{ transform: 'translate(-350px, 0)scale(0)', opacity: 0 },
|
|
10
|
+
{ transform: 'translate(0, 0)scale(1)', opacity: 1 },
|
|
11
|
+
],
|
|
12
|
+
{
|
|
13
|
+
duration: 500,
|
|
14
|
+
easing: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)',
|
|
15
|
+
fill: 'forwards',
|
|
16
|
+
...options,
|
|
17
|
+
},
|
|
18
|
+
))
|
|
17
19
|
},
|
|
18
|
-
hideSlide: async (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
hideSlide: async (element?: Element | null, options?: KeyframeAnimationOptions) => {
|
|
21
|
+
element &&
|
|
22
|
+
(await promisifyAnimation(
|
|
23
|
+
element,
|
|
24
|
+
[
|
|
25
|
+
{ transform: 'translate(0, 0)scale(1)', opacity: 1 },
|
|
26
|
+
{ transform: 'translate(-350px, 0)scale(0)', opacity: 0 },
|
|
27
|
+
],
|
|
28
|
+
{
|
|
29
|
+
duration: 500,
|
|
30
|
+
easing: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)',
|
|
31
|
+
fill: 'forwards',
|
|
32
|
+
...options,
|
|
33
|
+
},
|
|
34
|
+
))
|
|
31
35
|
},
|
|
32
|
-
fadeOut: async (element?: Element | null) => {
|
|
36
|
+
fadeOut: async (element?: Element | null, options?: KeyframeAnimationOptions) => {
|
|
33
37
|
element &&
|
|
34
38
|
(await promisifyAnimation(element, [{ opacity: 1 }, { opacity: 0 }], {
|
|
35
39
|
duration: 500,
|
|
36
40
|
easing: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)',
|
|
41
|
+
...options,
|
|
37
42
|
}))
|
|
38
43
|
},
|
|
39
|
-
fadeIn: async (element?: Element | null) => {
|
|
44
|
+
fadeIn: async (element?: Element | null, options?: KeyframeAnimationOptions) => {
|
|
40
45
|
element &&
|
|
41
46
|
(await promisifyAnimation(element, [{ opacity: 0 }, { opacity: 1 }], {
|
|
42
47
|
duration: 500,
|
|
43
48
|
easing: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)',
|
|
49
|
+
...options,
|
|
44
50
|
}))
|
|
45
51
|
},
|
|
52
|
+
showParallax: async (element?: Element | null, options?: KeyframeAnimationOptions) => {
|
|
53
|
+
element &&
|
|
54
|
+
(await promisifyAnimation(
|
|
55
|
+
element,
|
|
56
|
+
[
|
|
57
|
+
{ transform: 'translate(50px, 0)', opacity: 0 },
|
|
58
|
+
{ transform: 'translate(0, 0)', opacity: 1 },
|
|
59
|
+
],
|
|
60
|
+
{
|
|
61
|
+
duration: 900,
|
|
62
|
+
easing: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)',
|
|
63
|
+
fill: 'forwards',
|
|
64
|
+
...options,
|
|
65
|
+
},
|
|
66
|
+
))
|
|
67
|
+
},
|
|
46
68
|
}
|
|
@@ -11,6 +11,10 @@ export interface DataGridBodyProps<T> {
|
|
|
11
11
|
columns: Array<keyof T>
|
|
12
12
|
rowComponents?: DataRowCells<T>
|
|
13
13
|
style?: Partial<CSSStyleDeclaration>
|
|
14
|
+
focusedRowStyle?: Partial<CSSStyleDeclaration>
|
|
15
|
+
unfocusedRowStyle?: Partial<CSSStyleDeclaration>
|
|
16
|
+
selectedRowStyle?: Partial<CSSStyleDeclaration>
|
|
17
|
+
unselectedRowStyle?: Partial<CSSStyleDeclaration>
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
export interface DataGridBodyState<T> {
|
|
@@ -57,6 +61,10 @@ export const DataGridBody: <T>(props: DataGridBodyProps<T>, children: ChildrenLi
|
|
|
57
61
|
service={props.service}
|
|
58
62
|
rowComponents={props.rowComponents}
|
|
59
63
|
onRowClick={props.onRowClick}
|
|
64
|
+
focusedRowStyle={props.focusedRowStyle}
|
|
65
|
+
unfocusedRowStyle={props.unfocusedRowStyle}
|
|
66
|
+
selectedRowStyle={props.selectedRowStyle}
|
|
67
|
+
unselectedRowStyle={props.unselectedRowStyle}
|
|
60
68
|
></DataGridRow>
|
|
61
69
|
))}
|
|
62
70
|
</>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChildrenList, createComponent, createFragment, Shade } from '@furystack/shades'
|
|
1
|
+
import { attachStyles, ChildrenList, createComponent, createFragment, Shade } from '@furystack/shades'
|
|
2
2
|
import { CollectionService } from '../../services/collection-service'
|
|
3
3
|
import { DataRowCells } from './data-grid'
|
|
4
4
|
|
|
@@ -8,6 +8,10 @@ export interface DataGridRowProps<T> {
|
|
|
8
8
|
service: CollectionService<T>
|
|
9
9
|
rowComponents?: DataRowCells<T>
|
|
10
10
|
onRowClick?: (row: T, event: MouseEvent) => void
|
|
11
|
+
focusedRowStyle?: Partial<CSSStyleDeclaration>
|
|
12
|
+
selectedRowStyle?: Partial<CSSStyleDeclaration>
|
|
13
|
+
unfocusedRowStyle?: Partial<CSSStyleDeclaration>
|
|
14
|
+
unselectedRowStyle?: Partial<CSSStyleDeclaration>
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export interface DataGridRowState<T> {
|
|
@@ -27,8 +31,12 @@ export const DataGridRow: <T>(props: DataGridRowProps<T>, children: ChildrenList
|
|
|
27
31
|
resources: ({ props, element }) => [
|
|
28
32
|
props.service.focusedEntry.subscribe((newEntry) => {
|
|
29
33
|
if (newEntry === props.entry) {
|
|
30
|
-
element
|
|
31
|
-
|
|
34
|
+
attachStyles(element, {
|
|
35
|
+
style: props.focusedRowStyle || {
|
|
36
|
+
filter: 'brightness(1.5)',
|
|
37
|
+
fontWeight: 'bolder',
|
|
38
|
+
},
|
|
39
|
+
})
|
|
32
40
|
|
|
33
41
|
const headerHeight = element.closest('table')?.querySelector('th')?.getBoundingClientRect().height || 42
|
|
34
42
|
|
|
@@ -42,25 +50,27 @@ export const DataGridRow: <T>(props: DataGridRowProps<T>, children: ChildrenList
|
|
|
42
50
|
const footerHeight =
|
|
43
51
|
element.closest('shade-data-grid')?.querySelector('shade-data-grid-footer')?.getBoundingClientRect().height ||
|
|
44
52
|
42
|
|
45
|
-
const visibleMaxTop = parent.clientHeight - footerHeight
|
|
53
|
+
const visibleMaxTop = parent.clientHeight - footerHeight
|
|
46
54
|
const desiredMaxTop = element.offsetTop + element.clientHeight
|
|
47
55
|
if (desiredMaxTop > visibleMaxTop) {
|
|
48
56
|
parent.scrollTo({ top: desiredMaxTop - visibleMaxTop, behavior: 'smooth' })
|
|
49
57
|
}
|
|
50
|
-
|
|
51
|
-
// ;(element as any).scrollIntoView({ inline: 'nearest', block: 'nearest', behavior: 'smooth' })
|
|
52
58
|
} else {
|
|
53
|
-
element
|
|
54
|
-
|
|
59
|
+
attachStyles(element, {
|
|
60
|
+
style: props.unfocusedRowStyle || {
|
|
61
|
+
filter: 'brightness(1)',
|
|
62
|
+
fontWeight: 'inherit',
|
|
63
|
+
},
|
|
64
|
+
})
|
|
55
65
|
}
|
|
56
|
-
}),
|
|
66
|
+
}, true),
|
|
57
67
|
props.service.selection.subscribe((selection) => {
|
|
58
68
|
if (selection.includes(props.entry)) {
|
|
59
|
-
element
|
|
69
|
+
attachStyles(element, { style: props.selectedRowStyle || { backgroundColor: 'rgba(128,128,128,0.1)' } })
|
|
60
70
|
} else {
|
|
61
|
-
element
|
|
71
|
+
attachStyles(element, { style: props.unselectedRowStyle || { backgroundColor: 'transparent' } })
|
|
62
72
|
}
|
|
63
|
-
}),
|
|
73
|
+
}, true),
|
|
64
74
|
],
|
|
65
75
|
|
|
66
76
|
render: ({ getState, props, element }) => {
|
|
@@ -15,12 +15,46 @@ export type DataRowCells<T> = {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface DataGridProps<T> {
|
|
18
|
+
/**
|
|
19
|
+
* A list of columns to display
|
|
20
|
+
*/
|
|
18
21
|
columns: Array<keyof T>
|
|
22
|
+
/**
|
|
23
|
+
* Optional style overrides for the grid
|
|
24
|
+
*/
|
|
19
25
|
styles: GridProps<T>['styles']
|
|
26
|
+
/**
|
|
27
|
+
* A collection service to use for data source
|
|
28
|
+
*/
|
|
20
29
|
service: CollectionService<T>
|
|
30
|
+
/**
|
|
31
|
+
* A list of custom header components to use
|
|
32
|
+
*/
|
|
21
33
|
headerComponents: DataHeaderCells<T>
|
|
34
|
+
/**
|
|
35
|
+
* A list of custom row components to use
|
|
36
|
+
*/
|
|
22
37
|
rowComponents: DataRowCells<T>
|
|
38
|
+
/**
|
|
39
|
+
* Optional autoFocus property to set the grid as focused
|
|
40
|
+
*/
|
|
23
41
|
autofocus?: boolean
|
|
42
|
+
/**
|
|
43
|
+
* Optional style to attach to grid rows when the row is focused
|
|
44
|
+
*/
|
|
45
|
+
focusedRowStyle?: Partial<CSSStyleDeclaration>
|
|
46
|
+
/**
|
|
47
|
+
* Optional style to attach to grid rows when the row is not focused
|
|
48
|
+
*/
|
|
49
|
+
unfocusedRowStyle?: Partial<CSSStyleDeclaration>
|
|
50
|
+
/**
|
|
51
|
+
* Optional style to attach to grid rows when the row is selected
|
|
52
|
+
*/
|
|
53
|
+
selectedRowStyle?: Partial<CSSStyleDeclaration>
|
|
54
|
+
/**
|
|
55
|
+
* Optional style to attach to grid rows when the row is not selected
|
|
56
|
+
*/
|
|
57
|
+
unselectedRowStyle?: Partial<CSSStyleDeclaration>
|
|
24
58
|
}
|
|
25
59
|
|
|
26
60
|
export const DataGrid: <T>(props: DataGridProps<T>, children: ChildrenList) => JSX.Element<any, any> = Shade<
|
|
@@ -102,6 +136,10 @@ export const DataGrid: <T>(props: DataGridProps<T>, children: ChildrenList) => J
|
|
|
102
136
|
rowComponents={props.rowComponents}
|
|
103
137
|
onRowClick={(entry, ev) => props.service.handleRowClick(entry, ev)}
|
|
104
138
|
style={props.styles?.cell}
|
|
139
|
+
focusedRowStyle={props.focusedRowStyle}
|
|
140
|
+
selectedRowStyle={props.selectedRowStyle}
|
|
141
|
+
unfocusedRowStyle={props.unfocusedRowStyle}
|
|
142
|
+
unselectedRowStyle={props.unselectedRowStyle}
|
|
105
143
|
/>
|
|
106
144
|
</table>
|
|
107
145
|
<DataGridFooter service={props.service} />
|
package/src/components/index.ts
CHANGED
package/src/components/modal.tsx
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
import { Shade, createComponent } from '@furystack/shades'
|
|
2
|
+
import { ObservableValue } from '@furystack/utils'
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
+
export type ModalProps = {
|
|
5
|
+
backdropStyle?: Partial<CSSStyleDeclaration>
|
|
6
|
+
isVisible: ObservableValue<boolean>
|
|
7
|
+
onClose?: () => void
|
|
8
|
+
showAnimation?: (el: Element | null) => Promise<void>
|
|
9
|
+
hideAnimation?: (el: Element | null) => Promise<void>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Modal = Shade<ModalProps, { isVisible?: boolean }>({
|
|
13
|
+
getInitialState: ({ props }) => ({ isVisible: props.isVisible.getValue() }),
|
|
4
14
|
shadowDomName: 'shade-modal',
|
|
5
|
-
|
|
6
|
-
|
|
15
|
+
resources: ({ props, element, updateState }) => [
|
|
16
|
+
props.isVisible.subscribe(async (visible) => {
|
|
17
|
+
if (visible) {
|
|
18
|
+
updateState({ isVisible: visible })
|
|
19
|
+
await props.showAnimation?.(element)
|
|
20
|
+
} else {
|
|
21
|
+
await props.hideAnimation?.(element).finally(() => updateState({ isVisible: visible }))
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
render: ({ props, getState, children }) => {
|
|
27
|
+
const { isVisible } = getState()
|
|
28
|
+
return isVisible ? (
|
|
7
29
|
<div
|
|
8
30
|
className="shade-backdrop"
|
|
9
|
-
onclick={() =>
|
|
31
|
+
onclick={() => {
|
|
32
|
+
props.onClose?.()
|
|
33
|
+
}}
|
|
10
34
|
style={{
|
|
11
35
|
width: '100%',
|
|
12
36
|
height: '100%',
|
|
@@ -14,12 +38,11 @@ export const Modal = Shade<{ isVisible: boolean; onClose?: () => void }>({
|
|
|
14
38
|
position: 'fixed',
|
|
15
39
|
top: '0',
|
|
16
40
|
left: '0',
|
|
41
|
+
...props.backdropStyle,
|
|
17
42
|
}}
|
|
18
43
|
>
|
|
19
44
|
{children}
|
|
20
45
|
</div>
|
|
21
|
-
) :
|
|
22
|
-
<div />
|
|
23
|
-
)
|
|
46
|
+
) : null
|
|
24
47
|
},
|
|
25
48
|
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ChildrenList, createComponent, Shade } from '@furystack/shades'
|
|
2
|
+
import { Paper } from '../paper'
|
|
3
|
+
|
|
4
|
+
export interface WizardStepProps {
|
|
5
|
+
currentPage: number
|
|
6
|
+
maxPages: number
|
|
7
|
+
onNext?: () => void
|
|
8
|
+
onPrev?: () => void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface WizardProps {
|
|
12
|
+
steps: Array<(props: WizardStepProps, children: ChildrenList) => JSX.Element<any, any>>
|
|
13
|
+
isOpened?: boolean
|
|
14
|
+
onFinish?: () => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface WizardState {
|
|
18
|
+
currentPage: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Wizard = Shade<WizardProps, WizardState>({
|
|
22
|
+
shadowDomName: 'shades-wizard',
|
|
23
|
+
getInitialState: () => ({
|
|
24
|
+
currentPage: 0,
|
|
25
|
+
}),
|
|
26
|
+
render: ({ props, getState, updateState }) => {
|
|
27
|
+
const { currentPage } = getState()
|
|
28
|
+
|
|
29
|
+
const CurrentPage = props.steps[currentPage]
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
style={{
|
|
34
|
+
display: 'flex',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
width: '100%',
|
|
38
|
+
height: '100%',
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<Paper elevation={3} onclick={(ev) => ev.stopPropagation()}>
|
|
42
|
+
<CurrentPage
|
|
43
|
+
currentPage={currentPage}
|
|
44
|
+
maxPages={props.steps.length}
|
|
45
|
+
onNext={() => {
|
|
46
|
+
if (currentPage < props.steps.length - 1) {
|
|
47
|
+
updateState({ currentPage: currentPage + 1 })
|
|
48
|
+
} else {
|
|
49
|
+
props.onFinish?.()
|
|
50
|
+
}
|
|
51
|
+
}}
|
|
52
|
+
onPrev={() => {
|
|
53
|
+
if (currentPage > 0) {
|
|
54
|
+
updateState({ currentPage: currentPage - 1 })
|
|
55
|
+
}
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
</Paper>
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
},
|
|
62
|
+
})
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param el The element to animate
|
|
3
|
+
* @param keyframes A list of keyframe definitions
|
|
4
|
+
* @param options Animation options
|
|
5
|
+
* @returns A promise that resolves when the animation is complete or rejects if cancelled
|
|
6
|
+
*/
|
|
1
7
|
export const promisifyAnimation = async (
|
|
2
8
|
el: Element | null,
|
|
3
9
|
keyframes: Keyframe[] | PropertyIndexedKeyframes | null,
|