@operato/input 8.0.0-alpha.4 → 8.0.0-alpha.41

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 (39) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/dist/src/ox-input-color-stops.d.ts +1 -1
  3. package/dist/src/ox-input-color-stops.js +2 -2
  4. package/dist/src/ox-input-color-stops.js.map +1 -1
  5. package/dist/src/ox-input-direction.d.ts +1 -0
  6. package/dist/src/ox-input-direction.js +37 -4
  7. package/dist/src/ox-input-direction.js.map +1 -1
  8. package/dist/src/ox-input-signature.d.ts +4 -2
  9. package/dist/src/ox-input-signature.js +34 -14
  10. package/dist/src/ox-input-signature.js.map +1 -1
  11. package/dist/src/ox-select-floor.d.ts +35 -0
  12. package/dist/src/ox-select-floor.js +238 -0
  13. package/dist/src/ox-select-floor.js.map +1 -0
  14. package/dist/stories/image-for-select-floor.d.ts +1 -0
  15. package/dist/stories/image-for-select-floor.js +2 -0
  16. package/dist/stories/image-for-select-floor.js.map +1 -0
  17. package/dist/stories/ox-input-direction.stories.js +11 -0
  18. package/dist/stories/ox-input-direction.stories.js.map +1 -1
  19. package/dist/stories/ox-select-floor.stories.d.ts +45 -0
  20. package/dist/stories/ox-select-floor.stories.js +166 -0
  21. package/dist/stories/ox-select-floor.stories.js.map +1 -0
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +19 -15
  24. package/src/ox-input-color-stops.ts +2 -2
  25. package/src/ox-input-direction.ts +31 -4
  26. package/src/ox-input-signature.ts +45 -17
  27. package/src/ox-select-floor.ts +246 -0
  28. package/stories/image-for-select-floor.ts +2 -0
  29. package/stories/ox-input-direction.stories.ts +11 -0
  30. package/stories/ox-select-floor.stories.ts +197 -0
  31. package/themes/calendar-theme.css +3 -1
  32. package/assets/images/icon-editor-gradient-direction.png +0 -0
  33. package/assets/images/icon-properties-label.png +0 -0
  34. package/assets/images/icon-properties-line-type.png +0 -0
  35. package/assets/images/icon-properties-table.png +0 -0
  36. package/dist/src/ox-zoomable-image.d.ts +0 -17
  37. package/dist/src/ox-zoomable-image.js +0 -80
  38. package/dist/src/ox-zoomable-image.js.map +0 -1
  39. package/src/ox-zoomable-image.ts +0 -75
