smoothly 0.1.119 → 0.2.2

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.
Files changed (44) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/smoothly-accordion_51.cjs.entry.js +73 -54
  3. package/dist/cjs/smoothly.cjs.js +1 -1
  4. package/dist/collection/components/app/style.css +24 -24
  5. package/dist/collection/components/button/style.css +1 -2
  6. package/dist/collection/components/calendar/style.css +2 -3
  7. package/dist/collection/components/input/index.js +72 -9
  8. package/dist/collection/components/input-date/index.js +1 -1
  9. package/dist/collection/components/input-date/style.css +2 -3
  10. package/dist/collection/components/input-date-range/index.js +2 -2
  11. package/dist/collection/components/input-demo/index.js +2 -1
  12. package/dist/collection/components/item/style.css +2 -3
  13. package/dist/collection/components/select-demo/style.css +1 -1
  14. package/dist/collection/components/selector/style.css +0 -2
  15. package/dist/collection/components/tab/style.css +3 -4
  16. package/dist/collection/components/tab-switch/index.js +1 -0
  17. package/dist/collection/components/tab-switch/style.css +1 -1
  18. package/dist/collection/components/table/cell/style.css +3 -1
  19. package/dist/collection/components/table/demo/index.js +38 -32
  20. package/dist/collection/components/table/expandable/cell/index.js +8 -9
  21. package/dist/collection/components/table/expandable/cell/style.css +38 -1
  22. package/dist/collection/components/table/expandable/row/index.js +84 -21
  23. package/dist/collection/components/table/expandable/row/style.css +35 -4
  24. package/dist/collection/components/table/header/index.js +22 -2
  25. package/dist/collection/components/table/header/style.css +5 -3
  26. package/dist/collection/components/table/index.js +33 -1
  27. package/dist/collection/components/table/row/index.js +20 -84
  28. package/dist/collection/components/table/row/style.css +2 -8
  29. package/dist/collection/components/table/style.css +8 -3
  30. package/dist/custom-elements/index.js +79 -60
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/esm/smoothly-accordion_51.entry.js +73 -54
  33. package/dist/esm/smoothly.js +1 -1
  34. package/dist/smoothly/p-9d6a20c4.entry.js +1 -0
  35. package/dist/smoothly/smoothly.esm.js +1 -1
  36. package/dist/types/components/input/index.d.ts +10 -3
  37. package/dist/types/components/table/expandable/cell/index.d.ts +2 -2
  38. package/dist/types/components/table/expandable/row/index.d.ts +9 -4
  39. package/dist/types/components/table/header/index.d.ts +1 -0
  40. package/dist/types/components/table/index.d.ts +3 -0
  41. package/dist/types/components/table/row/index.d.ts +3 -9
  42. package/dist/types/components.d.ts +14 -7
  43. package/package.json +2 -2
  44. package/dist/smoothly/p-991517e4.entry.js +0 -1
@@ -18,13 +18,13 @@
18
18
  }
19
19
  a,
20
20
  button {
21
+ display: block;
21
22
  border-color: transparent;
22
23
  background-color: transparent;
23
24
  padding: 0.2em 0.3em;
24
25
  font-size: 110%;
25
26
  font-weight: 400;
26
27
  }
27
-
28
28
  :host:not([disabled]):hover,
29
29
  :host:not([disabled]):focus,
