@operato/input 0.2.31 → 0.2.36

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 (40) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/demo/index-3dish.html +15 -2
  3. package/demo/index-angle.html +9 -4
  4. package/demo/index-button-radio.html +18 -6
  5. package/demo/index-checkbox.html +16 -5
  6. package/demo/index-stack.html +15 -3
  7. package/demo/index.html +79 -69
  8. package/dist/src/ox-buttons-radio.d.ts +7 -5
  9. package/dist/src/ox-buttons-radio.js +13 -9
  10. package/dist/src/ox-buttons-radio.js.map +1 -1
  11. package/dist/src/ox-checkbox.d.ts +5 -6
  12. package/dist/src/ox-checkbox.js +28 -25
  13. package/dist/src/ox-checkbox.js.map +1 -1
  14. package/dist/src/ox-formfield.d.ts +10 -0
  15. package/dist/src/ox-formfield.js +38 -0
  16. package/dist/src/ox-formfield.js.map +1 -0
  17. package/dist/src/ox-input-3dish.d.ts +15 -14
  18. package/dist/src/ox-input-3dish.js +51 -23
  19. package/dist/src/ox-input-3dish.js.map +1 -1
  20. package/dist/src/ox-input-angle.d.ts +4 -5
  21. package/dist/src/ox-input-angle.js +10 -12
  22. package/dist/src/ox-input-angle.js.map +1 -1
  23. package/dist/src/ox-input-stack.d.ts +5 -3
  24. package/dist/src/ox-input-stack.js +40 -35
  25. package/dist/src/ox-input-stack.js.map +1 -1
  26. package/dist/src/ox-select.d.ts +5 -4
  27. package/dist/src/ox-select.js +34 -12
  28. package/dist/src/ox-select.js.map +1 -1
  29. package/dist/test/property-angle.test.js +3 -3
  30. package/dist/test/property-angle.test.js.map +1 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +3 -3
  33. package/src/ox-buttons-radio.ts +15 -9
  34. package/src/ox-checkbox.ts +32 -25
  35. package/src/ox-formfield.ts +36 -0
  36. package/src/ox-input-3dish.ts +65 -29
  37. package/src/ox-input-angle.ts +11 -12
  38. package/src/ox-input-stack.ts +43 -24
  39. package/src/ox-select.ts +44 -15
  40. package/test/property-angle.test.ts +3 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,71 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [0.2.36](https://github.com/hatiolab/operato/compare/v0.2.35...v0.2.36) (2021-12-06)
7
+
8
+
9
+ ### :mega: Other
10
+
11
+ * operato/input/ox-select ([dd2fcbc](https://github.com/hatiolab/operato/commit/dd2fcbcee22705c1d68d5743f04cb0d5c1739503))
12
+
13
+
14
+ ### :rocket: New Features
15
+
16
+ * adding filter options for data-grist ([3620e8b](https://github.com/hatiolab/operato/commit/3620e8b5c39e7e66f8e7ab39b2ae7200f7f7afb5))
17
+
18
+
19
+ ### :bug: Bug Fix
20
+
21
+ * apply class name prefix Ox for operato/popup ([d528848](https://github.com/hatiolab/operato/commit/d5288486ea0e1bec84fff3c5b6bac696eb701e5d))
22
+ * apply things-scene version ([cbebd17](https://github.com/hatiolab/operato/commit/cbebd1729704e6e42e70d60a4e3b122d42271c2e))
23
+ * operato/input to support formfield ([21b4d46](https://github.com/hatiolab/operato/commit/21b4d46d750ba833c571b5caeed27eebd8aa03ca))
24
+ * operato/input to support formfield ([544bf92](https://github.com/hatiolab/operato/commit/544bf928946d878aa967f33b20efdf90eb8e82f5))
25
+ * operato/ox-popup-list rewritten ([f78b3e9](https://github.com/hatiolab/operato/commit/f78b3e9623faac5ea653442ced653173d630d9e6))
26
+ * operato/popup, input sample ([116b037](https://github.com/hatiolab/operato/commit/116b0371446cb24d8863c2bdea876b97f6e11dfd))
27
+ * operato/popup, input sample ([31fb99f](https://github.com/hatiolab/operato/commit/31fb99fc4e37a26c38826dd3554f92ded0632e82))
28
+
29
+
30
+
31
+ ### [0.2.35](https://github.com/hatiolab/operato/compare/v0.2.34...v0.2.35) (2021-12-03)
32
+
33
+ **Note:** Version bump only for package @operato/input
34
+
35
+
36
+
37
+
38
+
39
+ ### [0.2.34](https://github.com/hatiolab/operato/compare/v0.2.33...v0.2.34) (2021-12-03)
40
+
41
+ **Note:** Version bump only for package @operato/input
42
+
43
+
44
+
45
+
46
+
47
+ ### [0.2.33](https://github.com/hatiolab/operato/compare/v0.2.32...v0.2.33) (2021-12-03)
48
+
49
+ **Note:** Version bump only for package @operato/input
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ **Note:** Version bump only for package @operato/input
58
+
59
+
60
+
61
+
62
+
63
+ ### [0.2.32](https://github.com/hatiolab/operato/compare/v0.2.31...v0.2.32) (2021-12-03)
64
+
65
+ **Note:** Version bump only for package @operato/input
66
+
67
+
68
+
69
+
70
+
6
71
  ### [0.2.31](https://github.com/hatiolab/operato/compare/v0.2.30...v0.2.31) (2021-12-03)
7
72
 
8
73
  **Note:** Version bump only for package @operato/input
@@ -9,14 +9,27 @@
9
9
  </style>
10
10
  </head>
11
11
  <body>
12
- <div id="demo"></div>
12
+ <form id="demo"></form>
13
13
 
14
14
  <script type="module">
15
15
  import { html, render } from 'lit'
16
16
  import '../dist/src/ox-input-angle.js'
17
17
  import '../dist/src/ox-input-3dish.js'
18
18
 
19
- render(html` <ox-input-3dish></ox-input-3dish> `, document.querySelector('#demo'))
19
+ const form = document.querySelector('#demo')
20
+
21
+ render(
22
+ html`
23
+ <ox-input-3dish
24
+ name="threedish"
25
+ @change=${e => {
26
+ console.log(e.target.value)
27
+ console.log('form value', new FormData(form).get('threedish'))
28
+ }}
29
+ ></ox-input-3dish>
30
+ `,
31
+ form
32
+ )
20
33
  </script>
21
34
  </body>
22
35
  </html>
@@ -9,22 +9,27 @@
9
9
  </style>
10
10
  </head>
11
11
  <body>
12
- <div id="demo"></div>
12
+ <form id="demo"></form>
13
13
 
14
14
  <script type="module">
15
15
  import { html, render } from 'lit'
16
16
  import '../dist/src/ox-input-angle.js'
17
17
 
18
+ const form = document.querySelector('#demo')
18
19
  const placeholder = 'enter a angle in degree'
19
20
  render(
20
21
  html`
21
22
  <ox-input-angle
22
- radian="1"
23
+ value="1"
24
+ name="angle"
23
25
  placeholder=${placeholder}
24
- @change=${e => console.log(e.target.radian)}
26
+ @change=${e => {
27
+ console.log(e.target.value)
28
+ console.log('form value', new FormData(form).get('angle'))
29
+ }}
25
30
  ></ox-input-angle>
26
31
  `,
27
- document.querySelector('#demo')
32
+ form
28
33
  )
29
34
  </script>
30
35
  </body>
@@ -9,21 +9,33 @@
9
9
  </style>
10
10
  </head>
11
11
  <body>
12
- <div id="demo"></div>
12
+ <form id="demo"></form>
13
13
 
14
14
  <script type="module">
15
15
  import { html, render } from 'lit'
16
16
  import '../dist/src/ox-buttons-radio.js'
17
17
 
18
+ const form = document.querySelector('#demo')
19
+
20
+ function onchange(e) {
21
+ const target = e.target
22
+ console.log(target.name, target.value)
23
+
24
+ const formData = new FormData(form)
25
+ for (var pair of formData.entries()) {
26
+ console.log(pair[0] + ', ' + pair[1])
27
+ }
28
+ }
29
+
18
30
  render(
19
31
  html`
20
- <ox-buttons-radio @change=${e => console.log(e.target.value)}>
21
- <div data-value="top">TOP</div>
22
- <div data-value="middle">MID</div>
23
- <div data-value="bottom">BOT</div>
32
+ <ox-buttons-radio name="group" @change=${onchange}>
33
+ <div value="top">TOP</div>
34
+ <div value="middle">MID</div>
35
+ <div value="bottom">BOT</div>
24
36
  </ox-buttons-radio>
25
37
  `,
26
- document.querySelector('#demo')
38
+ form
27
39
  )
28
40
  </script>
29
41
  </body>
@@ -39,19 +39,30 @@
39
39
  </style>
40
40
  </head>
41
41
  <body>
42
- <div id="demo"></div>
42
+ <form id="demo"></form>
43
43
 
44
44
  <script type="module">
45
45
  import { html, render } from 'lit'
46
46
  import '../dist/src/ox-checkbox.js'
47
+ const form = document.querySelector('#demo')
48
+
49
+ function onchange(e) {
50
+ const target = e.target
51
+ console.log(target.name, target.checked)
52
+
53
+ const formData = new FormData(form)
54
+ for (var pair of formData.entries()) {
55
+ console.log(pair[0] + ', ' + pair[1])
56
+ }
57
+ }
47
58
 
48
59
  render(
49
60
  html`
50
- <ox-checkbox @change=${e => console.log(e.target.checked)} class=""></ox-checkbox>
51
- <ox-checkbox @change=${e => console.log(e.target.checked)} class="customized">hatiolab</ox-checkbox>
52
- <ox-checkbox @change=${e => console.log(e.target.checked)} class="customized" disabled>ibex</ox-checkbox>
61
+ <ox-checkbox name="check-a" @change=${onchange} class=""></ox-checkbox>
62
+ <ox-checkbox name="check-b" @change=${onchange} class="customized">hatiolab</ox-checkbox>
63
+ <ox-checkbox name="check-c" @change=${onchange} class="customized" disabled>ibex</ox-checkbox>
53
64
  `,
54
- document.querySelector('#demo')
65
+ form
55
66
  )
56
67
  </script>
57
68
  </body>
@@ -9,13 +9,25 @@
9
9
  </style>
10
10
  </head>
11
11
  <body>
12
- <div id="demo"></div>
12
+ <form id="demo"></form>
13
13
 
14
14
  <script type="module">
15
15
  import { html, render } from 'lit'
16
- import '../dist/src/ox-stack.js'
16
+ import '../dist/src/ox-input-stack.js'
17
17
 
18
- render(html` <ox-stack> </ox-stack> `, document.querySelector('#demo'))
18
+ const form = document.querySelector('#demo')
19
+
20
+ function onchange(e) {
21
+ const target = e.target
22
+ console.log(target.name, target.checked)
23
+
24
+ const formData = new FormData(form)
25
+ for (var pair of formData.entries()) {
26
+ console.log(pair[0] + ', ' + pair[1])
27
+ }
28
+ }
29
+
30
+ render(html` <ox-input-stack name="stack" @change=${onchange}> </ox-input-stack> `, form)
19
31
  </script>
20
32
  </body>
21
33
  </html>
package/demo/index.html CHANGED
@@ -12,100 +12,110 @@
12
12
  }
13
13
 
14
14
  ox-select {
15
- width: 200px;
15
+ display: inline-block;
16
+ width: 100px;
16
17
  }
17
18
 
18
19
  ox-popup-list {
19
- height: 200px;
20
+ max-height: 200px;
20
21
  overflow: auto;
21
22
  }
23
+
24
+ ::-webkit-scrollbar {
25
+ width: 5px;
26
+ height: 5px;
27
+ }
28
+ ::-webkit-scrollbar-track {
29
+ background-color: transparent;
30
+ }
31
+ ::-webkit-scrollbar-thumb {
32
+ background-color: var(--scrollbar-thumb-color, rgba(0, 0, 0, 0.2));
33
+ }
34
+ ::-webkit-scrollbar-thumb:hover {
35
+ background-color: var(--scrollbar-thumb-hover-color, #aa866a);
36
+ }
22
37
  </style>
23
38
 
24
39
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
25
40
  <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
26
41
  </head>
27
42
  <body>
28
- <div id="demo"></div>
43
+ <form id="demo"></form>
29
44
 
30
45
  <script type="module">
31
46
  import { html, render } from 'lit'
32
47
  import '../dist/src/ox-select.js'
33
48
  import '../dist/src/ox-checkbox.js'
34
49
 
50
+ const form = document.querySelector('#demo')
51
+
52
+ function onchanged(e) {
53
+ const target = e.target
54
+ console.log(target, target.name, e.detail)
55
+
56
+ const formData = new FormData(form)
57
+ for (var pair of formData.entries()) {
58
+ console.log(pair[0] + ', ' + pair[1])
59
+ }
60
+ }
61
+
35
62
  render(
36
63
  html`
37
- <ox-select @selected=${e => console.log(e.target)} label="Click to expand this">
64
+ <ox-select name="single" @change=${onchanged} placeholder="single select">
38
65
  <ox-popup-list>
39
- <div option @selected=${e => console.log(e.target)}>Click this to close</div>
40
-
41
- <div option alive-on-select @selected=${e => console.log(e.target)}>
42
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
43
- </div>
44
-
45
- <div option alive-on-select>
46
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
47
- </div>
48
-
49
- <div option alive-on-select>
50
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
51
- </div>
52
-
53
- <div option alive-on-select>
54
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
55
- </div>
56
-
57
- <div option alive-on-select>
58
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
59
- </div>
60
-
61
- <div option alive-on-select>
62
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
63
- </div>
64
-
65
- <div option alive-on-select>
66
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
67
- </div>
68
-
69
- <div option alive-on-select>
70
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
71
- </div>
66
+ <div option value="A" />A</div>
67
+ <div option value="B" />B</div>
68
+ <div option value="C" />C</div>
69
+ <div option value="TOO LONG VALUE" />TOO LONG VALUE</div>
70
+ </ox-popup-list>
71
+ </ox-select>
72
+
73
+ <ox-select name="multiple" @change=${onchanged} placeholder="multiple select">
74
+ <ox-popup-list multiple>
75
+ <div option value="A" />A</div>
76
+ <div option value="B" />B</div>
77
+ <div option value="C" />C</div>
78
+ <div option value="TOO LONG VALUE" />TOO LONG VALUE</div>
79
+ </ox-popup-list>
80
+ </ox-select>
72
81
 
82
+ <ox-select name="multiple with checkbox" @change=${onchanged} placeholder="multiple with checkbox">
83
+ <ox-popup-list attr-selected="checked" multiple>
84
+ <ox-checkbox option @change=${e => {
85
+ const options = e.target.parentElement.querySelectorAll('[option]')
86
+ console.log(options)
87
+ options.forEach(option => (option.checked = e.target.checked))
88
+ }}>set all</ox-checkbox>
89
+ <ox-checkbox option value="A" />A</ox-checkbox>
90
+ <ox-checkbox option value="B" />B</ox-checkbox>
91
+ <ox-checkbox option value="C" checked />C</ox-checkbox>
92
+ <ox-checkbox option value="D" />D</ox-checkbox>
93
+ <ox-checkbox option value="E" />E</ox-checkbox>
94
+ <ox-checkbox option value="F" />F</ox-checkbox>
95
+ <ox-checkbox option value="G" />G</ox-checkbox>
96
+ <ox-checkbox option value="TOO LONG VALUE" />TOO LONG VALUE</ox-checkbox>
97
+ </ox-popup-list>
98
+ </ox-select>
73
99
 
74
- <div option alive-on-select @selected=${e => console.log(e.target)}>
75
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
76
- </div>
77
-
78
- <div option alive-on-select>
79
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
80
- </div>
81
-
82
- <div option alive-on-select>
83
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
84
- </div>
85
-
86
- <div option alive-on-select>
87
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
88
- </div>
89
-
90
- <div option alive-on-select>
91
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
92
- </div>
93
-
94
- <div option alive-on-select>
95
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
96
- </div>
97
-
98
- <div option alive-on-select>
99
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
100
- </div>
101
-
102
- <div option alive-on-select>
103
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
104
- </div>
100
+ <ox-select name="multiple with input" @change=${onchanged} placeholder="multiple with checkbox">
101
+ <ox-popup-list attr-selected="checked" multiple>
102
+ <input type="checkbox" option @change=${e => {
103
+ const options = e.target.parentElement.querySelectorAll('[option]')
104
+ console.log(options)
105
+ options.forEach(option => (option.checked = e.target.checked))
106
+ }}>set all
107
+ <input type="checkbox" option value="A" />A
108
+ <input type="checkbox" option value="B" />B
109
+ <input type="checkbox" option value="C" />C
110
+ <input type="checkbox" option value="D" />D
111
+ <input type="checkbox" option value="E" />E
112
+ <input type="checkbox" option value="F" />F
113
+ <input type="checkbox" option value="G" />G
114
+ <input type="checkbox" option value="TOO LONG VALUE" />TOO LONG VALUE
105
115
  </ox-popup-list>
106
116
  </ox-select>
107
117
  `,
108
- document.querySelector('#demo')
118
+ form
109
119
  )
110
120
  </script>
111
121
  </body>
@@ -1,19 +1,20 @@
1
1
  /**
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
- import { LitElement, PropertyValues } from 'lit';
4
+ import { PropertyValues } from 'lit';
5
+ import { OxFormField } from './ox-formfield';
5
6
  /**
6
7
  여러 버튼 중에서 하나만 눌리거나, 모두 눌리지 않은 상태만을 갖는 라디오 형태의 버튼이다.
7
8
 
8
9
  Example:
9
10
 
10
11
  <ox-buttons-radio @change=${e => this._onChange(e)} value=${value}>
11
- <div data-value="top"></div>
12
- <div data-value="middle"></div>
13
- <div data-value="bottom"></div>
12
+ <div value="top"></div>
13
+ <div value="middle"></div>
14
+ <div value="bottom"></div>
14
15
  </ox-buttons-radio>
15
16
  */
16
- export declare class PropertyButtonsRadio extends LitElement {
17
+ export declare class PropertyButtonsRadio extends OxFormField {
17
18
  static styles: import("lit").CSSResult[];
18
19
  /**
19
20
  * `value`는 버튼의 눌린 상태를 값으로 갖는 속성이다.
@@ -25,4 +26,5 @@ export declare class PropertyButtonsRadio extends LitElement {
25
26
  get buttons(): Element[];
26
27
  _onValueChanged(value: Object | null): void;
27
28
  _onTapButton(e: Event): void;
29
+ protected appendFormData({ formData }: FormDataEvent): void;
28
30
  }
@@ -2,20 +2,21 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
  import { __decorate } from "tslib";
5
- import { css, html, LitElement } from 'lit';
5
+ import { css, html } from 'lit';
6
6
  import { customElement, property } from 'lit/decorators.js';
7
+ import { OxFormField } from './ox-formfield';
7
8
  /**
8
9
  여러 버튼 중에서 하나만 눌리거나, 모두 눌리지 않은 상태만을 갖는 라디오 형태의 버튼이다.
9
10
 
10
11
  Example:
11
12
 
12
13
  <ox-buttons-radio @change=${e => this._onChange(e)} value=${value}>
13
- <div data-value="top"></div>
14
- <div data-value="middle"></div>
15
- <div data-value="bottom"></div>
14
+ <div value="top"></div>
15
+ <div value="middle"></div>
16
+ <div value="bottom"></div>
16
17
  </ox-buttons-radio>
17
18
  */
18
- let PropertyButtonsRadio = class PropertyButtonsRadio extends LitElement {
19
+ let PropertyButtonsRadio = class PropertyButtonsRadio extends OxFormField {
19
20
  constructor() {
20
21
  super(...arguments);
21
22
  /**
@@ -34,7 +35,7 @@ let PropertyButtonsRadio = class PropertyButtonsRadio extends LitElement {
34
35
  }
35
36
  _onValueChanged(value) {
36
37
  this.buttons.forEach(button => {
37
- if (value === button.getAttribute('data-value')) {
38
+ if (value === button.getAttribute('value')) {
38
39
  button.setAttribute('active', '');
39
40
  }
40
41
  else {
@@ -44,7 +45,7 @@ let PropertyButtonsRadio = class PropertyButtonsRadio extends LitElement {
44
45
  }
45
46
  _onTapButton(e) {
46
47
  var target = e.target;
47
- while (!target.hasAttribute('data-value') && target !== this) {
48
+ while (!target.hasAttribute('value') && target !== this) {
48
49
  target = target.parentElement;
49
50
  }
50
51
  if (target === this) {
@@ -53,7 +54,7 @@ let PropertyButtonsRadio = class PropertyButtonsRadio extends LitElement {
53
54
  var old = this.value;
54
55
  if (!this.mandatory) {
55
56
  if (!target.getAttribute('active')) {
56
- this.value = target.getAttribute('data-value');
57
+ this.value = target.getAttribute('value');
57
58
  target.setAttribute('active', '');
58
59
  }
59
60
  else {
@@ -62,13 +63,16 @@ let PropertyButtonsRadio = class PropertyButtonsRadio extends LitElement {
62
63
  }
63
64
  }
64
65
  else {
65
- this.value = target.getAttribute('data-value');
66
+ this.value = target.getAttribute('value');
66
67
  target.setAttribute('active', '');
67
68
  }
68
69
  if (old !== this.value) {
69
70
  this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
70
71
  }
71
72
  }
73
+ appendFormData({ formData }) {
74
+ this.name && formData.append(this.name, JSON.stringify(this.value));
75
+ }
72
76
  };
73
77
  PropertyButtonsRadio.styles = [
74
78
  css `
@@ -1 +1 @@
1
- {"version":3,"file":"ox-buttons-radio.js","sourceRoot":"","sources":["../../src/ox-buttons-radio.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;;;;;;;;EAUE;AAEF,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,UAAU;IAApD;;QASE;;WAEG;Q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AC,CAAA;gBAC9C,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;aAClC;iBAAM;gBACL,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;gBACjB,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;aACjC;SACF;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,CAAA;YAC9C,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;SAClC;QAED,IAAI,GAAG,KAAK,IAAI,CAAC,KAAK,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;SACjF;IACH,CAAC;CACF,CAAA;AAlEQ,2BAAM,GAAG;IACd,GAAG,CAAA;;;;KAIF;CACF,CAAA;AAK2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAA4B;AAC1B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAoB;AAbrC,oBAAoB;IADhC,aAAa,CAAC,kBAAkB,CAAC;GACrB,oBAAoB,CAmEhC;SAnEY,oBAAoB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n/**\n여러 버튼 중에서 하나만 눌리거나, 모두 눌리지 않은 상태만을 갖는 라디오 형태의 버튼이다.\n\nExample:\n\n <ox-buttons-radio @change=${e => this._onChange(e)} value=${value}>\n <div data-value=\"top\"></div>\n <div data-value=\"middle\"></div>\n <div data-value=\"bottom\"></div>\n </ox-buttons-radio>\n*/\n@customElement('ox-buttons-radio')\nexport class PropertyButtonsRadio extends LitElement {\n static styles = [\n css`\n :host {\n display: inline-block;\n }\n `\n ]\n\n /**\n * `value`는 버튼의 눌린 상태를 값으로 갖는 속성이다.\n */\n @property({ type: Object }) value: Object | null = null\n @property({ type: Boolean }) mandatory!: boolean\n\n render() {\n return html` <slot @click=${(e: Event) => this._onTapButton(e)}></slot> `\n }\n\n updated(changes: PropertyValues<this>) {\n changes.has('value') && this._onValueChanged(this.value)\n }\n\n get buttons() {\n return Array.from(this.querySelectorAll('*'))\n }\n\n _onValueChanged(value: Object | null) {\n this.buttons.forEach(button => {\n if (value === button.getAttribute('data-value')) {\n button.setAttribute('active', '')\n } else {\n button.removeAttribute('active')\n }\n })\n }\n\n _onTapButton(e: Event) {\n var target = e.target as HTMLElement\n\n while (!target.hasAttribute('data-value') && target !== this) {\n target = target.parentElement!\n }\n\n if (target === this) {\n return\n }\n\n var old = this.value\n\n if (!this.mandatory) {\n if (!target.getAttribute('active')) {\n this.value = target.getAttribute('data-value')\n target.setAttribute('active', '')\n } else {\n this.value = null\n target.removeAttribute('active')\n }\n } else {\n this.value = target.getAttribute('data-value')\n target.setAttribute('active', '')\n }\n\n if (old !== this.value) {\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ox-buttons-radio.js","sourceRoot":"","sources":["../../src/ox-buttons-radio.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAA8B,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C;;;;;;;;;;EAUE;AAEF,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,WAAW;IAArD;;QASE;;WAEG;QACyB,UAAK,GAAkB,IAAI,CAAA;IA2DzD,CAAC;IAxDC,MAAM;QACJ,OAAO,IAAI,CAAA,iBAAiB,CAAC,CAAQ,EAAE,EAAE,CA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AI,CAAA;gBACjB,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;aACjC;SACF;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;YACzC,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;SAClC;QAED,IAAI,GAAG,KAAK,IAAI,CAAC,KAAK,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;SACjF;IACH,CAAC;IAES,cAAc,CAAC,EAAE,QAAQ,EAAiB;QAClD,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IACrE,CAAC;CACF,CAAA;AAtEQ,2BAAM,GAAG;IACd,GAAG,CAAA;;;;KAIF;CACF,CAAA;AAK2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAA4B;AAC1B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAoB;AAbrC,oBAAoB;IADhC,aAAa,CAAC,kBAAkB,CAAC;GACrB,oBAAoB,CAuEhC;SAvEY,oBAAoB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { LitElement, PropertyValues, css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-formfield'\n\n/**\n여러 버튼 중에서 하나만 눌리거나, 모두 눌리지 않은 상태만을 갖는 라디오 형태의 버튼이다.\n\nExample:\n\n <ox-buttons-radio @change=${e => this._onChange(e)} value=${value}>\n <div value=\"top\"></div>\n <div value=\"middle\"></div>\n <div value=\"bottom\"></div>\n </ox-buttons-radio>\n*/\n@customElement('ox-buttons-radio')\nexport class PropertyButtonsRadio extends OxFormField {\n static styles = [\n css`\n :host {\n display: inline-block;\n }\n `\n ]\n\n /**\n * `value`는 버튼의 눌린 상태를 값으로 갖는 속성이다.\n */\n @property({ type: Object }) value: Object | null = null\n @property({ type: Boolean }) mandatory!: boolean\n\n render() {\n return html` <slot @click=${(e: Event) => this._onTapButton(e)}></slot> `\n }\n\n updated(changes: PropertyValues<this>) {\n changes.has('value') && this._onValueChanged(this.value)\n }\n\n get buttons() {\n return Array.from(this.querySelectorAll('*'))\n }\n\n _onValueChanged(value: Object | null) {\n this.buttons.forEach(button => {\n if (value === button.getAttribute('value')) {\n button.setAttribute('active', '')\n } else {\n button.removeAttribute('active')\n }\n })\n }\n\n _onTapButton(e: Event) {\n var target = e.target as HTMLElement\n\n while (!target.hasAttribute('value') && target !== this) {\n target = target.parentElement!\n }\n\n if (target === this) {\n return\n }\n\n var old = this.value\n\n if (!this.mandatory) {\n if (!target.getAttribute('active')) {\n this.value = target.getAttribute('value')\n target.setAttribute('active', '')\n } else {\n this.value = null\n target.removeAttribute('active')\n }\n } else {\n this.value = target.getAttribute('value')\n target.setAttribute('active', '')\n }\n\n if (old !== this.value) {\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n this.name && formData.append(this.name, JSON.stringify(this.value))\n }\n}\n"]}
@@ -1,16 +1,15 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import { LitElement } from 'lit';
5
- export declare class OxCheckbox extends LitElement {
1
+ import { OxFormField } from './ox-formfield';
2
+ export declare class OxCheckbox extends OxFormField {
6
3
  static styles: import("lit").CSSResult[];
7
4
  checked: boolean;
8
5
  disabled: boolean;
9
- name: string;
6
+ name?: string;
10
7
  _hasInner: boolean;
11
8
  render(): import("lit-html").TemplateResult<1>;
9
+ connectedCallback(): void;
12
10
  onClick(): void;
13
11
  get checkedIcon(): import("lit-html").TemplateResult<1>;
14
12
  get uncheckedIcon(): import("lit-html").TemplateResult<1>;
15
13
  onKeyDown(e: KeyboardEvent): void;
14
+ protected appendFormData({ formData }: FormDataEvent): void;
16
15
  }