package/CHANGELOG.md CHANGED
@@ -3,6 +3,113 @@
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
+ ## [8.0.0-alpha.41](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.40...v8.0.0-alpha.41) (2024-10-21)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * add inbound property for ox-input-direction ([c1e8b99](https://github.com/hatiolab/operato/commit/c1e8b99bccb179b883a04c2463391865055116bc))
12
+
13
+
14
+
15
+ ## [8.0.0-alpha.37](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.36...v8.0.0-alpha.37) (2024-10-20)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * update dev-dependencies version ([d6fe342](https://github.com/hatiolab/operato/commit/d6fe342de738c6bad3528550a862b5a1d2573161))
21
+
22
+
23
+
24
+ ## [8.0.0-alpha.34](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.33...v8.0.0-alpha.34) (2024-10-15)
25
+
26
+
27
+ ### :bug: Bug Fix
28
+
29
+ * select-floor 층 간격 속성 추가 ([cba8523](https://github.com/hatiolab/operato/commit/cba85236422485dcb96f6c2d907adb4d4c2dc6e7))
30
+
31
+
32
+
33
+ ## [8.0.0-alpha.33](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.32...v8.0.0-alpha.33) (2024-10-14)
34
+
35
+ **Note:** Version bump only for package @operato/input
36
+
37
+
38
+
39
+
40
+
41
+ ## [8.0.0-alpha.30](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.29...v8.0.0-alpha.30) (2024-10-11)
42
+
43
+
44
+ ### :bug: Bug Fix
45
+
46
+ * ox-select-floor event handling for toggling active card ([c1b2662](https://github.com/hatiolab/operato/commit/c1b2662a0923df506eae7c3cf4ed5baa3e4c0dc3))
47
+
48
+
49
+
50
+ ## [8.0.0-alpha.29](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.28...v8.0.0-alpha.29) (2024-10-10)
51
+
52
+
53
+ ### :bug: Bug Fix
54
+
55
+ * apply pointer-event ([ecc73a1](https://github.com/hatiolab/operato/commit/ecc73a1d2df0d8ce7ba462965062a91461c504c3))
56
+
57
+
58
+
59
+ ## [8.0.0-alpha.27](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.26...v8.0.0-alpha.27) (2024-10-06)
60
+
61
+
62
+ ### :bug: Bug Fix
63
+
64
+ * calendar css variables ([9ea1918](https://github.com/hatiolab/operato/commit/9ea191844c72de5f920a8da85ad50209ba77cc07))
65
+
66
+
67
+
68
+ ## [8.0.0-alpha.26](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.25...v8.0.0-alpha.26) (2024-10-06)
69
+
70
+
71
+ ### :bug: Bug Fix
72
+
73
+ * ox-input-signature ([dfd4e67](https://github.com/hatiolab/operato/commit/dfd4e67c213b33c78f6ef380fcc5e8642356e76c))
74
+
75
+
76
+
77
+ ## [8.0.0-alpha.21](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.20...v8.0.0-alpha.21) (2024-10-05)
78
+
79
+
80
+ ### :bug: Bug Fix
81
+
82
+ * support touch gesture for ox-select-floor ([217b1b6](https://github.com/hatiolab/operato/commit/217b1b6bf6415a893a9bb08524b546ec7a8fdca4))
83
+
84
+
85
+
86
+ ## [8.0.0-alpha.20](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.19...v8.0.0-alpha.20) (2024-10-04)
87
+
88
+
89
+ ### :rocket: New Features
90
+
91
+ * ox-select-floor input component ([ad71891](https://github.com/hatiolab/operato/commit/ad718914cd44d16abc62109bfd17594dce43b349))
92
+
93
+
94
+
95
+ ## [8.0.0-alpha.19](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.18...v8.0.0-alpha.19) (2024-10-04)
96
+
97
+
98
+ ### :rocket: New Features
99
+
100
+ * ox-select-floor input component ([3d5c53e](https://github.com/hatiolab/operato/commit/3d5c53e8ecac718b3713fc244c36739c977f5dcf))
101
+
102
+
103
+
104
+ ## [8.0.0-alpha.10](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.9...v8.0.0-alpha.10) (2024-09-18)
105
+
106
+
107
+ ### :bug: Bug Fix
108
+
109
+ * remove unused files ([7c84a82](https://github.com/hatiolab/operato/commit/7c84a82e62897f0844423f6e2cb27d8f4ef0942f))
110
+
111
+
112
+
6
113
  ## [8.0.0-alpha.4](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.3...v8.0.0-alpha.4) (2024-09-07)
7
114
 
8
115
 
@@ -60,7 +60,7 @@ export declare class OxInputColorStops extends OxFormField {
60
60
  _onChangeSubComponent(e: Event): void;
61
61
  _onDblClickColorbar(e: MouseEvent): void;
62
62
  _onDblClickMarkers(e: MouseEvent): void;
63
- _onMouseDown(e: MouseEvent): void;
63
+ _onPointerDown(e: PointerEvent): void;
64
64
  private dragstart;
65
65
  _onDragStart(e: DragEvent): void;
66
66
  _throttled(delay: number, fn: (...args: any[]) => any): (...args: any[]) => any;
@@ -182,7 +182,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
182
182
  <div
183
183
  id="markers"
184
184
  @dblclick=${(e) => this._onDblClickMarkers(e)}
185
- @mousedown=${(e) => this._onMouseDown(e)}
185
+ @pointerdown=${(e) => this._onPointerDown(e)}
186
186
  @dragstart=${(e) => this._onDragStart(e)}
187
187
  @drag=${this._throttled(100, this._onDrag.bind(this))}
188
188
  @dragend=${(e) => this._onDragEnd(e)}
@@ -360,7 +360,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
360
360
  }
361
361
  this.colorEditor.showPicker();
362
362
  }
363
- _onMouseDown(e) {
363
+ _onPointerDown(e) {
364
364
  if (this.disabled) {
365
365
  return;
366
366
  }
@@ -1 +1 @@
1
- {"version":3,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AC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIhB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDAAoB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAa;AAEpB;IAAnB,KAAK,CAAC,WAAW,CAAC;mDAAuB;AAClB;IAAvB,KAAK,CAAC,eAAe,CAAC;sDAA2B;AAvHvC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAye7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-color'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\nimport { OxInputColor } from './ox-input-color'\nimport deepEquals from 'lodash-es/isEqual'\n\nexport type ColorStop = {\n color: string\n position: number\n}\n\n/**\n범위내에서 여러 컬러셋(포지션과 색깔) 배열을 편집하는 컴포넌트이다.\n\n미리보기 Bar에서는 gradient나, solid 형태의 컬러셋을 보여준다.\n\n새로운 컬러셋을 추가고자 할 때는 미리보기 Bar를 더블클릭한다.\n컬러셋을 제거하고자 할 때는 컬러셋 마커를 아래방향으로 드래깅한다.\n컬러셋의 위치를 옮기고자 할 때는, 컬러셋 마커를 좌우로 드래깅하여 이동시키거나,\n옮기고자하는 컬러셋 마커를 마우스로 선택하고, 포지션 입력 에디터에서 직접 수정한다.\n컬러셋의 색상을 바꾸고자 할 때는, 컬러셋 마커를 더블클릭하여 컬러파레트를 팝업시켜서 색상을 선택하거나, 색상 입력 에디터에서 직접 색상을 수정할 수 있다.\n\nExample:\n\n <ox-input-color-stops type=\"gradient\" .value=${gradient.colorStops}>\n </ox-input-color-stops>\n*/\n@customElement('ox-input-color-stops')\nexport class OxInputColorStops extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 0;\n grid-auto-rows: minmax(0, auto);\n }\n\n #color-stops {\n grid-column: 1 / 11;\n grid-row: 1;\n\n clear: both;\n margin-bottom: -3px;\n }\n\n #colorbar {\n width: 95%;\n height: 12px;\n margin: auto;\n margin-bottom: 25px;\n border: 1px solid #ccc;\n }\n\n #markers {\n position: relative;\n top: 30px;\n }\n\n #markers div {\n width: 10px;\n height: 10px;\n margin-top: -15px;\n position: absolute;\n border: 2px solid #fff;\n cursor: pointer;\n -webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n }\n\n #markers div::before {\n border-bottom: 6px solid #fff;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n content: '';\n width: 0;\n height: 0;\n left: -2px;\n position: absolute;\n top: -8px;\n }\n\n #markers div[focused] {\n border-color: var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n #markers div[focused]:before {\n border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n .icon-only-label {\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n width: 30px;\n height: 24px;\n }\n\n .icon-only-label.color {\n grid-column: 1 / 2;\n grid-row: 2;\n\n background-position: 70% -498px;\n float: left;\n margin-top: 0;\n }\n\n .icon-only-label.position {\n grid-column: 7 / 8;\n grid-row: 2;\n\n background-position: 70% -797px;\n float: left;\n margin-top: 0;\n }\n\n ox-input-color {\n grid-column: 2 / 7;\n grid-row: 2;\n }\n\n input[type='number'] {\n grid-column: 8 / 11;\n grid-row: 2;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n\n /**\n * `type`은 color-stop bar의 표시 방법을 의미한다.\n * - 'solid' : 컬러스톱위치에서 다음 컬러스톱까지 solid color로 채운다.\n * - 'gradient' : 컬러스톱위치에서 다음 컬러스톱까지 gradient color로 채운다.\n */\n @property({ type: String }) type: 'solid' | 'gradient' = 'solid'\n /**\n * `min`은 color-stop bar의 위치값 범위의 최소값을 의미한다.\n */\n @property({ type: Number }) min: number = 0\n /**\n * `max`은 color-stop bar의 위치값 범위의 최대값을 의미한다.\n */\n @property({ type: Number }) max: number = 1\n /**\n * `value`은 color-stops에 의해 만들어진 color-stop 배열을 유지한다.\n */\n @property({ type: Array }) value?: ColorStop[]\n @property({ type: Object }) focused: any\n\n @query('#colorbar') colorbar!: HTMLElement\n @query('#color-editor') colorEditor!: OxInputColor\n\n private _dragImage?: HTMLImageElement\n\n connectedCallback() {\n super.connectedCallback()\n\n this._dragImage = new Image()\n this._dragImage.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n\n firstUpdated() {\n window.addEventListener('resize', () => {\n this.requestUpdate()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n var needRerenderColorBar = false\n\n if (changes.has('value') && this.value instanceof Array) {\n var oldValue = changes.get('value')\n if (\n this.focused &&\n (!oldValue ||\n this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)\n ) {\n /* 이전 값이 없었던 경우에 focused를 클리어시킨다.\n * 이전 값이 있던 경우에도, focused는 이 에디터 내부에서만 선택될 수 있으며, 수정될 수 있으므로 동일한 포지션을 갖는 value가 없으면, 새로운 에디터가 시작된 것으로 판단하여 focused를 클리어시킨다.\n */\n this.focused = null\n }\n\n if (!deepEquals(oldValue, this.value)) {\n needRerenderColorBar = true\n }\n }\n\n if (needRerenderColorBar || changes.has('min') || changes.has('max')) {\n if (!this.value) {\n this.value = [\n { color: 'white', position: this.min },\n { color: 'white', position: this.max }\n ]\n }\n\n this._renderColorBar(this.min, this.max, this.type)\n this.requestUpdate()\n }\n }\n\n render() {\n return html`\n <div id=\"color-stops\">\n <div id=\"colorbar\" @dblclick=${(e: MouseEvent) => this._onDblClickColorbar(e)}>\n <div\n id=\"markers\"\n @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}\n @mousedown=${(e: MouseEvent) => this._onMouseDown(e)}\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n >\n ${this._refinedValue(this.value).map(\n (item, index) => html`\n <div\n .style=\"background-color:${item.color};margin-left:${this._calculatePosition(\n item.position,\n this.min,\n this.max\n )}px;\"\n marker-index=${index}\n draggable=\"true\"\n ></div>\n `\n )}\n </div>\n </div>\n </div>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-color\n id=\"color-editor\"\n .value=${this.focused && this.focused.color}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n ?disabled=${this.disabled}\n >\n </ox-input-color>\n\n <label class=\"icon-only-label position\"></label>\n <input\n type=\"number\"\n id=\"color-position\"\n .value=${this.focused && this.focused.position}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n step=\"0.01\"\n ?disabled=${this.disabled}\n />\n `\n }\n\n _refinedValue(value: any) {\n return value instanceof Array ? value : []\n }\n\n _setFocused(index: number) {\n if (this.focused && this.focused.index === index) {\n return\n }\n\n var marker = this.renderRoot.querySelector(`#markers div[marker-index='${index}']`) as HTMLElement\n var olds = this.renderRoot.querySelectorAll('#markers div[focused]')\n olds.length > 0 && olds.forEach(old => old.removeAttribute('focused'))\n marker && marker.setAttribute('focused', '')\n\n if (!marker) {\n this.focused = null\n return\n }\n\n var colorStop = this.value![index]\n\n this._changeFocused({\n index: index,\n color: colorStop.color,\n position: Math.max(this.min, Math.min(colorStop.position, this.max))\n })\n }\n\n _changeFocused(focused: any) {\n if (!focused) {\n this._setFocused(-1) // clear focused marker\n\n return\n }\n\n this.focused = focused\n\n this.value = this.value!.map((colorStop, index): ColorStop => {\n if (index != focused.index) {\n return colorStop\n }\n\n return {\n color: focused.color,\n position: focused.position\n }\n }).sort((a: ColorStop, b: ColorStop) => {\n return b.position < a.position ? 1 : -1\n })\n\n var colorStop = this.value[focused.index]\n\n if (focused.position != colorStop.position || focused.color != colorStop.color) {\n var index = -1\n for (var i = 0; i < this.value.length; i++) {\n colorStop = this.value[i]\n if (focused.position == colorStop.position && focused.color == colorStop.color) {\n index = i\n break\n }\n }\n\n this._setFocused(index)\n }\n }\n\n _renderColorBar(min: number, max: number, type: 'solid' | 'gradient') {\n var value = this._refinedValue(this.value)\n var gradient = ''\n\n if (value instanceof Array && value.length > 0) {\n if (this.type == 'gradient') {\n var stopsStrings = (value || []).map(function (stop) {\n var position = (stop.position - min) / (max - min)\n return `${stop.color} ${position * 100}%`\n })\n } else {\n var stops = value || []\n var last: ColorStop | undefined\n var last_position = 0\n var stopsStrings = stops.map(function (stop) {\n var stop_position = (stop.position - min) / (max - min)\n if (last) {\n last_position = (last.position - min) / (max - min)\n var step = `${stop.color} ${last_position * 100}%, ${stop.color} ${stop_position * 100}%`\n } else {\n var step = `${stop.color} ${stop_position * 100}%`\n }\n last = stop\n return step\n })\n if (last) {\n last_position = (last.position - min) / (max - min)\n stopsStrings.push(`${last.color} ${last_position * 100}%, white ${last_position * 100}%, white 100%`)\n }\n }\n\n gradient = stopsStrings.join(',')\n } else {\n gradient = 'black 0%, black 100%'\n }\n\n this.colorbar!.style.background = `linear-gradient(to right, ${gradient})`\n /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n }\n\n _onChangeSubComponent(e: Event) {\n var element = e.target as HTMLInputElement\n var id = element.id\n\n if (!this.focused) {\n return\n }\n\n switch (id) {\n case 'color-editor':\n this._changeFocused({\n ...this.focused,\n color: element.value\n })\n break\n case 'color-position':\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(Number(element.value), this.max))\n })\n break\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickColorbar(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n /* 마커를 클릭한 경우를 걸러낸다. */\n if (e.target !== this.colorbar) return\n\n var width = this.colorbar.offsetWidth\n var position = this.min + (this.max - this.min) * (e.offsetX / width)\n var colorStops = this.value ? this.value.slice() : []\n\n for (var i = 0; i < colorStops.length; i++) {\n if (colorStops[i].position > position) break\n }\n\n colorStops.splice(i, 0, {\n position: position,\n color: '#fff'\n })\n\n this.value = colorStops\n\n this.focused = null\n this._setFocused(i)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickMarkers(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n this.colorEditor.showPicker()\n }\n\n _onMouseDown(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n var marker = e.target as HTMLElement\n var index = marker.getAttribute('marker-index')\n\n this._setFocused(Number(index))\n }\n\n private dragstart: { position: number; x: number; y: number } = { position: 0, x: 0, y: 0 }\n\n _onDragStart(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n /* drag 시에 ghost image를 보이지 않게 하려고 함 */\n e.dataTransfer?.setDragImage(this._dragImage!, 0, 0)\n\n this.dragstart = {\n position: this.focused.position,\n x: e.clientX,\n y: e.clientY\n }\n }\n\n // TODO onDrag 이벤트가 계속 발생하므로 처리하는 성능 저하됨. 그래서 throttling 하도록 함\n _throttled(delay: number, fn: (...args: any[]) => any) {\n let lastCall = 0\n return function (...args: any[]) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDrag(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientX <= 0) {\n return\n }\n\n var width = this.colorbar.offsetWidth\n var position = this.dragstart.position + ((e.clientX - this.dragstart.x) / width) * (this.max - this.min)\n\n if (position != this.focused.position) {\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(position, this.max))\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _onDragEnd(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientY - this.dragstart.y > 40) {\n this.value!.splice(this.focused.index, 1)\n this.value = this.value!.slice()\n\n this._setFocused(-1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _calculatePosition(position: number, min: number, max: number) {\n /* TODO 7 ==> 마커 폭의 절반으로 계산해야함. */\n var calculated = position\n\n if (calculated > this.max) calculated = this.max\n else if (calculated < this.min) calculated = this.min\n\n var width = (this.colorbar && this.colorbar.offsetWidth) || 0\n\n return ((calculated - this.min) / (this.max - this.min)) * width - 7\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-color-stops.js","sourceRoot":"","sources":["../../src/ox-input-color-stops.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,UAAU,MAAM,mBAAmB,CAAA;AAO1C;;;;;;;;;;;;;;;EAeE;AAEK,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,WAAW;IAA3C;;QAkGL;;;;WAIG;QACyB,SAAI,GAAyB,OAAO,CAAA;QAChE;;WAEG;QACyB,QAAG,GAAW,CAAC,CAAA;QAC3C;;WAEG;QACyB,QAAG,GAAW,CAAC,CAAA;QAiSnC,cAAS,GAA+C,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;IAyF7F,CAAC;aAxeQ,WAAM,GAAG,GAA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AC,CAAA;IACtE,CAAC;IAES,cAAc,CAAC,EAAE,QAAQ,EAAiB;QAClD,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAEtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAExB,QAAQ,CAAC,MAAM,CACb,IAAI,CAAC,IAAK,EACV,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACvG,CAAA;IACH,CAAC;;AAjY2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAqC;AAIpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIhB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDAAoB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAa;AAEpB;IAAnB,KAAK,CAAC,WAAW,CAAC;mDAAuB;AAClB;IAAvB,KAAK,CAAC,eAAe,CAAC;sDAA2B;AAvHvC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAye7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-color'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\nimport { OxInputColor } from './ox-input-color'\nimport deepEquals from 'lodash-es/isEqual'\n\nexport type ColorStop = {\n color: string\n position: number\n}\n\n/**\n범위내에서 여러 컬러셋(포지션과 색깔) 배열을 편집하는 컴포넌트이다.\n\n미리보기 Bar에서는 gradient나, solid 형태의 컬러셋을 보여준다.\n\n새로운 컬러셋을 추가고자 할 때는 미리보기 Bar를 더블클릭한다.\n컬러셋을 제거하고자 할 때는 컬러셋 마커를 아래방향으로 드래깅한다.\n컬러셋의 위치를 옮기고자 할 때는, 컬러셋 마커를 좌우로 드래깅하여 이동시키거나,\n옮기고자하는 컬러셋 마커를 마우스로 선택하고, 포지션 입력 에디터에서 직접 수정한다.\n컬러셋의 색상을 바꾸고자 할 때는, 컬러셋 마커를 더블클릭하여 컬러파레트를 팝업시켜서 색상을 선택하거나, 색상 입력 에디터에서 직접 색상을 수정할 수 있다.\n\nExample:\n\n <ox-input-color-stops type=\"gradient\" .value=${gradient.colorStops}>\n </ox-input-color-stops>\n*/\n@customElement('ox-input-color-stops')\nexport class OxInputColorStops extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 0;\n grid-auto-rows: minmax(0, auto);\n }\n\n #color-stops {\n grid-column: 1 / 11;\n grid-row: 1;\n\n clear: both;\n margin-bottom: -3px;\n }\n\n #colorbar {\n width: 95%;\n height: 12px;\n margin: auto;\n margin-bottom: 25px;\n border: 1px solid #ccc;\n }\n\n #markers {\n position: relative;\n top: 30px;\n }\n\n #markers div {\n width: 10px;\n height: 10px;\n margin-top: -15px;\n position: absolute;\n border: 2px solid #fff;\n cursor: pointer;\n -webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n }\n\n #markers div::before {\n border-bottom: 6px solid #fff;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n content: '';\n width: 0;\n height: 0;\n left: -2px;\n position: absolute;\n top: -8px;\n }\n\n #markers div[focused] {\n border-color: var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n #markers div[focused]:before {\n border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n .icon-only-label {\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n width: 30px;\n height: 24px;\n }\n\n .icon-only-label.color {\n grid-column: 1 / 2;\n grid-row: 2;\n\n background-position: 70% -498px;\n float: left;\n margin-top: 0;\n }\n\n .icon-only-label.position {\n grid-column: 7 / 8;\n grid-row: 2;\n\n background-position: 70% -797px;\n float: left;\n margin-top: 0;\n }\n\n ox-input-color {\n grid-column: 2 / 7;\n grid-row: 2;\n }\n\n input[type='number'] {\n grid-column: 8 / 11;\n grid-row: 2;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n\n /**\n * `type`은 color-stop bar의 표시 방법을 의미한다.\n * - 'solid' : 컬러스톱위치에서 다음 컬러스톱까지 solid color로 채운다.\n * - 'gradient' : 컬러스톱위치에서 다음 컬러스톱까지 gradient color로 채운다.\n */\n @property({ type: String }) type: 'solid' | 'gradient' = 'solid'\n /**\n * `min`은 color-stop bar의 위치값 범위의 최소값을 의미한다.\n */\n @property({ type: Number }) min: number = 0\n /**\n * `max`은 color-stop bar의 위치값 범위의 최대값을 의미한다.\n */\n @property({ type: Number }) max: number = 1\n /**\n * `value`은 color-stops에 의해 만들어진 color-stop 배열을 유지한다.\n */\n @property({ type: Array }) value?: ColorStop[]\n @property({ type: Object }) focused: any\n\n @query('#colorbar') colorbar!: HTMLElement\n @query('#color-editor') colorEditor!: OxInputColor\n\n private _dragImage?: HTMLImageElement\n\n connectedCallback() {\n super.connectedCallback()\n\n this._dragImage = new Image()\n this._dragImage.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n\n firstUpdated() {\n window.addEventListener('resize', () => {\n this.requestUpdate()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n var needRerenderColorBar = false\n\n if (changes.has('value') && this.value instanceof Array) {\n var oldValue = changes.get('value')\n if (\n this.focused &&\n (!oldValue ||\n this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)\n ) {\n /* 이전 값이 없었던 경우에 focused를 클리어시킨다.\n * 이전 값이 있던 경우에도, focused는 이 에디터 내부에서만 선택될 수 있으며, 수정될 수 있으므로 동일한 포지션을 갖는 value가 없으면, 새로운 에디터가 시작된 것으로 판단하여 focused를 클리어시킨다.\n */\n this.focused = null\n }\n\n if (!deepEquals(oldValue, this.value)) {\n needRerenderColorBar = true\n }\n }\n\n if (needRerenderColorBar || changes.has('min') || changes.has('max')) {\n if (!this.value) {\n this.value = [\n { color: 'white', position: this.min },\n { color: 'white', position: this.max }\n ]\n }\n\n this._renderColorBar(this.min, this.max, this.type)\n this.requestUpdate()\n }\n }\n\n render() {\n return html`\n <div id=\"color-stops\">\n <div id=\"colorbar\" @dblclick=${(e: MouseEvent) => this._onDblClickColorbar(e)}>\n <div\n id=\"markers\"\n @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}\n @pointerdown=${(e: PointerEvent) => this._onPointerDown(e)}\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n >\n ${this._refinedValue(this.value).map(\n (item, index) => html`\n <div\n .style=\"background-color:${item.color};margin-left:${this._calculatePosition(\n item.position,\n this.min,\n this.max\n )}px;\"\n marker-index=${index}\n draggable=\"true\"\n ></div>\n `\n )}\n </div>\n </div>\n </div>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-color\n id=\"color-editor\"\n .value=${this.focused && this.focused.color}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n ?disabled=${this.disabled}\n >\n </ox-input-color>\n\n <label class=\"icon-only-label position\"></label>\n <input\n type=\"number\"\n id=\"color-position\"\n .value=${this.focused && this.focused.position}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n step=\"0.01\"\n ?disabled=${this.disabled}\n />\n `\n }\n\n _refinedValue(value: any) {\n return value instanceof Array ? value : []\n }\n\n _setFocused(index: number) {\n if (this.focused && this.focused.index === index) {\n return\n }\n\n var marker = this.renderRoot.querySelector(`#markers div[marker-index='${index}']`) as HTMLElement\n var olds = this.renderRoot.querySelectorAll('#markers div[focused]')\n olds.length > 0 && olds.forEach(old => old.removeAttribute('focused'))\n marker && marker.setAttribute('focused', '')\n\n if (!marker) {\n this.focused = null\n return\n }\n\n var colorStop = this.value![index]\n\n this._changeFocused({\n index: index,\n color: colorStop.color,\n position: Math.max(this.min, Math.min(colorStop.position, this.max))\n })\n }\n\n _changeFocused(focused: any) {\n if (!focused) {\n this._setFocused(-1) // clear focused marker\n\n return\n }\n\n this.focused = focused\n\n this.value = this.value!.map((colorStop, index): ColorStop => {\n if (index != focused.index) {\n return colorStop\n }\n\n return {\n color: focused.color,\n position: focused.position\n }\n }).sort((a: ColorStop, b: ColorStop) => {\n return b.position < a.position ? 1 : -1\n })\n\n var colorStop = this.value[focused.index]\n\n if (focused.position != colorStop.position || focused.color != colorStop.color) {\n var index = -1\n for (var i = 0; i < this.value.length; i++) {\n colorStop = this.value[i]\n if (focused.position == colorStop.position && focused.color == colorStop.color) {\n index = i\n break\n }\n }\n\n this._setFocused(index)\n }\n }\n\n _renderColorBar(min: number, max: number, type: 'solid' | 'gradient') {\n var value = this._refinedValue(this.value)\n var gradient = ''\n\n if (value instanceof Array && value.length > 0) {\n if (this.type == 'gradient') {\n var stopsStrings = (value || []).map(function (stop) {\n var position = (stop.position - min) / (max - min)\n return `${stop.color} ${position * 100}%`\n })\n } else {\n var stops = value || []\n var last: ColorStop | undefined\n var last_position = 0\n var stopsStrings = stops.map(function (stop) {\n var stop_position = (stop.position - min) / (max - min)\n if (last) {\n last_position = (last.position - min) / (max - min)\n var step = `${stop.color} ${last_position * 100}%, ${stop.color} ${stop_position * 100}%`\n } else {\n var step = `${stop.color} ${stop_position * 100}%`\n }\n last = stop\n return step\n })\n if (last) {\n last_position = (last.position - min) / (max - min)\n stopsStrings.push(`${last.color} ${last_position * 100}%, white ${last_position * 100}%, white 100%`)\n }\n }\n\n gradient = stopsStrings.join(',')\n } else {\n gradient = 'black 0%, black 100%'\n }\n\n this.colorbar!.style.background = `linear-gradient(to right, ${gradient})`\n /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n }\n\n _onChangeSubComponent(e: Event) {\n var element = e.target as HTMLInputElement\n var id = element.id\n\n if (!this.focused) {\n return\n }\n\n switch (id) {\n case 'color-editor':\n this._changeFocused({\n ...this.focused,\n color: element.value\n })\n break\n case 'color-position':\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(Number(element.value), this.max))\n })\n break\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickColorbar(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n /* 마커를 클릭한 경우를 걸러낸다. */\n if (e.target !== this.colorbar) return\n\n var width = this.colorbar.offsetWidth\n var position = this.min + (this.max - this.min) * (e.offsetX / width)\n var colorStops = this.value ? this.value.slice() : []\n\n for (var i = 0; i < colorStops.length; i++) {\n if (colorStops[i].position > position) break\n }\n\n colorStops.splice(i, 0, {\n position: position,\n color: '#fff'\n })\n\n this.value = colorStops\n\n this.focused = null\n this._setFocused(i)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickMarkers(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n this.colorEditor.showPicker()\n }\n\n _onPointerDown(e: PointerEvent) {\n if (this.disabled) {\n return\n }\n\n var marker = e.target as HTMLElement\n var index = marker.getAttribute('marker-index')\n\n this._setFocused(Number(index))\n }\n\n private dragstart: { position: number; x: number; y: number } = { position: 0, x: 0, y: 0 }\n\n _onDragStart(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n /* drag 시에 ghost image를 보이지 않게 하려고 함 */\n e.dataTransfer?.setDragImage(this._dragImage!, 0, 0)\n\n this.dragstart = {\n position: this.focused.position,\n x: e.clientX,\n y: e.clientY\n }\n }\n\n // TODO onDrag 이벤트가 계속 발생하므로 처리하는 성능 저하됨. 그래서 throttling 하도록 함\n _throttled(delay: number, fn: (...args: any[]) => any) {\n let lastCall = 0\n return function (...args: any[]) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDrag(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientX <= 0) {\n return\n }\n\n var width = this.colorbar.offsetWidth\n var position = this.dragstart.position + ((e.clientX - this.dragstart.x) / width) * (this.max - this.min)\n\n if (position != this.focused.position) {\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(position, this.max))\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _onDragEnd(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientY - this.dragstart.y > 40) {\n this.value!.splice(this.focused.index, 1)\n this.value = this.value!.slice()\n\n this._setFocused(-1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _calculatePosition(position: number, min: number, max: number) {\n /* TODO 7 ==> 마커 폭의 절반으로 계산해야함. */\n var calculated = position\n\n if (calculated > this.max) calculated = this.max\n else if (calculated < this.min) calculated = this.min\n\n var width = (this.colorbar && this.colorbar.offsetWidth) || 0\n\n return ((calculated - this.min) / (this.max - this.min)) * width - 7\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
@@ -6,6 +6,7 @@ import { OxFormField } from './ox-form-field';
6
6
  export declare class OxInputDirection extends OxFormField {
7
7
  static styles: import("lit").CSSResult;
8
8
  value?: string;
9
+ inbound?: boolean;
9
10
  render(): import("lit-html").TemplateResult<1>;
10
11
  onClick(e: MouseEvent): void;
11
12
  }
@@ -7,6 +7,10 @@ import { css, html } from 'lit';
7
7
  import { customElement, property } from 'lit/decorators.js';
8
8
  import { OxFormField } from './ox-form-field';
9
9
  let OxInputDirection = class OxInputDirection extends OxFormField {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.inbound = false;
13
+ }
10
14
  static { this.styles = css `
11
15
  :host {
12
16
  --md-icon-size: 1.4em;
@@ -27,15 +31,41 @@ let OxInputDirection = class OxInputDirection extends OxFormField {
27
31
  color: var(--md-sys-color-on-primary);
28
32
  background-color: var(--md-sys-color-primary);
29
33
  }
34
+
35
+ /* 아이콘 회전 */
36
+ md-icon[data-value='W'] {
37
+ transform: rotate(-90deg);
38
+ }
39
+
40
+ md-icon[data-value='N'] {
41
+ transform: rotate(0deg);
42
+ }
43
+
44
+ md-icon[data-value='S'] {
45
+ transform: rotate(180deg);
46
+ }
47
+
48
+ md-icon[data-value='E'] {
49
+ transform: rotate(90deg);
50
+ }
30
51
  `; }
31
52
  render() {
32
53
  const value = this.value;
33
54
  return html `
34
55
  <div @click=${this.onClick.bind(this)}>
35
- <md-icon ?selected=${value == 'W'} data-value="W">arrow_back</md-icon>
36
- <md-icon ?selected=${value == 'N'} data-value="N">arrow_upward</md-icon>
37
- <md-icon ?selected=${value == 'S'} data-value="S">arrow_downward</md-icon>
38
- <md-icon ?selected=${value == 'E'} data-value="E">arrow_forward</md-icon>
56
+ ${this.inbound
57
+ ? html `
58
+ <md-icon ?selected=${value == 'W'} data-value="W">step_into</md-icon>
59
+ <md-icon ?selected=${value == 'N'} data-value="N">step_into</md-icon>
60
+ <md-icon ?selected=${value == 'S'} data-value="S">step_into</md-icon>
61
+ <md-icon ?selected=${value == 'E'} data-value="E">step_into</md-icon>
62
+ `
63
+ : html `
64
+ <md-icon ?selected=${value == 'W'} data-value="W">step_out</md-icon>
65
+ <md-icon ?selected=${value == 'N'} data-value="N">step_out</md-icon>
66
+ <md-icon ?selected=${value == 'S'} data-value="S">step_out</md-icon>
67
+ <md-icon ?selected=${value == 'E'} data-value="E">step_out</md-icon>
68
+ `}
39
69
  </div>
40
70
  `;
41
71
  }
@@ -53,6 +83,9 @@ let OxInputDirection = class OxInputDirection extends OxFormField {
53
83
  __decorate([
54
84
  property({ type: String })
55
85
  ], OxInputDirection.prototype, "value", void 0);
86
+ __decorate([
87
+ property({ type: Boolean })
88
+ ], OxInputDirection.prototype, "inbound", void 0);
56
89
  OxInputDirection = __decorate([
57
90
  customElement('ox-input-direction')
58
91
  ], OxInputDirection);
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-direction.js","sourceRoot":"","sources":["../../src/ox-input-direction.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;aACxC,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;GAoBlB,AApBY,CAoBZ;IAID,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAExB,OAAO,IAAI,CAAA;oBACK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;6BACd,KAAK,IAAI,GAAG;6BACZ,KAAK,IAAI,GAAG;6BACZ,KAAK,IAAI,GAAG;6BACZ,KAAK,IAAI,GAAG;;KAEpC,CAAA;IACH,CAAC;IAED,OAAO,CAAC,CAAa;QACnB,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,CAAC,MAAiB,CAAA;QAClC,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAW,CAAA;QAEzD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;QAErD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACtG,CAAC;;AA5B2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAe;AAvB/B,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAoD5B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-direction')\nexport class OxInputDirection extends OxFormField {\n static styles = css`\n :host {\n --md-icon-size: 1.4em;\n }\n\n div {\n display: flex;\n justify-content: space-between;\n max-width: 140px;\n }\n\n md-icon {\n color: var(--md-sys-color-on-background);\n background-color: var(--md-sys-color-background);\n }\n\n md-icon[selected] {\n color: var(--md-sys-color-on-primary);\n background-color: var(--md-sys-color-primary);\n }\n `\n\n @property({ type: String }) value?: string\n\n render() {\n const value = this.value\n\n return html`\n <div @click=${this.onClick.bind(this)}>\n <md-icon ?selected=${value == 'W'} data-value=\"W\">arrow_back</md-icon>\n <md-icon ?selected=${value == 'N'} data-value=\"N\">arrow_upward</md-icon>\n <md-icon ?selected=${value == 'S'} data-value=\"S\">arrow_downward</md-icon>\n <md-icon ?selected=${value == 'E'} data-value=\"E\">arrow_forward</md-icon>\n </div>\n `\n }\n\n onClick(e: MouseEvent) {\n e.stopPropagation()\n\n if (this.disabled) {\n return\n }\n\n const target = e.target as Element\n const value = target.getAttribute('data-value') as string\n\n this.value = this.value === value ? undefined : value\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-direction.js","sourceRoot":"","sources":["../../src/ox-input-direction.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAyCwB,YAAO,GAAa,KAAK,CAAA;IAsCxD,CAAC;aA9EQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqClB,AArCY,CAqCZ;IAKD,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAExB,OAAO,IAAI,CAAA;oBACK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;UACjC,IAAI,CAAC,OAAO;YACZ,CAAC,CAAC,IAAI,CAAA;mCACmB,KAAK,IAAI,GAAG;mCACZ,KAAK,IAAI,GAAG;mCACZ,KAAK,IAAI,GAAG;mCACZ,KAAK,IAAI,GAAG;aAClC;YACH,CAAC,CAAC,IAAI,CAAA;mCACmB,KAAK,IAAI,GAAG;mCACZ,KAAK,IAAI,GAAG;mCACZ,KAAK,IAAI,GAAG;mCACZ,KAAK,IAAI,GAAG;aAClC;;KAER,CAAA;IACH,CAAC;IAED,OAAO,CAAC,CAAa;QACnB,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,CAAC,MAAiB,CAAA;QAClC,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAW,CAAA;QAEzD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;QAErD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACtG,CAAC;;AAtC2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAe;AACb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAA0B;AAzC3C,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA+E5B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-direction')\nexport class OxInputDirection extends OxFormField {\n static styles = css`\n :host {\n --md-icon-size: 1.4em;\n }\n\n div {\n display: flex;\n justify-content: space-between;\n max-width: 140px;\n }\n\n md-icon {\n color: var(--md-sys-color-on-background);\n background-color: var(--md-sys-color-background);\n }\n\n md-icon[selected] {\n color: var(--md-sys-color-on-primary);\n background-color: var(--md-sys-color-primary);\n }\n\n /* 아이콘 회전 */\n md-icon[data-value='W'] {\n transform: rotate(-90deg);\n }\n\n md-icon[data-value='N'] {\n transform: rotate(0deg);\n }\n\n md-icon[data-value='S'] {\n transform: rotate(180deg);\n }\n\n md-icon[data-value='E'] {\n transform: rotate(90deg);\n }\n `\n\n @property({ type: String }) value?: string\n @property({ type: Boolean }) inbound?: boolean = false\n\n render() {\n const value = this.value\n\n return html`\n <div @click=${this.onClick.bind(this)}>\n ${this.inbound\n ? html`\n <md-icon ?selected=${value == 'W'} data-value=\"W\">step_into</md-icon>\n <md-icon ?selected=${value == 'N'} data-value=\"N\">step_into</md-icon>\n <md-icon ?selected=${value == 'S'} data-value=\"S\">step_into</md-icon>\n <md-icon ?selected=${value == 'E'} data-value=\"E\">step_into</md-icon>\n `\n : html`\n <md-icon ?selected=${value == 'W'} data-value=\"W\">step_out</md-icon>\n <md-icon ?selected=${value == 'N'} data-value=\"N\">step_out</md-icon>\n <md-icon ?selected=${value == 'S'} data-value=\"S\">step_out</md-icon>\n <md-icon ?selected=${value == 'E'} data-value=\"E\">step_out</md-icon>\n `}\n </div>\n `\n }\n\n onClick(e: MouseEvent) {\n e.stopPropagation()\n\n if (this.disabled) {\n return\n }\n\n const target = e.target as Element\n const value = target.getAttribute('data-value') as string\n\n this.value = this.value === value ? undefined : value\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import '@material/web/icon/icon.js';
2
+ import { PropertyValues } from 'lit';
2
3
  import { OxFormField } from './ox-form-field.js';
3
4
  export declare class OxInputSignature extends OxFormField {
4
5
  static styles: import("lit").CSSResult[];
@@ -10,14 +11,15 @@ export declare class OxInputSignature extends OxFormField {
10
11
  private isDrawing;
11
12
  render(): import("lit-html").TemplateResult<1>;
12
13
  firstUpdated(): void;
14
+ updated(changes: PropertyValues<this>): void;
13
15
  openDialog(): void;
14
16
  closeDialog(): void;
15
17
  startDrawing(event: MouseEvent | TouchEvent): void;
16
- stopDrawing(): void;
18
+ stopDrawing(event: MouseEvent | TouchEvent): void;
17
19
  draw(event: MouseEvent | TouchEvent): void;
18
20
  clearCanvas(): void;
19
21
  saveSignature(): void;
20
- loadSignature(dataUrl: string): void;
22
+ loadSignature(dataUrl: string | null): void;
21
23
  getEventPosition(event: MouseEvent | TouchEvent): {
22
24
  x: number;
23
25
  y: number;
@@ -33,8 +33,6 @@ let OxInputSignature = class OxInputSignature extends OxFormField {
33
33
  }
34
34
 
35
35
  dialog canvas {
36
- width: 100%;
37
- height: 100%;
38
36
  border: 1px solid var(--md-sys-color-outline);
39
37
  }
40
38
 
@@ -48,6 +46,19 @@ let OxInputSignature = class OxInputSignature extends OxFormField {
48
46
  .filler {
49
47
  flex: 1;
50
48
  }
49
+
50
+ /* 버튼 스타일 */
51
+ button {
52
+ background-color: var(--md-sys-color-primary);
53
+ color: var(--md-sys-color-on-primary);
54
+ padding: 10px 20px;
55
+ border: none;
56
+ border-radius: var(--spacing-small);
57
+ font-family: 'Roboto', sans-serif;
58
+ font-size: 14px;
59
+ cursor: pointer;
60
+ transition: background-color 0.3s ease;
61
+ }
51
62
  `
52
63
  ]; }
53
64
  render() {
@@ -58,13 +69,10 @@ let OxInputSignature = class OxInputSignature extends OxFormField {
58
69
  <canvas
59
70
  width="800"
60
71
  height="400"
61
- @mousedown=${this.startDrawing}
62
- @mouseup=${this.stopDrawing}
63
- @mousemove=${this.draw}
64
- @mouseleave=${this.stopDrawing}
65
- @touchstart=${this.startDrawing}
66
- @touchend=${this.stopDrawing}
67
- @touchmove=${this.draw}
72
+ @pointerdown=${this.startDrawing}
73
+ @pointerup=${this.stopDrawing}
74
+ @pointermove=${this.draw}
75
+ @pointerleave=${this.stopDrawing}
68
76
  ></canvas>
69
77
  <div class="controls">
70
78
  <button @click="${this.clearCanvas}">Clear</button>
@@ -84,11 +92,16 @@ let OxInputSignature = class OxInputSignature extends OxFormField {
84
92
  this.loadSignature(this.value);
85
93
  }
86
94
  }
95
+ updated(changes) {
96
+ if (changes.has('value')) {
97
+ this.loadSignature(this.value);
98
+ }
99
+ }
87
100
  openDialog() {
88
- if (this.disabled)
101
+ if (this.disabled) {
89
102
  return;
103
+ }
90
104
  this.dialog.showModal();
91
- // 다이아로그가 열릴 때 현재 value를 캔버스에 그리기
92
105
  if (this.value) {
93
106
  const img = new Image();
94
107
  img.onload = () => {
@@ -104,17 +117,24 @@ let OxInputSignature = class OxInputSignature extends OxFormField {
104
117
  if (this.disabled) {
105
118
  return;
106
119
  }
120
+ event.preventDefault();
121
+ event.stopPropagation();
107
122
  this.isDrawing = true;
108
123
  this.ctx.beginPath();
109
124
  const position = this.getEventPosition(event);
110
125
  this.ctx.moveTo(position.x, position.y);
111
126
  }
112
- stopDrawing() {
127
+ stopDrawing(event) {
128
+ event.preventDefault();
129
+ event.stopPropagation();
113
130
  this.isDrawing = false;
114
131
  }
115
132
  draw(event) {
116
- if (!this.isDrawing)
133
+ if (!this.isDrawing) {
117
134
  return;
135
+ }
136
+ event.preventDefault();
137
+ event.stopPropagation();
118
138
  const position = this.getEventPosition(event);
119
139
  this.ctx.lineTo(position.x, position.y);
120
140
  this.ctx.stroke();
@@ -129,7 +149,7 @@ let OxInputSignature = class OxInputSignature extends OxFormField {
129
149
  this.closeDialog();
130
150
  }
131
151
  loadSignature(dataUrl) {
132
- this.previewDiv.style.backgroundImage = `url(${dataUrl})`;
152
+ this.previewDiv.style.backgroundImage = dataUrl ? `url(${dataUrl})` : 'none';
133
153
  }
134
154
  getEventPosition(event) {
135
155
  const rect = this.canvas.getBoundingClientRect();
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-signature.js","sourceRoot":"","sources":["../../src/ox-input-signature.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAW,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAS,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QA2CuB,UAAK,GAAkB,IAAI,CAAA;QAU/C,cAAS,GAAG,KAAK,CAAA;IAsH3B,CAAC;aA1KQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;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B,CAAC;oDACO;AAE3B;IADP,KAAK,CAAC,QAAQ,CAAC;gDACkB;AAE1B;IADP,KAAK,CAAC,QAAQ,CAAC;gDACkB;AAlDvB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA2K5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, nothing } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@customElement('ox-input-signature')\nexport class OxInputSignature extends OxFormField {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n min-height: var(--signature-min-height, 80px);\n min-width: var(--signature-min-width, 120px);\n\n background-color: var(--signature-background-color, white);\n\n overflow: hidden;\n }\n\n .signature-preview {\n flex: 1;\n align-self: stretch;\n\n border: 1px solid var(--md-sys-color-outline);\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n dialog canvas {\n width: 100%;\n height: 100%;\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .controls {\n margin-top: 10px;\n display: flex;\n flex-direction: row;\n gap: var(--spacing-medium);\n }\n\n .filler {\n flex: 1;\n }\n `\n ]\n\n @property({ type: String }) value: string | null = null\n\n @query('.signature-preview')\n private previewDiv!: HTMLDivElement\n @query('dialog')\n private dialog!: HTMLDialogElement\n @query('canvas')\n private canvas!: HTMLCanvasElement\n\n private ctx!: CanvasRenderingContext2D\n private isDrawing = false\n\n render() {\n return html`\n <div class=\"signature-preview\" @click=${this.openDialog}></div>\n\n <dialog>\n <canvas\n width=\"800\"\n height=\"400\"\n @mousedown=${this.startDrawing}\n @mouseup=${this.stopDrawing}\n @mousemove=${this.draw}\n @mouseleave=${this.stopDrawing}\n @touchstart=${this.startDrawing}\n @touchend=${this.stopDrawing}\n @touchmove=${this.draw}\n ></canvas>\n <div class=\"controls\">\n <button @click=\"${this.clearCanvas}\">Clear</button>\n <div class=\"filler\"></div>\n <button @click=\"${this.saveSignature}\">Save</button>\n <button @click=\"${this.closeDialog}\">Close</button>\n </div>\n </dialog>\n `\n }\n\n firstUpdated() {\n this.ctx = this.canvas.getContext('2d')!\n this.ctx.strokeStyle = '#000'\n this.ctx.lineWidth = 2\n\n // 처음 로딩 시 서명 데이터를 미리보기 div에 표시\n if (this.value) {\n this.loadSignature(this.value)\n }\n }\n\n openDialog() {\n if (this.disabled) return\n this.dialog.showModal()\n\n // 다이아로그가 열릴 때 현재 value를 캔버스에 그리기\n if (this.value) {\n const img = new Image()\n img.onload = () => {\n this.ctx.drawImage(img, 0, 0, this.canvas.width, this.canvas.height)\n }\n img.src = this.value\n }\n }\n\n closeDialog() {\n this.dialog.close()\n }\n\n startDrawing(event: MouseEvent | TouchEvent) {\n if (this.disabled) {\n return\n }\n\n this.isDrawing = true\n this.ctx.beginPath()\n const position = this.getEventPosition(event)\n this.ctx.moveTo(position.x, position.y)\n }\n\n stopDrawing() {\n this.isDrawing = false\n }\n\n draw(event: MouseEvent | TouchEvent) {\n if (!this.isDrawing) return\n const position = this.getEventPosition(event)\n this.ctx.lineTo(position.x, position.y)\n this.ctx.stroke()\n }\n\n clearCanvas() {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n }\n\n saveSignature() {\n this.value = this.canvas.toDataURL()\n this._notifyChange()\n this.previewDiv.style.backgroundImage = `url(${this.value})`\n this.closeDialog()\n }\n\n loadSignature(dataUrl: string) {\n this.previewDiv.style.backgroundImage = `url(${dataUrl})`\n }\n\n getEventPosition(event: MouseEvent | TouchEvent) {\n const rect = this.canvas.getBoundingClientRect()\n\n // 캔버스의 실제 크기와 CSS 크기 간의 비율을 계산\n const scaleX = this.canvas.width / rect.width\n const scaleY = this.canvas.height / rect.height\n\n // 실제 좌표 계산\n const isTouchEvent = event instanceof TouchEvent\n const x = (isTouchEvent ? event.touches[0].clientX - rect.left : (event as MouseEvent).clientX - rect.left) * scaleX\n const y = (isTouchEvent ? event.touches[0].clientY - rect.top : (event as MouseEvent).clientY - rect.top) * scaleY\n\n return { x, y }\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-signature.js","sourceRoot":"","sources":["../../src/ox-input-signature.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAsDuB,UAAK,GAAkB,IAAI,CAAA;QAU/C,cAAS,GAAG,KAAK,CAAA;IAuI3B,CAAC;aAtMQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiDF;KACF,AAnDY,CAmDZ;IAcD,MAAM;QACJ,OAAO,IAAI,CAAA;8CAC+B,IAAI,CAAC,UAAU;;;;;;yBAMpC,IAAI,CAAC,YAAY;uBACnB,IAAI,CAAC,WAAW;yBACd,IAAI,CAAC,IAAI;0BACR,IAAI,CAAC,WAAW;;;4BAGd,IAAI,CAAC,WAAW;;4BAEhB,IAAI,CAAC,aAAa;4BAClB,IAAI,CAAC,WAAW;;;KAGvC,CAAA;IACH,CAAC;IAED,YAAY;QACV,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAE,CAAA;QACxC,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,MAAM,CAAA;QAC7B,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,CAAA;QAEtB,+BAA+B;QAC/B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,aAAa,C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\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@customElement('ox-input-signature')\nexport class OxInputSignature extends OxFormField {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n min-height: var(--signature-min-height, 80px);\n min-width: var(--signature-min-width, 120px);\n\n background-color: var(--signature-background-color, white);\n\n overflow: hidden;\n }\n\n .signature-preview {\n flex: 1;\n align-self: stretch;\n\n border: 1px solid var(--md-sys-color-outline);\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n dialog canvas {\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .controls {\n margin-top: 10px;\n display: flex;\n flex-direction: row;\n gap: var(--spacing-medium);\n }\n\n .filler {\n flex: 1;\n }\n\n /* 버튼 스타일 */\n button {\n background-color: var(--md-sys-color-primary);\n color: var(--md-sys-color-on-primary);\n padding: 10px 20px;\n border: none;\n border-radius: var(--spacing-small);\n font-family: 'Roboto', sans-serif;\n font-size: 14px;\n cursor: pointer;\n transition: background-color 0.3s ease;\n }\n `\n ]\n\n @property({ type: String }) value: string | null = null\n\n @query('.signature-preview')\n private previewDiv!: HTMLDivElement\n @query('dialog')\n private dialog!: HTMLDialogElement\n @query('canvas')\n private canvas!: HTMLCanvasElement\n\n private ctx!: CanvasRenderingContext2D\n private isDrawing = false\n\n render() {\n return html`\n <div class=\"signature-preview\" @click=${this.openDialog}></div>\n\n <dialog>\n <canvas\n width=\"800\"\n height=\"400\"\n @pointerdown=${this.startDrawing}\n @pointerup=${this.stopDrawing}\n @pointermove=${this.draw}\n @pointerleave=${this.stopDrawing}\n ></canvas>\n <div class=\"controls\">\n <button @click=\"${this.clearCanvas}\">Clear</button>\n <div class=\"filler\"></div>\n <button @click=\"${this.saveSignature}\">Save</button>\n <button @click=\"${this.closeDialog}\">Close</button>\n </div>\n </dialog>\n `\n }\n\n firstUpdated() {\n this.ctx = this.canvas.getContext('2d')!\n this.ctx.strokeStyle = '#000'\n this.ctx.lineWidth = 2\n\n // 처음 로딩 시 서명 데이터를 미리보기 div에 표시\n if (this.value) {\n this.loadSignature(this.value)\n }\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n this.loadSignature(this.value)\n }\n }\n\n openDialog() {\n if (this.disabled) {\n return\n }\n\n this.dialog.showModal()\n\n if (this.value) {\n const img = new Image()\n img.onload = () => {\n this.ctx.drawImage(img, 0, 0, this.canvas.width, this.canvas.height)\n }\n img.src = this.value\n }\n }\n\n closeDialog() {\n this.dialog.close()\n }\n\n startDrawing(event: MouseEvent | TouchEvent) {\n if (this.disabled) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n this.isDrawing = true\n this.ctx.beginPath()\n const position = this.getEventPosition(event)\n this.ctx.moveTo(position.x, position.y)\n }\n\n stopDrawing(event: MouseEvent | TouchEvent) {\n event.preventDefault()\n event.stopPropagation()\n\n this.isDrawing = false\n }\n\n draw(event: MouseEvent | TouchEvent) {\n if (!this.isDrawing) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n const position = this.getEventPosition(event)\n this.ctx.lineTo(position.x, position.y)\n this.ctx.stroke()\n }\n\n clearCanvas() {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n }\n\n saveSignature() {\n this.value = this.canvas.toDataURL()\n this._notifyChange()\n this.previewDiv.style.backgroundImage = `url(${this.value})`\n this.closeDialog()\n }\n\n loadSignature(dataUrl: string | null) {\n this.previewDiv.style.backgroundImage = dataUrl ? `url(${dataUrl})` : 'none'\n }\n\n getEventPosition(event: MouseEvent | TouchEvent) {\n const rect = this.canvas.getBoundingClientRect()\n\n // 캔버스의 실제 크기와 CSS 크기 간의 비율을 계산\n const scaleX = this.canvas.width / rect.width\n const scaleY = this.canvas.height / rect.height\n\n // 실제 좌표 계산\n const isTouchEvent = event instanceof TouchEvent\n const x = (isTouchEvent ? event.touches[0].clientX - rect.left : (event as MouseEvent).clientX - rect.left) * scaleX\n const y = (isTouchEvent ? event.touches[0].clientY - rect.top : (event as MouseEvent).clientY - rect.top) * scaleY\n\n return { x, y }\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import { PropertyValues } from 'lit';
2
+ import { OxFormField } from './ox-form-field';
3
+ type Card = {
4
+ name: string;
5
+ image: string;
6
+ };
7
+ export declare class OxSelectFloor extends OxFormField {
8
+ static styles: import("lit").CSSResult[];
9
+ cards: Card[];
10
+ value?: string;
11
+ bottomLimit: number;
12
+ interval: number;
13
+ private selectedIndex;
14
+ private activeIndex;
15
+ private carouselContainer;
16
+ private isDragging;
17
+ private lastMouseY;
18
+ render(): import("lit-html").TemplateResult<1>;
19
+ updated(changes: PropertyValues<this>): void;
20
+ firstUpdated(): void;
21
+ getClassForCard(index: number): "selected" | "compressed";
22
+ isActive(index: number): boolean;
23
+ handleWheel(event: WheelEvent): void;
24
+ handlePointerDown(event: PointerEvent): void;
25
+ handlePointerMove(event: PointerEvent): void;
26
+ handlePointerUp(event: PointerEvent): void;
27
+ handlePointerLeave(event: PointerEvent): void;
28
+ private toggleActiveCard;
29
+ private updateSelectedIndex;
30
+ private scrollToSelectedCard;
31
+ private selectCard;
32
+ private notifySelection;
33
+ private adjustCardHeight;
34
+ }
35
+ export {};