jsl-ui 9.29.0 → 10.0.0
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/docs/AutoSuggestComponent.md +17 -0
- package/docs/ButtonComponent.md +14 -0
- package/docs/CheckBoxComponent.md +12 -0
- package/docs/DateComponent.md +12 -0
- package/docs/DateRangeComponent.md +13 -0
- package/docs/DateTimeComponent.md +13 -0
- package/docs/DialogComponent.md +15 -0
- package/docs/ExpanderComponent.md +13 -0
- package/docs/FormComponent.md +15 -0
- package/docs/FormFieldComponent.md +15 -0
- package/docs/GridComponent.md +19 -0
- package/docs/InputComponent.md +15 -0
- package/docs/IntervalComponent.md +13 -0
- package/docs/LoadingComponent.md +12 -0
- package/docs/NavigationComponent.md +17 -0
- package/docs/Notification.md +14 -0
- package/docs/NotificationComponent.md +13 -0
- package/docs/NumberComponent.md +12 -0
- package/docs/OverlayComponent.md +12 -0
- package/docs/ProgressComponent.md +12 -0
- package/docs/README.md +24 -0
- package/docs/RibbonMenuComponent.md +14 -0
- package/docs/SelectComponent.md +15 -0
- package/docs/SplitterComponent.md +14 -0
- package/docs/StackPanelComponent.md +13 -0
- package/docs/TabsComponent.md +16 -0
- package/docs/TimeComponent.md +13 -0
- package/docs/TreeViewComponent.md +16 -0
- package/examples/showcase/checks-and-expanders.ts +163 -0
- package/examples/showcase/cultures.ts +39 -0
- package/examples/showcase/dates.ts +182 -0
- package/examples/showcase/dialogs.ts +184 -0
- package/examples/showcase/feedback-and-navigation.ts +174 -0
- package/examples/showcase/fields.ts +178 -0
- package/examples/showcase/fonts/Jost-Variable.ttf +0 -0
- package/examples/showcase/fonts/OFL-Jost.txt +93 -0
- package/examples/showcase/grids.ts +150 -0
- package/examples/showcase/index.html +60 -0
- package/examples/showcase/layout-and-navigation.ts +47 -0
- package/examples/showcase/nivona.css +98 -0
- package/examples/showcase/selects.ts +158 -0
- package/examples/showcase/showcase.css +231 -0
- package/examples/showcase/showcase.ts +214 -0
- package/examples/showcase/tabs.ts +161 -0
- package/examples/showcase/themes.css +83 -0
- package/examples/showcase/themes.ts +54 -0
- package/lib/components/IntervalComponent.d.ts +5 -0
- package/lib/components/IntervalComponent.js +29 -13
- package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +11 -9
- package/lib/components/auto-suggest/AutoSuggestComponent.js +25 -38
- package/lib/components/button/ButtonComponent.d.ts +30 -1
- package/lib/components/button/ButtonComponent.js +85 -4
- package/lib/components/checkbox/CheckBoxComponent.d.ts +11 -1
- package/lib/components/checkbox/CheckBoxComponent.js +66 -56
- package/lib/components/checkbox/CheckBoxStyle.scss +72 -85
- package/lib/components/date/DateComponent.d.ts +10 -0
- package/lib/components/date/DateComponent.js +92 -44
- package/lib/components/date-range/DateRangeComponent.d.ts +14 -3
- package/lib/components/date-range/DateRangeComponent.js +96 -86
- package/lib/components/date-range/DateRangeStyle.scss +35 -11
- package/lib/components/date-time/DateTimeComponent.d.ts +8 -0
- package/lib/components/date-time/DateTimeComponent.js +64 -23
- package/lib/components/date-time/DateTimeStyle.scss +10 -7
- package/lib/components/dialog/DialogComponent.d.ts +21 -7
- package/lib/components/dialog/DialogComponent.js +179 -122
- package/lib/components/expander/ExpanderComponent.d.ts +15 -1
- package/lib/components/expander/ExpanderComponent.js +85 -64
- package/lib/components/expander/ExpanderStyle.scss +61 -47
- package/lib/components/form-field/FormFieldComponent.d.ts +45 -15
- package/lib/components/form-field/FormFieldComponent.js +249 -96
- package/lib/components/form-field/FormFieldStyle.scss +36 -87
- package/lib/components/form-field/create-control.d.ts +7 -0
- package/lib/components/form-field/create-control.js +48 -0
- package/lib/components/input/InputComponent.d.ts +18 -1
- package/lib/components/input/InputComponent.js +68 -93
- package/lib/components/loading/LoadingComponent.d.ts +9 -2
- package/lib/components/loading/LoadingComponent.js +13 -12
- package/lib/components/loading/LoadingStyle.css +19 -29
- package/lib/components/navigation/NavigationComponent.d.ts +34 -10
- package/lib/components/navigation/NavigationComponent.js +261 -33
- package/lib/components/navigation/NavigationStyle.scss +62 -226
- package/lib/components/notification/Notification.d.ts +37 -4
- package/lib/components/notification/Notification.js +160 -41
- package/lib/components/notification/Notification.scss +103 -19
- package/lib/components/number/NumberComponent.d.ts +16 -2
- package/lib/components/number/NumberComponent.js +54 -53
- package/lib/components/overlay/OverlayComponent.d.ts +13 -7
- package/lib/components/overlay/OverlayComponent.js +46 -114
- package/lib/components/overlay/overlay.css +18 -57
- package/lib/components/progress/ProgressComponent.d.ts +1 -0
- package/lib/components/progress/ProgressComponent.js +6 -6
- package/lib/components/progress/ProgressStyle.scss +5 -15
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +2 -2
- package/lib/components/ribbon-menu/RibbonMenuStyle.scss +6 -76
- package/lib/components/select/SelectComponent.d.ts +33 -3
- package/lib/components/select/SelectComponent.js +312 -278
- package/lib/components/select/SelectDDAreaComponent.d.ts +13 -7
- package/lib/components/select/SelectDDAreaComponent.js +215 -256
- package/lib/components/select/SelectStyle.scss +204 -186
- package/lib/components/slider/nouislider.css +40 -54
- package/lib/components/stack-panel/SplitterComponent.d.ts +19 -3
- package/lib/components/stack-panel/SplitterComponent.js +94 -111
- package/lib/components/stack-panel/SplitterStyle.scss +9 -45
- package/lib/components/stack-panel/StackPanelComponent.js +3 -3
- package/lib/components/stack-panel/StackPanelStyle.scss +10 -52
- package/lib/components/tabs/TabsComponent.d.ts +17 -1
- package/lib/components/tabs/TabsComponent.js +247 -123
- package/lib/components/tabs/TabsStyle.scss +138 -75
- package/lib/components/time/TimeComponent.d.ts +5 -0
- package/lib/components/time/TimeComponent.js +61 -69
- package/lib/components/time/TimeComponent.scss +4 -4
- package/lib/components/tree-view/TreeViewComponent.d.ts +10 -4
- package/lib/components/tree-view/TreeViewComponent.js +65 -32
- package/lib/components/tree-view/TreeViewStyle.scss +12 -96
- package/lib/core/jq.js +11 -8
- package/lib/grid/slick-default-theme.css +107 -31
- package/lib/grid/slick.creator.js +23 -5
- package/lib/grid/slick.formatters.js +4 -3
- package/lib/grid/slick.grid.css +38 -26
- package/lib/grid/slick.grid.d.ts +1 -0
- package/lib/grid/slick.grid.js +2 -3
- package/lib/grid.css +3413 -454
- package/lib/index.css +2500 -1031
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interaction/moveable.d.ts +1 -0
- package/lib/interaction/moveable.js +8 -0
- package/lib/interaction/resizable.d.ts +1 -0
- package/lib/interaction/resizable.js +9 -0
- package/lib/ui/auto.suggest.css +31 -14
- package/lib/ui/auto.suggest.d.ts +1 -0
- package/lib/ui/auto.suggest.js +88 -18
- package/lib/ui/base.css +2 -48
- package/lib/ui/button.css +134 -0
- package/lib/ui/date-input.css +11 -0
- package/lib/ui/date.picker/css/tiny-date-picker.css +124 -325
- package/lib/ui/date.picker/date-picker-options.js +4 -3
- package/lib/ui/date.picker/lib/date-manip.js +9 -0
- package/lib/ui/date.picker/mode/base-mode.d.ts +2 -1
- package/lib/ui/date.picker/mode/base-mode.js +112 -22
- package/lib/ui/date.picker/mode/dropdown-mode.d.ts +2 -4
- package/lib/ui/date.picker/mode/dropdown-mode.js +29 -42
- package/lib/ui/date.picker/mode/index.d.ts +2 -1
- package/lib/ui/date.picker/mode/modal-mode.d.ts +2 -1
- package/lib/ui/date.picker/mode/modal-mode.js +4 -2
- package/lib/ui/date.picker/mode/permanent-mode.d.ts +2 -1
- package/lib/ui/date.picker/views/day-picker.js +24 -15
- package/lib/ui/date.picker/views/month-picker.js +1 -1
- package/lib/ui/date.picker/views/year-picker.js +3 -2
- package/lib/ui/date.picker.d.ts +2 -1
- package/lib/ui/dialog.css +144 -108
- package/lib/ui/dialog.d.ts +19 -1
- package/lib/ui/dialog.js +178 -60
- package/lib/ui/input.css +35 -0
- package/lib/ui/number.input.js +50 -37
- package/lib/ui/theme.css +28 -0
- package/package.json +12 -8
- package/lib/components/drop-down/DropDownComponent.d.ts +0 -27
- package/lib/components/drop-down/DropDownComponent.js +0 -60
- package/lib/components/expander/OldExpanderStyle.scss +0 -37
- package/lib/ui/drop.down.d.ts +0 -52
- package/lib/ui/drop.down.js +0 -2112
|
@@ -7,6 +7,7 @@ export interface ITimeComponentOptions<T> {
|
|
|
7
7
|
class?: string;
|
|
8
8
|
style?: string;
|
|
9
9
|
placeholder?: string;
|
|
10
|
+
ariaLabel?: string;
|
|
10
11
|
value?: Date;
|
|
11
12
|
onChange?: EventHandler<Date> | ((v?: Date) => void);
|
|
12
13
|
bindTo?: T;
|
|
@@ -19,11 +20,15 @@ export interface ITimeComponentOptions<T> {
|
|
|
19
20
|
export declare class TimeComponent<T = any> implements IJSLComponent {
|
|
20
21
|
private options;
|
|
21
22
|
private currentDom;
|
|
23
|
+
private modelValue;
|
|
22
24
|
constructor(options: ITimeComponentOptions<T>);
|
|
23
25
|
render(): IJSLVNode;
|
|
24
26
|
onCreate(node: IJSLVNode): void;
|
|
25
27
|
onUpdate(node: IJSLVNode): void;
|
|
26
28
|
getValue(): string;
|
|
27
29
|
getValueAsDate(datePart: Date): Date;
|
|
30
|
+
/** Updates the input without raising onChange. */
|
|
31
|
+
setValue(value: Date): void;
|
|
32
|
+
private readModel;
|
|
28
33
|
private raiseChangeEvent;
|
|
29
34
|
}
|
|
@@ -6,97 +6,89 @@ export class TimeComponent {
|
|
|
6
6
|
constructor(options) {
|
|
7
7
|
var _a;
|
|
8
8
|
this.options = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
inputMode: "HourMinute",
|
|
13
|
-
bindMode: "toModel",
|
|
14
|
-
placeholder: (options === null || options === void 0 ? void 0 : options.inputMode) === "HourMinuteSecond" ? "__:__:__" : "__:__"
|
|
15
|
-
}, ...options
|
|
9
|
+
enabled: true, id: helper.newDomGuid(), inputMode: "HourMinute", bindMode: "toModel",
|
|
10
|
+
placeholder: (options === null || options === void 0 ? void 0 : options.inputMode) === "HourMinuteSecond" ? "HH:MM:SS" : "HH:MM",
|
|
11
|
+
...options
|
|
16
12
|
};
|
|
17
|
-
if (this.options.bindTo != null && this.options.
|
|
18
|
-
this.options.value =
|
|
19
|
-
this.options.converter.toUI(this.options.bindTo[this.options.property]) :
|
|
20
|
-
this.options.bindTo[this.options.property]);
|
|
13
|
+
if (this.options.bindTo != null && this.options.property != null && this.options.value == null) {
|
|
14
|
+
this.options.value = this.readModel();
|
|
21
15
|
}
|
|
16
|
+
this.modelValue = (_a = this.options.value) === null || _a === void 0 ? void 0 : _a.getTime();
|
|
22
17
|
this.options.onChange = EventHandler.Create(this.options.onChange);
|
|
23
18
|
}
|
|
24
19
|
render() {
|
|
25
|
-
var _a
|
|
26
|
-
let val = this.options.value;
|
|
20
|
+
var _a;
|
|
27
21
|
if (this.options.bindMode !== "toModel" && this.options.bindTo != null && this.options.property != null) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
const newValStr = date.formatTime(newVal, this.options.inputMode);
|
|
33
|
-
val = newVal;
|
|
34
|
-
if (newValStr !== current) {
|
|
35
|
-
if (this.currentDom != null) {
|
|
36
|
-
this.currentDom.value = newValStr;
|
|
37
|
-
}
|
|
22
|
+
const value = this.readModel();
|
|
23
|
+
if ((value === null || value === void 0 ? void 0 : value.getTime()) !== this.modelValue) {
|
|
24
|
+
this.setValue(value);
|
|
25
|
+
this.modelValue = value === null || value === void 0 ? void 0 : value.getTime();
|
|
38
26
|
}
|
|
39
27
|
}
|
|
40
28
|
return {
|
|
41
29
|
tag: "input", attr: {
|
|
42
|
-
id: this.options.id,
|
|
43
|
-
|
|
44
|
-
value: date.formatTime(
|
|
45
|
-
class: "time-comp " + ((
|
|
46
|
-
style: this.options.style,
|
|
47
|
-
|
|
30
|
+
id: this.options.id, type: "text", inputmode: "numeric", autocomplete: "off",
|
|
31
|
+
disabled: !this.options.enabled ? "disabled" : undefined,
|
|
32
|
+
value: date.formatTime(this.options.value, this.options.inputMode),
|
|
33
|
+
class: "jsl-date-input time-comp " + (this.options.inputMode === "HourMinuteSecond" ? "time-comp-seconds " : "") + ((_a = this.options.class) !== null && _a !== void 0 ? _a : ""),
|
|
34
|
+
style: this.options.style, placeholder: this.options.placeholder,
|
|
35
|
+
"aria-label": this.options.ariaLabel,
|
|
48
36
|
change: this.raiseChangeEvent
|
|
49
37
|
}
|
|
50
38
|
};
|
|
51
39
|
}
|
|
52
|
-
onCreate(node) {
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
onUpdate(node) {
|
|
56
|
-
this.currentDom = node.dom;
|
|
57
|
-
}
|
|
40
|
+
onCreate(node) { this.currentDom = node.dom; }
|
|
41
|
+
onUpdate(node) { this.currentDom = node.dom; }
|
|
58
42
|
getValue() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
return this.currentDom.value;
|
|
43
|
+
var _a, _b;
|
|
44
|
+
return (_b = (_a = this.currentDom) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : date.formatTime(this.options.value, this.options.inputMode);
|
|
63
45
|
}
|
|
64
46
|
getValueAsDate(datePart) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
x.setMinutes(0);
|
|
74
|
-
}
|
|
75
|
-
if (this.options.inputMode === "HourMinuteSecond" && parts.length > 2) {
|
|
76
|
-
x.setSeconds(parseInt(parts[2], 10));
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
x.setSeconds(0);
|
|
80
|
-
}
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const text = this.getValue().trim();
|
|
49
|
+
const pattern = this.options.inputMode === "HourMinuteSecond" ? /^(\d{1,2}):(\d{2}):(\d{2})$/ : /^(\d{1,2}):(\d{2})$/;
|
|
50
|
+
const parts = pattern.exec(text);
|
|
51
|
+
if (!parts || +parts[1] > 23 || +parts[2] > 59 || +((_a = parts[3]) !== null && _a !== void 0 ? _a : 0) > 59) {
|
|
52
|
+
return null;
|
|
81
53
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
54
|
+
const value = datePart ? new Date(datePart.getTime()) : new Date();
|
|
55
|
+
value.setHours(+parts[1], +parts[2], +((_b = parts[3]) !== null && _b !== void 0 ? _b : 0), 0);
|
|
56
|
+
return isNaN(value.getTime()) ? null : value;
|
|
57
|
+
}
|
|
58
|
+
/** Updates the input without raising onChange. */
|
|
59
|
+
setValue(value) {
|
|
60
|
+
this.options.value = value ? new Date(value.getTime()) : null;
|
|
61
|
+
if (this.currentDom) {
|
|
62
|
+
this.currentDom.value = date.formatTime(value, this.options.inputMode);
|
|
63
|
+
this.currentDom.setCustomValidity("");
|
|
64
|
+
this.currentDom.removeAttribute("aria-invalid");
|
|
88
65
|
}
|
|
89
|
-
|
|
66
|
+
}
|
|
67
|
+
readModel() {
|
|
68
|
+
var _a;
|
|
69
|
+
const value = this.options.bindTo[this.options.property];
|
|
70
|
+
return ((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toUI) ? this.options.converter.toUI(value) : value;
|
|
90
71
|
}
|
|
91
72
|
raiseChangeEvent(e, node) {
|
|
92
73
|
var _a;
|
|
93
|
-
if (this.options.enabled) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
74
|
+
if (!this.options.enabled) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.currentDom = node.dom;
|
|
78
|
+
const value = this.getValueAsDate(this.options.value);
|
|
79
|
+
const invalid = this.getValue().trim() !== "" && !value;
|
|
80
|
+
this.currentDom.setCustomValidity(invalid ? "Enter a valid time." : "");
|
|
81
|
+
if (invalid) {
|
|
82
|
+
this.currentDom.setAttribute("aria-invalid", "true");
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
this.currentDom.removeAttribute("aria-invalid");
|
|
86
|
+
this.options.value = value;
|
|
87
|
+
if (this.options.bindTo != null && this.options.bindMode !== "fromModel" && this.options.property != null) {
|
|
88
|
+
this.options.bindTo[this.options.property] =
|
|
89
|
+
((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toData) ? this.options.converter.toData(value) : value;
|
|
90
|
+
this.modelValue = value === null || value === void 0 ? void 0 : value.getTime();
|
|
100
91
|
}
|
|
92
|
+
this.options.onChange.notify(value);
|
|
101
93
|
}
|
|
102
94
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
@import "../../ui/date-input.css";
|
|
2
|
+
|
|
3
|
+
.time-comp { width: 6rem; text-align: center; }
|
|
4
|
+
.time-comp-seconds { width: 7.5rem; }
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import "./TreeViewStyle.scss";
|
|
2
|
-
import { IJSLComponent, IJSLVNode } from "jsl-render";
|
|
2
|
+
import { IJSLComponent, IJSLVNode, JSLRender } from "jsl-render";
|
|
3
3
|
export interface ITreeViewComponentOptions {
|
|
4
4
|
data: ITreeViewChild;
|
|
5
5
|
renderItem?: (data: any) => IJSLVNode;
|
|
6
6
|
style?: string;
|
|
7
7
|
class?: string;
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
onSelect?: (item: ITreeViewChild) => void;
|
|
8
10
|
}
|
|
9
11
|
export interface ITreeViewChild {
|
|
10
12
|
id: string;
|
|
@@ -14,10 +16,14 @@ export interface ITreeViewChild {
|
|
|
14
16
|
}
|
|
15
17
|
export declare class TreeViewComponent implements IJSLComponent {
|
|
16
18
|
private options;
|
|
17
|
-
|
|
19
|
+
State: {
|
|
20
|
+
selected: string;
|
|
21
|
+
id: string;
|
|
22
|
+
renderer?: JSLRender;
|
|
23
|
+
};
|
|
18
24
|
constructor(options: ITreeViewComponentOptions);
|
|
19
25
|
isEqual(node: IJSLComponent): boolean;
|
|
26
|
+
onInit(renderer: JSLRender): void;
|
|
20
27
|
render(): IJSLVNode;
|
|
21
|
-
private
|
|
22
|
-
private addChild;
|
|
28
|
+
private node;
|
|
23
29
|
}
|
|
@@ -1,42 +1,75 @@
|
|
|
1
1
|
import "./TreeViewStyle.scss";
|
|
2
|
+
import { helper } from "../../core/helper";
|
|
2
3
|
export class TreeViewComponent {
|
|
3
4
|
constructor(options) {
|
|
4
5
|
this.options = options;
|
|
6
|
+
this.State = { selected: "", id: helper.newDomGuid() };
|
|
5
7
|
}
|
|
6
|
-
isEqual(node) {
|
|
7
|
-
|
|
8
|
-
}
|
|
8
|
+
isEqual(node) { return Object.getPrototypeOf(node) === Object.getPrototypeOf(this); }
|
|
9
|
+
onInit(renderer) { this.State.renderer = renderer; }
|
|
9
10
|
render() {
|
|
10
11
|
var _a, _b;
|
|
11
|
-
return {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
]
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
renderNode(el) {
|
|
18
|
-
function getInput() {
|
|
19
|
-
const res = { tag: "input", attr: { class: "tv-input", type: "checkbox", id: el.id } };
|
|
20
|
-
if (el.collapsed) {
|
|
21
|
-
res.attr.checked = "checked";
|
|
22
|
-
}
|
|
23
|
-
return res;
|
|
24
|
-
}
|
|
25
|
-
return (el.children && el.children.length > 0) ?
|
|
26
|
-
{ tag: "li", children: [
|
|
27
|
-
getInput(),
|
|
28
|
-
this.addChild({ tag: "label", attr: { for: el.id } }, this.options.renderItem != null ? this.options.renderItem(el) : el.content),
|
|
29
|
-
{ tag: "ul", attr: { class: "tv-ul" }, children: el.children.map((c) => this.renderNode(c)) }
|
|
30
|
-
] } :
|
|
31
|
-
this.addChild({ tag: "li" }, this.options.renderItem != null ? this.options.renderItem(el) : el.content);
|
|
12
|
+
return { tag: "div", attr: { class: "treeview-comp " + ((_a = this.options.class) !== null && _a !== void 0 ? _a : ""), style: this.options.style }, children: [
|
|
13
|
+
{ tag: "ul", attr: { class: "tv-ul", role: "tree", "aria-label": (_b = this.options.ariaLabel) !== null && _b !== void 0 ? _b : "Tree" }, children: this.options.data ? [this.node(this.options.data, "0")] : [] }
|
|
14
|
+
] };
|
|
32
15
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
16
|
+
node(item, path) {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
|
+
const branch = !!((_a = item.children) === null || _a === void 0 ? void 0 : _a.length), content = (_d = (_c = (_b = this.options).renderItem) === null || _c === void 0 ? void 0 : _c.call(_b, item)) !== null && _d !== void 0 ? _d : item.content;
|
|
19
|
+
return { tag: "li", attr: { role: "none" }, children: [
|
|
20
|
+
{ tag: "div", attr: { role: "treeitem", class: "tv-row" + (this.State.selected === item.id ? " is-selected" : ""), tabindex: path === "0" ? "0" : "-1",
|
|
21
|
+
"aria-expanded": branch ? String(!item.collapsed) : undefined, "aria-selected": String(this.State.selected === item.id), "aria-owns": branch ? this.State.id + "-" + path : undefined,
|
|
22
|
+
click: () => { var _a, _b, _c; this.State.selected = item.id; if (branch) {
|
|
23
|
+
item.collapsed = !item.collapsed;
|
|
24
|
+
} (_b = (_a = this.options).onSelect) === null || _b === void 0 ? void 0 : _b.call(_a, item); (_c = this.State.renderer) === null || _c === void 0 ? void 0 : _c.refresh(); return false; },
|
|
25
|
+
keydown: (e) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const row = e.currentTarget, root = row.closest('[role=tree]');
|
|
28
|
+
const rows = Array.from(root.querySelectorAll('.tv-row')).filter(x => x.getClientRects().length > 0), index = rows.indexOf(row);
|
|
29
|
+
let next;
|
|
30
|
+
if (e.key === "ArrowDown") {
|
|
31
|
+
next = rows[Math.min(rows.length - 1, index + 1)];
|
|
32
|
+
}
|
|
33
|
+
else if (e.key === "ArrowUp") {
|
|
34
|
+
next = rows[Math.max(0, index - 1)];
|
|
35
|
+
}
|
|
36
|
+
else if (e.key === "Home") {
|
|
37
|
+
next = rows[0];
|
|
38
|
+
}
|
|
39
|
+
else if (e.key === "End") {
|
|
40
|
+
next = rows[rows.length - 1];
|
|
41
|
+
}
|
|
42
|
+
else if (e.key === "ArrowRight" && branch) {
|
|
43
|
+
if (item.collapsed) {
|
|
44
|
+
item.collapsed = false;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
next = rows[index + 1];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (e.key === "ArrowLeft") {
|
|
51
|
+
if (branch && !item.collapsed) {
|
|
52
|
+
item.collapsed = true;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
next = (_a = row.parentElement.parentElement.closest('li')) === null || _a === void 0 ? void 0 : _a.querySelector(':scope > .tv-row');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (e.key === "Enter" || e.key === " ") {
|
|
59
|
+
row.click();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
next === null || next === void 0 ? void 0 : next.focus();
|
|
67
|
+
(_b = this.State.renderer) === null || _b === void 0 ? void 0 : _b.refresh();
|
|
68
|
+
return false;
|
|
69
|
+
},
|
|
70
|
+
focus: (e) => { const row = e.currentTarget; row.closest('[role=tree]').querySelectorAll('.tv-row').forEach(x => x.setAttribute('tabindex', x === row ? '0' : '-1')); return false; }
|
|
71
|
+
}, children: [{ tag: "span", attr: { class: "tv-chevron" + (branch ? "" : " tv-leaf"), "aria-hidden": "true" } }, typeof content === "string" ? { tag: "span", content } : content] },
|
|
72
|
+
...(branch ? [{ tag: "ul", attr: { id: this.State.id + "-" + path, class: "tv-ul", role: "group", hidden: item.collapsed ? "hidden" : undefined }, children: item.children.map((child, index) => this.node(child, path + "-" + index)) }] : [])
|
|
73
|
+
] };
|
|
41
74
|
}
|
|
42
75
|
}
|
|
@@ -1,96 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// @mixin transition-property($property){
|
|
14
|
-
// -webkit-transition-property: $property;
|
|
15
|
-
// -moz-transition-property: $property;
|
|
16
|
-
// -ms-transition-property: $property;
|
|
17
|
-
// -o-transition-property: $property;
|
|
18
|
-
// transition-property: $property;
|
|
19
|
-
// }
|
|
20
|
-
|
|
21
|
-
// @mixin user-select($select: none){
|
|
22
|
-
// -webkit-user-select: $select;
|
|
23
|
-
// -moz-user-select: $select;
|
|
24
|
-
// -ms-user-select: $select;
|
|
25
|
-
// -o-user-select: $select;
|
|
26
|
-
// user-select: $select;
|
|
27
|
-
// }
|
|
28
|
-
|
|
29
|
-
.treeview-comp {
|
|
30
|
-
// float: left;
|
|
31
|
-
// @include user-select;
|
|
32
|
-
|
|
33
|
-
// &:hover input ~ label:before,
|
|
34
|
-
// &.hover input ~ label:before{
|
|
35
|
-
// opacity: 1.0;
|
|
36
|
-
// @include transition-duration(0.5s);
|
|
37
|
-
// }
|
|
38
|
-
|
|
39
|
-
.tv-ul {
|
|
40
|
-
// @include transition-duration;
|
|
41
|
-
list-style: none;
|
|
42
|
-
padding-left: 1em;
|
|
43
|
-
|
|
44
|
-
// li {
|
|
45
|
-
// span{
|
|
46
|
-
// @include transition-property(color);
|
|
47
|
-
// @include transition-duration;
|
|
48
|
-
|
|
49
|
-
// &:hover {
|
|
50
|
-
// color: $hoverColor;
|
|
51
|
-
// @include transition-duration(0.3s);
|
|
52
|
-
// }
|
|
53
|
-
// }
|
|
54
|
-
// }
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.tv-input{
|
|
58
|
-
display: none;
|
|
59
|
-
|
|
60
|
-
&:checked ~ ul {
|
|
61
|
-
display: none;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
& ~ label {
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
position: relative;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
& ~ label:before {
|
|
70
|
-
content: '';
|
|
71
|
-
width: 0;
|
|
72
|
-
height: 0;
|
|
73
|
-
position: absolute;
|
|
74
|
-
margin-left: -1em;
|
|
75
|
-
margin-top: 0.4em;
|
|
76
|
-
border-width: 4px;
|
|
77
|
-
border-style: solid;
|
|
78
|
-
border-top-color: transparent;
|
|
79
|
-
border-right-color: $defaultColor;
|
|
80
|
-
border-bottom-color: $defaultColor;
|
|
81
|
-
border-left-color: transparent;
|
|
82
|
-
// opacity: 0.0;
|
|
83
|
-
// @include transition-property(opacity);
|
|
84
|
-
// @include transition-duration;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&:checked ~ label:before {
|
|
88
|
-
margin-left: -0.8em;
|
|
89
|
-
border-width: 5px;
|
|
90
|
-
border-top-color: transparent;
|
|
91
|
-
border-right-color: transparent;
|
|
92
|
-
border-bottom-color: transparent;
|
|
93
|
-
border-left-color: $defaultColor;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
1
|
+
@import "../../ui/theme.css";
|
|
2
|
+
.treeview-comp { color: var(--jsl-color-text); font: inherit; font-size: .875rem; line-height: 1.5; }
|
|
3
|
+
.treeview-comp .tv-ul { list-style: none; padding: 0; margin: 0; }
|
|
4
|
+
.treeview-comp .tv-ul .tv-ul { margin-left: 1rem; padding-left: .5rem; border-left: 1px solid var(--jsl-color-border-subtle); }
|
|
5
|
+
.treeview-comp [hidden] { display: none; }
|
|
6
|
+
.tv-row { display: flex; align-items: center; gap: .625rem; padding: .375rem .625rem; border-radius: .375rem; cursor: pointer; overflow-wrap: anywhere; }
|
|
7
|
+
.tv-row:hover { background: var(--jsl-color-surface-hover); }
|
|
8
|
+
.tv-row.is-selected { background: var(--jsl-color-surface-selected); }
|
|
9
|
+
.tv-row:focus-visible { outline: 2px solid var(--jsl-color-focus); outline-offset: -2px; }
|
|
10
|
+
.tv-chevron { flex: 0 0 .375rem; width: .375rem; height: .375rem; border-right: 1.5px solid var(--jsl-color-text-muted); border-bottom: 1.5px solid var(--jsl-color-text-muted); transform: rotate(-45deg); margin-right: .25rem; }
|
|
11
|
+
.tv-row[aria-expanded=true] > .tv-chevron { transform: translateY(-.125rem) rotate(45deg); }
|
|
12
|
+
.tv-leaf { border-color: transparent; }
|
package/lib/core/jq.js
CHANGED
|
@@ -78,12 +78,14 @@ function jQWrapper(elements) {
|
|
|
78
78
|
if (!_elements.length) {
|
|
79
79
|
return undefined;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
const element = _elements[0];
|
|
82
|
+
const view = element.ownerDocument.defaultView || window;
|
|
83
|
+
const computed = view.getComputedStyle(element);
|
|
84
|
+
// Read stylesheet and inherited values, supporting both CSS names
|
|
85
|
+
// (box-sizing, --custom-property) and camelCase (boxSizing).
|
|
86
|
+
// Detached elements may need the inline fallback.
|
|
87
|
+
return computed.getPropertyValue(key) || computed[key] ||
|
|
88
|
+
element.style.getPropertyValue(key) || element.style[key];
|
|
87
89
|
}
|
|
88
90
|
else {
|
|
89
91
|
for (const keyEl in key) {
|
|
@@ -228,9 +230,10 @@ function jQWrapper(elements) {
|
|
|
228
230
|
return undefined;
|
|
229
231
|
let el = _elements[0];
|
|
230
232
|
let rect = el.getBoundingClientRect();
|
|
233
|
+
const view = el.ownerDocument.defaultView || window;
|
|
231
234
|
return {
|
|
232
|
-
top: rect.top +
|
|
233
|
-
left: rect.left +
|
|
235
|
+
top: rect.top + view.pageYOffset,
|
|
236
|
+
left: rect.left + view.pageXOffset
|
|
234
237
|
};
|
|
235
238
|
};
|
|
236
239
|
_elements.children = function () {
|