@dssp/dkpi 1.0.0-alpha.65 → 1.0.0-alpha.67

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 (82) hide show
  1. package/_index.html +0 -5
  2. package/dist-client/components/kpi-2d-lookup-chart.d.ts +63 -0
  3. package/dist-client/components/kpi-2d-lookup-chart.js +470 -0
  4. package/dist-client/components/kpi-2d-lookup-chart.js.map +1 -0
  5. package/dist-client/google-map/common-google-map.js +10 -8
  6. package/dist-client/google-map/common-google-map.js.map +1 -1
  7. package/dist-client/pages/kpi-admin/dssp-kpi-list-page.d.ts +22 -0
  8. package/dist-client/pages/kpi-admin/dssp-kpi-list-page.js +57 -0
  9. package/dist-client/pages/kpi-admin/dssp-kpi-list-page.js.map +1 -0
  10. package/dist-client/pages/kpi-admin/kpi-grade-2d-editor.d.ts +20 -0
  11. package/dist-client/pages/kpi-admin/kpi-grade-2d-editor.js +445 -0
  12. package/dist-client/pages/kpi-admin/kpi-grade-2d-editor.js.map +1 -0
  13. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.d.ts +6 -5
  14. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +47 -68
  15. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +1 -1
  16. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.d.ts +3 -2
  17. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +79 -122
  18. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +1 -1
  19. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.d.ts +3 -2
  20. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +71 -107
  21. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +1 -1
  22. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.d.ts +4 -0
  23. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js +246 -28
  24. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js.map +1 -1
  25. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +4 -0
  26. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +22 -207
  27. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +1 -1
  28. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.d.ts +2 -0
  29. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js +84 -25
  30. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js.map +1 -1
  31. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +16 -0
  32. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +261 -31
  33. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +1 -1
  34. package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +4 -0
  35. package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +66 -4
  36. package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -1
  37. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +1 -2
  38. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +1 -2
  39. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -1
  40. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +1 -2
  41. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +1 -2
  42. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
  43. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.d.ts +1 -2
  44. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js +1 -2
  45. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +1 -1
  46. package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +1 -2
  47. package/dist-client/pages/kpi-value/kpi-value-list-page.js +1 -2
  48. package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
  49. package/dist-client/pages/sv-project-detail.d.ts +1 -0
  50. package/dist-client/pages/sv-project-detail.js +26 -13
  51. package/dist-client/pages/sv-project-detail.js.map +1 -1
  52. package/dist-client/pages/sv-project-list.js +6 -6
  53. package/dist-client/pages/sv-project-list.js.map +1 -1
  54. package/dist-client/route.d.ts +1 -1
  55. package/dist-client/route.js +4 -0
  56. package/dist-client/route.js.map +1 -1
  57. package/dist-client/tsconfig.tsbuildinfo +1 -1
  58. package/dist-client/viewparts/menu-tools.d.ts +1 -2
  59. package/dist-client/viewparts/menu-tools.js +1 -2
  60. package/dist-client/viewparts/menu-tools.js.map +1 -1
  61. package/dist-server/scripts/calculate-kpi-scores.js +65 -3
  62. package/dist-server/scripts/calculate-kpi-scores.js.map +1 -1
  63. package/dist-server/scripts/load-grade-data-migration.d.ts +4 -0
  64. package/dist-server/scripts/load-grade-data-migration.js +95 -10
  65. package/dist-server/scripts/load-grade-data-migration.js.map +1 -1
  66. package/dist-server/scripts/propagate-parent-kpi-values.js +58 -4
  67. package/dist-server/scripts/propagate-parent-kpi-values.js.map +1 -1
  68. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.d.ts +6 -0
  69. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +57 -7
  70. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -1
  71. package/dist-server/service/kpi-stat/kpi-stat-query.d.ts +8 -5
  72. package/dist-server/service/kpi-stat/kpi-stat-query.js +228 -11
  73. package/dist-server/service/kpi-stat/kpi-stat-query.js.map +1 -1
  74. package/dist-server/service/kpi-stat/kpi-stat-types.d.ts +13 -0
  75. package/dist-server/service/kpi-stat/kpi-stat-types.js +51 -1
  76. package/dist-server/service/kpi-stat/kpi-stat-types.js.map +1 -1
  77. package/dist-server/tsconfig.tsbuildinfo +1 -1
  78. package/package.json +54 -54
  79. package/schema.graphql +95 -58
  80. package/things-factory.config.js +3 -1
  81. package/views/auth-page.html +0 -1
  82. package/views/public/home.html +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"common-google-map.js","sourceRoot":"","sources":["../../client/google-map/common-google-map.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,eAAe,MAAM,wBAAwB,CAAA;AAwB7C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QA4BsB,cAAS,GAAU,EAAE,CAAA;QAOpB,gBAAW,GAAG,EAAE,CAAA;QAEnC,QAAG,GAAQ,IAAI,CAAA;QACf,kBAAa,GAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;QAC/C,gBAAW,GAAQ,IAAI,CAAA;QACvB,qBAAgB,GAAQ,IAAI,CAAA;QAC5B,uBAAkB,GAAQ,IAAI,CAAA;IAoTxC,CAAC;IAlTC,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;IAED,KAAK,CAAC,QAAQ;;QACZ,MAAM,eAAe,CAAC,IAAI,EAAE,CAAA;QAE5B,2BAA2B;QAC3B,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YAC5B,MAAM,eAAe,CAAC,mBAAmB,EAAE,CAAA;QAC7C,CAAC;QAED,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,OAAM;QACR,CAAC;QAED,mBAAmB;QACnB,MAAM,IAAI,CAAC,cAAc,CAAA;QAEzB,sBAAsB;QACtB,IAAI,QAAQ,GAAG,CAAC,CAAA;QAChB,MAAM,WAAW,GAAG,EAAE,CAAA;QACtB,OAAO,QAAQ,GAAG,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AAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAY;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAS;AACR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAiB;AAEnC;IAAR,KAAK,EAAE;;4CAAgB;AACf;IAAR,KAAK,EAAE;;sDAA+C;AAtC5C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA6V3B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport GoogleMapLoader from './google-map-loader.js'\n\ndeclare global {\n interface Window {\n google: any\n markerClusterer?: any\n }\n}\n\ndeclare const google: any\n\ndeclare namespace google.maps {\n interface MapsLibrary {\n Map: any\n InfoWindow: any\n }\n\n interface MarkerLibrary {\n AdvancedMarkerElement: any\n PinElement: any\n }\n}\n\n@customElement('common-google-map')\nexport class CommonGoogleMap extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n }\n\n [map] {\n flex: 1;\n }\n\n .gm-style .gm-style-iw-c {\n padding: 0;\n }\n\n .gm-style .gm-style-iw-d {\n overflow: auto !important;\n }\n .gm-style .gm-style-iw-d + button {\n top: 0 !important;\n right: 0 !important;\n }\n `\n ]\n\n @property({ type: Object }) center\n @property({ type: Number }) zoom\n @property({ type: Array }) locations: any[] = []\n @property({ type: Object }) focused\n @property({ type: Array }) polygons\n @property({ type: Array }) polylines\n @property({ type: Array }) markers\n @property({ type: Array }) boundCoords\n @property({ type: Object }) controls\n @property({ type: Number }) clusterZoom = 10\n\n @state() map: any = null\n @state() defaultCenter: any = { lat: 36.5, lng: 127.5 }\n private _infoWindow: any = null\n private _markerClusterer: any = null\n private _buildMarkersTimer: any = null\n\n get anchor() {\n return this.renderRoot.querySelector('[map]')\n }\n\n async readyMap() {\n await GoogleMapLoader.load()\n\n // MarkerClusterer 라이브러리 로드\n if (!window.markerClusterer) {\n await GoogleMapLoader.loadMarkerClusterer()\n }\n\n if (this.map) {\n return\n }\n\n // DOM이 준비될 때까지 기다림\n await this.updateComplete\n\n // anchor가 준비될 때까지 기다림\n let attempts = 0\n const maxAttempts = 20\n while (attempts < maxAttempts) {\n const anchor = this.anchor as HTMLElement\n if (anchor && anchor.offsetWidth > 0) {\n break\n }\n await new Promise(resolve => setTimeout(resolve, 50))\n attempts++\n }\n\n if (!this.anchor) {\n console.error('Map anchor element not found')\n return\n }\n\n var show = async (center, zoom) => {\n try {\n // Google Maps 최신 API 사용\n const { Map } = (await google.maps.importLibrary('maps')) as google.maps.MapsLibrary\n\n const mapOptions = {\n zoom,\n center,\n mapId: 'DEMO_MAP_ID'\n }\n\n // controls 속성이 있으면 지도 옵션에 추가\n if (this.controls) {\n Object.assign(mapOptions, this.controls)\n }\n\n const map = new Map(this.anchor, mapOptions)\n\n this.markers && this.markers.forEach(marker => marker.setMap(map))\n\n this.map = map\n\n this.dispatchEvent(\n new CustomEvent('map-change', {\n detail: this.map\n })\n )\n\n this.resetBounds()\n } catch (e) {\n console.error(e)\n }\n }\n\n var { center, zoom = 10 } = this\n\n /* center 속성이 설정되어있지 않으면, 현재 위치를 구해서 지도의 center로 설정한다. */\n if (!center && 'geolocation' in navigator && !this.boundCoords?.length) {\n navigator.geolocation.getCurrentPosition(\n ({ coords: { latitude: lat, longitude: lng } }) => show({ lat, lng }, zoom),\n err => {\n console.warn(`navigator.geolocation.getCurrentPosition failed. (${err.code}): ${err.message}`)\n show(this.defaultCenter, zoom)\n },\n {\n /* https://stackoverflow.com/questions/3397585/navigator-geolocation-getcurrentposition-sometimes-works-sometimes-doesnt */\n timeout: 500\n }\n )\n } else {\n show(center, zoom)\n }\n }\n\n async buildMarkers(locations: any[] = []) {\n if (!this.map) {\n return\n }\n\n if (this.markers) {\n this.markers.forEach(marker => marker.setMap(null))\n this.markers = []\n }\n\n // 기존 클러스터 제거\n if (this._markerClusterer) {\n this._markerClusterer.clearMarkers()\n this._markerClusterer = null\n }\n\n // Google Maps 최신 API 사용\n const { AdvancedMarkerElement, PinElement } = (await google.maps.importLibrary(\n 'marker'\n )) as google.maps.MarkerLibrary\n\n this.markers = locations\n .map(location => {\n // location 객체가 유효한지 확인\n if (!location || typeof location !== 'object') {\n console.warn('Invalid location object:', location)\n return null\n }\n\n // lat, lng 값이 유효한지 확인\n const lat = parseFloat(location.lat)\n const lng = parseFloat(location.lng)\n\n if (isNaN(lat) || isNaN(lng)) {\n console.warn('Invalid lat/lng values:', location)\n return null\n }\n\n // LatLng 객체 생성\n const position = new google.maps.LatLng(lat, lng)\n\n // 커스텀 마커 콘텐츠가 있으면 사용\n let markerElement\n if (location.markerContent) {\n // HTML 문자열을 DOM 요소로 변환\n const tempDiv = document.createElement('div')\n tempDiv.innerHTML = location.markerContent\n markerElement = tempDiv.firstElementChild\n } else {\n // 기본 핀 사용\n markerElement = new PinElement({\n background: '#1976d2',\n borderColor: '#1565c0',\n glyphColor: '#ffffff',\n scale: 1.2\n })\n }\n\n // AdvancedMarkerElement 사용\n const marker = new AdvancedMarkerElement({\n position: position,\n map: null, // 클러스터에서 관리하므로 지도에 직접 추가하지 않음\n content: markerElement\n })\n\n marker.addListener('click', () => {\n // InfoWindow 대신 커스텀 이벤트 발생\n if (location?.region) {\n this.dispatchEvent(\n new CustomEvent('region-click', {\n detail: { region: location.region },\n bubbles: true,\n composed: true\n })\n )\n }\n })\n\n return marker\n })\n .filter(marker => marker !== null) // null 마커 제거\n\n // Google Maps 공식 MarkerClusterer 사용 (예시와 동일한 방식)\n if (this.markers.length > 0 && window.markerClusterer) {\n this._markerClusterer = new window.markerClusterer.MarkerClusterer({\n markers: this.markers,\n map: this.map\n })\n }\n }\n\n get infoWindow() {\n if (!this._infoWindow && this.map) {\n this._infoWindow = new google.maps.InfoWindow({\n content: 'loading...'\n })\n }\n\n return this._infoWindow\n }\n\n setFocus(focus, icon) {\n focus.setZIndex(1)\n focus.setIcon(icon)\n }\n\n resetFocus(focus, icon) {\n focus.setZIndex(0)\n focus.setIcon(icon)\n }\n\n async changeFocus(after, before) {\n await this.readyMap()\n\n // map이 준비되지 않았으면 포커스 변경하지 않음\n if (!this.map) {\n return\n }\n\n var locations = this.locations || []\n\n if (before) {\n var idx = locations.findIndex(location => {\n // location 객체의 구조를 안전하게 확인\n const beforePos = before?.position\n const locationPos = location?.position\n\n return (\n location?.name == before?.name && locationPos?.lat == beforePos?.lat && locationPos?.lng == beforePos?.lng\n )\n })\n idx !== -1 && this.markers && this.resetFocus(this.markers[idx], locations[idx]?.icon)\n }\n\n if (after) {\n var idx = locations.findIndex(location => {\n // location 객체의 구조를 안전하게 확인\n const afterPos = after?.position\n const locationPos = location?.position\n\n return location?.name == after?.name && locationPos?.lat == afterPos?.lat && locationPos?.lng == afterPos?.lng\n })\n idx !== -1 && this.markers && this.setFocus(this.markers[idx], after?.icon)\n }\n }\n\n async updated(changes) {\n if (!this.map) {\n await this.readyMap()\n }\n\n if (changes.has('locations')) {\n // 디바운스: 연속된 업데이트를 하나로 묶음\n if (this._buildMarkersTimer) {\n clearTimeout(this._buildMarkersTimer)\n }\n this._buildMarkersTimer = setTimeout(() => {\n this.buildMarkers(this.locations)\n this._buildMarkersTimer = null\n }, 500)\n }\n\n if (changes.has('focused')) {\n this.changeFocus(this.focused, changes.get('focused'))\n }\n\n if (changes.has('center')) {\n this.map.setCenter(this.center)\n }\n\n if (changes.has('controls')) {\n // controls가 변경되면 기존 지도의 옵션만 업데이트\n if (this.map && this.controls) {\n // Google Maps API의 setOptions 메서드 사용\n this.map.setOptions(this.controls)\n }\n }\n\n if (changes.has('polygons')) {\n ;(changes.get('polygons') || []).forEach(geofence => geofence.setMap(null))\n ;(this.polygons || []).forEach(geofence => geofence.setMap(this.map))\n }\n\n if (changes.has('polylines')) {\n ;(changes.get('polylines') || []).forEach(polyline => polyline.setMap(null))\n ;(this.polylines || []).forEach(polyline => polyline.setMap(this.map))\n }\n\n if (changes.has('markers')) {\n ;(changes.get('markers') || []).forEach(marker => marker.setMap(null))\n ;(this.markers || []).forEach(marker => marker.setMap(this.map))\n }\n\n if (changes.has('boundCoords')) {\n this.resetBounds()\n }\n\n // 클러스터링 설정 변경 시 마커 재구성\n if (changes.has('clusterZoom')) {\n this.buildMarkers(this.locations)\n }\n }\n\n render() {\n return html` <div map></div> `\n }\n\n resetBounds() {\n if (!this.boundCoords || this.boundCoords.length < 1 || !this.map) {\n return\n }\n\n var bounds = new google.maps.LatLngBounds()\n this.boundCoords.forEach(coord => bounds.extend(coord))\n this.map.fitBounds(bounds)\n }\n}\n"]}
