@dssp/supervision 1.0.0-alpha.32 → 1.0.0-alpha.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.
@@ -0,0 +1,205 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { BUILDING_INSPECTION_STATUS_DISPLAY } from '../../building-inspection/building-inspection-list';
5
+ let GridInspectionListLayer = class GridInspectionListLayer extends LitElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.items = [];
9
+ this.direction = 'down';
10
+ // 내부 계산값
11
+ this.left = 0;
12
+ this.top = 0;
13
+ this._onWindowChanged = () => {
14
+ this._reposition();
15
+ };
16
+ this._onGlobalMouseDown = (ev) => {
17
+ const path = (ev.composedPath && ev.composedPath()) || [];
18
+ const containsSelf = path.includes(this);
19
+ if (!containsSelf) {
20
+ this._requestClose();
21
+ }
22
+ };
23
+ this._onKeyDown = (ev) => {
24
+ if (ev.key === 'Escape') {
25
+ this._requestClose();
26
+ }
27
+ };
28
+ }
29
+ render() {
30
+ return html `
31
+ <div container>
32
+ ${this.items.map(item => {
33
+ var _a, _b;
34
+ const status = BUILDING_INSPECTION_STATUS_DISPLAY[item.status];
35
+ const title = `${((_a = item === null || item === void 0 ? void 0 : item.checklist) === null || _a === void 0 ? void 0 : _a.constructionType) || ''} / ${((_b = item === null || item === void 0 ? void 0 : item.checklist) === null || _b === void 0 ? void 0 : _b.constructionDetailType) || ''}`;
36
+ return html `<div item @click=${() => this._select(item.id)}>
37
+ <span status class=${item.status.toLowerCase()}>${status}</span>
38
+ <span title=${title}>${title}</span>
39
+ </div>`;
40
+ })}
41
+ </div>
42
+ `;
43
+ }
44
+ _select(id) {
45
+ this.dispatchEvent(new CustomEvent('select', { detail: { id }, bubbles: true, composed: true }));
46
+ }
47
+ connectedCallback() {
48
+ super.connectedCallback();
49
+ this._reposition();
50
+ window.addEventListener('mousedown', this._onGlobalMouseDown, { capture: true });
51
+ window.addEventListener('keydown', this._onKeyDown, { capture: true });
52
+ window.addEventListener('resize', this._onWindowChanged);
53
+ window.addEventListener('scroll', this._onWindowChanged, true);
54
+ }
55
+ disconnectedCallback() {
56
+ window.removeEventListener('mousedown', this._onGlobalMouseDown, { capture: true });
57
+ window.removeEventListener('keydown', this._onKeyDown, { capture: true });
58
+ window.removeEventListener('resize', this._onWindowChanged);
59
+ window.removeEventListener('scroll', this._onWindowChanged, true);
60
+ super.disconnectedCallback();
61
+ }
62
+ _requestClose() {
63
+ this.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }));
64
+ }
65
+ _reposition() {
66
+ const anchor = this.anchorEl;
67
+ const container = this.containerEl;
68
+ if (!anchor || !container)
69
+ return;
70
+ const anchorRect = anchor.getBoundingClientRect();
71
+ const containerRect = container.getBoundingClientRect();
72
+ const estimatedItemHeight = 40;
73
+ const padding = 8;
74
+ const estimatedHeight = Math.min(this.items.length, 10) * estimatedItemHeight + padding * 2;
75
+ let direction = 'down';
76
+ let top = anchorRect.bottom - containerRect.top + 4;
77
+ let left = anchorRect.left - containerRect.left + 4;
78
+ if (anchorRect.bottom + estimatedHeight > window.innerHeight) {
79
+ direction = 'up';
80
+ top = anchorRect.top - containerRect.top - estimatedHeight - 4;
81
+ }
82
+ this.direction = direction;
83
+ this.left = left;
84
+ this.top = top;
85
+ this.style.left = `${left}px`;
86
+ this.style.top = `${top}px`;
87
+ }
88
+ };
89
+ GridInspectionListLayer.styles = [
90
+ css `
91
+ :host {
92
+ display: block;
93
+ position: absolute;
94
+ background: #fff;
95
+ border: 1px solid #cccccc80;
96
+ border-radius: 6px;
97
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
98
+ min-width: 260px;
99
+ max-width: 360px;
100
+ max-height: 420px; /* 약 10개 기준 */
101
+ overflow-y: auto;
102
+ z-index: 10;
103
+ }
104
+
105
+ div[container] {
106
+ display: flex;
107
+ flex-direction: column;
108
+ padding: 8px;
109
+ gap: 6px;
110
+ }
111
+
112
+ div[item] {
113
+ display: grid;
114
+ grid-template-columns: 70px 1fr;
115
+ gap: 10px;
116
+ align-items: center;
117
+ padding: 8px 10px;
118
+ border-radius: 6px;
119
+ cursor: pointer;
120
+ border: 1px solid transparent;
121
+ }
122
+ div[item]:hover {
123
+ background: #f5fbff;
124
+ border-color: #cfeeff;
125
+ }
126
+
127
+ span[status] {
128
+ font-weight: 700;
129
+ font-size: 12px;
130
+ color: #ffffff;
131
+ background: #eef3f8;
132
+ border-radius: 4px;
133
+ padding: 4px 6px;
134
+ text-align: center;
135
+ }
136
+ span[status].wait,
137
+ span[status].overall_wait,
138
+ span[status].request,
139
+ span[status].overall_request {
140
+ background: #4e5055;
141
+ }
142
+ span[status].pass {
143
+ background: #4bbb4a;
144
+ }
145
+ span[status].fail {
146
+ background: #ff4444;
147
+ }
148
+
149
+ span[title] {
150
+ font-size: 13px;
151
+ color: #4e5055;
152
+ white-space: nowrap;
153
+ }
154
+
155
+ :host([direction='up'])::after,
156
+ :host([direction='down'])::after {
157
+ content: '';
158
+ position: absolute;
159
+ left: 12px;
160
+ width: 10px;
161
+ height: 10px;
162
+ background: #fff;
163
+ border-left: 1px solid #cccccc80;
164
+ border-top: 1px solid #cccccc80;
165
+ transform: rotate(45deg);
166
+ }
167
+ :host([direction='down'])::after {
168
+ top: -6px;
169
+ }
170
+ :host([direction='up'])::after {
171
+ bottom: -6px;
172
+ }
173
+ `
174
+ ];
175
+ __decorate([
176
+ property({ type: Array }),
177
+ __metadata("design:type", Array)
178
+ ], GridInspectionListLayer.prototype, "items", void 0);
179
+ __decorate([
180
+ property({ type: String, reflect: true }),
181
+ __metadata("design:type", String)
182
+ ], GridInspectionListLayer.prototype, "direction", void 0);
183
+ __decorate([
184
+ property({ attribute: false }),
185
+ __metadata("design:type", HTMLElement)
186
+ ], GridInspectionListLayer.prototype, "anchorEl", void 0);
187
+ __decorate([
188
+ property({ attribute: false }),
189
+ __metadata("design:type", HTMLElement
190
+ // 내부 계산값
191
+ )
192
+ ], GridInspectionListLayer.prototype, "containerEl", void 0);
193
+ __decorate([
194
+ property({ type: Number }),
195
+ __metadata("design:type", Number)
196
+ ], GridInspectionListLayer.prototype, "left", void 0);
197
+ __decorate([
198
+ property({ type: Number }),
199
+ __metadata("design:type", Number)
200
+ ], GridInspectionListLayer.prototype, "top", void 0);
201
+ GridInspectionListLayer = __decorate([
202
+ customElement('grid-inspection-list-layer')
203
+ ], GridInspectionListLayer);
204
+ export { GridInspectionListLayer };
205
+ //# sourceMappingURL=grid-inspection-list-layer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-inspection-list-layer.js","sourceRoot":"","sources":["../../../../client/pages/building-inspection-grid/component/grid-inspection-list-layer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,kCAAkC,EAAE,MAAM,oDAAoD,CAAA;AAGhG,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAU;IAAhD;;QAwFsB,UAAK,GAAU,EAAE,CAAA;QACD,cAAS,GAAkB,MAAM,CAAA;QAM5E,SAAS;QACmB,SAAI,GAAW,CAAC,CAAA;QAChB,QAAG,GAAW,CAAC,CAAA;QAsCnC,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,CAAC,WAAW,EAAE,CAAA;QACpB,CAAC,CAAA;QAEO,uBAAkB,GAAG,CAAC,EAAc,EAAE,EAAE;YAC9C,MAAM,IAAI,GAAG,CAAC,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,CAAA;YACzD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;YACxC,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB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kC;AAG5C;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8BAAY,WAAW;yDAAA;AACtB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8BAAe,WAAW;IAEzD,SAAS;;4DAFgD;AAG7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAgB;AAjGhC,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CAyLnC","sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { BUILDING_INSPECTION_STATUS_DISPLAY } from '../../building-inspection/building-inspection-list'\n\n@customElement('grid-inspection-list-layer')\nexport class GridInspectionListLayer extends LitElement {\n static styles = [\n css`\n :host {\n display: block;\n position: absolute;\n background: #fff;\n border: 1px solid #cccccc80;\n border-radius: 6px;\n box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);\n min-width: 260px;\n max-width: 360px;\n max-height: 420px; /* 약 10개 기준 */\n overflow-y: auto;\n z-index: 10;\n }\n\n div[container] {\n display: flex;\n flex-direction: column;\n padding: 8px;\n gap: 6px;\n }\n\n div[item] {\n display: grid;\n grid-template-columns: 70px 1fr;\n gap: 10px;\n align-items: center;\n padding: 8px 10px;\n border-radius: 6px;\n cursor: pointer;\n border: 1px solid transparent;\n }\n div[item]:hover {\n background: #f5fbff;\n border-color: #cfeeff;\n }\n\n span[status] {\n font-weight: 700;\n font-size: 12px;\n color: #ffffff;\n background: #eef3f8;\n border-radius: 4px;\n padding: 4px 6px;\n text-align: center;\n }\n span[status].wait,\n span[status].overall_wait,\n span[status].request,\n span[status].overall_request {\n background: #4e5055;\n }\n span[status].pass {\n background: #4bbb4a;\n }\n span[status].fail {\n background: #ff4444;\n }\n\n span[title] {\n font-size: 13px;\n color: #4e5055;\n white-space: nowrap;\n }\n\n :host([direction='up'])::after,\n :host([direction='down'])::after {\n content: '';\n position: absolute;\n left: 12px;\n width: 10px;\n height: 10px;\n background: #fff;\n border-left: 1px solid #cccccc80;\n border-top: 1px solid #cccccc80;\n transform: rotate(45deg);\n }\n :host([direction='down'])::after {\n top: -6px;\n }\n :host([direction='up'])::after {\n bottom: -6px;\n }\n `\n ]\n\n @property({ type: Array }) items: any[] = []\n @property({ type: String, reflect: true }) direction: 'down' | 'up' = 'down'\n\n // 포지셔닝 입력\n @property({ attribute: false }) anchorEl?: HTMLElement\n @property({ attribute: false }) containerEl?: HTMLElement\n\n // 내부 계산값\n @property({ type: Number }) left: number = 0\n @property({ type: Number }) top: number = 0\n\n render() {\n return html`\n <div container>\n ${this.items.map(item => {\n const status = BUILDING_INSPECTION_STATUS_DISPLAY[item.status]\n const title = `${item?.checklist?.constructionType || ''} / ${item?.checklist?.constructionDetailType || ''}`\n return html`<div item @click=${() => this._select(item.id)}>\n <span status class=${item.status.toLowerCase()}>${status}</span>\n <span title=${title}>${title}</span>\n </div>`\n })}\n </div>\n `\n }\n\n private _select(id: string) {\n this.dispatchEvent(new CustomEvent('select', { detail: { id }, bubbles: true, composed: true }))\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this._reposition()\n window.addEventListener('mousedown', this._onGlobalMouseDown, { capture: true })\n window.addEventListener('keydown', this._onKeyDown, { capture: true })\n window.addEventListener('resize', this._onWindowChanged)\n window.addEventListener('scroll', this._onWindowChanged, true)\n }\n\n disconnectedCallback(): void {\n window.removeEventListener('mousedown', this._onGlobalMouseDown as any, { capture: true } as any)\n window.removeEventListener('keydown', this._onKeyDown as any, { capture: true } as any)\n window.removeEventListener('resize', this._onWindowChanged as any)\n window.removeEventListener('scroll', this._onWindowChanged as any, true)\n super.disconnectedCallback()\n }\n\n private _onWindowChanged = () => {\n this._reposition()\n }\n\n private _onGlobalMouseDown = (ev: MouseEvent) => {\n const path = (ev.composedPath && ev.composedPath()) || []\n const containsSelf = path.includes(this)\n if (!containsSelf) {\n this._requestClose()\n }\n }\n\n private _onKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === 'Escape') {\n this._requestClose()\n }\n }\n\n private _requestClose() {\n this.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }))\n }\n\n private _reposition() {\n const anchor = this.anchorEl\n const container = this.containerEl\n if (!anchor || !container) return\n\n const anchorRect = anchor.getBoundingClientRect()\n const containerRect = container.getBoundingClientRect()\n\n const estimatedItemHeight = 40\n const padding = 8\n const estimatedHeight = Math.min(this.items.length, 10) * estimatedItemHeight + padding * 2\n\n let direction: 'down' | 'up' = 'down'\n let top = anchorRect.bottom - containerRect.top + 4\n let left = anchorRect.left - containerRect.left + 4\n\n if (anchorRect.bottom + estimatedHeight > window.innerHeight) {\n direction = 'up'\n top = anchorRect.top - containerRect.top - estimatedHeight - 4\n }\n\n this.direction = direction\n this.left = left\n this.top = top\n\n this.style.left = `${left}px`\n this.style.top = `${top}px`\n }\n}\n"]}
@@ -1 +1 @@
1
- export default function route(page: string): "checklist-type-management" | "building-inspection-list" | "checklist-template-list" | "building-inspection-detail-drawing" | "building-inspection-detail-checklist" | "building-inspection-detail-camera" | "building-inspection-grid-detail" | undefined;
1
+ export default function route(page: string): "checklist-template-list" | "checklist-type-management" | "building-inspection-list" | "building-inspection-detail-drawing" | "building-inspection-detail-checklist" | "building-inspection-detail-camera" | "building-inspection-grid-detail" | undefined;