30
30
  :host:not([disabled]):active {
@@ -35,7 +35,6 @@ button {
35
35
  text-align: center;
36
36
  text-decoration: inherit;
37
37
  }
38
-
39
38
  :host[type=button] > a {
40
39
  width: calc(100% - 0.6em);
41
40
  }
@@ -35,7 +35,7 @@ td:nth-child(6):not(.currentMonth),
35
35
  td:nth-child(7):not(.currentMonth) {
36
36
  color: rgba(var(--smoothly-danger-tint), var(--other-month-opacity));
37
37
  }
38
- td:not(.selected,.disable):hover {
38
+ td:not(.selected, .disable):hover {
39
39
  color: rgb(var(--smoothly-primary-contrast));
40
40
  background: rgb(var(--smoothly-primary-tint));
41
41
  }
@@ -43,7 +43,7 @@ td.selected {
43
43
  color: rgb(var(--smoothly-primary-contrast));
44
44
  background: rgb(var(--smoothly-primary-color));
45
45
  }
46
- td:not(.selected,.dateRange):not(:hover).today {
46
+ td:not(.selected, .dateRange):not(:hover).today {
47
47
  background: rgb(var(--smoothly-dark-tint));
48
48
  color: rgb(var(--smoothly-dark-contrast));
49
49
  }
@@ -56,4 +56,3 @@ td.disable {
56
56
  background-color: rgb(var(--smoothly-default-tint), 0.5);
57
57
  color: rgb(var(--smoothly-default-contrast), 0.5);
58
58
  }
59
-
@@ -1,4 +1,4 @@
1
- import { Component, Event, h, Host, Method, Prop, Watch } from "@stencil/core";
1
+ import { Component, Event, h, Host, Method, Prop, State, Watch } from "@stencil/core";
2
2
  import { Language, Locale } from "isoly";
3
3
  import { Action, get, StateEditor } from "tidily";
4
4
  export class SmoothlyInput {
@@ -11,6 +11,7 @@ export class SmoothlyInput {
11
11
  this.maxLength = Number.POSITIVE_INFINITY;
12
12
  this.autocomplete = true;
13
13
  this.disabled = false;
14
+ this.readonly = false;
14
15
  }
15
16
  get formatter() {
16
17
  let result;
@@ -33,8 +34,11 @@ export class SmoothlyInput {
33
34
  this.lastValue = value;
34
35
  this.state = Object.assign(Object.assign({}, this.state), { value: this.newState({ value: this.formatter.toString(value), selection: this.state.selection }).value });
35
36
  }
36
- if (value != before)
37
- this.smoothlyChanged.emit({ name: this.name, value });
37
+ if (value != before) {
38
+ if (typeof value == "string")
39
+ value = value.trim();
40
+ this.smoothlyInput.emit({ name: this.name, value });
41
+ }
38
42
  }
39
43
  onCurrency() {
40
44
  this.state = Object.assign(Object.assign({}, this.state), { value: this.newState({ value: this.formatter.toString(this.value), selection: this.state.selection }).value, pattern: this.newState({ value: this.formatter.toString(this.value), selection: this.state.selection }).pattern });
@@ -83,8 +87,14 @@ export class SmoothlyInput {
83
87
  const after = this.formatter.format(StateEditor.copy(this.formatter.unformat(StateEditor.copy(Object.assign({}, this.state)))));
84
88
  this.updateBackend(after, this.inputElement);
85
89
  }
86
- onBlur(event) { }
90
+ onBlur(event) {
91
+ this.smoothlyBlur.emit();
92
+ if (this.initialValue != this.value)
93
+ this.smoothlyChange.emit({ name: this.name, value: this.value });
94
+ this.initialValue = undefined;
95
+ }
87
96
  onFocus(event) {
97
+ this.initialValue = this.value;
88
98
  const after = this.formatter.format(StateEditor.copy(this.formatter.unformat(StateEditor.copy(Object.assign({}, this.state)))));
89
99
  if (event.target)
90
100
  this.updateBackend(after, event.target);
@@ -160,8 +170,10 @@ export class SmoothlyInput {
160
170
  return value;
161
171
  }
162
172
  processKey(event, backend) {
163
- const after = Action.apply(this.formatter, this.state, event);
164
- this.updateBackend(after, backend);
173
+ if (!this.readonly) {
174
+ const after = Action.apply(this.formatter, this.state, event);
175
+ this.updateBackend(after, backend);
176
+ }
165
177
  }
166
178
  updateBackend(after, backend) {
167
179
  if (after.value != backend.value)
@@ -178,7 +190,7 @@ export class SmoothlyInput {
178
190
  var _a, _b, _c, _d, _e, _f, _g;
179
191
  return (h(Host, { class: { "has-value": ((_a = this.state) === null || _a === void 0 ? void 0 : _a.value) != undefined && ((_b = this.state) === null || _b === void 0 ? void 0 : _b.value) != "" }, onclick: () => { var _a; return (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.focus(); } },
180
192
  h("div", null,
181
- h("input", { name: this.name, type: (_c = this.state) === null || _c === void 0 ? void 0 : _c.type, placeholder: this.placeholder, required: this.required, autocomplete: this.autocomplete ? (_d = this.state) === null || _d === void 0 ? void 0 : _d.autocomplete : "off", disabled: this.disabled, pattern: ((_e = this.state) === null || _e === void 0 ? void 0 : _e.pattern) && ((_f = this.state) === null || _f === void 0 ? void 0 : _f.pattern.source), value: (_g = this.state) === null || _g === void 0 ? void 0 : _g.value, onInput: (e) => this.onInput(e), onFocus: e => this.onFocus(e), onClick: e => this.onClick(e), onBlur: e => this.onBlur(e), onKeyDown: e => this.onKeyDown(e), ref: (el) => (this.inputElement = el), onPaste: e => this.onPaste(e) }),
193
+ h("input", { name: this.name, type: (_c = this.state) === null || _c === void 0 ? void 0 : _c.type, placeholder: this.placeholder, required: this.required, autocomplete: this.autocomplete ? (_d = this.state) === null || _d === void 0 ? void 0 : _d.autocomplete : "off", disabled: this.disabled, readOnly: this.readonly, pattern: ((_e = this.state) === null || _e === void 0 ? void 0 : _e.pattern) && ((_f = this.state) === null || _f === void 0 ? void 0 : _f.pattern.source), value: (_g = this.state) === null || _g === void 0 ? void 0 : _g.value, onInput: (e) => this.onInput(e), onFocus: e => this.onFocus(e), onClick: e => this.onClick(e), onBlur: e => this.onBlur(e), onKeyDown: e => this.onKeyDown(e), ref: (el) => (this.inputElement = el), onPaste: e => this.onPaste(e) }),
182
194
  h("label", { htmlFor: this.name },
183
195
  h("slot", null)),
184
196
  h("smoothly-icon", { name: "alert-circle", color: "danger", fill: "clear", size: "small" }))));
@@ -388,6 +400,24 @@ export class SmoothlyInput {
388
400
  "reflect": false,
389
401
  "defaultValue": "false"
390
402
  },
403
+ "readonly": {
404
+ "type": "boolean",
405
+ "mutable": true,
406
+ "complexType": {
407
+ "original": "boolean",
408
+ "resolved": "boolean",
409
+ "references": {}
410
+ },
411
+ "required": false,
412
+ "optional": false,
413
+ "docs": {
414
+ "tags": [],
415
+ "text": ""
416
+ },
417
+ "attribute": "readonly",
418
+ "reflect": false,
419
+ "defaultValue": "false"
420
+ },
391
421
  "currency": {
392
422
  "type": "string",
393
423
  "mutable": false,
@@ -411,9 +441,42 @@ export class SmoothlyInput {
411
441
  "reflect": true
412
442
  }
413
443
  }; }
444
+ static get states() { return {
445
+ "initialValue": {}
446
+ }; }
414
447
  static get events() { return [{
415
- "method": "smoothlyChanged",
416
- "name": "smoothlyChanged",
448
+ "method": "smoothlyBlur",
449
+ "name": "smoothlyBlur",
450
+ "bubbles": true,
451
+ "cancelable": true,
452
+ "composed": true,
453
+ "docs": {
454
+ "tags": [],
455
+ "text": ""
456
+ },
457
+ "complexType": {
458
+ "original": "void",
459
+ "resolved": "void",
460
+ "references": {}
461
+ }
462
+ }, {
463
+ "method": "smoothlyChange",
464
+ "name": "smoothlyChange",
465
+ "bubbles": true,
466
+ "cancelable": true,
467
+ "composed": true,
468
+ "docs": {
469
+ "tags": [],
470
+ "text": ""
471
+ },
472
+ "complexType": {
473
+ "original": "{ name: string; value: any }",
474
+ "resolved": "{ name: string; value: any; }",
475
+ "references": {}
476
+ }
477
+ }, {
478
+ "method": "smoothlyInput",
479
+ "name": "smoothlyInput",
417
480
  "bubbles": true,
418
481
  "cancelable": true,
419
482
  "composed": true,
@@ -11,7 +11,7 @@ export class InputDate {
11
11
  render() {
12
12
  var _a;
13
13
  return [
14
- h("smoothly-input", { onClick: () => (this.open = !this.open), disabled: this.disabled, type: "date", value: this.value, onSmoothlyChanged: e => (this.value = e.detail.value) },
14
+ h("smoothly-input", { onClick: () => (this.open = !this.open), disabled: this.disabled, type: "date", value: this.value, onSmoothlyInput: e => (this.value = e.detail.value) },
15
15
  h("slot", null)),
16
16
  this.open && !this.disabled
17
17
  ? [
@@ -1,14 +1,13 @@
1
1
  :host {
2
2
  position: relative;
3
3
  }
4
-
5
4
  nav {
6
5
  position: absolute;
7
6
  z-index: 10;
8
7
  top: 3.5em;
9
8
  background-color: rgb(var(--smoothly-default-shade));
10
9
  max-width: 22em;
11
- }
10
+ }
12
11
  :host > div {
13
12
  position: fixed;
14
13
  top: 0px;
@@ -22,7 +21,7 @@ nav {
22
21
  :host > nav > .arrow {
23
22
  position: absolute;
24
23
  z-index: 9;
25
- transform: translate(2em, -.55em) rotate(45deg);
24
+ transform: translate(2em, -0.55em) rotate(45deg);
26
25
  width: 1em;
27
26
  height: 1em;
28
27
  background-color: rgb(var(--smoothly-default-shade));
@@ -23,9 +23,9 @@ export class InputDateRange {
23
23
  var _a;
24
24
  return [
25
25
  h("section", { onClick: () => (this.open = !this.open) },
26
- h("smoothly-input", { type: "date", value: this.start, showLabel: this.showLabel, onSmoothlyChanged: e => (this.start = e.detail.value) }, "from"),
26
+ h("smoothly-input", { type: "date", value: this.start, showLabel: this.showLabel, onSmoothlyInput: e => (this.start = e.detail.value) }, "from"),
27
27
  h("span", null, "\u2013"),
28
- h("smoothly-input", { type: "date", showLabel: this.showLabel, value: this.end, onSmoothlyChanged: e => (this.end = e.detail.value) }, "to")),
28
+ h("smoothly-input", { type: "date", showLabel: this.showLabel, value: this.end, onSmoothlyInput: e => (this.end = e.detail.value) }, "to")),
29
29
  this.open ? h("div", { onClick: () => (this.open = false) }) : [],
30
30
  this.open ? (h("nav", null,
31
31
  h("div", { class: "arrow" }),
@@ -6,7 +6,8 @@ export class SmoothlyInputDemo {
6
6
  h("header", null,
7
7
  h("h5", null, "Address")),
8
8
  h("main", null,
9
- h("smoothly-input", { type: "text", name: "name" }, "Name"),
9
+ h("smoothly-input", { type: "text", name: "name", readonly: true, value: "Readonly", onSmoothlyBlur: () => console.log("smoothly blur") }, "Readonly"),
10
+ h("smoothly-input", { type: "text", name: "name", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"),
10
11
  h("smoothly-input", { type: "date", name: "date" }, "Date"),
11
12
  h("smoothly-input", { type: "date-time", name: "date-time" }, "Date-Time"),
12
13
  h("smoothly-input", { type: "divisor", name: "divisor" }, "Divisor"),
@@ -3,14 +3,13 @@
3
3
  color: rgb(var(--smoothly-primary-contrast));
4
4
  }
5
5
  :host {
6
- padding: .5em;
6
+ padding: 0.5em;
7
7
  cursor: pointer;
8
8
  background-color: rgb(var(--smoothly-default-shade));
9
9
  color: rgb(var(--smoothly-default-contrast));
10
- border: rgb(var(--smoothly-default-shade) solid 1px)
10
+ border: rgb(var(--smoothly-default-shade) solid 1px);
11
11
  }
12
12
  :host:hover {
13
13
  background-color: rgb(var(--smoothly-primary-color));
14
14
  color: rgb(var(--smoothly-primary-contrast));
15
15
  }
16
-
@@ -8,5 +8,5 @@ button:focus {
8
8
  outline: none;
9
9
  }
10
10
  smoothly-selector {
11
- outline: none
11
+ outline: none;
12
12
  }
@@ -1,4 +1,3 @@
1
-
2
1
  :host {
3
2
  position: relative;
4
3
  height: 100%;
@@ -9,7 +8,6 @@
9
8
  display: flex;
10
9
  align-items: center;
11
10
  }
12
-
13
11
  :host > div > nav {
14
12
  display: flex;
15
13
  flex-direction: column;
@@ -6,14 +6,13 @@
6
6
  }
7
7
  label {
8
8
  display: block;
9
- padding: 1em;
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
- background-color: rgb(var(--smoothly-default-shade));
18
- padding: 1em;
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);
@@ -1,5 +1,5 @@
1
1
  :host {
2
2
  display: flex;
3
3
  flex-direction: row;
4
- margin: 1em 1em 0em 0em
4
+ margin: 1em 1em 0em 0em;
5
5
  }
@@ -1,4 +1,6 @@
1
1
  :host {
2
2
  display: table-cell;
3
- padding: 0.5em;
3
+ vertical-align: middle;
4
+ line-height: 1.5rem;
5
+ padding: 0.2rem 0 0.2rem 1rem;
4
6
  }
@@ -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
- h("smoothly-table-expandable-row", null,
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
- "Value 1A",
13
- h("div", { slot: "detail" }, "1A details")),
14
+ "normal row (exp.cell)",
15
+ h("div", { slot: "detail" }, "expandable cell 1 content")),
14
16
  h("smoothly-table-expandable-cell", null,
15
- h("smoothly-display", { type: "price", value: 20, currency: "EUR" }),
16
- h("div", { slot: "detail" }, "Budget details.")),
17
+ "expandable cell",
18
+ h("div", { slot: "detail" }, "expandable cell 2 content")),
17
19
  h("smoothly-table-expandable-cell", null,
18
- h("smoothly-display", { type: "price", value: 18, currency: "EUR" }),
19
- h("div", { slot: "detail" }, "Cost details."))),
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
- "Value 1A",
23
- h("div", { slot: "detail" }, "2A details")),
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
- h("smoothly-display", { type: "price", value: 30, currency: "EUR" }),
26
- h("div", { slot: "detail" }, "Budget details.")),
29
+ "expandable cell",
30
+ h("div", { slot: "detail" }, "expandable cell details.")),
27
31
  h("smoothly-table-expandable-cell", null,
28
- h("smoothly-display", { type: "price", value: 38, currency: "EUR" }),
29
- h("div", { slot: "detail" }, "Cost details.")))),
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 D"),
33
- h("smoothly-table-header", null, "Header E"),
34
- h("smoothly-table-header", null, "Header F")),
35
- h("smoothly-table-row", null,
36
- h("smoothly-table-cell", null, "Value 1A"),
37
- h("smoothly-table-cell", null,
38
- h("smoothly-display", { type: "price", value: 20, currency: "EUR" })),
39
- h("smoothly-table-cell", null,
40
- h("smoothly-display", { type: "price", value: 18, currency: "EUR" })),
41
- h("div", { slot: "detail" }, "Cost details.")),
42
- h("smoothly-table-row", null,
43
- h("smoothly-table-cell", null, "Value 1A"),
44
- h("smoothly-table-cell", null,
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, State, Watch, } from "@stencil/core";
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.expansionLoaded.emit();
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: 500, class: !this.open ? "hide" : "" },
30
- h("slot", { name: "detail" })))));
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": "expansionLoaded",
101
- "name": "expansionLoaded",
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
- padding: 0.5em;
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.expansions = [];
4
+ this.align = "left";
5
5
  }
6
- onExpansionLoaded(event) {
7
- this.expansions.push(event.target);
6
+ openChanged(value) {
7
+ if (this.expansionElement)
8
+ this.element.after(this.expansionElement);
8
9
  }
9
- onDetailsLoaded(event) {
10
- this.expansions.forEach(cell => {
11
- if (cell != event.target)
12
- cell.open = false;
13
- });
14
- if (event.detail)
15
- this.element.after(event.detail);
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, null,
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": "expansionLoaded",
32
- "method": "onExpansionLoaded",
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