Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/uyoufu/UzonCalc --skill popup-dialog명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | popup-dialog |
| description | popup dialog for creating or modifying items |
This skill provides a reusable popup dialog component that can be used for creating or modifying items.
IPopupDialogParams object to specify the dialog's title, fields, and other options.showDialog with the IPopupDialogParams object to display the dialog and get the result.import type { ILowCodeField, IPopupDialogParams } from 'src/components/lowCode/types'
import { LowCodeFieldType } from 'src/components/lowCode/types'
import { showDialog } from 'src/components/lowCode/PopupDialog'
import { confirmOperation, notifySuccess } from 'src/utils/dialog'
function buildCategoryFields(category?: ICategoryInfo) {
const fields: ILowCodeField[] = [
{
name: 'name',
label: t('categoryList.field_name'),
value: category ? category.name : '',
type: LowCodeFieldType.text,
required: true,
validate: (value: string) => {
// 必须仅包含字母、数字、下划线且不能以数字开头
const valid = /^[A-Za-z_][A-Za-z0-9_]*$/.test(value)
if (!valid) {
return {
ok: false,
message: t('categoryList.onlyLettersNumbersUnderscoresAndCannotStartWithNumber')
}
}
return { ok: true }
}
},
{
name: 'description',
label: t('categoryList.field_description'),
value: category ? category.description || '' : '',
type: LowCodeFieldType.textarea
}
]
return fields
}
// 新增分类
async function onCreateCategory() {
const popupParams: IPopupDialogParams = {
title: t('categoryList.newCategory'),
fields: buildCategoryFields(),
oneColumn: true
}
const result = await showDialog<ICategoryInfo>(popupParams)
if (!result.ok) return
// 添加默认的 icon
const newCategory = await props.createCategory(result.data)
categoryItems.value.push({
...newCategory,
active: false
})
// 设置新组为当前组
activeCategory(categoryItems.value[categoryItems.value.length - 1] as ICategoryInfo)
// 新增组
notifySuccess(t('categoryList.newCategorySuccess'))
}
async function onModifyCategory(categoryDetails: Record<string, any>) {
const categoryInfo = categoryDetails as ICategoryInfo
const popupParams: IPopupDialogParams = {
title: t('categoryList.modifyCategory'),
fields: buildCategoryFields(categoryInfo),
oneColumn: true
}
const result = await showDialog<ICategoryInfo>(popupParams)
if (!result.ok) return
// 指定 id 和 oid
result.data.id = categoryInfo.id
result.data.oid = categoryInfo.oid
await props.updateCategory(result.data)
// 更新数据
categoryInfo.name = result.data.name
categoryInfo.description = result.data.description
// 修改分类成功
notifySuccess(t('categoryList.modifyCategorySuccess'))
}