smoothly 0.1.121 → 0.2.4
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/cjs/loader.cjs.js +1 -1
- package/dist/cjs/smoothly-accordion_51.cjs.entry.js +127 -65
- package/dist/cjs/smoothly.cjs.js +1 -1
- package/dist/collection/components/app/style.css +12 -12
- package/dist/collection/components/button/style.css +1 -2
- package/dist/collection/components/calendar/style.css +2 -3
- package/dist/collection/components/input/index.js +68 -8
- package/dist/collection/components/input-date/index.js +1 -1
- package/dist/collection/components/input-date/style.css +2 -3
- package/dist/collection/components/input-date-range/index.js +2 -2
- package/dist/collection/components/input-demo/index.js +2 -1
- package/dist/collection/components/item/style.css +2 -3
- package/dist/collection/components/menu-options/index.js +64 -3
- package/dist/collection/components/option/index.js +35 -1
- package/dist/collection/components/option/style.css +6 -0
- package/dist/collection/components/picker/index.js +149 -11
- package/dist/collection/components/select-demo/index.js +9 -1
- package/dist/collection/components/select-demo/style.css +1 -1
- package/dist/collection/components/selector/style.css +0 -2
- package/dist/collection/components/tab/style.css +3 -4
- package/dist/collection/components/tab-switch/index.js +1 -0
- package/dist/collection/components/tab-switch/style.css +1 -1
- package/dist/collection/components/table/cell/style.css +3 -1
- package/dist/collection/components/table/demo/index.js +38 -32
- package/dist/collection/components/table/expandable/cell/index.js +8 -9
- package/dist/collection/components/table/expandable/cell/style.css +38 -1
- package/dist/collection/components/table/expandable/row/index.js +84 -21
- package/dist/collection/components/table/expandable/row/style.css +35 -4
- package/dist/collection/components/table/header/index.js +22 -2
- package/dist/collection/components/table/header/style.css +5 -3
- package/dist/collection/components/table/index.js +33 -1
- package/dist/collection/components/table/row/index.js +20 -84
- package/dist/collection/components/table/row/style.css +2 -8
- package/dist/collection/components/table/style.css +8 -3
- package/dist/custom-elements/index.js +136 -74
- package/dist/esm/loader.js +1 -1
- package/dist/esm/smoothly-accordion_51.entry.js +127 -65
- package/dist/esm/smoothly.js +1 -1
- package/dist/smoothly/p-a302008c.entry.js +1 -0
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/components/input/index.d.ts +10 -3
- package/dist/types/components/menu-options/index.d.ts +5 -0
- package/dist/types/components/option/index.d.ts +5 -0
- package/dist/types/components/picker/index.d.ts +14 -3
- package/dist/types/components/table/expandable/cell/index.d.ts +2 -2
- package/dist/types/components/table/expandable/row/index.d.ts +9 -4
- package/dist/types/components/table/header/index.d.ts +1 -0
- package/dist/types/components/table/index.d.ts +3 -0
- package/dist/types/components/table/row/index.d.ts +3 -9
- package/dist/types/components.d.ts +31 -7
- package/package.json +2 -2
- package/dist/smoothly/p-f4529a2d.entry.js +0 -1
|
@@ -4,12 +4,16 @@ export class SmoothlyPicker {
|
|
|
4
4
|
this.keepFocusOnReRender = false;
|
|
5
5
|
this.emptyMenuLabel = "No Options";
|
|
6
6
|
this.multiple = false;
|
|
7
|
+
this.mutable = false;
|
|
7
8
|
this.options = [];
|
|
8
9
|
this.selections = [];
|
|
9
10
|
this.selectNoneName = "Select None";
|
|
11
|
+
this.selectAllName = "Select All";
|
|
10
12
|
this.selectionName = "items selected";
|
|
13
|
+
this.newOptionLabel = "Add:";
|
|
14
|
+
this.valueValidator = _ => [true, undefined];
|
|
11
15
|
}
|
|
12
|
-
|
|
16
|
+
isOpenChangeHandler() {
|
|
13
17
|
if (this.isOpen == false) {
|
|
14
18
|
this.menuClose.emit(this.selections);
|
|
15
19
|
}
|
|
@@ -21,10 +25,26 @@ export class SmoothlyPicker {
|
|
|
21
25
|
this.keepFocusOnReRender = false;
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
|
-
|
|
28
|
+
optionSelectHandler(event) {
|
|
25
29
|
this.toggle(event.detail);
|
|
26
30
|
event.stopPropagation();
|
|
27
31
|
}
|
|
32
|
+
optionAddHandler(event) {
|
|
33
|
+
if (this.mutable) {
|
|
34
|
+
const [status, notice] = this.valueValidator(event.detail.value);
|
|
35
|
+
if (status) {
|
|
36
|
+
const option = Object.assign({}, event.detail);
|
|
37
|
+
this.options = [...this.options, option];
|
|
38
|
+
this.select(option);
|
|
39
|
+
}
|
|
40
|
+
notice && this.notice.emit(notice);
|
|
41
|
+
}
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
}
|
|
44
|
+
emptyHandler(event) {
|
|
45
|
+
this.empty = event.detail;
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
}
|
|
28
48
|
toggle(option) {
|
|
29
49
|
option.value == "select-none"
|
|
30
50
|
? this.toggleAll()
|
|
@@ -59,9 +79,19 @@ export class SmoothlyPicker {
|
|
|
59
79
|
}
|
|
60
80
|
toggleHighlighted() {
|
|
61
81
|
var _a;
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
82
|
+
if (this.mutable && this.empty) {
|
|
83
|
+
const [status, notice] = this.valueValidator(this.inputElement.value);
|
|
84
|
+
if (status) {
|
|
85
|
+
const option = { name: this.inputElement.value, value: this.inputElement.value };
|
|
86
|
+
this.options = [...this.options, option];
|
|
87
|
+
this.select(option);
|
|
88
|
+
}
|
|
89
|
+
notice && this.notice.emit(notice);
|
|
90
|
+
}
|
|
91
|
+
else
|
|
92
|
+
(_a = this.menuElement) === null || _a === void 0 ? void 0 : _a.getHighlighted().then((result) => {
|
|
93
|
+
result && this.toggle(result);
|
|
94
|
+
});
|
|
65
95
|
}
|
|
66
96
|
highlightDefault() {
|
|
67
97
|
var _a;
|
|
@@ -123,7 +153,7 @@ export class SmoothlyPicker {
|
|
|
123
153
|
? [
|
|
124
154
|
{
|
|
125
155
|
value: "select-none",
|
|
126
|
-
name: this.selectNoneName,
|
|
156
|
+
name: this.selections.length == this.options.length ? this.selectNoneName : this.selectAllName,
|
|
127
157
|
left: this.getCheckHtml(this.selections.length == ((_c = this.options) === null || _c === void 0 ? void 0 : _c.length)),
|
|
128
158
|
divider: true,
|
|
129
159
|
},
|
|
@@ -140,7 +170,7 @@ export class SmoothlyPicker {
|
|
|
140
170
|
: this.selections.map(selection => selection.name).join(", "), onKeyDown: e => this.onKeyDown(e), onInput: (e) => this.onInput(e) }),
|
|
141
171
|
h("smoothly-icon", { class: "down", name: "chevron-down", size: "tiny" }),
|
|
142
172
|
h("smoothly-icon", { class: "up", name: "chevron-up", size: "tiny" })),
|
|
143
|
-
h("smoothly-menu-options", { style: { width: "100%" }, optionStyle: Object.assign({}, this.optionStyle), order: false, emptyMenuLabel: this.emptyMenuLabel, "max-menu-height": this.maxMenuHeight, ref: (el) => (this.menuElement = el !== null && el !== void 0 ? el : this.menuElement), onClick: e => e.stopPropagation(), resetHighlightOnOptionsChange: false, options: options })));
|
|
173
|
+
h("smoothly-menu-options", { style: { width: "100%" }, optionStyle: Object.assign({}, this.optionStyle), order: false, emptyMenuLabel: this.emptyMenuLabel, newOptionLabel: this.newOptionLabel, "max-menu-height": this.maxMenuHeight, mutable: this.mutable, ref: (el) => (this.menuElement = el !== null && el !== void 0 ? el : this.menuElement), onClick: e => e.stopPropagation(), resetHighlightOnOptionsChange: false, options: options })));
|
|
144
174
|
}
|
|
145
175
|
static get is() { return "smoothly-picker"; }
|
|
146
176
|
static get encapsulation() { return "shadow"; }
|
|
@@ -221,6 +251,24 @@ export class SmoothlyPicker {
|
|
|
221
251
|
"reflect": true,
|
|
222
252
|
"defaultValue": "false"
|
|
223
253
|
},
|
|
254
|
+
"mutable": {
|
|
255
|
+
"type": "boolean",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "boolean",
|
|
259
|
+
"resolved": "boolean",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": false,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": ""
|
|
267
|
+
},
|
|
268
|
+
"attribute": "mutable",
|
|
269
|
+
"reflect": false,
|
|
270
|
+
"defaultValue": "false"
|
|
271
|
+
},
|
|
224
272
|
"optionStyle": {
|
|
225
273
|
"type": "any",
|
|
226
274
|
"mutable": false,
|
|
@@ -332,6 +380,24 @@ export class SmoothlyPicker {
|
|
|
332
380
|
"reflect": false,
|
|
333
381
|
"defaultValue": "\"Select None\""
|
|
334
382
|
},
|
|
383
|
+
"selectAllName": {
|
|
384
|
+
"type": "string",
|
|
385
|
+
"mutable": true,
|
|
386
|
+
"complexType": {
|
|
387
|
+
"original": "string",
|
|
388
|
+
"resolved": "string",
|
|
389
|
+
"references": {}
|
|
390
|
+
},
|
|
391
|
+
"required": false,
|
|
392
|
+
"optional": false,
|
|
393
|
+
"docs": {
|
|
394
|
+
"tags": [],
|
|
395
|
+
"text": ""
|
|
396
|
+
},
|
|
397
|
+
"attribute": "select-all-name",
|
|
398
|
+
"reflect": false,
|
|
399
|
+
"defaultValue": "\"Select All\""
|
|
400
|
+
},
|
|
335
401
|
"selectionName": {
|
|
336
402
|
"type": "string",
|
|
337
403
|
"mutable": true,
|
|
@@ -349,10 +415,50 @@ export class SmoothlyPicker {
|
|
|
349
415
|
"attribute": "selection-name",
|
|
350
416
|
"reflect": false,
|
|
351
417
|
"defaultValue": "\"items selected\""
|
|
418
|
+
},
|
|
419
|
+
"newOptionLabel": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"mutable": true,
|
|
422
|
+
"complexType": {
|
|
423
|
+
"original": "string",
|
|
424
|
+
"resolved": "string",
|
|
425
|
+
"references": {}
|
|
426
|
+
},
|
|
427
|
+
"required": false,
|
|
428
|
+
"optional": false,
|
|
429
|
+
"docs": {
|
|
430
|
+
"tags": [],
|
|
431
|
+
"text": ""
|
|
432
|
+
},
|
|
433
|
+
"attribute": "new-option-label",
|
|
434
|
+
"reflect": false,
|
|
435
|
+
"defaultValue": "\"Add:\""
|
|
436
|
+
},
|
|
437
|
+
"valueValidator": {
|
|
438
|
+
"type": "unknown",
|
|
439
|
+
"mutable": false,
|
|
440
|
+
"complexType": {
|
|
441
|
+
"original": "(value: any) => [boolean, Notice | undefined]",
|
|
442
|
+
"resolved": "(value: any) => [boolean, Notice | undefined]",
|
|
443
|
+
"references": {
|
|
444
|
+
"Notice": {
|
|
445
|
+
"location": "import",
|
|
446
|
+
"path": "../../model"
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"required": false,
|
|
451
|
+
"optional": false,
|
|
452
|
+
"docs": {
|
|
453
|
+
"tags": [],
|
|
454
|
+
"text": ""
|
|
455
|
+
},
|
|
456
|
+
"defaultValue": "_ => [true, undefined]"
|
|
352
457
|
}
|
|
353
458
|
}; }
|
|
354
459
|
static get states() { return {
|
|
355
|
-
"isOpen": {}
|
|
460
|
+
"isOpen": {},
|
|
461
|
+
"empty": {}
|
|
356
462
|
}; }
|
|
357
463
|
static get events() { return [{
|
|
358
464
|
"method": "menuClose",
|
|
@@ -374,18 +480,50 @@ export class SmoothlyPicker {
|
|
|
374
480
|
}
|
|
375
481
|
}
|
|
376
482
|
}
|
|
483
|
+
}, {
|
|
484
|
+
"method": "notice",
|
|
485
|
+
"name": "notice",
|
|
486
|
+
"bubbles": true,
|
|
487
|
+
"cancelable": true,
|
|
488
|
+
"composed": true,
|
|
489
|
+
"docs": {
|
|
490
|
+
"tags": [],
|
|
491
|
+
"text": ""
|
|
492
|
+
},
|
|
493
|
+
"complexType": {
|
|
494
|
+
"original": "Notice",
|
|
495
|
+
"resolved": "Notice",
|
|
496
|
+
"references": {
|
|
497
|
+
"Notice": {
|
|
498
|
+
"location": "import",
|
|
499
|
+
"path": "../../model"
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
377
503
|
}]; }
|
|
378
504
|
static get elementRef() { return "element"; }
|
|
379
505
|
static get watchers() { return [{
|
|
380
506
|
"propName": "selections",
|
|
381
|
-
"methodName": "
|
|
507
|
+
"methodName": "isOpenChangeHandler"
|
|
382
508
|
}, {
|
|
383
509
|
"propName": "isOpen",
|
|
384
|
-
"methodName": "
|
|
510
|
+
"methodName": "isOpenChangeHandler"
|
|
385
511
|
}]; }
|
|
386
512
|
static get listeners() { return [{
|
|
387
513
|
"name": "optionSelect",
|
|
388
|
-
"method": "
|
|
514
|
+
"method": "optionSelectHandler",
|
|
515
|
+
"target": undefined,
|
|
516
|
+
"capture": false,
|
|
517
|
+
"passive": false
|
|
518
|
+
}, {
|
|
519
|
+
"name": "optionAdd",
|
|
520
|
+
"method": "optionAddHandler",
|
|
521
|
+
"target": undefined,
|
|
522
|
+
"capture": false,
|
|
523
|
+
"passive": false
|
|
524
|
+
}, {
|
|
525
|
+
"name": "menuEmpty",
|
|
526
|
+
"method": "emptyHandler",
|
|
389
527
|
"target": undefined,
|
|
390
528
|
"capture": false,
|
|
391
529
|
"passive": false
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component, h, Listen } from "@stencil/core";
|
|
2
|
+
import { Notice } from "../../model";
|
|
2
3
|
export class SmoothlySelectDemo {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.currencies = ["SEK", "EUR"];
|
|
@@ -63,7 +64,7 @@ export class SmoothlySelectDemo {
|
|
|
63
64
|
{ name: "Scary Kraken", value: "kraken" },
|
|
64
65
|
] }),
|
|
65
66
|
h("br", null),
|
|
66
|
-
h("smoothly-picker", { label: "", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, options: [
|
|
67
|
+
h("smoothly-picker", { label: "Multiple", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, options: [
|
|
67
68
|
{ name: "Big Dog", value: "dog", aliases: ["WOFF"] },
|
|
68
69
|
{ name: "Cat Stevens", value: "cat", aliases: ["moew"] },
|
|
69
70
|
{ name: "Noble Pig", value: "pig" },
|
|
@@ -77,6 +78,13 @@ export class SmoothlySelectDemo {
|
|
|
77
78
|
{ name: "Scary Kraken", value: "kraken" },
|
|
78
79
|
] }),
|
|
79
80
|
h("br", null),
|
|
81
|
+
h("smoothly-picker", { label: "Multiple mutable", "max-height": "58px", multiple: true, mutable: true, newOptionLabel: "Invite:", options: [
|
|
82
|
+
{ name: "john@example.com", value: "john@example.com" },
|
|
83
|
+
{ name: "jane@example.com", value: "jane@example.com" },
|
|
84
|
+
{ name: "james@example.com", value: "james@example.com" },
|
|
85
|
+
{ name: "jessie@example.com", value: "jessie@example.com" },
|
|
86
|
+
], valueValidator: (email) => email.match(/^\w+@\w+/) ? [true, undefined] : [false, Notice.failed("Incorrectly formatted email")] }),
|
|
87
|
+
h("br", null),
|
|
80
88
|
h("smoothly-picker", { label: "Single select", multiple: false, "max-menu-height": "200px", options: [
|
|
81
89
|
{ name: "Dog", value: "dog", aliases: ["WOFF"], right: "Woof 🐶" },
|
|
82
90
|
{ name: "Cat", value: "cat", aliases: ["moew"] },
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
}
|
|
7
7
|
label {
|
|
8
8
|
display: block;
|
|
9
|
-
|
|
9
|
+
padding: 1em;
|
|
10
10
|
background-color: rgb(var(--smoothly-default-shade));
|
|
11
11
|
border-top-left-radius: 0.3rem;
|
|
12
12
|
border-top-right-radius: 0.3rem;
|
|
13
13
|
width: 6.25rem;
|
|
14
|
-
|
|
15
14
|
}
|
|
16
15
|
div {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
background-color: rgb(var(--smoothly-default-shade));
|
|
17
|
+
padding: 1em;
|
|
19
18
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, Element, h, Host, Listen, State, Watch } from "@stencil/core";
|
|
2
2
|
export class SmoothlyTabSwitch {
|
|
3
3
|
openChanged(event) {
|
|
4
|
+
event.stopPropagation();
|
|
4
5
|
this.selectedElement = event.target;
|
|
5
6
|
this.selectedElement.open = true;
|
|
6
7
|
this.element.after(event.detail);
|
|
@@ -6,46 +6,52 @@ export class TableDemo {
|
|
|
6
6
|
h("smoothly-table-row", null,
|
|
7
7
|
h("smoothly-table-header", null, "Header A"),
|
|
8
8
|
h("smoothly-table-header", null, "Header B"),
|
|
9
|
-
h("smoothly-table-header", null, "Header C")
|
|
10
|
-
|
|
9
|
+
h("smoothly-table-header", null, "Header C"),
|
|
10
|
+
h("smoothly-table-header", null, "Header D"),
|
|
11
|
+
h("smoothly-table-header", null)),
|
|
12
|
+
h("smoothly-table-row", null,
|
|
11
13
|
h("smoothly-table-expandable-cell", null,
|
|
12
|
-
"
|
|
13
|
-
h("div", { slot: "detail" }, "
|
|
14
|
+
"normal row (exp.cell)",
|
|
15
|
+
h("div", { slot: "detail" }, "expandable cell 1 content")),
|
|
14
16
|
h("smoothly-table-expandable-cell", null,
|
|
15
|
-
|
|
16
|
-
h("div", { slot: "detail" }, "
|
|
17
|
+
"expandable cell",
|
|
18
|
+
h("div", { slot: "detail" }, "expandable cell 2 content")),
|
|
17
19
|
h("smoothly-table-expandable-cell", null,
|
|
18
|
-
|
|
19
|
-
h("div", { slot: "detail" }, "
|
|
20
|
-
h("smoothly-table-expandable-row", null,
|
|
20
|
+
"expandable cell",
|
|
21
|
+
h("div", { slot: "detail" }, "expandable cell 3 content")),
|
|
21
22
|
h("smoothly-table-expandable-cell", null,
|
|
22
|
-
"
|
|
23
|
-
h("div", { slot: "detail" }, "
|
|
23
|
+
"expandable cell",
|
|
24
|
+
h("div", { slot: "detail" }, "expandable cell 4 content"))),
|
|
25
|
+
h("smoothly-table-row", null,
|
|
26
|
+
h("smoothly-table-cell", null, "normal row (nor.cell)\""),
|
|
27
|
+
h("smoothly-table-cell", null, "normal cell"),
|
|
24
28
|
h("smoothly-table-expandable-cell", null,
|
|
25
|
-
|
|
26
|
-
h("div", { slot: "detail" }, "
|
|
29
|
+
"expandable cell",
|
|
30
|
+
h("div", { slot: "detail" }, "expandable cell details.")),
|
|
27
31
|
h("smoothly-table-expandable-cell", null,
|
|
28
|
-
|
|
29
|
-
h("div", { slot: "detail" }, "
|
|
32
|
+
"expandable cell",
|
|
33
|
+
h("div", { slot: "detail" }, "expandable cell details."))),
|
|
34
|
+
h("smoothly-table-expandable-row", null,
|
|
35
|
+
h("smoothly-table-cell", null, "expandable row (nor.cell)"),
|
|
36
|
+
h("smoothly-table-cell", null, "Normal cell"),
|
|
37
|
+
h("smoothly-table-cell", null, "normal cell"),
|
|
38
|
+
h("smoothly-table-cell", null, "Normal cell"),
|
|
39
|
+
h("div", { slot: "detail" }, "expandable row content"))),
|
|
30
40
|
h("smoothly-table", null,
|
|
31
41
|
h("smoothly-table-row", null,
|
|
32
|
-
h("smoothly-table-header", null, "Header
|
|
33
|
-
h("smoothly-table-header", null
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
h("
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
h("smoothly-display", { type: "price", value: 20, currency: "EUR" })),
|
|
46
|
-
h("smoothly-table-cell", null,
|
|
47
|
-
h("smoothly-display", { type: "price", value: 18, currency: "EUR" })),
|
|
48
|
-
h("div", { slot: "detail" }, "Cost details."))),
|
|
42
|
+
h("smoothly-table-header", null, "Header A"),
|
|
43
|
+
h("smoothly-table-header", null)),
|
|
44
|
+
h("smoothly-table-expandable-row", null,
|
|
45
|
+
"A Content",
|
|
46
|
+
h("div", { slot: "detail" },
|
|
47
|
+
h("smoothly-tab-switch", null,
|
|
48
|
+
h("smoothly-tab", { label: "1", open: true },
|
|
49
|
+
h("smoothly-table", null,
|
|
50
|
+
h("smoothly-table-row", null,
|
|
51
|
+
h("smoothly-table-header", null, "Header B"),
|
|
52
|
+
h("smoothly-table-header", null)),
|
|
53
|
+
h("smoothly-table-expandable-row", null,
|
|
54
|
+
h("smoothly-table-cell", null, "B Content")))))))),
|
|
49
55
|
];
|
|
50
56
|
}
|
|
51
57
|
static get is() { return "smoothly-table-demo"; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Element, Event, h, Host, Listen, Prop,
|
|
1
|
+
import { Component, Element, Event, h, Host, Listen, Prop, Watch } from "@stencil/core";
|
|
2
2
|
export class TableExpandableCell {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.align = "left";
|
|
@@ -14,7 +14,7 @@ export class TableExpandableCell {
|
|
|
14
14
|
this.open = !this.open;
|
|
15
15
|
}
|
|
16
16
|
componentDidLoad() {
|
|
17
|
-
this.
|
|
17
|
+
this.expansionLoad.emit();
|
|
18
18
|
}
|
|
19
19
|
componentDidRender() {
|
|
20
20
|
if (this.beginOpen) {
|
|
@@ -25,9 +25,11 @@ export class TableExpandableCell {
|
|
|
25
25
|
render() {
|
|
26
26
|
return (h(Host, { style: { textAlign: this.align } },
|
|
27
27
|
h("slot", null),
|
|
28
|
+
h("smoothly-icon", { name: "chevron-forward", size: "tiny" }),
|
|
28
29
|
h("tr", { ref: e => (this.expansionElement = e) },
|
|
29
|
-
h("td", { colSpan:
|
|
30
|
-
h("
|
|
30
|
+
h("td", { colSpan: 999, class: !this.open ? "hide" : "" },
|
|
31
|
+
h("div", { class: "slot-detail" },
|
|
32
|
+
h("slot", { name: "detail" }))))));
|
|
31
33
|
}
|
|
32
34
|
static get is() { return "smoothly-table-expandable-cell"; }
|
|
33
35
|
static get encapsulation() { return "scoped"; }
|
|
@@ -74,9 +76,6 @@ export class TableExpandableCell {
|
|
|
74
76
|
"reflect": true
|
|
75
77
|
}
|
|
76
78
|
}; }
|
|
77
|
-
static get states() { return {
|
|
78
|
-
"beginOpen": {}
|
|
79
|
-
}; }
|
|
80
79
|
static get events() { return [{
|
|
81
80
|
"method": "expansionOpen",
|
|
82
81
|
"name": "expansionOpen",
|
|
@@ -97,8 +96,8 @@ export class TableExpandableCell {
|
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
}, {
|
|
100
|
-
"method": "
|
|
101
|
-
"name": "
|
|
99
|
+
"method": "expansionLoad",
|
|
100
|
+
"name": "expansionLoad",
|
|
102
101
|
"bubbles": true,
|
|
103
102
|
"cancelable": true,
|
|
104
103
|
"composed": true,
|
|
@@ -1,7 +1,44 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: table-cell;
|
|
3
|
-
|
|
3
|
+
vertical-align: middle;
|
|
4
|
+
line-height: 1.5em;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
padding: 0.2em 0 0.2em;
|
|
7
|
+
border-style: solid solid none solid;
|
|
8
|
+
border-width: 2px;
|
|
9
|
+
border-color: rgb(var(--smoothly-default-color));
|
|
4
10
|
}
|
|
5
11
|
.hide {
|
|
6
12
|
display: none;
|
|
7
13
|
}
|
|
14
|
+
:host[open] {
|
|
15
|
+
position: relative;
|
|
16
|
+
z-index: 3;
|
|
17
|
+
background-color: rgb(var(--smoothly-default-color));
|
|
18
|
+
border-style: solid solid none solid;
|
|
19
|
+
border-width: 2px;
|
|
20
|
+
border-color: rgb(var(--smoothly-dark-color));
|
|
21
|
+
}
|
|
22
|
+
.slot-detail {
|
|
23
|
+
position: relative;
|
|
24
|
+
background-color: rgb(var(--smoothly-default-color));
|
|
25
|
+
width: 104%;
|
|
26
|
+
left: -2%;
|
|
27
|
+
border-left-style: solid;
|
|
28
|
+
border-left-color: rgb(var(--smoothly-tertiary-color));
|
|
29
|
+
box-shadow: 0px 0px 5px 4px rgb(var(--smoothly-dark-color), 0.5);
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
padding: 0.5rem 2%;
|
|
32
|
+
}
|
|
33
|
+
:host smoothly-icon {
|
|
34
|
+
width: 0.6rem;
|
|
35
|
+
height: 1rem;
|
|
36
|
+
float: left;
|
|
37
|
+
padding-left: 0.2rem;
|
|
38
|
+
padding-right: 0.2rem;
|
|
39
|
+
padding-bottom: 0.5rem;
|
|
40
|
+
transition: transform 0.2s;
|
|
41
|
+
}
|
|
42
|
+
:host[open] smoothly-icon {
|
|
43
|
+
transform: rotate(90deg);
|
|
44
|
+
}
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import { Component, Element, h, Host, Listen } from "@stencil/core";
|
|
1
|
+
import { Component, Element, Event, h, Host, Listen, Prop, Watch } from "@stencil/core";
|
|
2
2
|
export class TableExpandableRow {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
4
|
+
this.align = "left";
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
this.
|
|
6
|
+
openChanged(value) {
|
|
7
|
+
if (this.expansionElement)
|
|
8
|
+
this.element.after(this.expansionElement);
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
onClick(e) {
|
|
11
|
+
this.open = !this.open;
|
|
12
|
+
e.stopPropagation();
|
|
13
|
+
}
|
|
14
|
+
componentDidRender() {
|
|
15
|
+
this.expansionOpen.emit(this.expansionElement);
|
|
16
|
+
if (this.expansionElement && this.open)
|
|
17
|
+
this.element.after(this.expansionElement);
|
|
16
18
|
}
|
|
17
19
|
render() {
|
|
18
|
-
return (h(Host,
|
|
19
|
-
h("slot", null)
|
|
20
|
+
return (h(Host, { style: { textAlign: this.align } },
|
|
21
|
+
h("slot", null),
|
|
22
|
+
h("smoothly-table-cell", null,
|
|
23
|
+
h("smoothly-icon", { name: "chevron-forward", size: "tiny" })),
|
|
24
|
+
h("tr", { ref: e => (this.expansionElement = e) },
|
|
25
|
+
h("td", { colSpan: 999, class: !this.open ? "hide" : "" },
|
|
26
|
+
h("div", { class: "slot-detail" },
|
|
27
|
+
h("slot", { name: "detail" }))))));
|
|
20
28
|
}
|
|
21
29
|
static get is() { return "smoothly-table-expandable-row"; }
|
|
22
30
|
static get encapsulation() { return "scoped"; }
|
|
@@ -26,16 +34,71 @@ export class TableExpandableRow {
|
|
|
26
34
|
static get styleUrls() { return {
|
|
27
35
|
"$": ["style.css"]
|
|
28
36
|
}; }
|
|
37
|
+
static get properties() { return {
|
|
38
|
+
"align": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"mutable": false,
|
|
41
|
+
"complexType": {
|
|
42
|
+
"original": "\"left\" | \"center\" | \"right\"",
|
|
43
|
+
"resolved": "\"center\" | \"left\" | \"right\"",
|
|
44
|
+
"references": {}
|
|
45
|
+
},
|
|
46
|
+
"required": false,
|
|
47
|
+
"optional": false,
|
|
48
|
+
"docs": {
|
|
49
|
+
"tags": [],
|
|
50
|
+
"text": ""
|
|
51
|
+
},
|
|
52
|
+
"attribute": "align",
|
|
53
|
+
"reflect": false,
|
|
54
|
+
"defaultValue": "\"left\""
|
|
55
|
+
},
|
|
56
|
+
"open": {
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"mutable": true,
|
|
59
|
+
"complexType": {
|
|
60
|
+
"original": "boolean",
|
|
61
|
+
"resolved": "boolean",
|
|
62
|
+
"references": {}
|
|
63
|
+
},
|
|
64
|
+
"required": false,
|
|
65
|
+
"optional": false,
|
|
66
|
+
"docs": {
|
|
67
|
+
"tags": [],
|
|
68
|
+
"text": ""
|
|
69
|
+
},
|
|
70
|
+
"attribute": "open",
|
|
71
|
+
"reflect": true
|
|
72
|
+
}
|
|
73
|
+
}; }
|
|
74
|
+
static get events() { return [{
|
|
75
|
+
"method": "expansionOpen",
|
|
76
|
+
"name": "expansionOpen",
|
|
77
|
+
"bubbles": true,
|
|
78
|
+
"cancelable": true,
|
|
79
|
+
"composed": true,
|
|
80
|
+
"docs": {
|
|
81
|
+
"tags": [],
|
|
82
|
+
"text": ""
|
|
83
|
+
},
|
|
84
|
+
"complexType": {
|
|
85
|
+
"original": "HTMLElement",
|
|
86
|
+
"resolved": "HTMLElement",
|
|
87
|
+
"references": {
|
|
88
|
+
"HTMLElement": {
|
|
89
|
+
"location": "global"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}]; }
|
|
29
94
|
static get elementRef() { return "element"; }
|
|
95
|
+
static get watchers() { return [{
|
|
96
|
+
"propName": "open",
|
|
97
|
+
"methodName": "openChanged"
|
|
98
|
+
}]; }
|
|
30
99
|
static get listeners() { return [{
|
|
31
|
-
"name": "
|
|
32
|
-
"method": "
|
|
33
|
-
"target": undefined,
|
|
34
|
-
"capture": false,
|
|
35
|
-
"passive": false
|
|
36
|
-
}, {
|
|
37
|
-
"name": "expansionOpen",
|
|
38
|
-
"method": "onDetailsLoaded",
|
|
100
|
+
"name": "click",
|
|
101
|
+
"method": "onClick",
|
|
39
102
|
"target": undefined,
|
|
40
103
|
"capture": false,
|
|
41
104
|
"passive": false
|