@opsnow-mcp/opsnow-mcp-common-ui-server 1.0.40 → 1.0.42
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.
- package/build/components/all-component-tools.js +2 -0
- package/build/components/data/icon-names.generated.js +341 -0
- package/build/components/data/icon-names.js +32 -16
- package/build/components/examples/opsnow-common-chart-examples-data.js +73 -471
- package/build/components/examples/opsnow-common-forms-examples-data.js +1 -11
- package/build/components/examples/opsnow-common-grid-examples-data.js +93 -129
- package/build/components/examples/opsnow-common-layout-examples-data.js +12 -13
- package/build/components/examples/opsnow-common-popup-examples-data.js +14 -28
- package/build/components/examples/opsnow-common-progress-examples-data.js +0 -5
- package/build/components/examples/opsnow-common-select-examples-data.js +16 -0
- package/build/components/examples/opsnow-common-stepper-examples-data.js +2 -3
- package/build/components/examples/opsnow-common-storage-examples-data.js +23 -4
- package/build/components/examples/opsnow-common-tab-examples-data.js +37 -0
- package/build/components/examples/opsnow-common-tooltip-examples-data.js +1 -21
- package/build/components/opsnow-common-calendar.js +36 -15
- package/build/components/opsnow-common-chart.js +245 -156
- package/build/components/opsnow-common-coach-mark.js +3 -2
- package/build/components/opsnow-common-data-status.js +17 -11
- package/build/components/opsnow-common-dropdown.js +80 -0
- package/build/components/opsnow-common-examples.js +4 -2
- package/build/components/opsnow-common-file-upload.js +4 -1
- package/build/components/opsnow-common-forms.js +73 -36
- package/build/components/opsnow-common-grid.js +110 -79
- package/build/components/opsnow-common-icons.js +23 -39
- package/build/components/opsnow-common-jsx-helper.js +36 -0
- package/build/components/opsnow-common-layout.js +66 -25
- package/build/components/opsnow-common-notification.js +3 -2
- package/build/components/opsnow-common-pagination.js +4 -4
- package/build/components/opsnow-common-popup.js +12 -11
- package/build/components/opsnow-common-progress.js +10 -16
- package/build/components/opsnow-common-select.js +30 -15
- package/build/components/opsnow-common-stepper.js +30 -7
- package/build/components/opsnow-common-tab.js +26 -3
- package/build/components/opsnow-common-toast-popup.js +1 -0
- package/build/components/opsnow-common-tooltip.js +44 -46
- package/build/components/opsnow-common-typography.js +11 -5
- package/build/components/opsnow-common-validate-props.js +0 -0
- package/build/index.js +43 -0
- package/package.json +2 -1
|
@@ -1135,16 +1135,6 @@ export const CollapseExamples = [
|
|
|
1135
1135
|
<div>This is the content inside the collapse component.</div>
|
|
1136
1136
|
</OpsnowCommonCollapse>`,
|
|
1137
1137
|
description: '기본 Collapse 예제입니다.'
|
|
1138
|
-
},
|
|
1139
|
-
{
|
|
1140
|
-
title: 'controlled-collapse',
|
|
1141
|
-
code: `<OpsnowCommonCollapse
|
|
1142
|
-
label="Toggle ContentToggle ContentToggle ContentToggle ContentToggle ContentToggle ContentToggle ContentToggle ContentToggle Content"
|
|
1143
|
-
defaultExpanded
|
|
1144
|
-
>
|
|
1145
|
-
<div>This is the content inside the collapse component.</div>
|
|
1146
|
-
</OpsnowCommonCollapse>`,
|
|
1147
|
-
description: 'defaultExpanded 속성이 설정된 Collapse 예제입니다.'
|
|
1148
1138
|
}
|
|
1149
1139
|
];
|
|
1150
1140
|
export const SliderExamples = [
|
|
@@ -1782,7 +1772,7 @@ const [customRate, setCustomRate] = useState(null) // 앵커 통화 1단위당
|
|
|
1782
1772
|
}}
|
|
1783
1773
|
/>`,
|
|
1784
1774
|
description: "환율 직접 입력(시뮬레이션) 예제입니다 (2.0.11+). 시뮬레이션 섹션은 showDetail && simulationAnchorCurrency 지정 && 앵커 !== 선택 통화 3조건으로만 노출되며, 선택 통화가 USD여도 앵커가 다르면 노출됩니다. 입력 라벨은 '1 {simulationAnchorCurrency} = [입력] {선택 통화}'이고 입력창에 현재 환율 placeholder는 없습니다. onCustomRateChange의 context.currency는 적용·초기화·통화 변경 모두 항상 simulationAnchorCurrency이며, 값은 적용/Enter 시 입력값·초기화/통화 변경 시 null로 통지됩니다(입력 중 미호출). defaultTargetCurrency·simulationTarget은 @deprecated로 무시되니 앵커는 simulationAnchorCurrency로 지정하세요. [검색 키워드: 환율 시뮬레이션, 직접 입력, what-if, 커스텀 환율, showDetail, simulationAnchorCurrency, customRate]"
|
|
1785
|
-
}
|
|
1775
|
+
}
|
|
1786
1776
|
];
|
|
1787
1777
|
export const ToggleButtonExamples = [
|
|
1788
1778
|
{
|
|
@@ -281,8 +281,6 @@ export const DataGridExamples = [
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
const defaultColDef = {
|
|
284
|
-
wrapText: true,
|
|
285
|
-
autoHeight: true,
|
|
286
284
|
suppressMenu: true,
|
|
287
285
|
unSortIcon: true,
|
|
288
286
|
sortable: true,
|
|
@@ -434,8 +432,6 @@ export const DataGridExamples = [
|
|
|
434
432
|
}
|
|
435
433
|
|
|
436
434
|
const defaultColDef = {
|
|
437
|
-
wrapText: true,
|
|
438
|
-
autoHeight: true,
|
|
439
435
|
suppressMenu: true,
|
|
440
436
|
unSortIcon: true,
|
|
441
437
|
sortable: true,
|
|
@@ -492,9 +488,8 @@ export const DataGridExamples = [
|
|
|
492
488
|
defaultColDef={defaultColDef}
|
|
493
489
|
rowData={rowData}
|
|
494
490
|
status={status} // 상태를 전달
|
|
495
|
-
gridOptions={gridOptions}
|
|
491
|
+
gridOptions={{ ...gridOptions, pinnedTopRowData }} // pinned row는 gridOptions로 전달
|
|
496
492
|
pagination={true}
|
|
497
|
-
pinnedTopRowData={pinnedTopRowData} // pinned row 전달
|
|
498
493
|
langCd={i18n.getLocale()}
|
|
499
494
|
/>`
|
|
500
495
|
},
|
|
@@ -508,8 +503,6 @@ export const DataGridExamples = [
|
|
|
508
503
|
|
|
509
504
|
// 기본 컬럼 정의
|
|
510
505
|
const defaultColDef = {
|
|
511
|
-
wrapText: true,
|
|
512
|
-
autoHeight: true,
|
|
513
506
|
suppressMenu: true, // 개별 컬럼에서 메뉴를 노출하려면 재설정할 예정
|
|
514
507
|
resizable: true,
|
|
515
508
|
sortable: false,
|
|
@@ -665,8 +658,6 @@ export const DataGridExamples = [
|
|
|
665
658
|
]
|
|
666
659
|
|
|
667
660
|
const defaultColDef = {
|
|
668
|
-
wrapText: true,
|
|
669
|
-
autoHeight: true,
|
|
670
661
|
suppressMenu: true,
|
|
671
662
|
unSortIcon: true,
|
|
672
663
|
sortable: false,
|
|
@@ -705,8 +696,6 @@ export const DataGridExamples = [
|
|
|
705
696
|
]
|
|
706
697
|
|
|
707
698
|
const defaultColDef = {
|
|
708
|
-
wrapText: true,
|
|
709
|
-
autoHeight: true,
|
|
710
699
|
suppressMenu: true,
|
|
711
700
|
unSortIcon: true,
|
|
712
701
|
sortable: false,
|
|
@@ -993,8 +982,6 @@ export const DataGridExamples = [
|
|
|
993
982
|
}
|
|
994
983
|
|
|
995
984
|
const defaultColDef = {
|
|
996
|
-
wrapText: true,
|
|
997
|
-
autoHeight: true,
|
|
998
985
|
suppressMenu: true,
|
|
999
986
|
unSortIcon: true,
|
|
1000
987
|
sortable: true,
|
|
@@ -1144,8 +1131,6 @@ export const DataGridExamples = [
|
|
|
1144
1131
|
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
1145
1132
|
|
|
1146
1133
|
const defaultColDef = {
|
|
1147
|
-
wrapText: true,
|
|
1148
|
-
autoHeight: true,
|
|
1149
1134
|
suppressMenu: true,
|
|
1150
1135
|
unSortIcon: true,
|
|
1151
1136
|
resizable: true,
|
|
@@ -1271,8 +1256,6 @@ export const DataGridExamples = [
|
|
|
1271
1256
|
// 달력 컴포넌트를 searchAddon에 전달
|
|
1272
1257
|
searchAddon={
|
|
1273
1258
|
<OpsnowCommonDatePicker
|
|
1274
|
-
clearable={true}
|
|
1275
|
-
placeholderText="날짜를 선택해주세요"
|
|
1276
1259
|
type="date"
|
|
1277
1260
|
value={time}
|
|
1278
1261
|
onChange={onChangeMonth}
|
|
@@ -1305,8 +1288,6 @@ export const DataGridExamples = [
|
|
|
1305
1288
|
|
|
1306
1289
|
// 기본 컬럼 설정
|
|
1307
1290
|
const defaultColDef = {
|
|
1308
|
-
wrapText: true,
|
|
1309
|
-
autoHeight: true,
|
|
1310
1291
|
suppressMenu: true,
|
|
1311
1292
|
unSortIcon: true,
|
|
1312
1293
|
sortable: false,
|
|
@@ -1508,8 +1489,6 @@ export const DataGridExamples = [
|
|
|
1508
1489
|
const [colDefs1, setColDefs1] = useState([])
|
|
1509
1490
|
const [colDefs2, setColDefs2] = useState([])
|
|
1510
1491
|
const defaultColDef = {
|
|
1511
|
-
wrapText: true,
|
|
1512
|
-
autoHeight: true,
|
|
1513
1492
|
suppressMenu: true,
|
|
1514
1493
|
unSortIcon: true,
|
|
1515
1494
|
resizable: true,
|
|
@@ -1786,8 +1765,6 @@ export const DataGridExamples = [
|
|
|
1786
1765
|
|
|
1787
1766
|
// 공통 컬럼 정의
|
|
1788
1767
|
const defaultColDef = {
|
|
1789
|
-
wrapText: true,
|
|
1790
|
-
autoHeight: true,
|
|
1791
1768
|
suppressMenu: true,
|
|
1792
1769
|
unSortIcon: true,
|
|
1793
1770
|
sortable: false,
|
|
@@ -2192,124 +2169,82 @@ export const DataGridExamples = [
|
|
|
2192
2169
|
/>`
|
|
2193
2170
|
},
|
|
2194
2171
|
{
|
|
2195
|
-
title: 'Error Status',
|
|
2196
|
-
description: '
|
|
2172
|
+
title: 'Error Status (다시 시도 onRetry)',
|
|
2173
|
+
description: '오류 상태 예제입니다. 오류·로딩·데이터 없음·검색 결과 없음 문구는 그리드가 langCd(ko/en/ja)에 맞는 표준 문구로 표시하므로 textErrorTitle/textErrorDescription 등은 넘기지 않는 것이 기본입니다 (화면 고유 문구가 꼭 필요할 때만 지정). onRetry를 넘기면 오류 상태에 [다시 시도] 버튼이 생기고, 누르면 onRetry가 호출됩니다 — 보통 재조회 함수를 그대로 넘깁니다.',
|
|
2197
2174
|
code_props_usage: `
|
|
2175
|
+
import { useState, useEffect, useCallback } from 'react'
|
|
2198
2176
|
import { useCommonComponents, useGlobalContext } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
2199
2177
|
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
2200
2178
|
|
|
2201
|
-
// 컬럼 정의
|
|
2202
2179
|
const columnDefs = [
|
|
2203
2180
|
{ headerName: 'Make', field: 'make' },
|
|
2204
2181
|
{ headerName: 'Model', field: 'model' },
|
|
2205
|
-
{ headerName: 'Price', field: 'price' },
|
|
2182
|
+
{ headerName: 'Price', field: 'price', type: ['cost'] },
|
|
2206
2183
|
]
|
|
2207
2184
|
|
|
2208
2185
|
const gridOptions = {
|
|
2209
2186
|
animateRows: true,
|
|
2210
2187
|
rowSelection: { mode: 'singleRow', checkboxes: false, enableClickSelection: true },
|
|
2211
|
-
tooltipShowDelay: 100,
|
|
2212
2188
|
domLayout: 'autoHeight',
|
|
2213
2189
|
suppressCellFocus: true,
|
|
2214
2190
|
}
|
|
2215
2191
|
|
|
2216
2192
|
const { OpsnowCommonDataGrid } = useCommonComponents();
|
|
2217
2193
|
const { CommonConst } = useGlobalContext()
|
|
2218
|
-
|
|
2219
|
-
const [
|
|
2220
|
-
|
|
2221
|
-
// 에러 상태 시뮬레이션을 위한 useEffect
|
|
2222
|
-
useEffect(() => {
|
|
2223
|
-
// 1초 후에 에러 상태로 설정
|
|
2224
|
-
const timeoutId = setTimeout(() => {
|
|
2225
|
-
setErrorStatus(CommonConst.GRID_STATUS.ERROR)
|
|
2226
|
-
}, 1000)
|
|
2194
|
+
const [status, setStatus] = useState(CommonConst.GRID_STATUS.LOADING)
|
|
2195
|
+
const [rowData, setRowData] = useState([])
|
|
2227
2196
|
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2197
|
+
// 조회 함수 — onRetry에도 그대로 넘긴다
|
|
2198
|
+
const fetchData = useCallback(async () => {
|
|
2199
|
+
setStatus(CommonConst.GRID_STATUS.LOADING)
|
|
2200
|
+
try {
|
|
2201
|
+
// 실제로는 API 호출: const { data } = await getAxios().get('/api/cars')
|
|
2202
|
+
await new Promise((_, reject) => setTimeout(() => reject(new Error('demo error')), 1000))
|
|
2203
|
+
setRowData([])
|
|
2204
|
+
setStatus(CommonConst.GRID_STATUS.DATA_EXISTS)
|
|
2205
|
+
} catch (error) {
|
|
2206
|
+
setStatus(CommonConst.GRID_STATUS.ERROR)
|
|
2231
2207
|
}
|
|
2232
2208
|
}, [])
|
|
2209
|
+
|
|
2210
|
+
useEffect(() => {
|
|
2211
|
+
fetchData()
|
|
2212
|
+
}, [fetchData])
|
|
2233
2213
|
`,
|
|
2234
2214
|
code: `<OpsnowCommonDataGrid
|
|
2235
2215
|
columnDefs={columnDefs}
|
|
2236
|
-
rowData={
|
|
2237
|
-
status={
|
|
2216
|
+
rowData={rowData}
|
|
2217
|
+
status={status}
|
|
2238
2218
|
gridOptions={gridOptions}
|
|
2239
|
-
|
|
2240
|
-
textErrorDescription="데이터를 불러오는 중 오류가 발생했습니다."
|
|
2219
|
+
onRetry={fetchData}
|
|
2241
2220
|
langCd={i18n.getLocale()}
|
|
2242
2221
|
/>`
|
|
2243
2222
|
},
|
|
2244
2223
|
{
|
|
2245
|
-
title: '
|
|
2246
|
-
description: '
|
|
2224
|
+
title: '긴 텍스트 컬럼 (한 줄 + 말줄임 툴팁 / 줄바꿈 선택)',
|
|
2225
|
+
description: 'FinOps 그리드 표기 표준: 셀은 기본이 한 줄 + 말줄임이고, 잘린 셀에만 마우스를 올리면 전체 값 툴팁이 뜹니다(그리드가 tooltipShowMode: \'whenTruncated\'를 자동 적용). 긴 텍스트 컬럼이라도 기본은 아무 설정도 하지 않습니다. 줄바꿈이 꼭 필요한 컬럼에만 colDef에 wrapText: true를 지정합니다(행 높이는 기본 autoHeight라 자동으로 늘어남). defaultColDef에 wrapText: true를 넣어 모든 컬럼을 줄바꿈하지 마세요. 컬럼에 tooltipField/tooltipValueGetter/headerTooltip 등을 하나라도 지정하거나 gridOptions.tooltipShowMode를 주면 자동 말줄임 툴팁이 그리드 전체에서 꺼지고 직접 지정한 툴팁만 동작합니다.',
|
|
2247
2226
|
code_props_usage: `
|
|
2248
2227
|
import { useCommonComponents, useGlobalContext } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
2249
2228
|
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
2250
2229
|
|
|
2251
|
-
|
|
2230
|
+
const LONG_TEXT = 'arn:aws:ec2:ap-northeast-2:123456789012:instance/i-0abcdef1234567890 (production-web-server-autoscaling-group)'
|
|
2231
|
+
|
|
2252
2232
|
const columnDefs = [
|
|
2253
|
-
{
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
},
|
|
2259
|
-
{
|
|
2260
|
-
headerName: 'Description',
|
|
2261
|
-
field: 'description',
|
|
2262
|
-
flex: 3, // 가장 넓은 비율
|
|
2263
|
-
minWidth: 300,
|
|
2264
|
-
wrapText: true, // 텍스트 줄바꿈 - 필수
|
|
2265
|
-
autoHeight: true, // 행 높이 자동 조절 - 필수
|
|
2266
|
-
suppressSizeToFit: true, // 자동 리사이즈 방지
|
|
2267
|
-
cellStyle: {
|
|
2268
|
-
alignItems: 'center' // autoHeight 작동을 위해 필수
|
|
2269
|
-
}
|
|
2270
|
-
},
|
|
2271
|
-
{
|
|
2272
|
-
headerName: 'Status',
|
|
2273
|
-
field: 'status',
|
|
2274
|
-
flex: 1,
|
|
2275
|
-
minWidth: 120
|
|
2276
|
-
},
|
|
2233
|
+
{ headerName: 'Resource Name', field: 'name', width: 160 },
|
|
2234
|
+
// 기본: 한 줄 + 말줄임, 잘렸을 때만 툴팁 — 아무 설정 없음
|
|
2235
|
+
{ headerName: 'Description', field: 'description', flex: 2, minWidth: 220 },
|
|
2236
|
+
// 줄바꿈이 필요한 컬럼에만 wrapText 지정
|
|
2237
|
+
{ headerName: 'Memo', field: 'memo', flex: 2, minWidth: 220, wrapText: true },
|
|
2277
2238
|
]
|
|
2278
2239
|
|
|
2279
|
-
// Long Text용 행 데이터
|
|
2280
2240
|
const rowData = [
|
|
2281
|
-
{
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
status: 'Active'
|
|
2285
|
-
},
|
|
2286
|
-
{
|
|
2287
|
-
id: 2,
|
|
2288
|
-
description: 'Short text',
|
|
2289
|
-
status: 'Inactive'
|
|
2290
|
-
},
|
|
2291
|
-
{
|
|
2292
|
-
id: 3,
|
|
2293
|
-
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.',
|
|
2294
|
-
status: 'Pending'
|
|
2295
|
-
},
|
|
2296
|
-
{
|
|
2297
|
-
id: 4,
|
|
2298
|
-
description: 'Another example of long text content that needs multiple lines',
|
|
2299
|
-
status: 'Active'
|
|
2300
|
-
},
|
|
2241
|
+
{ name: 'web-server-01', description: LONG_TEXT, memo: LONG_TEXT },
|
|
2242
|
+
{ name: 'batch-worker', description: '짧은 설명', memo: '짧은 메모' },
|
|
2243
|
+
{ name: 'db-replica', description: LONG_TEXT, memo: LONG_TEXT },
|
|
2301
2244
|
]
|
|
2302
2245
|
|
|
2303
|
-
const defaultColDef = {
|
|
2304
|
-
wrapText: true, // 텍스트 줄바꿈 활성화
|
|
2305
|
-
autoHeight: true, // 셀 높이 자동 조절
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
2246
|
const gridOptions = {
|
|
2309
|
-
|
|
2310
|
-
rowSelection: { mode: 'singleRow', checkboxes: false, enableClickSelection: true },
|
|
2311
|
-
tooltipShowDelay: 100,
|
|
2312
|
-
domLayout: 'autoHeight', // 그리드 전체 레이아웃 자동 높이
|
|
2247
|
+
domLayout: 'autoHeight',
|
|
2313
2248
|
suppressCellFocus: true,
|
|
2314
2249
|
}
|
|
2315
2250
|
|
|
@@ -2318,7 +2253,6 @@ export const DataGridExamples = [
|
|
|
2318
2253
|
`,
|
|
2319
2254
|
code: `<OpsnowCommonDataGrid
|
|
2320
2255
|
columnDefs={columnDefs}
|
|
2321
|
-
defaultColDef={defaultColDef}
|
|
2322
2256
|
rowData={rowData}
|
|
2323
2257
|
status={CommonConst.GRID_STATUS.DATA_EXISTS}
|
|
2324
2258
|
gridOptions={gridOptions}
|
|
@@ -2326,14 +2260,53 @@ export const DataGridExamples = [
|
|
|
2326
2260
|
/>`
|
|
2327
2261
|
},
|
|
2328
2262
|
{
|
|
2329
|
-
title: '
|
|
2330
|
-
description: '
|
|
2263
|
+
title: '표기 표준 (숫자·날짜·2줄 헤더)',
|
|
2264
|
+
description: '컬럼 type만 지정하면 그리드가 FinOps 표기 표준으로 표시합니다 — 직접 valueFormatter/cellStyle로 다시 만들지 마세요. cost·ratio·integer·number·mixFormat 타입은 헤더·셀 오른쪽 정렬. ratio는 소수 1자리(85.3%, 0.0%), cost는 0.01 미만이면 <$0.01(실제 0은 $0.00). 증감 컬럼은 cellRendererParams.typeParams.showSign: true로 +12.5% / -3.2% (0은 부호 없음, ratio·cost·mixFormat 지원). date 타입은 셀 YYYY-MM-DD HH:mm(24시간제, 언어 무관, 입력값을 UTC로 보고 브라우저 시간대로 변환)이고 시간대는 헤더에 한 번 붙습니다(예: "Updated At (UTC+9)") — headerName에 이미 "(UTC"가 있으면 다시 붙이지 않습니다. 긴 헤더명은 2줄까지 표시되고 넘치면 말줄임, 마우스를 올리면 전체 명칭 툴팁(HeaderFilter·HeaderInfoTooltip 커스텀 헤더도 동일).',
|
|
2331
2265
|
code_props_usage: `
|
|
2332
2266
|
import { useCommonComponents, useGlobalContext } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
2333
2267
|
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
2334
2268
|
|
|
2335
|
-
const
|
|
2336
|
-
|
|
2269
|
+
const columnDefs = [
|
|
2270
|
+
{ headerName: '계정명', field: 'account', width: 160 },
|
|
2271
|
+
{ headerName: 'Monthly Cost Including Tax And Support Fee (USD)', field: 'cost', type: ['cost'], width: 150 }, // 2줄 헤더
|
|
2272
|
+
{ headerName: '사용률', field: 'usage', type: ['ratio'], width: 120 },
|
|
2273
|
+
{
|
|
2274
|
+
headerName: '전월 대비',
|
|
2275
|
+
field: 'mom',
|
|
2276
|
+
type: ['ratio'],
|
|
2277
|
+
width: 120,
|
|
2278
|
+
cellRendererParams: { typeParams: { showSign: true } }, // +12.5% / -3.2%
|
|
2279
|
+
},
|
|
2280
|
+
{ headerName: '건수', field: 'count', type: ['integer'], width: 110 },
|
|
2281
|
+
{ headerName: 'Updated At', field: 'updatedAt', type: ['date'] }, // 헤더: Updated At (UTC+9)
|
|
2282
|
+
]
|
|
2283
|
+
|
|
2284
|
+
// updatedAt은 UTC 기준 문자열 그대로 넘긴다 (변환은 그리드가 함)
|
|
2285
|
+
const rowData = [
|
|
2286
|
+
{ account: 'prod-main', cost: 31420.15, usage: 85.3, mom: 12.5, count: 1284, updatedAt: '2026-10-07 05:00:00' },
|
|
2287
|
+
{ account: 'dev-sandbox', cost: 1250, usage: 42, mom: -3.2, count: 37, updatedAt: '2026-10-15 23:30:00' },
|
|
2288
|
+
{ account: 'log-archive', cost: 0.004, usage: 0, mom: 0, count: 0, updatedAt: '2026-01-01 00:00:00' }, // <$0.01, 0.0%
|
|
2289
|
+
]
|
|
2290
|
+
|
|
2291
|
+
const gridOptions = { domLayout: 'autoHeight', suppressCellFocus: true }
|
|
2292
|
+
|
|
2293
|
+
const { OpsnowCommonDataGrid } = useCommonComponents();
|
|
2294
|
+
const { CommonConst } = useGlobalContext()
|
|
2295
|
+
`,
|
|
2296
|
+
code: `<OpsnowCommonDataGrid
|
|
2297
|
+
columnDefs={columnDefs}
|
|
2298
|
+
rowData={rowData}
|
|
2299
|
+
status={CommonConst.GRID_STATUS.DATA_EXISTS}
|
|
2300
|
+
gridOptions={gridOptions}
|
|
2301
|
+
langCd={i18n.getLocale()}
|
|
2302
|
+
/>`
|
|
2303
|
+
},
|
|
2304
|
+
{
|
|
2305
|
+
title: '그리드 최대 높이 + 스크롤 (domLayout autoHeight)',
|
|
2306
|
+
description: 'domLayout: \'autoHeight\'는 행이 적으면 콘텐츠 높이에 맞추고, maxGridHeight(기본 600px, 헤더 42px 포함)를 넘으면 본문에 세로 스크롤이 자동으로 생깁니다(grid ≥2.0.6). 행 수로 domLayout을 분기하지 마세요 — domLayout: \'normal\'을 주면 그리드 높이가 0이 되어 화면에서 사라집니다. 상한은 maxGridHeight로 바꾸고, 모든 행을 펼치려면 unlimitedHeight를 씁니다. 고정 높이가 필요하면 domLayout 키를 빼고 gridHeight를 지정합니다.',
|
|
2307
|
+
code_props_usage: `
|
|
2308
|
+
import { useCommonComponents, useGlobalContext } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
2309
|
+
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
2337
2310
|
|
|
2338
2311
|
const columnDefs = [
|
|
2339
2312
|
{ headerName: 'ID', field: 'id', flex: 1, minWidth: 80 },
|
|
@@ -2342,23 +2315,15 @@ export const DataGridExamples = [
|
|
|
2342
2315
|
field: 'description',
|
|
2343
2316
|
flex: 3,
|
|
2344
2317
|
minWidth: 300,
|
|
2345
|
-
wrapText: true,
|
|
2346
|
-
autoHeight: true, // 행 높이 자동 조절 - 필수
|
|
2347
|
-
suppressSizeToFit: true,
|
|
2348
|
-
cellStyle: { alignItems: 'center' } // autoHeight 작동을 위해 필수
|
|
2318
|
+
wrapText: true, // 이 예제는 행 높이 변화를 보이려고 줄바꿈 지정 — 기본은 한 줄 + 말줄임
|
|
2349
2319
|
},
|
|
2350
2320
|
{ headerName: 'Status', field: 'status', flex: 1, minWidth: 120 },
|
|
2351
2321
|
]
|
|
2352
2322
|
|
|
2353
|
-
const
|
|
2354
|
-
wrapText: true, // 텍스트 줄바꿈 활성화
|
|
2355
|
-
autoHeight: true, // 셀 높이 자동 조절
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
const { OpsnowCommonDataGrid } = useCommonComponents()
|
|
2323
|
+
const { OpsnowCommonDataGrid, OpsnowCommonButton } = useCommonComponents()
|
|
2359
2324
|
const { CommonConst } = useGlobalContext()
|
|
2360
2325
|
|
|
2361
|
-
// 4행 데이터 (
|
|
2326
|
+
// 4행 데이터 (최대 높이 미만 → 콘텐츠 높이, 스크롤 없음)
|
|
2362
2327
|
const fewRowData = [
|
|
2363
2328
|
{ id: 1, description: 'This is a very long description text that will wrap to multiple lines when the column width is not sufficient to display all content in a single line.', status: 'Active' },
|
|
2364
2329
|
{ id: 2, description: 'Short text', status: 'Inactive' },
|
|
@@ -2366,8 +2331,8 @@ export const DataGridExamples = [
|
|
|
2366
2331
|
{ id: 4, description: 'Another example of long text content that needs multiple lines', status: 'Active' },
|
|
2367
2332
|
]
|
|
2368
2333
|
|
|
2369
|
-
//
|
|
2370
|
-
const manyRowData = Array.from({ length:
|
|
2334
|
+
// 30행 데이터 (최대 높이 초과 → 600px에서 잘리고 내부 스크롤)
|
|
2335
|
+
const manyRowData = Array.from({ length: 30 }, (_, i) => ({
|
|
2371
2336
|
id: i + 1,
|
|
2372
2337
|
description: 'Row ' + (i + 1) + ': long description text that wraps to multiple lines when the column is narrow, demonstrating autoHeight with scroll.',
|
|
2373
2338
|
status: i % 2 === 0 ? 'Active' : 'Inactive',
|
|
@@ -2389,28 +2354,26 @@ export const DataGridExamples = [
|
|
|
2389
2354
|
fetchData()
|
|
2390
2355
|
}, [])
|
|
2391
2356
|
|
|
2392
|
-
// 행
|
|
2393
|
-
const isScroll = rowData.length > ROW_LIMIT
|
|
2357
|
+
// 행 수와 무관하게 autoHeight 하나만 — 높이 상한은 그리드가 처리
|
|
2394
2358
|
const gridOptions = {
|
|
2395
2359
|
animateRows: true,
|
|
2396
2360
|
rowSelection: { mode: 'singleRow', checkboxes: false, enableClickSelection: true },
|
|
2397
2361
|
tooltipShowDelay: 100,
|
|
2398
|
-
domLayout:
|
|
2362
|
+
domLayout: 'autoHeight',
|
|
2399
2363
|
suppressCellFocus: true,
|
|
2400
2364
|
}
|
|
2401
2365
|
`,
|
|
2402
2366
|
code: `<>
|
|
2403
|
-
<div style={{ marginBottom: '
|
|
2367
|
+
<div style={{ marginBottom: 'var(--opsnow-spacing-filter-label-gap)', display: 'flex', gap: 'var(--opsnow-spacing-filter-label-gap)' }}>
|
|
2404
2368
|
<OpsnowCommonButton label="4행 (스크롤 X)" size="large" variant="outlined" color="secondary" onClick={() => setRowData(fewRowData)} />
|
|
2405
|
-
<OpsnowCommonButton label="
|
|
2369
|
+
<OpsnowCommonButton label="30행 (스크롤 O)" size="large" variant="outlined" color="secondary" onClick={() => setRowData(manyRowData)} />
|
|
2406
2370
|
</div>
|
|
2407
2371
|
<OpsnowCommonDataGrid
|
|
2408
2372
|
columnDefs={columnDefs}
|
|
2409
|
-
defaultColDef={defaultColDef}
|
|
2410
2373
|
rowData={rowData}
|
|
2411
2374
|
status={status}
|
|
2412
2375
|
gridOptions={gridOptions}
|
|
2413
|
-
|
|
2376
|
+
maxGridHeight={600} // 기본값과 같음. 상한을 바꾸려면 이 값만 조정 (모두 펼치려면 unlimitedHeight)
|
|
2414
2377
|
langCd={i18n.getLocale()}
|
|
2415
2378
|
/>
|
|
2416
2379
|
</>`
|
|
@@ -2623,10 +2586,11 @@ export const DataGridExamples = [
|
|
|
2623
2586
|
}
|
|
2624
2587
|
|
|
2625
2588
|
const fakeApi = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
2626
|
-
const nowLabel = () => new Date().toLocaleTimeString()
|
|
2627
2589
|
|
|
2628
2590
|
const { OpsnowCommonDataGrid, OpsnowCommonButton } = useCommonComponents()
|
|
2629
|
-
const { CommonConst } = useGlobalContext()
|
|
2591
|
+
const { CommonConst, finOpsDateUtils } = useGlobalContext()
|
|
2592
|
+
// 화면 표시 일시는 표기 표준 함수로 (시간대는 생략 — 상태 컬럼 안의 짧은 표기)
|
|
2593
|
+
const nowLabel = () => finOpsDateUtils.formatDateTime(Date.now(), { showTimeZone: false })
|
|
2630
2594
|
const gridRef = useRef(null)
|
|
2631
2595
|
|
|
2632
2596
|
const [rowData] = useState([
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
export const GridLayoutExamples = [
|
|
3
3
|
{
|
|
4
4
|
title: '4열 그리드 레이아웃',
|
|
5
|
-
description: '
|
|
5
|
+
description: 'MUI 9 Grid size 문법과 간격 토큰(pagePadding·sectionGap·cardPadding·cardGap)을 적용한 4열 레이아웃 예제입니다. 섹션 간격은 Grid spacing에 토큰 CSS 변수로 지정합니다(sx gap은 size 폭 계산에 들어가지 않아 줄바꿈이 깨짐). 색상 토큰처럼 theme.commonSpacing 을 참조하며 px 하드코딩하지 않습니다.',
|
|
6
6
|
code: `
|
|
7
|
-
<Grid container
|
|
8
|
-
<Grid
|
|
7
|
+
<Grid container spacing="var(--opsnow-spacing-section-gap)" sx={theme => ({ padding: theme.commonSpacing.pagePadding })}>
|
|
8
|
+
<Grid size={{ xs: 12, sm: 6, md: 3 }} key={0}>
|
|
9
9
|
<Box sx={theme => ({
|
|
10
10
|
border: '1px solid #ddd',
|
|
11
11
|
borderRadius: '12px',
|
|
@@ -17,8 +17,7 @@ export const GridLayoutExamples = [
|
|
|
17
17
|
})}>
|
|
18
18
|
</Box>
|
|
19
19
|
</Grid>
|
|
20
|
-
|
|
21
|
-
<!-- ... -->
|
|
20
|
+
{/* 총 4개 아이템 반복 (sm: 2열, md: 4열) */}
|
|
22
21
|
</Grid>
|
|
23
22
|
`,
|
|
24
23
|
},
|
|
@@ -26,12 +25,12 @@ export const GridLayoutExamples = [
|
|
|
26
25
|
title: '2열 그리드 레이아웃',
|
|
27
26
|
description: '2개의 박스를 한 줄에 배치하는 예제입니다.',
|
|
28
27
|
code: `
|
|
29
|
-
<Grid container
|
|
30
|
-
<Grid
|
|
28
|
+
<Grid container spacing="var(--opsnow-spacing-section-gap)" sx={theme => ({ padding: theme.commonSpacing.pagePadding })}>
|
|
29
|
+
<Grid size={{ xs: 12, md: 6 }} key={0}>
|
|
31
30
|
<Box sx={{ /* 동일한 스타일 */ }}>
|
|
32
31
|
</Box>
|
|
33
32
|
</Grid>
|
|
34
|
-
<Grid
|
|
33
|
+
<Grid size={{ xs: 12, md: 6 }} key={1}>
|
|
35
34
|
<Box sx={{ /* 동일한 스타일 */ }}>
|
|
36
35
|
</Box>
|
|
37
36
|
</Grid>
|
|
@@ -42,16 +41,16 @@ export const GridLayoutExamples = [
|
|
|
42
41
|
title: '3열 그리드 레이아웃',
|
|
43
42
|
description: '3개의 박스를 한 줄에 배치하는 예제입니다.',
|
|
44
43
|
code: `
|
|
45
|
-
<Grid container
|
|
46
|
-
<Grid
|
|
44
|
+
<Grid container spacing="var(--opsnow-spacing-section-gap)" sx={theme => ({ padding: theme.commonSpacing.pagePadding })}>
|
|
45
|
+
<Grid size={{ xs: 12, md: 4 }} key={0}>
|
|
47
46
|
<Box sx={{ /* 동일한 스타일 */ }}>
|
|
48
47
|
</Box>
|
|
49
48
|
</Grid>
|
|
50
|
-
<Grid
|
|
49
|
+
<Grid size={{ xs: 12, md: 4 }} key={1}>
|
|
51
50
|
<Box sx={{ /* 동일한 스타일 */ }}>
|
|
52
51
|
</Box>
|
|
53
52
|
</Grid>
|
|
54
|
-
<Grid
|
|
53
|
+
<Grid size={{ xs: 12, md: 4 }} key={2}>
|
|
55
54
|
<Box sx={{ /* 동일한 스타일 */ }}>
|
|
56
55
|
</Box>
|
|
57
56
|
</Grid>
|
|
@@ -61,7 +60,7 @@ export const GridLayoutExamples = [
|
|
|
61
60
|
{
|
|
62
61
|
title: 'Tile with Checkbox UI',
|
|
63
62
|
description: 'Tile 내부에 체크박스와 텍스트가 포함된 2열 레이아웃 예제입니다.',
|
|
64
|
-
code: `<Grid container spacing={3} sx={{ marginTop: '20px' }}><Grid
|
|
63
|
+
code: `<Grid container spacing={3} sx={{ marginTop: '20px' }}><Grid size={{ xs: 12, md: 6 }} sx={{ display: 'flex' }}><OpsnowCommonTile><OpsnowCommonTile.Content><Stack direction="row" alignItems="flex-start" spacing={2}><OpsnowCommonCheckbox name="organizationScope" checked={checkboxStates.organizationScope} onChange={handleCheckboxChange} color="primary" /><Stack spacing={1}><OpsnowCommonTypography variant="e-b10">Use Organization Scope(Cost Allocation)</OpsnowCommonTypography><OpsnowCommonTypography variant="e-r11" color="commonPalette.gray.600">The same scope defined in Organization Settings is used as the baseline for Budget and KPI tracking.</OpsnowCommonTypography></Stack></Stack></OpsnowCommonTile.Content></OpsnowCommonTile></Grid><Grid size={{ xs: 12, md: 6 }} sx={{ display: 'flex' }}><OpsnowCommonTile><OpsnowCommonTile.Content><Stack direction="row" alignItems="flex-start" spacing={2}><OpsnowCommonCheckbox name="customizeScope" checked={checkboxStates.customizeScope} onChange={handleCheckboxChange} color="primary" /><Stack spacing={1}><OpsnowCommonTypography variant="e-b10">Customize Scope</OpsnowCommonTypography><OpsnowCommonTypography variant="e-r11" color="commonPalette.gray.600">Apply only to selected dimensions, such as specific services (e.g., EC2)</OpsnowCommonTypography></Stack></Stack></OpsnowCommonTile.Content></OpsnowCommonTile></Grid></Grid>`,
|
|
65
64
|
},
|
|
66
65
|
];
|
|
67
66
|
export const MegaFilterExamples = [
|
|
@@ -23,27 +23,27 @@ export const PopupExamples = [
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
title: 'Footer 버튼 커스텀',
|
|
26
|
-
code: `<OpsnowCommonPopup
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
code: `<OpsnowCommonPopup
|
|
27
|
+
title="Footer Custom"
|
|
28
|
+
open={true}
|
|
29
|
+
onClose={handleClose}
|
|
30
|
+
confirmButton={{ text: '확인', variant: 'contained' }}
|
|
31
|
+
cancelButton={{ text: '취소', variant: 'outlined' }}
|
|
32
|
+
onConfirm={handleConfirm}
|
|
33
|
+
>
|
|
34
34
|
<p>Popup content here</p>
|
|
35
35
|
</OpsnowCommonPopup>`,
|
|
36
|
-
description: '
|
|
36
|
+
description: '하단 버튼은 confirmButton/cancelButton 객체({ text, variant, disabled, color })로 커스텀합니다. 취소 버튼은 기본 표시(useFooterCancelBtn 기본 true)이며 onClose가 호출됩니다. footer prop은 없습니다.'
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
title: '
|
|
40
|
-
code: `<OpsnowCommonPopup title="
|
|
39
|
+
title: '헤더 닫기(X) 버튼 숨김',
|
|
40
|
+
code: `<OpsnowCommonPopup title="No Close Button" open={true} onClose={handleClose} hideHeaderClose>
|
|
41
41
|
<p>Popup content here</p>
|
|
42
42
|
</OpsnowCommonPopup>`,
|
|
43
|
-
description: '
|
|
43
|
+
description: 'hideHeaderClose로 헤더의 닫기(X) 버튼을 숨깁니다. closable/maskClosable prop은 없습니다.'
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
title: 'Wing 타입, 작은 사이즈 + cancel/confirm
|
|
46
|
+
title: 'Wing 타입, 작은 사이즈 + cancel/confirm',
|
|
47
47
|
code: `<OpsnowCommonPopup
|
|
48
48
|
title="Example Popup"
|
|
49
49
|
open={true}
|
|
@@ -52,11 +52,10 @@ export const PopupExamples = [
|
|
|
52
52
|
cancelButton={{ variant: 'outlined' }}
|
|
53
53
|
confirmButton={{ color: 'primary', text: 'Save' }}
|
|
54
54
|
type="wing"
|
|
55
|
-
disableEscapeKeyDown
|
|
56
55
|
>
|
|
57
56
|
<p>Popup content here</p>
|
|
58
57
|
</OpsnowCommonPopup>`,
|
|
59
|
-
description: 'wing 타입, 작은 사이즈(sm)에 cancel/confirm
|
|
58
|
+
description: 'wing 타입, 작은 사이즈(sm)에 cancel/confirm 버튼을 적용한 예제입니다. (ESC·배경 클릭으로 닫히지 않게 하는 옵션은 없음 — onClose가 reason을 받지 않음)'
|
|
60
59
|
},
|
|
61
60
|
{
|
|
62
61
|
title: 'Wing 타입, md, Special Title & Footer Action Button',
|
|
@@ -188,18 +187,5 @@ export const PopupExamples = [
|
|
|
188
187
|
<p>Popup content here</p>
|
|
189
188
|
</OpsnowCommonPopup>`,
|
|
190
189
|
description: 'bottom 타입에서 cancelButton과 confirmButton을 사용하는 예제입니다.'
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
title: '고정 크기(width/height)',
|
|
194
|
-
code: `<OpsnowCommonPopup
|
|
195
|
-
title="Size Popup"
|
|
196
|
-
open={true}
|
|
197
|
-
onClose={handleClose}
|
|
198
|
-
width={400}
|
|
199
|
-
height={300}
|
|
200
|
-
>
|
|
201
|
-
<p>Popup content here</p>
|
|
202
|
-
</OpsnowCommonPopup>`,
|
|
203
|
-
description: '팝업의 너비와 높이를 고정(px)으로 지정하는 예제입니다.'
|
|
204
190
|
}
|
|
205
191
|
];
|
|
@@ -5,11 +5,6 @@ export const ProgressExamples = [
|
|
|
5
5
|
code: `<OpsnowCommonProgress value={50} />`,
|
|
6
6
|
description: "50% 진행률을 보여주는 기본 Progress 예제입니다.",
|
|
7
7
|
},
|
|
8
|
-
{
|
|
9
|
-
title: "value-size",
|
|
10
|
-
code: `<OpsnowCommonProgress value={50} size={32}/>`,
|
|
11
|
-
description: "사이즈가 32이고 value가 50인 기본 Progress 예제입니다.",
|
|
12
|
-
},
|
|
13
8
|
{
|
|
14
9
|
title: "value-inherit",
|
|
15
10
|
code: `<OpsnowCommonProgress value={75} color="inherit" />`,
|
|
@@ -60,6 +60,22 @@ export const SelectExamples = [
|
|
|
60
60
|
code: `<OpsnowCommonSelect items={[{ value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }, { value: '3', label: 'Option 3' }]} size="small" variant="outlined" multiple label="항목" placeholder="항목을 선택하세요" value={value} onChange={e => setValue(e.target.value)} />`,
|
|
61
61
|
description: 'outlined variant, small 사이즈, label과 placeholder를 함께 사용하는 다중 선택 셀렉트 예제입니다.'
|
|
62
62
|
},
|
|
63
|
+
{
|
|
64
|
+
title: 'copilotLabel (코파일럿 전용 옵션 이름)',
|
|
65
|
+
code: `<OpsnowCommonSelect
|
|
66
|
+
copilotId="report-select"
|
|
67
|
+
items={[
|
|
68
|
+
{ value: 'r1', label: 'GDPR Bespin Report', copilotLabel: 'GDPR Bespin Report (2026-10-01 09:00)' },
|
|
69
|
+
{ value: 'r2', label: 'GDPR Bespin Report', copilotLabel: 'GDPR Bespin Report (2026-10-15 14:30)' },
|
|
70
|
+
{ value: 'r3', label: 'Monthly Cost Report' },
|
|
71
|
+
]}
|
|
72
|
+
size="small"
|
|
73
|
+
variant="outlined"
|
|
74
|
+
value={reportId}
|
|
75
|
+
onChange={e => setReportId(e.target.value)}
|
|
76
|
+
/>`,
|
|
77
|
+
description: '화면 표시명(label)이 같은 옵션이 여럿이면 코파일럿이 어느 것인지 구분하지 못합니다. 항목에 copilotLabel을 주면 코파일럿 선택지 이름만 바뀌고 화면 드롭다운은 그대로입니다 (copilotId와 함께 사용, OpsnowCommonAutocomplete items도 동일).'
|
|
78
|
+
},
|
|
63
79
|
{
|
|
64
80
|
title: '필터 여러 개 배치 (간격 규칙: 필터 행 filterGap(24px), 라벨-필터 filterLabelGap(8px))',
|
|
65
81
|
code: `<Stack sx={{ flexDirection: 'row', gap: theme => theme.commonSpacing.filterGap }}>
|