1
+ {"version":3,"file":"common-google-map.js","sourceRoot":"","sources":["../../client/google-map/common-google-map.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,eAAe,MAAM,wBAAwB,CAAA;AAwB7C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QA4BsB,cAAS,GAAU,EAAE,CAAA;QAOpB,gBAAW,GAAG,EAAE,CAAA;QAEnC,QAAG,GAAQ,IAAI,CAAA;QACf,kBAAa,GAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;QAC/C,gBAAW,GAAQ,IAAI,CAAA;QACvB,qBAAgB,GAAQ,IAAI,CAAA;QAC5B,uBAAkB,GAAQ,IAAI,CAAA;IAyTxC,CAAC;IAvTC,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;IAED,KAAK,CAAC,QAAQ;;QACZ,MAAM,eAAe,CAAC,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,MAAM,EAAE,CAAC;;6CAAK;AACL;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;kDAAsB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAQ;AACR;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;iDAAS;AACR;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;kDAAU;AACT;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;gDAAQ;AACP;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAY;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAS;AACR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAiB;AAEnC;IAAR,KAAK,EAAE;;4CAAgB;AACf;IAAR,KAAK,EAAE;;sDAA+C;AAtC5C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkW3B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport GoogleMapLoader from './google-map-loader.js'\n\ndeclare global {\n interface Window {\n google: any\n markerClusterer?: any\n }\n}\n\ndeclare const google: any\n\ndeclare namespace google.maps {\n interface MapsLibrary {\n Map: any\n InfoWindow: any\n }\n\n interface MarkerLibrary {\n AdvancedMarkerElement: any\n PinElement: any\n }\n}\n\n@customElement('common-google-map')\nexport class CommonGoogleMap extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n }\n\n [map] {\n flex: 1;\n }\n\n .gm-style .gm-style-iw-c {\n padding: 0;\n }\n\n .gm-style .gm-style-iw-d {\n overflow: auto !important;\n }\n .gm-style .gm-style-iw-d + button {\n top: 0 !important;\n right: 0 !important;\n }\n `\n ]\n\n @property({ type: Object }) center\n @property({ type: Number }) zoom\n @property({ type: Array }) locations: any[] = []\n @property({ type: Object }) focused\n @property({ type: Array }) polygons\n @property({ type: Array }) polylines\n @property({ type: Array }) markers\n @property({ type: Array }) boundCoords\n @property({ type: Object }) controls\n @property({ type: Number }) clusterZoom = 10\n\n @state() map: any = null\n @state() defaultCenter: any = { lat: 36.5, lng: 127.5 }\n private _infoWindow: any = null\n private _markerClusterer: any = null\n private _buildMarkersTimer: any = null\n\n get anchor() {\n return this.renderRoot.querySelector('[map]')\n }\n\n async readyMap() {\n await GoogleMapLoader.load()\n\n // MarkerClusterer 라이브러리 로드\n if (!window.markerClusterer) {\n await GoogleMapLoader.loadMarkerClusterer()\n }\n\n if (this.map) {\n return\n }\n\n // DOM이 준비될 때까지 기다림\n await this.updateComplete\n\n // anchor가 준비될 때까지 기다림\n let attempts = 0\n const maxAttempts = 20\n while (attempts < maxAttempts) {\n const anchor = this.anchor as HTMLElement\n if (anchor && anchor.offsetWidth > 0) {\n break\n }\n await new Promise(resolve => setTimeout(resolve, 50))\n attempts++\n }\n\n if (!this.anchor) {\n console.error('Map anchor element not found')\n return\n }\n\n var show = async (center, zoom) => {\n try {\n // Google Maps 최신 API 사용\n const { Map } = (await google.maps.importLibrary('maps')) as google.maps.MapsLibrary\n\n const mapOptions = {\n zoom,\n center,\n mapId: 'DEMO_MAP_ID'\n }\n\n // controls 속성이 있으면 지도 옵션에 추가\n if (this.controls) {\n Object.assign(mapOptions, this.controls)\n }\n\n const map = new Map(this.anchor, mapOptions)\n\n this.markers && this.markers.forEach(marker => marker.setMap(map))\n\n this.map = map\n\n this.dispatchEvent(\n new CustomEvent('map-change', {\n detail: this.map\n })\n )\n\n // 줌 변경 이벤트 전달\n map.addListener('zoom_changed', () => {\n this.dispatchEvent(\n new CustomEvent('zoom-changed', {\n detail: { zoom: map.getZoom() },\n bubbles: true,\n composed: true\n })\n )\n })\n\n this.resetBounds()\n } catch (e) {\n console.error(e)\n }\n }\n\n var { center, zoom = 10 } = this\n\n /* center 속성이 설정되어있지 않으면, 현재 위치를 구해서 지도의 center로 설정한다. */\n if (!center && 'geolocation' in navigator && !this.boundCoords?.length) {\n navigator.geolocation.getCurrentPosition(\n ({ coords: { latitude: lat, longitude: lng } }) => show({ lat, lng }, zoom),\n err => {\n console.warn(`navigator.geolocation.getCurrentPosition failed. (${err.code}): ${err.message}`)\n show(this.defaultCenter, zoom)\n },\n {\n /* https://stackoverflow.com/questions/3397585/navigator-geolocation-getcurrentposition-sometimes-works-sometimes-doesnt */\n timeout: 500\n }\n )\n } else {\n show(center, zoom)\n }\n }\n\n async buildMarkers(locations: any[] = []) {\n if (!this.map) {\n return\n }\n\n if (this.markers) {\n this.markers.forEach(marker => marker.setMap(null))\n this.markers = []\n }\n\n // 기존 클러스터 제거\n if (this._markerClusterer) {\n this._markerClusterer.clearMarkers()\n this._markerClusterer = null\n }\n\n // Google Maps 최신 API 사용\n const { AdvancedMarkerElement, PinElement } = (await google.maps.importLibrary(\n 'marker'\n )) as google.maps.MarkerLibrary\n\n this.markers = locations\n .map(location => {\n // location 객체가 유효한지 확인\n if (!location || typeof location !== 'object') {\n console.warn('Invalid location object:', location)\n return null\n }\n\n // lat, lng 값이 유효한지 확인\n const lat = parseFloat(location.lat)\n const lng = parseFloat(location.lng)\n\n if (isNaN(lat) || isNaN(lng)) {\n console.warn('Invalid lat/lng values:', location)\n return null\n }\n\n // LatLng 객체 생성\n const position = new google.maps.LatLng(lat, lng)\n\n // 커스텀 마커 콘텐츠가 있으면 사용\n let markerElement\n if (location.markerContent) {\n // HTML 문자열을 DOM 요소로 변환\n const tempDiv = document.createElement('div')\n tempDiv.innerHTML = location.markerContent\n markerElement = tempDiv.firstElementChild\n } else {\n // 기본 핀 사용\n markerElement = new PinElement({\n background: '#1976d2',\n borderColor: '#1565c0',\n glyphColor: '#ffffff',\n scale: 1.2\n })\n }\n\n // AdvancedMarkerElement 사용\n const marker = new AdvancedMarkerElement({\n position: position,\n map: this.map,\n content: markerElement\n })\n\n marker.addListener('click', () => {\n // InfoWindow 대신 커스텀 이벤트 발생\n if (location?.region) {\n this.dispatchEvent(\n new CustomEvent('region-click', {\n detail: { region: location.region },\n bubbles: true,\n composed: true\n })\n )\n }\n })\n\n return marker\n })\n .filter(marker => marker !== null) // null 마커 제거\n\n // MarkerClusterer 미사용 — 마커 수가 적으므로 직접 지도에 표시\n }\n\n get infoWindow() {\n if (!this._infoWindow && this.map) {\n this._infoWindow = new google.maps.InfoWindow({\n content: 'loading...'\n })\n }\n\n return this._infoWindow\n }\n\n setFocus(focus, icon) {\n focus.setZIndex(1)\n focus.setIcon(icon)\n }\n\n resetFocus(focus, icon) {\n focus.setZIndex(0)\n focus.setIcon(icon)\n }\n\n async changeFocus(after, before) {\n await this.readyMap()\n\n // map이 준비되지 않았으면 포커스 변경하지 않음\n if (!this.map) {\n return\n }\n\n var locations = this.locations || []\n\n if (before) {\n var idx = locations.findIndex(location => {\n // location 객체의 구조를 안전하게 확인\n const beforePos = before?.position\n const locationPos = location?.position\n\n return (\n location?.name == before?.name && locationPos?.lat == beforePos?.lat && locationPos?.lng == beforePos?.lng\n )\n })\n idx !== -1 && this.markers && this.resetFocus(this.markers[idx], locations[idx]?.icon)\n }\n\n if (after) {\n var idx = locations.findIndex(location => {\n // location 객체의 구조를 안전하게 확인\n const afterPos = after?.position\n const locationPos = location?.position\n\n return location?.name == after?.name && locationPos?.lat == afterPos?.lat && locationPos?.lng == afterPos?.lng\n })\n idx !== -1 && this.markers && this.setFocus(this.markers[idx], after?.icon)\n }\n }\n\n async updated(changes) {\n if (!this.map) {\n await this.readyMap()\n }\n\n if (changes.has('locations')) {\n // 디바운스: 연속된 업데이트를 하나로 묶음\n if (this._buildMarkersTimer) {\n clearTimeout(this._buildMarkersTimer)\n }\n this._buildMarkersTimer = setTimeout(() => {\n this.buildMarkers(this.locations)\n this._buildMarkersTimer = null\n }, 500)\n }\n\n if (changes.has('focused')) {\n this.changeFocus(this.focused, changes.get('focused'))\n }\n\n if (changes.has('center')) {\n this.map.setCenter(this.center)\n }\n\n if (changes.has('controls')) {\n // controls가 변경되면 기존 지도의 옵션만 업데이트\n if (this.map && this.controls) {\n // Google Maps API의 setOptions 메서드 사용\n this.map.setOptions(this.controls)\n }\n }\n\n if (changes.has('polygons')) {\n ;(changes.get('polygons') || []).forEach(geofence => geofence.setMap(null))\n ;(this.polygons || []).forEach(geofence => geofence.setMap(this.map))\n }\n\n if (changes.has('polylines')) {\n ;(changes.get('polylines') || []).forEach(polyline => polyline.setMap(null))\n ;(this.polylines || []).forEach(polyline => polyline.setMap(this.map))\n }\n\n if (changes.has('markers')) {\n ;(changes.get('markers') || []).forEach(marker => marker.setMap(null))\n ;(this.markers || []).forEach(marker => marker.setMap(this.map))\n }\n\n if (changes.has('boundCoords')) {\n this.resetBounds()\n }\n\n // 클러스터링 설정 변경 시 마커 재구성\n if (changes.has('clusterZoom')) {\n this.buildMarkers(this.locations)\n }\n }\n\n render() {\n return html` <div map></div> `\n }\n\n resetBounds() {\n if (!this.boundCoords || this.boundCoords.length < 1 || !this.map) {\n return\n }\n\n var bounds = new google.maps.LatLngBounds()\n this.boundCoords.forEach(coord => bounds.extend(coord))\n this.map.fitBounds(bounds)\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import './kpi-grade-2d-editor.js';
2
+ import { TemplateResult } from 'lit';
3
+ import { KpiListPage } from '@things-factory/kpi/dist-client/pages/kpi/kpi-list-page.js';
4
+ import { KpiGrade2dEditor } from './kpi-grade-2d-editor.js';
5
+ export declare class DsspKpiListPage extends KpiListPage {
6
+ static get scopedElements(): {
7
+ 'kpi-grade-2d-editor': typeof KpiGrade2dEditor;
8
+ 'kpi-importer': typeof import("@things-factory/kpi/dist-client/pages/kpi/kpi-importer.js").KpiImporter;
9
+ 'kpi-grade-editor': typeof import("@things-factory/kpi/dist-client/pages/kpi/kpi-grade-editor.js").KpiGradeEditor;
10
+ 'kpi-viz-editor': typeof import("@things-factory/kpi/dist-client/pages/kpi/kpi-viz-editor.js").KpiVizEditor;
11
+ };
12
+ /**
13
+ * CUSTOM scoreType 셀 렌더러.
14
+ * 2D 룩업 구조인 경우 행 수와 함께 표시.
15
+ */
16
+ protected renderCustomGradesCell(kpi: any): TemplateResult;
17
+ /**
18
+ * CUSTOM scoreType 편집.
19
+ * 2D 룩업이면 kpi-grade-2d-editor 팝업을 연다.
20
+ */
21
+ protected _editCustomGrades(kpi: any): Promise<void>;
22
+ }
@@ -0,0 +1,57 @@
1
+ import { __decorate } from "tslib";
2
+ import './kpi-grade-2d-editor.js';
3
+ import { html } from 'lit';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { openPopup } from '@operato/layout';
6
+ import { KpiListPage } from '@things-factory/kpi/dist-client/pages/kpi/kpi-list-page.js';
7
+ import { KpiGrade2dEditor } from './kpi-grade-2d-editor.js';
8
+ let DsspKpiListPage = class DsspKpiListPage extends KpiListPage {
9
+ static get scopedElements() {
10
+ return Object.assign(Object.assign({}, super.scopedElements), { 'kpi-grade-2d-editor': KpiGrade2dEditor });
11
+ }
12
+ /**
13
+ * CUSTOM scoreType 셀 렌더러.
14
+ * 2D 룩업 구조인 경우 행 수와 함께 표시.
15
+ */
16
+ renderCustomGradesCell(kpi) {
17
+ var _a, _b;
18
+ const grades = kpi.grades;
19
+ const sub = grades === null || grades === void 0 ? void 0 : grades.type;
20
+ let label;
21
+ if (sub === 'PROGRESS_DEVIATION_LOOKUP' || sub === '2d-lookup') {
22
+ const rowCount = (_b = (_a = grades === null || grades === void 0 ? void 0 : grades.rows) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
23
+ label = `2D 룩업 (${rowCount}행)`;
24
+ }
25
+ else {
26
+ label = `커스텀 (${sub !== null && sub !== void 0 ? sub : '?'})`;
27
+ }
28
+ return html `<span
29
+ style="color:#4caf50;cursor:pointer;"
30
+ @click=${() => this._editGrades(kpi)}
31
+ >${label}</span
32
+ >`;
33
+ }
34
+ /**
35
+ * CUSTOM scoreType 편집.
36
+ * 2D 룩업이면 kpi-grade-2d-editor 팝업을 연다.
37
+ */
38
+ async _editCustomGrades(kpi) {
39
+ var _a;
40
+ const gradeType = (_a = kpi.grades) === null || _a === void 0 ? void 0 : _a.type;
41
+ if (gradeType !== 'PROGRESS_DEVIATION_LOOKUP' && gradeType !== '2d-lookup') {
42
+ return super._editCustomGrades(kpi);
43
+ }
44
+ const popup = await openPopup(html `<kpi-grade-2d-editor .kpi=${kpi}></kpi-grade-2d-editor>`, {
45
+ title: `${kpi.name} — 2D 룩업 편집`,
46
+ size: 'large'
47
+ });
48
+ popup.onclosed = () => {
49
+ this.grist.fetch();
50
+ };
51
+ }
52
+ };
53
+ DsspKpiListPage = __decorate([
54
+ customElement('dssp-kpi-list-page')
55
+ ], DsspKpiListPage);
56
+ export { DsspKpiListPage };
57
+ //# sourceMappingURL=dssp-kpi-list-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dssp-kpi-list-page.js","sourceRoot":"","sources":["../../../client/pages/kpi-admin/dssp-kpi-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,4DAA4D,CAAA;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAGpD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;IAC9C,MAAM,KAAc,cAAc;QAChC,uCACK,KAAK,CAAC,cAAc,KACvB,qBAAqB,EAAE,gBAAgB,IACxC;IACH,CAAC;IAED;;;OAGG;IACgB,sBAAsB,CAAC,GAAQ;;QAChD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM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nimport { html, TemplateResult } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport { openPopup } from '@operato/layout'\nimport { KpiListPage } from '@things-factory/kpi/dist-client/pages/kpi/kpi-list-page.js'\nimport { KpiGrade2dEditor } from './kpi-grade-2d-editor.js'\n\n@customElement('dssp-kpi-list-page')\nexport class DsspKpiListPage extends KpiListPage {\n static override get scopedElements() {\n return {\n ...super.scopedElements,\n 'kpi-grade-2d-editor': KpiGrade2dEditor\n }\n }\n\n /**\n * CUSTOM scoreType 셀 렌더러.\n * 2D 룩업 구조인 경우 행 수와 함께 표시.\n */\n protected override renderCustomGradesCell(kpi: any): TemplateResult {\n const grades = kpi.grades\n const sub = grades?.type\n let label: string\n\n if (sub === 'PROGRESS_DEVIATION_LOOKUP' || sub === '2d-lookup') {\n const rowCount = grades?.rows?.length ?? 0\n label = `2D 룩업 (${rowCount}행)`\n } else {\n label = `커스텀 (${sub ?? '?'})`\n }\n\n return html`<span\n style=\"color:#4caf50;cursor:pointer;\"\n @click=${() => this._editGrades(kpi)}\n >${label}</span\n >`\n }\n\n /**\n * CUSTOM scoreType 편집.\n * 2D 룩업이면 kpi-grade-2d-editor 팝업을 연다.\n */\n protected override async _editCustomGrades(kpi: any) {\n const gradeType = kpi.grades?.type\n if (gradeType !== 'PROGRESS_DEVIATION_LOOKUP' && gradeType !== '2d-lookup') {\n return super._editCustomGrades(kpi)\n }\n\n const popup = await openPopup(html`<kpi-grade-2d-editor .kpi=${kpi}></kpi-grade-2d-editor>`, {\n title: `${kpi.name} — 2D 룩업 편집`,\n size: 'large'\n })\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import '@material/web/button/filled-button.js';
2
+ import '@material/web/icon/icon.js';
3
+ import '@operato/data-grist/ox-grist.js';
4
+ import { LitElement } from 'lit';
5
+ export declare class KpiGrade2dEditor extends LitElement {
6
+ static styles: import("lit").CSSResult[];
7
+ kpi: any;
8
+ private rows;
9
+ private gristConfig;
10
+ private grist;
11
+ private svgEl;
12
+ firstUpdated(): void;
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ private _fetchHandler;
15
+ private _onGristChange;
16
+ private _getCurrentRows;
17
+ private _drawChart;
18
+ private _validate;
19
+ private _save;
20
+ }
@@ -0,0 +1,445 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/button/filled-button.js';
3
+ import '@material/web/icon/icon.js';
4
+ import '@operato/data-grist/ox-grist.js';
5
+ import gql from 'graphql-tag';
6
+ import * as d3 from 'd3';
7
+ import { LitElement, css, html } from 'lit';
8
+ import { customElement, property, state, query } from 'lit/decorators.js';
9
+ import { client } from '@operato/graphql';
10
+ import { notify } from '@operato/layout';
11
+ import { CommonHeaderStyles } from '@operato/styles';
12
+ import { DataGrist } from '@operato/data-grist';
13
+ // 점수 구간 정의 (높은 점수 = 좋음 = 낮은 공기편차)
14
+ const SCORE_ZONES = [
15
+ { score: 5, label: '5점', color: '#1b5e20', fillColor: 'rgba(76,175,80,0.15)' },
16
+ { score: 4, label: '4점', color: '#33691e', fillColor: 'rgba(139,195,74,0.15)' },
17
+ { score: 3, label: '3점', color: '#e65100', fillColor: 'rgba(255,193,7,0.15)' },
18
+ { score: 2, label: '2점', color: '#bf360c', fillColor: 'rgba(255,152,0,0.15)' },
19
+ { score: 1, label: '1점', color: '#b71c1c', fillColor: 'rgba(244,67,54,0.15)' }
20
+ ];
21
+ const BOUNDARIES = [
22
+ { key: 'boundary5to4', label: '5점 기준선', subLabel: '이하 → 5점', color: '#4caf50' },
23
+ { key: 'boundary4to3', label: '4점 기준선', subLabel: '이하 → 4점', color: '#8bc34a' },
24
+ { key: 'boundary3to2', label: '3점 기준선', subLabel: '이하 → 3점', color: '#ff9800' },
25
+ { key: 'boundary2to1', label: '2점 기준선', subLabel: '이하 → 2점', color: '#f44336' }
26
+ ];
27
+ let KpiGrade2dEditor = class KpiGrade2dEditor extends LitElement {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.rows = [];
31
+ this.gristConfig = null;
32
+ }
33
+ firstUpdated() {
34
+ var _a;
35
+ const grades = (_a = this.kpi) === null || _a === void 0 ? void 0 : _a.grades;
36
+ this.rows = (grades === null || grades === void 0 ? void 0 : grades.rows) ? grades.rows.map((r) => (Object.assign({}, r))) : [];
37
+ this.gristConfig = {
38
+ list: { fields: ['progressRate', 'boundary5to4', 'boundary4to3', 'boundary3to2', 'boundary2to1'] },
39
+ columns: [
40
+ { type: 'gutter', gutterName: 'sequence', fixed: true },
41
+ {
42
+ type: 'number',
43
+ name: 'progressRate',
44
+ header: '공정률 (%)',
45
+ record: { editable: false },
46
+ sortable: false,
47
+ width: 90
48
+ },
49
+ {
50
+ type: 'number',
51
+ name: 'boundary5to4',
52
+ header: '5점 기준선',
53
+ record: { editable: true, align: 'right' },
54
+ width: 110
55
+ },
56
+ {
57
+ type: 'number',
58
+ name: 'boundary4to3',
59
+ header: '4점 기준선',
60
+ record: { editable: true, align: 'right' },
61
+ width: 110
62
+ },
63
+ {
64
+ type: 'number',
65
+ name: 'boundary3to2',
66
+ header: '3점 기준선',
67
+ record: { editable: true, align: 'right' },
68
+ width: 110
69
+ },
70
+ {
71
+ type: 'number',
72
+ name: 'boundary2to1',
73
+ header: '2점 기준선',
74
+ record: { editable: true, align: 'right' },
75
+ width: 110
76
+ }
77
+ ],
78
+ rows: { selectable: false, appendable: false },
79
+ pagination: { infinite: true }
80
+ };
81
+ requestAnimationFrame(() => this._drawChart(this.rows));
82
+ }
83
+ render() {
84
+ return html `
85
+ <div class="info-bar">
86
+ <span><strong>X축</strong>: 공정률 (%)</span>
87
+ <span><strong>Y축</strong>: 공기편차 (%)</span>
88
+ <span class="arrow">|</span>
89
+ <span class="rule">
90
+ 공기편차
91
+ <span class="score-badge" style="background:#4caf50">5</span>
92
+ 기준선 미만 → 5점,
93
+ <span class="score-badge" style="background:#8bc34a">4</span>
94
+ 기준선 미만 → 4점,
95
+ <span class="score-badge" style="background:#ff9800">3</span>
96
+ 기준선 미만 → 3점,
97
+ <span class="score-badge" style="background:#f44336">2</span>
98
+ 기준선 미만 → 2점, 초과 → 1점
99
+ </span>
100
+ </div>
101
+
102
+ <div class="chart-wrap">
103
+ <svg height="220"></svg>
104
+ </div>
105
+
106
+ <div class="legend">
107
+ ${BOUNDARIES.map(b => html `
108
+ <div class="legend-item">
109
+ <div class="legend-line" style="background:${b.color}"></div>
110
+ <span>${b.label}</span>
111
+ <span class="legend-sub">(${b.subLabel})</span>
112
+ </div>
113
+ `)}
114
+ </div>
115
+
116
+ <ox-grist
117
+ .mode=${'GRID'}
118
+ .config=${this.gristConfig}
119
+ .fetchHandler=${this._fetchHandler.bind(this)}
120
+ @change=${this._onGristChange}
121
+ ></ox-grist>
122
+
123
+ <div class="footer">
124
+ <md-filled-button @click=${this._save}>
125
+ <md-icon slot="icon">save</md-icon>
126
+ 저장
127
+ </md-filled-button>
128
+ </div>
129
+ `;
130
+ }
131
+ async _fetchHandler({ page, limit }) {
132
+ return { total: this.rows.length, records: this.rows };
133
+ }
134
+ _onGristChange() {
135
+ this._drawChart(this._getCurrentRows());
136
+ }
137
+ _getCurrentRows() {
138
+ var _a, _b;
139
+ const records = (_b = (_a = this.grist) === null || _a === void 0 ? void 0 : _a.dirtyData) === null || _b === void 0 ? void 0 : _b.records;
140
+ if (!records || records.length === 0)
141
+ return this.rows;
142
+ return records.map((r) => ({
143
+ progressRate: r.progressRate,
144
+ boundary5to4: Number(r.boundary5to4),
145
+ boundary4to3: Number(r.boundary4to3),
146
+ boundary3to2: Number(r.boundary3to2),
147
+ boundary2to1: Number(r.boundary2to1)
148
+ }));
149
+ }
150
+ _drawChart(rows) {
151
+ if (!this.svgEl || !rows.length)
152
+ return;
153
+ const W = this.svgEl.clientWidth || 560;
154
+ const H = 220;
155
+ const m = { top: 16, right: 32, bottom: 36, left: 56 };
156
+ const w = W - m.left - m.right;
157
+ const h = H - m.top - m.bottom;
158
+ const svg = d3.select(this.svgEl).attr('height', H);
159
+ svg.selectAll('*').remove();
160
+ const g = svg.append('g').attr('transform', `translate(${m.left},${m.top})`);
161
+ const x = d3.scaleLinear().domain([0, 99]).range([0, w]);
162
+ const allVals = rows.flatMap(r => [r.boundary5to4, r.boundary4to3, r.boundary3to2, r.boundary2to1]);
163
+ const [yMin, yMax] = d3.extent(allVals);
164
+ const pad = (yMax - yMin) * 0.15 || 5;
165
+ const y = d3.scaleLinear().domain([yMin - pad, yMax + pad]).range([h, 0]);
166
+ // 점수 구간 채우기 (5개 존)
167
+ const zoneDefs = [
168
+ { y0: _r => h, y1: r => y(r.boundary5to4), fill: 'rgba(76,175,80,0.12)', label: '5점' },
169
+ { y0: r => y(r.boundary5to4), y1: r => y(r.boundary4to3), fill: 'rgba(139,195,74,0.12)', label: '4점' },
170
+ { y0: r => y(r.boundary4to3), y1: r => y(r.boundary3to2), fill: 'rgba(255,193,7,0.12)', label: '3점' },
171
+ { y0: r => y(r.boundary3to2), y1: r => y(r.boundary2to1), fill: 'rgba(255,152,0,0.12)', label: '2점' },
172
+ { y0: r => y(r.boundary2to1), y1: _r => 0, fill: 'rgba(244,67,54,0.12)', label: '1점' }
173
+ ];
174
+ for (const zone of zoneDefs) {
175
+ const area = d3.area()
176
+ .x(r => x(r.progressRate))
177
+ .y0(zone.y0)
178
+ .y1(zone.y1)
179
+ .curve(d3.curveMonotoneX);
180
+ g.append('path')
181
+ .datum(rows)
182
+ .attr('fill', zone.fill)
183
+ .attr('d', area);
184
+ }
185
+ // 중간 공정률 지점에 점수 레이블
186
+ const midRow = rows[Math.floor(rows.length / 2)];
187
+ if (midRow) {
188
+ const scoreColors = ['#2e7d32', '#558b2f', '#f57f17', '#e65100', '#c62828'];
189
+ const scorePositions = [
190
+ (h + y(midRow.boundary5to4)) / 2,
191
+ (y(midRow.boundary5to4) + y(midRow.boundary4to3)) / 2,
192
+ (y(midRow.boundary4to3) + y(midRow.boundary3to2)) / 2,
193
+ (y(midRow.boundary3to2) + y(midRow.boundary2to1)) / 2,
194
+ y(midRow.boundary2to1) / 2
195
+ ];
196
+ const scoreLabels = ['5점', '4점', '3점', '2점', '1점'];
197
+ scorePositions.forEach((yPos, i) => {
198
+ if (yPos > 4 && yPos < h - 4) {
199
+ g.append('text')
200
+ .attr('x', w - 4)
201
+ .attr('y', yPos)
202
+ .attr('text-anchor', 'end')
203
+ .attr('dominant-baseline', 'middle')
204
+ .attr('font-size', '10px')
205
+ .attr('font-weight', 'bold')
206
+ .attr('fill', scoreColors[i])
207
+ .attr('opacity', 0.8)
208
+ .text(scoreLabels[i]);
209
+ }
210
+ });
211
+ }
212
+ // 격자선
213
+ g.append('g')
214
+ .attr('stroke', '#e0e0e0')
215
+ .attr('stroke-dasharray', '2,3')
216
+ .selectAll('line')
217
+ .data(y.ticks(5))
218
+ .join('line')
219
+ .attr('x1', 0).attr('x2', w)
220
+ .attr('y1', d => y(d)).attr('y2', d => y(d));
221
+ // y=0 기준선 (공기편차 0%)
222
+ const yZero = y(0);
223
+ if (yZero >= 0 && yZero <= h) {
224
+ g.append('line')
225
+ .attr('x1', 0).attr('x2', w)
226
+ .attr('y1', yZero).attr('y2', yZero)
227
+ .attr('stroke', '#90a4ae')
228
+ .attr('stroke-width', 1)
229
+ .attr('stroke-dasharray', '4,2');
230
+ g.append('text')
231
+ .attr('x', -4)
232
+ .attr('y', yZero)
233
+ .attr('text-anchor', 'end')
234
+ .attr('dominant-baseline', 'middle')
235
+ .attr('font-size', '9px')
236
+ .attr('fill', '#90a4ae')
237
+ .text('0%');
238
+ }
239
+ // X축
240
+ g.append('g')
241
+ .attr('transform', `translate(0,${h})`)
242
+ .call(d3.axisBottom(x).ticks(10).tickFormat(d => `${d}%`))
243
+ .selectAll('text')
244
+ .style('font-size', '10px');
245
+ // X축 레이블
246
+ g.append('text')
247
+ .attr('x', w / 2)
248
+ .attr('y', h + 30)
249
+ .attr('text-anchor', 'middle')
250
+ .attr('font-size', '11px')
251
+ .attr('fill', '#666')
252
+ .text('공정률 (%)');
253
+ // Y축
254
+ g.append('g')
255
+ .call(d3.axisLeft(y).ticks(5))
256
+ .selectAll('text')
257
+ .style('font-size', '10px');
258
+ // Y축 레이블
259
+ g.append('text')
260
+ .attr('transform', 'rotate(-90)')
261
+ .attr('x', -h / 2)
262
+ .attr('y', -44)
263
+ .attr('text-anchor', 'middle')
264
+ .attr('font-size', '11px')
265
+ .attr('fill', '#666')
266
+ .text('공기편차 (%)');
267
+ // 4개 경계선
268
+ for (const { key, color } of BOUNDARIES) {
269
+ const line = d3
270
+ .line()
271
+ .x(r => x(r.progressRate))
272
+ .y(r => y(r[key]))
273
+ .curve(d3.curveMonotoneX);
274
+ g.append('path')
275
+ .datum(rows)
276
+ .attr('fill', 'none')
277
+ .attr('stroke', color)
278
+ .attr('stroke-width', 2)
279
+ .attr('d', line);
280
+ }
281
+ }
282
+ _validate(rows) {
283
+ for (const row of rows) {
284
+ const { progressRate: p, boundary5to4: b54, boundary4to3: b43, boundary3to2: b32, boundary2to1: b21 } = row;
285
+ if (!(b54 < b43 && b43 < b32 && b32 < b21)) {
286
+ notify({
287
+ message: `공정률 ${p}%행: 기준선 값이 잘못됐습니다. 5점 < 4점 < 3점 < 2점 기준선 순서여야 합니다.`,
288
+ level: 'error'
289
+ });
290
+ return false;
291
+ }
292
+ }
293
+ return true;
294
+ }
295
+ async _save() {
296
+ const rows = this._getCurrentRows();
297
+ if (!this._validate(rows))
298
+ return;
299
+ const grades = { type: 'PROGRESS_DEVIATION_LOOKUP', rows };
300
+ try {
301
+ await client.mutate({
302
+ mutation: gql `
303
+ mutation ($id: String!, $patch: KpiPatch!) {
304
+ updateKpi(id: $id, patch: $patch) {
305
+ id
306
+ grades
307
+ scoreType
308
+ }
309
+ }
310
+ `,
311
+ variables: {
312
+ id: this.kpi.id,
313
+ patch: { grades, scoreType: 'CUSTOM' }
314
+ }
315
+ });
316
+ this.rows = rows;
317
+ this._drawChart(rows);
318
+ notify({ message: '저장되었습니다.' });
319
+ }
320
+ catch (e) {
321
+ notify({ message: '저장 중 오류가 발생했습니다.', level: 'error' });
322
+ }
323
+ }
324
+ };
325
+ KpiGrade2dEditor.styles = [
326
+ CommonHeaderStyles,
327
+ css `
328
+ :host {
329
+ display: flex;
330
+ flex-direction: column;
331
+ height: 100%;
332
+ background-color: var(--md-sys-color-surface);
333
+ }
334
+
335
+ .info-bar {
336
+ display: flex;
337
+ align-items: center;
338
+ gap: 24px;
339
+ padding: 8px 16px;
340
+ background: var(--md-sys-color-surface-variant, #f5f5f5);
341
+ border-bottom: 1px solid var(--md-sys-color-outline-variant, #ddd);
342
+ font-size: 12px;
343
+ color: var(--md-sys-color-on-surface-variant, #555);
344
+ flex-shrink: 0;
345
+ }
346
+
347
+ .info-bar .rule {
348
+ display: flex;
349
+ align-items: center;
350
+ gap: 6px;
351
+ }
352
+
353
+ .info-bar .arrow {
354
+ color: #888;
355
+ }
356
+
357
+ .score-badge {
358
+ display: inline-flex;
359
+ align-items: center;
360
+ justify-content: center;
361
+ width: 20px;
362
+ height: 20px;
363
+ border-radius: 50%;
364
+ font-size: 11px;
365
+ font-weight: bold;
366
+ color: #fff;
367
+ }
368
+
369
+ .chart-wrap {
370
+ padding: 8px 16px 0;
371
+ flex-shrink: 0;
372
+ position: relative;
373
+ }
374
+
375
+ .chart-wrap svg {
376
+ width: 100%;
377
+ display: block;
378
+ }
379
+
380
+ .legend {
381
+ display: flex;
382
+ gap: 20px;
383
+ padding: 4px 16px 8px;
384
+ font-size: 12px;
385
+ flex-shrink: 0;
386
+ flex-wrap: wrap;
387
+ }
388
+
389
+ .legend-item {
390
+ display: flex;
391
+ align-items: center;
392
+ gap: 6px;
393
+ }
394
+
395
+ .legend-line {
396
+ width: 20px;
397
+ height: 3px;
398
+ border-radius: 2px;
399
+ }
400
+
401
+ .legend-sub {
402
+ color: #888;
403
+ font-size: 11px;
404
+ }
405
+
406
+ ox-grist {
407
+ flex: 1;
408
+ overflow: hidden;
409
+ }
410
+
411
+ .footer {
412
+ display: flex;
413
+ justify-content: flex-end;
414
+ gap: 8px;
415
+ padding: 8px 16px;
416
+ border-top: 1px solid var(--md-sys-color-outline-variant, #ccc);
417
+ flex-shrink: 0;
418
+ }
419
+ `
420
+ ];
421
+ __decorate([
422
+ property({ type: Object }),
423
+ __metadata("design:type", Object)
424
+ ], KpiGrade2dEditor.prototype, "kpi", void 0);
425
+ __decorate([
426
+ state(),
427
+ __metadata("design:type", Array)
428
+ ], KpiGrade2dEditor.prototype, "rows", void 0);
429
+ __decorate([
430
+ state(),
431
+ __metadata("design:type", Object)
432
+ ], KpiGrade2dEditor.prototype, "gristConfig", void 0);
433
+ __decorate([
434
+ query('ox-grist'),
435
+ __metadata("design:type", DataGrist)
436
+ ], KpiGrade2dEditor.prototype, "grist", void 0);
437
+ __decorate([
438
+ query('svg'),
439
+ __metadata("design:type", SVGElement)
440
+ ], KpiGrade2dEditor.prototype, "svgEl", void 0);
441
+ KpiGrade2dEditor = __decorate([
442
+ customElement('kpi-grade-2d-editor')
443
+ ], KpiGrade2dEditor);
444
+ export { KpiGrade2dEditor };
445
+ //# sourceMappingURL=kpi-grade-2d-editor.js.map