@opsnow-mcp/opsnow-mcp-common-ui-server 1.0.41 → 1.0.43
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/examples/opsnow-common-chart-examples-data.js +1016 -408
- package/build/components/examples/opsnow-common-grid-examples-data.js +83 -112
- package/build/components/examples/opsnow-common-select-examples-data.js +16 -0
- package/build/components/examples/opsnow-common-tab-examples-data.js +37 -0
- package/build/components/opsnow-common-chart.js +312 -42
- package/build/components/opsnow-common-grid.js +53 -50
- package/build/components/opsnow-common-select.js +5 -3
- package/build/components/opsnow-common-tab.js +21 -0
- package/build/components/opsnow-common-validate-props.js +0 -0
- package/build/index.js +41 -0
- package/package.json +1 -1
|
@@ -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,
|
|
@@ -507,8 +503,6 @@ export const DataGridExamples = [
|
|
|
507
503
|
|
|
508
504
|
// 기본 컬럼 정의
|
|
509
505
|
const defaultColDef = {
|
|
510
|
-
wrapText: true,
|
|
511
|
-
autoHeight: true,
|
|
512
506
|
suppressMenu: true, // 개별 컬럼에서 메뉴를 노출하려면 재설정할 예정
|
|
513
507
|
resizable: true,
|
|
514
508
|
sortable: false,
|
|
@@ -664,8 +658,6 @@ export const DataGridExamples = [
|
|
|
664
658
|
]
|
|
665
659
|
|
|
666
660
|
const defaultColDef = {
|
|
667
|
-
wrapText: true,
|
|
668
|
-
autoHeight: true,
|
|
669
661
|
suppressMenu: true,
|
|
670
662
|
unSortIcon: true,
|
|
671
663
|
sortable: false,
|
|
@@ -704,8 +696,6 @@ export const DataGridExamples = [
|
|
|
704
696
|
]
|
|
705
697
|
|
|
706
698
|
const defaultColDef = {
|
|
707
|
-
wrapText: true,
|
|
708
|
-
autoHeight: true,
|
|
709
699
|
suppressMenu: true,
|
|
710
700
|
unSortIcon: true,
|
|
711
701
|
sortable: false,
|
|
@@ -992,8 +982,6 @@ export const DataGridExamples = [
|
|
|
992
982
|
}
|
|
993
983
|
|
|
994
984
|
const defaultColDef = {
|
|
995
|
-
wrapText: true,
|
|
996
|
-
autoHeight: true,
|
|
997
985
|
suppressMenu: true,
|
|
998
986
|
unSortIcon: true,
|
|
999
987
|
sortable: true,
|
|
@@ -1143,8 +1131,6 @@ export const DataGridExamples = [
|
|
|
1143
1131
|
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
1144
1132
|
|
|
1145
1133
|
const defaultColDef = {
|
|
1146
|
-
wrapText: true,
|
|
1147
|
-
autoHeight: true,
|
|
1148
1134
|
suppressMenu: true,
|
|
1149
1135
|
unSortIcon: true,
|
|
1150
1136
|
resizable: true,
|
|
@@ -1302,8 +1288,6 @@ export const DataGridExamples = [
|
|
|
1302
1288
|
|
|
1303
1289
|
// 기본 컬럼 설정
|
|
1304
1290
|
const defaultColDef = {
|
|
1305
|
-
wrapText: true,
|
|
1306
|
-
autoHeight: true,
|
|
1307
1291
|
suppressMenu: true,
|
|
1308
1292
|
unSortIcon: true,
|
|
1309
1293
|
sortable: false,
|
|
@@ -1505,8 +1489,6 @@ export const DataGridExamples = [
|
|
|
1505
1489
|
const [colDefs1, setColDefs1] = useState([])
|
|
1506
1490
|
const [colDefs2, setColDefs2] = useState([])
|
|
1507
1491
|
const defaultColDef = {
|
|
1508
|
-
wrapText: true,
|
|
1509
|
-
autoHeight: true,
|
|
1510
1492
|
suppressMenu: true,
|
|
1511
1493
|
unSortIcon: true,
|
|
1512
1494
|
resizable: true,
|
|
@@ -1783,8 +1765,6 @@ export const DataGridExamples = [
|
|
|
1783
1765
|
|
|
1784
1766
|
// 공통 컬럼 정의
|
|
1785
1767
|
const defaultColDef = {
|
|
1786
|
-
wrapText: true,
|
|
1787
|
-
autoHeight: true,
|
|
1788
1768
|
suppressMenu: true,
|
|
1789
1769
|
unSortIcon: true,
|
|
1790
1770
|
sortable: false,
|
|
@@ -2189,124 +2169,82 @@ export const DataGridExamples = [
|
|
|
2189
2169
|
/>`
|
|
2190
2170
|
},
|
|
2191
2171
|
{
|
|
2192
|
-
title: 'Error Status',
|
|
2193
|
-
description: '
|
|
2172
|
+
title: 'Error Status (다시 시도 onRetry)',
|
|
2173
|
+
description: '오류 상태 예제입니다. 오류·로딩·데이터 없음·검색 결과 없음 문구는 그리드가 langCd(ko/en/ja)에 맞는 표준 문구로 표시하므로 textErrorTitle/textErrorDescription 등은 넘기지 않는 것이 기본입니다 (화면 고유 문구가 꼭 필요할 때만 지정). onRetry를 넘기면 오류 상태에 [다시 시도] 버튼이 생기고, 누르면 onRetry가 호출됩니다 — 보통 재조회 함수를 그대로 넘깁니다.',
|
|
2194
2174
|
code_props_usage: `
|
|
2175
|
+
import { useState, useEffect, useCallback } from 'react'
|
|
2195
2176
|
import { useCommonComponents, useGlobalContext } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
2196
2177
|
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
2197
2178
|
|
|
2198
|
-
// 컬럼 정의
|
|
2199
2179
|
const columnDefs = [
|
|
2200
2180
|
{ headerName: 'Make', field: 'make' },
|
|
2201
2181
|
{ headerName: 'Model', field: 'model' },
|
|
2202
|
-
{ headerName: 'Price', field: 'price' },
|
|
2182
|
+
{ headerName: 'Price', field: 'price', type: ['cost'] },
|
|
2203
2183
|
]
|
|
2204
2184
|
|
|
2205
2185
|
const gridOptions = {
|
|
2206
2186
|
animateRows: true,
|
|
2207
2187
|
rowSelection: { mode: 'singleRow', checkboxes: false, enableClickSelection: true },
|
|
2208
|
-
tooltipShowDelay: 100,
|
|
2209
2188
|
domLayout: 'autoHeight',
|
|
2210
2189
|
suppressCellFocus: true,
|
|
2211
2190
|
}
|
|
2212
2191
|
|
|
2213
2192
|
const { OpsnowCommonDataGrid } = useCommonComponents();
|
|
2214
2193
|
const { CommonConst } = useGlobalContext()
|
|
2215
|
-
|
|
2216
|
-
const [
|
|
2217
|
-
|
|
2218
|
-
// 에러 상태 시뮬레이션을 위한 useEffect
|
|
2219
|
-
useEffect(() => {
|
|
2220
|
-
// 1초 후에 에러 상태로 설정
|
|
2221
|
-
const timeoutId = setTimeout(() => {
|
|
2222
|
-
setErrorStatus(CommonConst.GRID_STATUS.ERROR)
|
|
2223
|
-
}, 1000)
|
|
2194
|
+
const [status, setStatus] = useState(CommonConst.GRID_STATUS.LOADING)
|
|
2195
|
+
const [rowData, setRowData] = useState([])
|
|
2224
2196
|
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
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)
|
|
2228
2207
|
}
|
|
2229
2208
|
}, [])
|
|
2209
|
+
|
|
2210
|
+
useEffect(() => {
|
|
2211
|
+
fetchData()
|
|
2212
|
+
}, [fetchData])
|
|
2230
2213
|
`,
|
|
2231
2214
|
code: `<OpsnowCommonDataGrid
|
|
2232
2215
|
columnDefs={columnDefs}
|
|
2233
|
-
rowData={
|
|
2234
|
-
status={
|
|
2216
|
+
rowData={rowData}
|
|
2217
|
+
status={status}
|
|
2235
2218
|
gridOptions={gridOptions}
|
|
2236
|
-
|
|
2237
|
-
textErrorDescription="데이터를 불러오는 중 오류가 발생했습니다."
|
|
2219
|
+
onRetry={fetchData}
|
|
2238
2220
|
langCd={i18n.getLocale()}
|
|
2239
2221
|
/>`
|
|
2240
2222
|
},
|
|
2241
2223
|
{
|
|
2242
|
-
title: '
|
|
2243
|
-
description: '
|
|
2224
|
+
title: '긴 텍스트 컬럼 (한 줄 + 말줄임 툴팁 / 줄바꿈 선택)',
|
|
2225
|
+
description: 'FinOps 그리드 표기 표준: 셀은 기본이 한 줄 + 말줄임이고, 잘린 셀에만 마우스를 올리면 전체 값 툴팁이 뜹니다(그리드가 tooltipShowMode: \'whenTruncated\'를 자동 적용). 긴 텍스트 컬럼이라도 기본은 아무 설정도 하지 않습니다. 줄바꿈이 꼭 필요한 컬럼에만 colDef에 wrapText: true를 지정합니다(행 높이는 기본 autoHeight라 자동으로 늘어남). defaultColDef에 wrapText: true를 넣어 모든 컬럼을 줄바꿈하지 마세요. 컬럼에 tooltipField/tooltipValueGetter/headerTooltip 등을 하나라도 지정하거나 gridOptions.tooltipShowMode를 주면 자동 말줄임 툴팁이 그리드 전체에서 꺼지고 직접 지정한 툴팁만 동작합니다.',
|
|
2244
2226
|
code_props_usage: `
|
|
2245
2227
|
import { useCommonComponents, useGlobalContext } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
2246
2228
|
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
2247
2229
|
|
|
2248
|
-
|
|
2230
|
+
const LONG_TEXT = 'arn:aws:ec2:ap-northeast-2:123456789012:instance/i-0abcdef1234567890 (production-web-server-autoscaling-group)'
|
|
2231
|
+
|
|
2249
2232
|
const columnDefs = [
|
|
2250
|
-
{
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
},
|
|
2256
|
-
{
|
|
2257
|
-
headerName: 'Description',
|
|
2258
|
-
field: 'description',
|
|
2259
|
-
flex: 3, // 가장 넓은 비율
|
|
2260
|
-
minWidth: 300,
|
|
2261
|
-
wrapText: true, // 텍스트 줄바꿈 - 필수
|
|
2262
|
-
autoHeight: true, // 행 높이 자동 조절 - 필수
|
|
2263
|
-
suppressSizeToFit: true, // 자동 리사이즈 방지
|
|
2264
|
-
cellStyle: {
|
|
2265
|
-
alignItems: 'center' // autoHeight 작동을 위해 필수
|
|
2266
|
-
}
|
|
2267
|
-
},
|
|
2268
|
-
{
|
|
2269
|
-
headerName: 'Status',
|
|
2270
|
-
field: 'status',
|
|
2271
|
-
flex: 1,
|
|
2272
|
-
minWidth: 120
|
|
2273
|
-
},
|
|
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 },
|
|
2274
2238
|
]
|
|
2275
2239
|
|
|
2276
|
-
// Long Text용 행 데이터
|
|
2277
2240
|
const rowData = [
|
|
2278
|
-
{
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
status: 'Active'
|
|
2282
|
-
},
|
|
2283
|
-
{
|
|
2284
|
-
id: 2,
|
|
2285
|
-
description: 'Short text',
|
|
2286
|
-
status: 'Inactive'
|
|
2287
|
-
},
|
|
2288
|
-
{
|
|
2289
|
-
id: 3,
|
|
2290
|
-
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.',
|
|
2291
|
-
status: 'Pending'
|
|
2292
|
-
},
|
|
2293
|
-
{
|
|
2294
|
-
id: 4,
|
|
2295
|
-
description: 'Another example of long text content that needs multiple lines',
|
|
2296
|
-
status: 'Active'
|
|
2297
|
-
},
|
|
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 },
|
|
2298
2244
|
]
|
|
2299
2245
|
|
|
2300
|
-
const defaultColDef = {
|
|
2301
|
-
wrapText: true, // 텍스트 줄바꿈 활성화
|
|
2302
|
-
autoHeight: true, // 셀 높이 자동 조절
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
2246
|
const gridOptions = {
|
|
2306
|
-
|
|
2307
|
-
rowSelection: { mode: 'singleRow', checkboxes: false, enableClickSelection: true },
|
|
2308
|
-
tooltipShowDelay: 100,
|
|
2309
|
-
domLayout: 'autoHeight', // 콘텐츠 높이에 맞춤, 최대 maxGridHeight(기본 600px)까지, 넘치면 내부 스크롤
|
|
2247
|
+
domLayout: 'autoHeight',
|
|
2310
2248
|
suppressCellFocus: true,
|
|
2311
2249
|
}
|
|
2312
2250
|
|
|
@@ -2315,7 +2253,6 @@ export const DataGridExamples = [
|
|
|
2315
2253
|
`,
|
|
2316
2254
|
code: `<OpsnowCommonDataGrid
|
|
2317
2255
|
columnDefs={columnDefs}
|
|
2318
|
-
defaultColDef={defaultColDef}
|
|
2319
2256
|
rowData={rowData}
|
|
2320
2257
|
status={CommonConst.GRID_STATUS.DATA_EXISTS}
|
|
2321
2258
|
gridOptions={gridOptions}
|
|
@@ -2323,7 +2260,49 @@ export const DataGridExamples = [
|
|
|
2323
2260
|
/>`
|
|
2324
2261
|
},
|
|
2325
2262
|
{
|
|
2326
|
-
title: '
|
|
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 커스텀 헤더도 동일).',
|
|
2265
|
+
code_props_usage: `
|
|
2266
|
+
import { useCommonComponents, useGlobalContext } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
2267
|
+
import i18n from '@opsnow-common/opsnow-finops-common-i18n'
|
|
2268
|
+
|
|
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)',
|
|
2327
2306
|
description: 'domLayout: \'autoHeight\'는 행이 적으면 콘텐츠 높이에 맞추고, maxGridHeight(기본 600px, 헤더 42px 포함)를 넘으면 본문에 세로 스크롤이 자동으로 생깁니다(grid ≥2.0.6). 행 수로 domLayout을 분기하지 마세요 — domLayout: \'normal\'을 주면 그리드 높이가 0이 되어 화면에서 사라집니다. 상한은 maxGridHeight로 바꾸고, 모든 행을 펼치려면 unlimitedHeight를 씁니다. 고정 높이가 필요하면 domLayout 키를 빼고 gridHeight를 지정합니다.',
|
|
2328
2307
|
code_props_usage: `
|
|
2329
2308
|
import { useCommonComponents, useGlobalContext } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
@@ -2336,19 +2315,11 @@ export const DataGridExamples = [
|
|
|
2336
2315
|
field: 'description',
|
|
2337
2316
|
flex: 3,
|
|
2338
2317
|
minWidth: 300,
|
|
2339
|
-
wrapText: true,
|
|
2340
|
-
autoHeight: true, // 행 높이 자동 조절 - 필수
|
|
2341
|
-
suppressSizeToFit: true,
|
|
2342
|
-
cellStyle: { alignItems: 'center' } // autoHeight 작동을 위해 필수
|
|
2318
|
+
wrapText: true, // 이 예제는 행 높이 변화를 보이려고 줄바꿈 지정 — 기본은 한 줄 + 말줄임
|
|
2343
2319
|
},
|
|
2344
2320
|
{ headerName: 'Status', field: 'status', flex: 1, minWidth: 120 },
|
|
2345
2321
|
]
|
|
2346
2322
|
|
|
2347
|
-
const defaultColDef = {
|
|
2348
|
-
wrapText: true, // 텍스트 줄바꿈 활성화
|
|
2349
|
-
autoHeight: true, // 셀 높이 자동 조절
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
2323
|
const { OpsnowCommonDataGrid, OpsnowCommonButton } = useCommonComponents()
|
|
2353
2324
|
const { CommonConst } = useGlobalContext()
|
|
2354
2325
|
|
|
@@ -2399,7 +2370,6 @@ export const DataGridExamples = [
|
|
|
2399
2370
|
</div>
|
|
2400
2371
|
<OpsnowCommonDataGrid
|
|
2401
2372
|
columnDefs={columnDefs}
|
|
2402
|
-
defaultColDef={defaultColDef}
|
|
2403
2373
|
rowData={rowData}
|
|
2404
2374
|
status={status}
|
|
2405
2375
|
gridOptions={gridOptions}
|
|
@@ -2616,10 +2586,11 @@ export const DataGridExamples = [
|
|
|
2616
2586
|
}
|
|
2617
2587
|
|
|
2618
2588
|
const fakeApi = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
2619
|
-
const nowLabel = () => new Date().toLocaleTimeString()
|
|
2620
2589
|
|
|
2621
2590
|
const { OpsnowCommonDataGrid, OpsnowCommonButton } = useCommonComponents()
|
|
2622
|
-
const { CommonConst } = useGlobalContext()
|
|
2591
|
+
const { CommonConst, finOpsDateUtils } = useGlobalContext()
|
|
2592
|
+
// 화면 표시 일시는 표기 표준 함수로 (시간대는 생략 — 상태 컬럼 안의 짧은 표기)
|
|
2593
|
+
const nowLabel = () => finOpsDateUtils.formatDateTime(Date.now(), { showTimeZone: false })
|
|
2623
2594
|
const gridRef = useRef(null)
|
|
2624
2595
|
|
|
2625
2596
|
const [rowData] = useState([
|
|
@@ -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 }}>
|
|
@@ -84,4 +84,41 @@ export const TabExamples = [
|
|
|
84
84
|
code: `<OpsnowCommonTab value={activeTab} onChange={handleTabChange} items={[{ label: 'Overview', content: (<div style={{ marginTop: '20px' }}><p>Overview content</p></div>) }, { label: 'Explorer', content: (<div style={{ marginTop: '20px' }}>{buttons.map((button) => (<OpsnowCommonButton key={button.value} label={button.label} onClick={() => handleButtonClick(button.value)} variant={selectedButton === button.value ? 'contained' : 'outlined'} style={{ marginRight: '10px', marginBottom: '10px' }} />))}{selectedButton && (<div style={{ marginTop: '20px' }}><p>Selected: {selectedButton}</p></div>)}</div>) }]} />`,
|
|
85
85
|
description: "2개의 탭(Overview, Explorer)이 있고, Explorer 탭에 동적 버튼 그룹이 포함된 2-Depth Button Tab UI 예제입니다.",
|
|
86
86
|
},
|
|
87
|
+
{
|
|
88
|
+
title: "useHashTab-URL-hash-sync",
|
|
89
|
+
code: `
|
|
90
|
+
import { useCommonComponents, useHashTab, buildTabUrl } from '@opsnow-common/opsnow-finops-common-ui-loader'
|
|
91
|
+
import { Link } from 'react-router-dom'
|
|
92
|
+
|
|
93
|
+
const TAB_IDS = ['overview', 'history', 'settings']
|
|
94
|
+
const SUB_IDS = ['daily', 'monthly']
|
|
95
|
+
|
|
96
|
+
const { OpsnowCommonTab } = useCommonComponents()
|
|
97
|
+
const tab = useHashTab(TAB_IDS) // #tab=overview
|
|
98
|
+
const sub = useHashTab(SUB_IDS, { key: 'sub' }) // #tab=history&sub=monthly
|
|
99
|
+
|
|
100
|
+
<OpsnowCommonTab
|
|
101
|
+
copilotId="demo-page-tab"
|
|
102
|
+
items={[
|
|
103
|
+
{ label: 'Overview', content: <div>Overview Content</div> },
|
|
104
|
+
{
|
|
105
|
+
label: 'History',
|
|
106
|
+
content: (
|
|
107
|
+
<OpsnowCommonTab
|
|
108
|
+
depth={2}
|
|
109
|
+
items={[
|
|
110
|
+
{ label: 'Daily', content: <div>Daily</div> },
|
|
111
|
+
{ label: 'Monthly', content: <div>Monthly</div> },
|
|
112
|
+
]}
|
|
113
|
+
{...sub.props}
|
|
114
|
+
/>
|
|
115
|
+
),
|
|
116
|
+
},
|
|
117
|
+
{ label: 'Settings', content: <div>Settings Content</div> },
|
|
118
|
+
]}
|
|
119
|
+
{...tab.props}
|
|
120
|
+
/>
|
|
121
|
+
<Link to={buildTabUrl('/my-page', 'history', {}, { sub: 'monthly' })}>월별 이력 보기</Link>`,
|
|
122
|
+
description: "페이지 탭을 URL 해시와 동기화하는 예제입니다 (새로고침·링크 공유 시 같은 탭 유지). useHashTab(ids)가 value/onChange/copilotTabIds를 담은 props를 돌려주므로 {...tab.props}로 펼칩니다. 다른 화면의 특정 탭으로 가는 링크는 buildTabUrl(path, id, query, { sub })로 만듭니다.",
|
|
123
|
+
},
|
|
87
124
|
];
|