@cratis/components 1.0.3 → 1.0.5
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/dist/cjs/CommandDialog/CommandDialog.js +26 -4
- package/dist/cjs/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/cjs/Dialogs/BusyIndicatorDialog.js +1 -1
- package/dist/cjs/Dialogs/BusyIndicatorDialog.js.map +1 -1
- package/dist/cjs/ObjectContentEditor/ObjectContentEditor.js +3 -16
- package/dist/cjs/ObjectContentEditor/ObjectContentEditor.js.map +1 -1
- package/dist/cjs/ObjectContentEditor/objectHelpers.js +19 -0
- package/dist/cjs/ObjectContentEditor/objectHelpers.js.map +1 -0
- package/dist/cjs/ObjectNavigationalBar/ObjectNavigationalBar.js +2 -10
- package/dist/cjs/ObjectNavigationalBar/ObjectNavigationalBar.js.map +1 -1
- package/dist/cjs/ObjectNavigationalBar/breadcrumbHelpers.js +15 -0
- package/dist/cjs/ObjectNavigationalBar/breadcrumbHelpers.js.map +1 -0
- package/dist/cjs/SchemaEditor/SchemaEditor.js +4 -35
- package/dist/cjs/SchemaEditor/SchemaEditor.js.map +1 -1
- package/dist/cjs/SchemaEditor/schemaHelpers.js +33 -0
- package/dist/cjs/SchemaEditor/schemaHelpers.js.map +1 -0
- package/dist/cjs/TimeMachine/Properties.js +2 -7
- package/dist/cjs/TimeMachine/Properties.js.map +1 -1
- package/dist/cjs/TimeMachine/propertiesHelpers.js +11 -0
- package/dist/cjs/TimeMachine/propertiesHelpers.js.map +1 -0
- package/dist/esm/CommandDialog/CommandDialog.d.ts +21 -0
- package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js +28 -6
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.stories.d.ts +10 -0
- package/dist/esm/CommandDialog/CommandDialog.stories.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.stories.js +152 -1
- package/dist/esm/CommandDialog/CommandDialog.stories.js.map +1 -1
- package/dist/esm/DataPage/DataPage.stories.d.ts.map +1 -1
- package/dist/esm/DataPage/DataPage.stories.js +25 -2
- package/dist/esm/DataPage/DataPage.stories.js.map +1 -1
- package/dist/esm/DataTables/DataTableForObservableQuery.stories.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableForObservableQuery.stories.js +25 -2
- package/dist/esm/DataTables/DataTableForObservableQuery.stories.js.map +1 -1
- package/dist/esm/DataTables/DataTableForQuery.stories.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableForQuery.stories.js +25 -3
- package/dist/esm/DataTables/DataTableForQuery.stories.js.map +1 -1
- package/dist/esm/Dialogs/BusyIndicatorDialog.d.ts.map +1 -1
- package/dist/esm/Dialogs/BusyIndicatorDialog.js +2 -2
- package/dist/esm/Dialogs/BusyIndicatorDialog.js.map +1 -1
- package/dist/esm/Dialogs/Dialog.stories.d.ts +12 -0
- package/dist/esm/Dialogs/Dialog.stories.d.ts.map +1 -0
- package/dist/esm/Dialogs/Dialog.stories.js +44 -0
- package/dist/esm/Dialogs/Dialog.stories.js.map +1 -0
- package/dist/esm/ObjectContentEditor/ObjectContentEditor.d.ts.map +1 -1
- package/dist/esm/ObjectContentEditor/ObjectContentEditor.js +1 -14
- package/dist/esm/ObjectContentEditor/ObjectContentEditor.js.map +1 -1
- package/dist/esm/ObjectContentEditor/objectHelpers.d.ts +3 -0
- package/dist/esm/ObjectContentEditor/objectHelpers.d.ts.map +1 -0
- package/dist/esm/ObjectContentEditor/objectHelpers.js +17 -0
- package/dist/esm/ObjectContentEditor/objectHelpers.js.map +1 -0
- package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.d.ts.map +1 -1
- package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.js +2 -10
- package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.js.map +1 -1
- package/dist/esm/ObjectNavigationalBar/breadcrumbHelpers.d.ts +5 -0
- package/dist/esm/ObjectNavigationalBar/breadcrumbHelpers.d.ts.map +1 -0
- package/dist/esm/ObjectNavigationalBar/breadcrumbHelpers.js +13 -0
- package/dist/esm/ObjectNavigationalBar/breadcrumbHelpers.js.map +1 -0
- package/dist/esm/SchemaEditor/SchemaEditor.d.ts.map +1 -1
- package/dist/esm/SchemaEditor/SchemaEditor.js +2 -33
- package/dist/esm/SchemaEditor/SchemaEditor.js.map +1 -1
- package/dist/esm/SchemaEditor/schemaHelpers.d.ts +4 -0
- package/dist/esm/SchemaEditor/schemaHelpers.d.ts.map +1 -0
- package/dist/esm/SchemaEditor/schemaHelpers.js +30 -0
- package/dist/esm/SchemaEditor/schemaHelpers.js.map +1 -0
- package/dist/esm/TimeMachine/Properties.d.ts.map +1 -1
- package/dist/esm/TimeMachine/Properties.js +1 -6
- package/dist/esm/TimeMachine/Properties.js.map +1 -1
- package/dist/esm/TimeMachine/propertiesHelpers.d.ts +2 -0
- package/dist/esm/TimeMachine/propertiesHelpers.d.ts.map +1 -0
- package/dist/esm/TimeMachine/propertiesHelpers.js +9 -0
- package/dist/esm/TimeMachine/propertiesHelpers.js.map +1 -0
- package/dist/esm/given.d.ts +5 -0
- package/dist/esm/given.d.ts.map +1 -0
- package/dist/esm/given.js +7 -0
- package/dist/esm/given.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaEditor.js","sources":["../../../SchemaEditor/SchemaEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState, useEffect, useMemo, useCallback } from 'react';\nimport { Button } from 'primereact/button';\nimport { DataTable } from 'primereact/datatable';\nimport { Column } from 'primereact/column';\nimport { Menubar } from 'primereact/menubar';\nimport { Tooltip } from 'primereact/tooltip';\nimport * as faIcons from 'react-icons/fa6';\nimport { NameCell } from './NameCell';\nimport { TypeCell } from './TypeCell';\nimport { JsonSchema, JsonSchemaProperty, NavigationItem } from '../types/JsonSchema';\nimport { TypeFormat, DEFAULT_TYPE_FORMATS } from '../types/TypeFormat';\nimport css from './SchemaEditor.module.css';\nimport { MenuItem } from 'primereact/menuitem';\n\nexport interface SchemaEditorProps {\n schema: JsonSchema;\n eventTypeName?: string;\n canEdit?: boolean;\n canNotEditReason?: string;\n onChange?: (schema: JsonSchema) => void;\n onSave?: () => void;\n onCancel?: () => void;\n editMode?: boolean;\n saveDisabled?: boolean;\n cancelDisabled?: boolean;\n typeFormats?: TypeFormat[];\n}\n\nexport const SchemaEditor = ({ \n schema, \n eventTypeName = '', \n canEdit = true, \n canNotEditReason, \n onChange, \n onSave, \n onCancel, \n editMode, \n saveDisabled = false, \n cancelDisabled = false,\n typeFormats = DEFAULT_TYPE_FORMATS\n}: SchemaEditorProps) => {\n const [currentPath, setCurrentPath] = useState<string[]>([]);\n const [properties, setProperties] = useState<JsonSchemaProperty[]>([]);\n const [currentSchema, setCurrentSchema] = useState<JsonSchema>(schema);\n const [isEditMode, setIsEditMode] = useState(editMode ?? false);\n const [initialSchema, setInitialSchema] = useState<JsonSchema>(schema);\n const [validationErrors, setValidationErrors] = useState<Record<string, string>>({});\n\n useEffect(() => {\n if (!isEditMode) {\n setCurrentPath([]);\n }\n }, [isEditMode]);\n\n const validatePropertyName = useCallback((name: string, propertyId: string, allProperties: JsonSchemaProperty[]): string | undefined => {\n if (!name || name.trim() === '') {\n return 'Property name cannot be empty';\n }\n\n const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n if (!validIdentifierPattern.test(name)) {\n return 'Property name must start with a letter or underscore and contain only letters, numbers, and underscores';\n }\n\n const duplicates = allProperties.filter(p => p.name === name && p.id !== propertyId);\n if (duplicates.length > 0) {\n return 'Property name must be unique';\n }\n\n return undefined;\n }, []);\n\n const validateAllProperties = useCallback((properties: JsonSchemaProperty[]) => {\n const errors: Record<string, string> = {};\n\n properties.forEach(prop => {\n if (!prop.name) return;\n const error = validatePropertyName(prop.name, prop.id!, properties);\n if (error) {\n errors[prop.id!] = error;\n }\n });\n\n setValidationErrors(errors);\n return Object.keys(errors).length === 0;\n }, [validatePropertyName]);\n\n useEffect(() => {\n setCurrentSchema(schema);\n setInitialSchema(JSON.parse(JSON.stringify(schema)));\n }, [schema]);\n\n useEffect(() => {\n loadPropertiesForCurrentPath();\n }, [currentPath, currentSchema, isEditMode]);\n\n const loadPropertiesForCurrentPath = () => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as JsonSchema | JsonSchemaProperty;\n } else {\n return;\n }\n }\n\n const schemaProps: JsonSchemaProperty[] = [];\n if (targetSchema.properties) {\n let idCounter = 0;\n for (const [name, property] of Object.entries(targetSchema.properties)) {\n schemaProps.push({\n id: `prop-${currentPath.join('-')}-${idCounter++}`,\n name,\n type: property.type || 'string',\n format: property.format,\n description: property.description,\n items: property.items,\n properties: property.properties,\n required: (currentSchema.required as string[] | undefined)?.includes(name) || false\n });\n }\n }\n\n setProperties(schemaProps);\n if (isEditMode) {\n validateAllProperties(schemaProps);\n }\n };\n\n const updateSchemaAtPath = useCallback((path: string[], updater: (schema: JsonSchema) => JsonSchema) => {\n const newSchema = JSON.parse(JSON.stringify(currentSchema));\n\n if (path.length === 0) {\n const updated = updater(newSchema);\n setCurrentSchema(updated);\n onChange?.(updated);\n return;\n }\n\n let targetSchema = newSchema;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i];\n if (targetSchema.type === 'array' && segment === '$items') {\n if (!targetSchema.items) {\n targetSchema.items = { type: 'object', properties: {} };\n }\n targetSchema = targetSchema.items;\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment];\n }\n }\n\n const lastSegment = path[path.length - 1];\n if (targetSchema.type === 'array' && lastSegment === '$items') {\n targetSchema.items = updater(targetSchema.items || {});\n } else {\n if (!targetSchema.properties) {\n targetSchema.properties = {};\n }\n targetSchema.properties[lastSegment] = updater(targetSchema.properties[lastSegment] || {});\n }\n\n setCurrentSchema(newSchema);\n onChange?.(newSchema);\n }, [currentSchema, onChange]);\n\n const addProperty = useCallback(() => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n let newName = 'newProperty';\n let counter = 1;\n while (newProps[newName]) {\n newName = `newProperty${counter++}`;\n }\n newProps[newName] = { type: 'string' };\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const removeProperty = useCallback((propertyName: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n delete newProps[propertyName];\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const updateProperty = useCallback((oldName: string, field: keyof JsonSchemaProperty, value: unknown, additionalUpdates?: Partial<JsonSchemaProperty>) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[oldName] || {}) };\n\n if (field === 'name') {\n if (value !== oldName && !newProps[value as string]) {\n newProps[value as string] = prop;\n delete newProps[oldName];\n }\n } else if (field === 'type') {\n prop.type = value as string;\n if (value === 'array') {\n prop.items = { type: 'string' };\n delete prop.format;\n } else if (value === 'object') {\n prop.properties = {};\n delete prop.format;\n delete prop.items;\n } else {\n delete prop.items;\n delete prop.properties;\n }\n\n if (additionalUpdates) {\n if ('format' in additionalUpdates) {\n if (additionalUpdates.format) {\n prop.format = additionalUpdates.format as string;\n } else {\n delete prop.format;\n }\n }\n }\n\n newProps[oldName] = prop;\n } else if (field === 'format') {\n if (value && value !== 'none') {\n prop.format = value as string;\n } else {\n delete prop.format;\n }\n newProps[oldName] = prop;\n }\n\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const updateArrayItemType = useCallback((propertyName: string, itemType: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[propertyName] || {}) };\n\n if (itemType === 'object') {\n prop.items = { type: 'object', properties: {} };\n } else if (itemType === 'array') {\n prop.items = { type: 'array', items: { type: 'string' } };\n } else {\n prop.items = { type: itemType };\n }\n\n newProps[propertyName] = prop;\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const navigateToProperty = useCallback((propertyName: string) => {\n setCurrentPath([...currentPath, propertyName]);\n }, [currentPath]);\n\n const navigateToArrayItems = useCallback((propertyName: string) => {\n setCurrentPath([...currentPath, propertyName, '$items']);\n }, [currentPath]);\n\n const navigateBack = useCallback(() => {\n if (currentPath.length > 0) {\n setCurrentPath(currentPath.slice(0, -1));\n }\n }, [currentPath]);\n\n const navigateToBreadcrumb = useCallback((index: number) => {\n const items = getBreadcrumbItems();\n setCurrentPath(items[index].path);\n }, [currentPath, eventTypeName]);\n\n const handleSave = useCallback(() => {\n onSave?.();\n setIsEditMode(false);\n }, [onSave]);\n\n const handleCancel = useCallback(() => {\n setCurrentSchema(JSON.parse(JSON.stringify(initialSchema)));\n onChange?.(JSON.parse(JSON.stringify(initialSchema)));\n setIsEditMode(false);\n onCancel?.();\n }, [initialSchema, onChange, onCancel]);\n\n const handleEdit = useCallback(() => {\n setInitialSchema(JSON.parse(JSON.stringify(currentSchema)));\n setIsEditMode(true);\n }, [currentSchema]);\n\n const getBreadcrumbItems = () => {\n const items: NavigationItem[] = [{ name: eventTypeName, path: [] }];\n\n for (let i = 0; i < currentPath.length; i++) {\n const segment = currentPath[i];\n if (segment === '$items') {\n items.push({\n name: '[items]',\n path: currentPath.slice(0, i + 1)\n });\n } else {\n items.push({\n name: segment,\n path: currentPath.slice(0, i + 1)\n });\n }\n }\n\n return items;\n };\n\n const getCurrentDescription = useCallback(() => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as JsonSchema | JsonSchemaProperty;\n } else {\n return undefined;\n }\n }\n\n return targetSchema.description;\n }, [currentSchema, currentPath]);\n\n const hasValidationErrors = Object.keys(validationErrors).length > 0;\n\n const menuItems = useMemo(() => [\n ...(!isEditMode ? [{\n label: 'Edit',\n icon: <faIcons.FaPencil className='mr-2' />,\n command: canEdit ? handleEdit : undefined,\n className: !canEdit ? 'edit-disabled-with-reason' : undefined,\n template: !canEdit && canNotEditReason ? (item: MenuItem) => (\n <div\n className=\"p-menuitem-link p-disabled\"\n data-pr-tooltip={canNotEditReason}\n data-pr-position=\"bottom\"\n style={{ cursor: 'not-allowed', opacity: 0.6 }}\n >\n {item.icon}\n <span className=\"p-menuitem-text\">{item.label}</span>\n </div>\n ) : undefined\n }] : []),\n ...(isEditMode ? [\n ...(!saveDisabled ? [{\n label: 'Save',\n icon: <faIcons.FaCheck className='mr-2' />,\n command: hasValidationErrors ? undefined : handleSave,\n disabled: hasValidationErrors\n }] : []),\n ...(!cancelDisabled ? [{\n label: 'Cancel',\n icon: <faIcons.FaXmark className='mr-2' />,\n command: handleCancel\n }] : []),\n {\n label: 'Add Property',\n icon: <faIcons.FaPlus className='mr-2' />,\n command: addProperty\n }\n ] : [])\n ], [isEditMode, handleSave, handleCancel, handleEdit, addProperty, canEdit, canNotEditReason, hasValidationErrors, saveDisabled, cancelDisabled]);\n\n const breadcrumbItems = getBreadcrumbItems();\n const isAtRoot = currentPath.length === 0;\n const currentDescription = getCurrentDescription();\n\n return (\n <div className=\"schema-editor\" style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n <div className=\"px-4 py-4\">\n <Tooltip target=\"[data-pr-tooltip]\" />\n <div className=\"schema-editor-menubar\">\n <Menubar aria-label=\"Actions\" model={menuItems} />\n </div>\n </div>\n\n <div className=\"px-4 py-2 border-bottom-1 surface-border\">\n <div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <Button\n icon={<faIcons.FaArrowLeft />}\n className=\"p-button-text p-button-sm\"\n onClick={navigateBack}\n disabled={isAtRoot}\n tooltip=\"Navigate back\"\n tooltipOptions={{ position: 'top' }}\n />\n <div style={{ fontSize: '0.9rem', color: 'var(--text-color-secondary)', cursor: 'pointer' }}>\n {breadcrumbItems.map((item, index) => (\n <span key={index}>\n {index > 0 && <span className=\"mx-2\">></span>}\n <span\n onClick={() => navigateToBreadcrumb(index)}\n style={{ cursor: 'pointer', textDecoration: index < breadcrumbItems.length - 1 ? 'underline' : 'none' }}\n >\n {item.name}\n </span>\n </span>\n ))}\n </div>\n </div>\n {currentDescription && (\n <div style={{ fontSize: '0.875rem', color: 'var(--text-color-secondary)', marginTop: '0.5rem', marginLeft: '2.5rem', fontStyle: 'italic', display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <faIcons.FaCircleInfo />\n <span>{currentDescription}</span>\n </div>\n )}\n </div>\n\n <div style={{ flex: 1, overflow: 'auto', padding: '1rem' }}>\n <Tooltip key={`nav-${eventTypeName}-${currentPath.join('/')}`} target=\".schema-navigation-tooltip\" mouseTrack mouseTrackTop={15} />\n <Tooltip key={`desc-${eventTypeName}-${currentPath.join('/')}`} target=\".schema-description-tooltip\" />\n <DataTable\n key={`${isEditMode}-${currentPath.join('/')}`}\n value={properties}\n dataKey=\"id\"\n emptyMessage=\"No properties defined\"\n rowClassName={(rowData: JsonSchemaProperty) => {\n if (!isEditMode && (rowData.type === 'object' || (rowData.type === 'array' && rowData.items?.type === 'object'))) {\n return css.navigableRow;\n }\n return '';\n }}\n onRowClick={(e) => {\n if (!isEditMode) {\n const rowData = e.data as JsonSchemaProperty;\n if (rowData.name) {\n if (rowData.type === 'object') {\n navigateToProperty(rowData.name);\n } else if (rowData.type === 'array' && rowData.items?.type === 'object') {\n navigateToArrayItems(rowData.name);\n }\n }\n }\n }}\n pt={{\n root: { style: { border: 'none' } },\n tbody: { style: { borderTop: '1px solid var(--surface-border)' } }\n }}\n >\n <Column\n field=\"name\"\n header=\"Property\"\n body={(rowData: JsonSchemaProperty) => (\n <NameCell\n rowData={rowData}\n isEditMode={isEditMode}\n onUpdate={updateProperty}\n validationError={validationErrors[rowData.id!]}\n />\n )}\n style={{ width: '30%' }}\n />\n <Column\n header=\"Type\"\n body={(rowData: JsonSchemaProperty) => (\n <TypeCell\n rowData={rowData}\n isEditMode={isEditMode}\n typeFormats={typeFormats}\n onUpdateProperty={updateProperty}\n onUpdateArrayItemType={updateArrayItemType}\n onNavigateToProperty={navigateToProperty}\n onNavigateToArrayItems={navigateToArrayItems}\n onRemoveProperty={removeProperty}\n />\n )}\n style={{ width: '70%' }}\n />\n </DataTable>\n </div>\n </div>\n );\n};\n"],"names":["DEFAULT_TYPE_FORMATS","useState","useEffect","useCallback","useMemo","_jsx","faIcons","_jsxs","Tooltip","Menubar","Button","DataTable","Column","NameCell","TypeCell"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,YAAY,GAAG,CAAC,EACzB,MAAM,EACN,aAAa,GAAG,EAAE,EAClB,OAAO,GAAG,IAAI,EACd,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,KAAK,EACtB,WAAW,GAAGA,+BAAoB,EAClB,KAAI;IACpB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAGC,cAAQ,CAAW,EAAE,CAAC;IAC5D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAuB,EAAE,CAAC;IACtE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAa,MAAM,CAAC;AACtE,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,Q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AAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAE,CAwDrC,CAAA,EAAA,CACV,CAAA,EAAA,CACJ;AAEd;;;;"}
|
|
1
|
+
{"version":3,"file":"SchemaEditor.js","sources":["../../../SchemaEditor/SchemaEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState, useEffect, useMemo, useCallback } from 'react';\nimport { Button } from 'primereact/button';\nimport { DataTable } from 'primereact/datatable';\nimport { Column } from 'primereact/column';\nimport { Menubar } from 'primereact/menubar';\nimport { Tooltip } from 'primereact/tooltip';\nimport * as faIcons from 'react-icons/fa6';\nimport { NameCell } from './NameCell';\nimport { TypeCell } from './TypeCell';\nimport { JsonSchema, JsonSchemaProperty } from '../types/JsonSchema';\nimport { TypeFormat, DEFAULT_TYPE_FORMATS } from '../types/TypeFormat';\nimport { validatePropertyName, buildBreadcrumbItems } from './schemaHelpers';\nimport css from './SchemaEditor.module.css';\nimport { MenuItem } from 'primereact/menuitem';\n\nexport interface SchemaEditorProps {\n schema: JsonSchema;\n eventTypeName?: string;\n canEdit?: boolean;\n canNotEditReason?: string;\n onChange?: (schema: JsonSchema) => void;\n onSave?: () => void;\n onCancel?: () => void;\n editMode?: boolean;\n saveDisabled?: boolean;\n cancelDisabled?: boolean;\n typeFormats?: TypeFormat[];\n}\n\nexport const SchemaEditor = ({ \n schema, \n eventTypeName = '', \n canEdit = true, \n canNotEditReason, \n onChange, \n onSave, \n onCancel, \n editMode, \n saveDisabled = false, \n cancelDisabled = false,\n typeFormats = DEFAULT_TYPE_FORMATS\n}: SchemaEditorProps) => {\n const [currentPath, setCurrentPath] = useState<string[]>([]);\n const [properties, setProperties] = useState<JsonSchemaProperty[]>([]);\n const [currentSchema, setCurrentSchema] = useState<JsonSchema>(schema);\n const [isEditMode, setIsEditMode] = useState(editMode ?? false);\n const [initialSchema, setInitialSchema] = useState<JsonSchema>(schema);\n const [validationErrors, setValidationErrors] = useState<Record<string, string>>({});\n\n useEffect(() => {\n if (!isEditMode) {\n setCurrentPath([]);\n }\n }, [isEditMode]);\n\n const validateAllProperties = useCallback((properties: JsonSchemaProperty[]) => {\n const errors: Record<string, string> = {};\n\n properties.forEach(prop => {\n if (!prop.name) return;\n const error = validatePropertyName(prop.name, prop.id!, properties);\n if (error) {\n errors[prop.id!] = error;\n }\n });\n\n setValidationErrors(errors);\n return Object.keys(errors).length === 0;\n }, [validatePropertyName]);\n\n useEffect(() => {\n setCurrentSchema(schema);\n setInitialSchema(JSON.parse(JSON.stringify(schema)));\n }, [schema]);\n\n useEffect(() => {\n loadPropertiesForCurrentPath();\n }, [currentPath, currentSchema, isEditMode]);\n\n const loadPropertiesForCurrentPath = () => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as JsonSchema | JsonSchemaProperty;\n } else {\n return;\n }\n }\n\n const schemaProps: JsonSchemaProperty[] = [];\n if (targetSchema.properties) {\n let idCounter = 0;\n for (const [name, property] of Object.entries(targetSchema.properties)) {\n schemaProps.push({\n id: `prop-${currentPath.join('-')}-${idCounter++}`,\n name,\n type: property.type || 'string',\n format: property.format,\n description: property.description,\n items: property.items,\n properties: property.properties,\n required: (currentSchema.required as string[] | undefined)?.includes(name) || false\n });\n }\n }\n\n setProperties(schemaProps);\n if (isEditMode) {\n validateAllProperties(schemaProps);\n }\n };\n\n const updateSchemaAtPath = useCallback((path: string[], updater: (schema: JsonSchema) => JsonSchema) => {\n const newSchema = JSON.parse(JSON.stringify(currentSchema));\n\n if (path.length === 0) {\n const updated = updater(newSchema);\n setCurrentSchema(updated);\n onChange?.(updated);\n return;\n }\n\n let targetSchema = newSchema;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i];\n if (targetSchema.type === 'array' && segment === '$items') {\n if (!targetSchema.items) {\n targetSchema.items = { type: 'object', properties: {} };\n }\n targetSchema = targetSchema.items;\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment];\n }\n }\n\n const lastSegment = path[path.length - 1];\n if (targetSchema.type === 'array' && lastSegment === '$items') {\n targetSchema.items = updater(targetSchema.items || {});\n } else {\n if (!targetSchema.properties) {\n targetSchema.properties = {};\n }\n targetSchema.properties[lastSegment] = updater(targetSchema.properties[lastSegment] || {});\n }\n\n setCurrentSchema(newSchema);\n onChange?.(newSchema);\n }, [currentSchema, onChange]);\n\n const addProperty = useCallback(() => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n let newName = 'newProperty';\n let counter = 1;\n while (newProps[newName]) {\n newName = `newProperty${counter++}`;\n }\n newProps[newName] = { type: 'string' };\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const removeProperty = useCallback((propertyName: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n delete newProps[propertyName];\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const updateProperty = useCallback((oldName: string, field: keyof JsonSchemaProperty, value: unknown, additionalUpdates?: Partial<JsonSchemaProperty>) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[oldName] || {}) };\n\n if (field === 'name') {\n if (value !== oldName && !newProps[value as string]) {\n newProps[value as string] = prop;\n delete newProps[oldName];\n }\n } else if (field === 'type') {\n prop.type = value as string;\n if (value === 'array') {\n prop.items = { type: 'string' };\n delete prop.format;\n } else if (value === 'object') {\n prop.properties = {};\n delete prop.format;\n delete prop.items;\n } else {\n delete prop.items;\n delete prop.properties;\n }\n\n if (additionalUpdates) {\n if ('format' in additionalUpdates) {\n if (additionalUpdates.format) {\n prop.format = additionalUpdates.format as string;\n } else {\n delete prop.format;\n }\n }\n }\n\n newProps[oldName] = prop;\n } else if (field === 'format') {\n if (value && value !== 'none') {\n prop.format = value as string;\n } else {\n delete prop.format;\n }\n newProps[oldName] = prop;\n }\n\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const updateArrayItemType = useCallback((propertyName: string, itemType: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[propertyName] || {}) };\n\n if (itemType === 'object') {\n prop.items = { type: 'object', properties: {} };\n } else if (itemType === 'array') {\n prop.items = { type: 'array', items: { type: 'string' } };\n } else {\n prop.items = { type: itemType };\n }\n\n newProps[propertyName] = prop;\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const navigateToProperty = useCallback((propertyName: string) => {\n setCurrentPath([...currentPath, propertyName]);\n }, [currentPath]);\n\n const navigateToArrayItems = useCallback((propertyName: string) => {\n setCurrentPath([...currentPath, propertyName, '$items']);\n }, [currentPath]);\n\n const navigateBack = useCallback(() => {\n if (currentPath.length > 0) {\n setCurrentPath(currentPath.slice(0, -1));\n }\n }, [currentPath]);\n\n const navigateToBreadcrumb = useCallback((index: number) => {\n const items = getBreadcrumbItems();\n setCurrentPath(items[index].path);\n }, [currentPath, eventTypeName]);\n\n const handleSave = useCallback(() => {\n onSave?.();\n setIsEditMode(false);\n }, [onSave]);\n\n const handleCancel = useCallback(() => {\n setCurrentSchema(JSON.parse(JSON.stringify(initialSchema)));\n onChange?.(JSON.parse(JSON.stringify(initialSchema)));\n setIsEditMode(false);\n onCancel?.();\n }, [initialSchema, onChange, onCancel]);\n\n const handleEdit = useCallback(() => {\n setInitialSchema(JSON.parse(JSON.stringify(currentSchema)));\n setIsEditMode(true);\n }, [currentSchema]);\n\n const getBreadcrumbItems = () => buildBreadcrumbItems(eventTypeName, currentPath);\n\n const getCurrentDescription = useCallback(() => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as JsonSchema | JsonSchemaProperty;\n } else {\n return undefined;\n }\n }\n\n return targetSchema.description;\n }, [currentSchema, currentPath]);\n\n const hasValidationErrors = Object.keys(validationErrors).length > 0;\n\n const menuItems = useMemo(() => [\n ...(!isEditMode ? [{\n label: 'Edit',\n icon: <faIcons.FaPencil className='mr-2' />,\n command: canEdit ? handleEdit : undefined,\n className: !canEdit ? 'edit-disabled-with-reason' : undefined,\n template: !canEdit && canNotEditReason ? (item: MenuItem) => (\n <div\n className=\"p-menuitem-link p-disabled\"\n data-pr-tooltip={canNotEditReason}\n data-pr-position=\"bottom\"\n style={{ cursor: 'not-allowed', opacity: 0.6 }}\n >\n {item.icon}\n <span className=\"p-menuitem-text\">{item.label}</span>\n </div>\n ) : undefined\n }] : []),\n ...(isEditMode ? [\n ...(!saveDisabled ? [{\n label: 'Save',\n icon: <faIcons.FaCheck className='mr-2' />,\n command: hasValidationErrors ? undefined : handleSave,\n disabled: hasValidationErrors\n }] : []),\n ...(!cancelDisabled ? [{\n label: 'Cancel',\n icon: <faIcons.FaXmark className='mr-2' />,\n command: handleCancel\n }] : []),\n {\n label: 'Add Property',\n icon: <faIcons.FaPlus className='mr-2' />,\n command: addProperty\n }\n ] : [])\n ], [isEditMode, handleSave, handleCancel, handleEdit, addProperty, canEdit, canNotEditReason, hasValidationErrors, saveDisabled, cancelDisabled]);\n\n const breadcrumbItems = getBreadcrumbItems();\n const isAtRoot = currentPath.length === 0;\n const currentDescription = getCurrentDescription();\n\n return (\n <div className=\"schema-editor\" style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n <div className=\"px-4 py-4\">\n <Tooltip target=\"[data-pr-tooltip]\" />\n <div className=\"schema-editor-menubar\">\n <Menubar aria-label=\"Actions\" model={menuItems} />\n </div>\n </div>\n\n <div className=\"px-4 py-2 border-bottom-1 surface-border\">\n <div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <Button\n icon={<faIcons.FaArrowLeft />}\n className=\"p-button-text p-button-sm\"\n onClick={navigateBack}\n disabled={isAtRoot}\n tooltip=\"Navigate back\"\n tooltipOptions={{ position: 'top' }}\n />\n <div style={{ fontSize: '0.9rem', color: 'var(--text-color-secondary)', cursor: 'pointer' }}>\n {breadcrumbItems.map((item, index) => (\n <span key={index}>\n {index > 0 && <span className=\"mx-2\">></span>}\n <span\n onClick={() => navigateToBreadcrumb(index)}\n style={{ cursor: 'pointer', textDecoration: index < breadcrumbItems.length - 1 ? 'underline' : 'none' }}\n >\n {item.name}\n </span>\n </span>\n ))}\n </div>\n </div>\n {currentDescription && (\n <div style={{ fontSize: '0.875rem', color: 'var(--text-color-secondary)', marginTop: '0.5rem', marginLeft: '2.5rem', fontStyle: 'italic', display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <faIcons.FaCircleInfo />\n <span>{currentDescription}</span>\n </div>\n )}\n </div>\n\n <div style={{ flex: 1, overflow: 'auto', padding: '1rem' }}>\n <Tooltip key={`nav-${eventTypeName}-${currentPath.join('/')}`} target=\".schema-navigation-tooltip\" mouseTrack mouseTrackTop={15} />\n <Tooltip key={`desc-${eventTypeName}-${currentPath.join('/')}`} target=\".schema-description-tooltip\" />\n <DataTable\n key={`${isEditMode}-${currentPath.join('/')}`}\n value={properties}\n dataKey=\"id\"\n emptyMessage=\"No properties defined\"\n rowClassName={(rowData: JsonSchemaProperty) => {\n if (!isEditMode && (rowData.type === 'object' || (rowData.type === 'array' && rowData.items?.type === 'object'))) {\n return css.navigableRow;\n }\n return '';\n }}\n onRowClick={(e) => {\n if (!isEditMode) {\n const rowData = e.data as JsonSchemaProperty;\n if (rowData.name) {\n if (rowData.type === 'object') {\n navigateToProperty(rowData.name);\n } else if (rowData.type === 'array' && rowData.items?.type === 'object') {\n navigateToArrayItems(rowData.name);\n }\n }\n }\n }}\n pt={{\n root: { style: { border: 'none' } },\n tbody: { style: { borderTop: '1px solid var(--surface-border)' } }\n }}\n >\n <Column\n field=\"name\"\n header=\"Property\"\n body={(rowData: JsonSchemaProperty) => (\n <NameCell\n rowData={rowData}\n isEditMode={isEditMode}\n onUpdate={updateProperty}\n validationError={validationErrors[rowData.id!]}\n />\n )}\n style={{ width: '30%' }}\n />\n <Column\n header=\"Type\"\n body={(rowData: JsonSchemaProperty) => (\n <TypeCell\n rowData={rowData}\n isEditMode={isEditMode}\n typeFormats={typeFormats}\n onUpdateProperty={updateProperty}\n onUpdateArrayItemType={updateArrayItemType}\n onNavigateToProperty={navigateToProperty}\n onNavigateToArrayItems={navigateToArrayItems}\n onRemoveProperty={removeProperty}\n />\n )}\n style={{ width: '70%' }}\n />\n </DataTable>\n </div>\n </div>\n );\n};\n"],"names":["DEFAULT_TYPE_FORMATS","useState","useEffect","useCallback","validatePropertyName","buildBreadcrumbItems","useMemo","_jsx","faIcons","_jsxs","Tooltip","Menubar","Button","DataTable","Column","NameCell","TypeCell"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,MAAM,YAAY,GAAG,CAAC,EACzB,MAAM,EACN,aAAa,GAAG,EAAE,EAClB,OAAO,GAAG,IAAI,EACd,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,KAAK,EACtB,WAAW,GAAGA,+BAAoB,EAClB,KAAI;IACpB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAGC,cAAQ,CAAW,EAAE,CAAC;IAC5D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAuB,EAAE,CAAC;IACtE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAa,MAAM,CAAC;AACtE,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,QAAQ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W,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAE,CAwDrC,CAAA,EAAA,CACV,CAAA,EAAA,CACJ;AAEd;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function validatePropertyName(name, propertyId, allProperties) {
|
|
4
|
+
if (!name || name.trim() === '') {
|
|
5
|
+
return 'Property name cannot be empty';
|
|
6
|
+
}
|
|
7
|
+
const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
8
|
+
if (!validIdentifierPattern.test(name)) {
|
|
9
|
+
return 'Property name must start with a letter or underscore and contain only letters, numbers, and underscores';
|
|
10
|
+
}
|
|
11
|
+
const duplicates = allProperties.filter(p => p.name === name && p.id !== propertyId);
|
|
12
|
+
if (duplicates.length > 0) {
|
|
13
|
+
return 'Property name must be unique';
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
function buildBreadcrumbItems(eventTypeName, currentPath) {
|
|
18
|
+
const items = [{ name: eventTypeName, path: [] }];
|
|
19
|
+
for (let i = 0; i < currentPath.length; i++) {
|
|
20
|
+
const segment = currentPath[i];
|
|
21
|
+
if (segment === '$items') {
|
|
22
|
+
items.push({ name: '[items]', path: currentPath.slice(0, i + 1) });
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
items.push({ name: segment, path: currentPath.slice(0, i + 1) });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return items;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.buildBreadcrumbItems = buildBreadcrumbItems;
|
|
32
|
+
exports.validatePropertyName = validatePropertyName;
|
|
33
|
+
//# sourceMappingURL=schemaHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaHelpers.js","sources":["../../../SchemaEditor/schemaHelpers.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { JsonSchemaProperty, NavigationItem } from '../types/JsonSchema';\n\n/**\n * Validates a property name, returning an error string or undefined if valid.\n */\nexport function validatePropertyName(name: string, propertyId: string, allProperties: JsonSchemaProperty[]): string | undefined {\n if (!name || name.trim() === '') {\n return 'Property name cannot be empty';\n }\n\n const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n if (!validIdentifierPattern.test(name)) {\n return 'Property name must start with a letter or underscore and contain only letters, numbers, and underscores';\n }\n\n const duplicates = allProperties.filter(p => p.name === name && p.id !== propertyId);\n if (duplicates.length > 0) {\n return 'Property name must be unique';\n }\n\n return undefined;\n}\n\n/**\n * Builds the list of breadcrumb navigation items from a path, using the event type name as the root.\n */\nexport function buildBreadcrumbItems(eventTypeName: string, currentPath: string[]): NavigationItem[] {\n const items: NavigationItem[] = [{ name: eventTypeName, path: [] }];\n\n for (let i = 0; i < currentPath.length; i++) {\n const segment = currentPath[i];\n if (segment === '$items') {\n items.push({ name: '[items]', path: currentPath.slice(0, i + 1) });\n } else {\n items.push({ name: segment, path: currentPath.slice(0, i + 1) });\n }\n }\n\n return items;\n}\n"],"names":[],"mappings":";;SAQgB,oBAAoB,CAAC,IAAY,EAAE,UAAkB,EAAE,aAAmC,EAAA;IACtG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;AAC7B,QAAA,OAAO,+BAA+B;IAC1C;IAEA,MAAM,sBAAsB,GAAG,0BAA0B;IACzD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;AACpC,QAAA,OAAO,yGAAyG;IACpH;IAEA,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC;AACpF,IAAA,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACvB,QAAA,OAAO,8BAA8B;IACzC;AAEA,IAAA,OAAO,SAAS;AACpB;AAKM,SAAU,oBAAoB,CAAC,aAAqB,EAAE,WAAqB,EAAA;AAC7E,IAAA,MAAM,KAAK,GAAqB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAEnE,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACzC,QAAA,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC;AAC9B,QAAA,IAAI,OAAO,KAAK,QAAQ,EAAE;YACtB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACtE;aAAO;YACH,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACpE;IACJ;AAEA,IAAA,OAAO,KAAK;AAChB;;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var propertiesHelpers = require('./propertiesHelpers.js');
|
|
4
5
|
|
|
5
6
|
const Properties = ({ data, className, align = 'left' }) => {
|
|
6
7
|
const tableStyle = {
|
|
@@ -45,13 +46,7 @@ const Properties = ({ data, className, align = 'left' }) => {
|
|
|
45
46
|
}
|
|
46
47
|
return jsxRuntime.jsx("span", { children: String(value) });
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
-
return key
|
|
50
|
-
.replace(/([A-Z])/g, ' $1')
|
|
51
|
-
.replace(/^./, str => str.toUpperCase())
|
|
52
|
-
.trim();
|
|
53
|
-
};
|
|
54
|
-
return (jsxRuntime.jsx("div", { className: className, children: jsxRuntime.jsx("table", { style: tableStyle, children: jsxRuntime.jsx("tbody", { children: data && Object.entries(data).map(([key, value], index) => (jsxRuntime.jsxs("tr", { style: rowStyle, children: [jsxRuntime.jsx("td", { style: labelStyle, children: formatPropertyName(key) }), jsxRuntime.jsx("td", { style: valueStyle, children: renderValue(value) })] }, `${key}-${index}`))) }) }) }));
|
|
49
|
+
return (jsxRuntime.jsx("div", { className: className, children: jsxRuntime.jsx("table", { style: tableStyle, children: jsxRuntime.jsx("tbody", { children: data && Object.entries(data).map(([key, value], index) => (jsxRuntime.jsxs("tr", { style: rowStyle, children: [jsxRuntime.jsx("td", { style: labelStyle, children: propertiesHelpers.formatPropertyName(key) }), jsxRuntime.jsx("td", { style: valueStyle, children: renderValue(value) })] }, `${key}-${index}`))) }) }) }));
|
|
55
50
|
};
|
|
56
51
|
|
|
57
52
|
exports.Properties = Properties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Properties.js","sources":["../../../TimeMachine/Properties.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React from 'react';\n\ninterface PropertiesProps {\n data: Record<string, unknown>;\n /** CSS class name for the container */\n className?: string;\n /** Text alignment for the table */\n align?: 'left' | 'right';\n}\n\nexport const Properties: React.FC<PropertiesProps> = ({ data, className, align = 'left' }) => {\n const tableStyle: React.CSSProperties = {\n width: '100%',\n borderCollapse: 'collapse',\n fontFamily: '-apple-system, BlinkMacSystemFont, \"SF Mono\", monospace',\n fontSize: '13px',\n };\n\n const rowStyle: React.CSSProperties = {\n borderBottom: '1px solid rgba(255,255,255,0.1)',\n };\n\n const labelStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: 'rgba(255,255,255,0.6)',\n textAlign: align,\n fontWeight: 500,\n width: '40%',\n };\n\n const valueStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: '#fff',\n textAlign: align,\n };\n\n const renderValue = (value: unknown): React.ReactNode => {\n if (value === null || value === undefined) {\n return <span style={{ color: 'rgba(255,255,255,0.4)' }}>null</span>;\n }\n\n if (typeof value === 'boolean') {\n return <span style={{ color: value ? '#4ade80' : '#f87171' }}>{value.toString()}</span>;\n }\n\n if (typeof value === 'number') {\n return <span style={{ color: '#fbbf24' }}>{value}</span>;\n }\n\n if (value instanceof Date) {\n return <span style={{ color: '#60a5fa' }}>{value.toLocaleString()}</span>;\n }\n\n if (Array.isArray(value)) {\n return (\n <span style={{ color: 'rgba(255,255,255,0.7)' }}>\n Array[{value.length}]\n </span>\n );\n }\n\n if (typeof value === 'object') {\n return (\n <span style={{ color: 'rgba(255,255,255,0.7)' }}>\n {'{'}...{'}'}\n </span>\n );\n }\n\n return <span>{String(value)}</span>;\n };\n\n
|
|
1
|
+
{"version":3,"file":"Properties.js","sources":["../../../TimeMachine/Properties.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React from 'react';\nimport { formatPropertyName } from './propertiesHelpers';\n\ninterface PropertiesProps {\n data: Record<string, unknown>;\n /** CSS class name for the container */\n className?: string;\n /** Text alignment for the table */\n align?: 'left' | 'right';\n}\n\nexport const Properties: React.FC<PropertiesProps> = ({ data, className, align = 'left' }) => {\n const tableStyle: React.CSSProperties = {\n width: '100%',\n borderCollapse: 'collapse',\n fontFamily: '-apple-system, BlinkMacSystemFont, \"SF Mono\", monospace',\n fontSize: '13px',\n };\n\n const rowStyle: React.CSSProperties = {\n borderBottom: '1px solid rgba(255,255,255,0.1)',\n };\n\n const labelStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: 'rgba(255,255,255,0.6)',\n textAlign: align,\n fontWeight: 500,\n width: '40%',\n };\n\n const valueStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: '#fff',\n textAlign: align,\n };\n\n const renderValue = (value: unknown): React.ReactNode => {\n if (value === null || value === undefined) {\n return <span style={{ color: 'rgba(255,255,255,0.4)' }}>null</span>;\n }\n\n if (typeof value === 'boolean') {\n return <span style={{ color: value ? '#4ade80' : '#f87171' }}>{value.toString()}</span>;\n }\n\n if (typeof value === 'number') {\n return <span style={{ color: '#fbbf24' }}>{value}</span>;\n }\n\n if (value instanceof Date) {\n return <span style={{ color: '#60a5fa' }}>{value.toLocaleString()}</span>;\n }\n\n if (Array.isArray(value)) {\n return (\n <span style={{ color: 'rgba(255,255,255,0.7)' }}>\n Array[{value.length}]\n </span>\n );\n }\n\n if (typeof value === 'object') {\n return (\n <span style={{ color: 'rgba(255,255,255,0.7)' }}>\n {'{'}...{'}'}\n </span>\n );\n }\n\n return <span>{String(value)}</span>;\n };\n\n return (\n <div className={className}>\n <table style={tableStyle}>\n <tbody>\n {data && Object.entries(data).map(([key, value], index) => (\n <tr key={`${key}-${index}`} style={rowStyle}>\n <td style={labelStyle}>{formatPropertyName(key)}</td>\n <td style={valueStyle}>{renderValue(value)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs","formatPropertyName"],"mappings":";;;;;AAcO,MAAM,UAAU,GAA8B,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,EAAE,KAAI;AACzF,IAAA,MAAM,UAAU,GAAwB;AACpC,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,cAAc,EAAE,UAAU;AAC1B,QAAA,UAAU,EAAE,yDAAyD;AACrE,QAAA,QAAQ,EAAE,MAAM;KACnB;AAED,IAAA,MAAM,QAAQ,GAAwB;AAClC,QAAA,YAAY,EAAE,iCAAiC;KAClD;AAED,IAAA,MAAM,UAAU,GAAwB;AACpC,QAAA,OAAO,EAAE,UAAU;AACnB,QAAA,KAAK,EAAE,uBAAuB;AAC9B,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,KAAK,EAAE,KAAK;KACf;AAED,IAAA,MAAM,UAAU,GAAwB;AACpC,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,KAAK,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,aAC1C,GAAG,EAAA,KAAA,EAAK,GAAG,CAAA,EAAA,CACT;QAEf;AAEA,QAAA,OAAOD,mCAAO,MAAM,CAAC,KAAK,CAAC,GAAQ;AACvC,IAAA,CAAC;AAED,IAAA,QACIA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,SAAS,EAAA,QAAA,EACrBA,cAAA,CAAA,OAAA,EAAA,EAAO,KAAK,EAAE,UAAU,EAAA,QAAA,EACpBA,cAAA,CAAA,OAAA,EAAA,EAAA,QAAA,EACK,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,MAClDC,eAAA,CAAA,IAAA,EAAA,EAA4B,KAAK,EAAE,QAAQ,EAAA,QAAA,EAAA,CACvCD,cAAA,CAAA,IAAA,EAAA,EAAI,KAAK,EAAE,UAAU,EAAA,QAAA,EAAGE,oCAAkB,CAAC,GAAG,CAAC,EAAA,CAAM,EACrDF,cAAA,CAAA,IAAA,EAAA,EAAI,KAAK,EAAE,UAAU,EAAA,QAAA,EAAG,WAAW,CAAC,KAAK,CAAC,EAAA,CAAM,CAAA,EAAA,EAF3C,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,CAGrB,CACR,CAAC,EAAA,CACE,EAAA,CACJ,EAAA,CACN;AAEd;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertiesHelpers.js","sources":["../../../TimeMachine/propertiesHelpers.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Converts a camelCase property key to a human-readable Title Case label with spaces.\n */\nexport function formatPropertyName(key: string): string {\n return key\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, str => str.toUpperCase())\n .trim();\n}\n"],"names":[],"mappings":";;AAMM,SAAU,kBAAkB,CAAC,GAAW,EAAA;AAC1C,IAAA,OAAO;AACF,SAAA,OAAO,CAAC,UAAU,EAAE,KAAK;SACzB,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE;AACtC,SAAA,IAAI,EAAE;AACf;;;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ICommandResult } from '@cratis/arc/commands';
|
|
2
2
|
import { Constructor } from '@cratis/fundamentals';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { CommandForm } from '@cratis/arc.react/commands';
|
|
5
|
+
type CommandFormProps = React.ComponentProps<typeof CommandForm>;
|
|
4
6
|
export type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;
|
|
5
7
|
export type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;
|
|
6
8
|
export type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;
|
|
@@ -22,6 +24,19 @@ export interface CommandDialogProps<TCommand, TResponse = object> {
|
|
|
22
24
|
children?: React.ReactNode;
|
|
23
25
|
style?: React.CSSProperties;
|
|
24
26
|
width?: string;
|
|
27
|
+
showTitles?: boolean;
|
|
28
|
+
showErrors?: boolean;
|
|
29
|
+
validateOn?: CommandFormProps['validateOn'];
|
|
30
|
+
validateAllFieldsOnChange?: boolean;
|
|
31
|
+
validateOnInit?: boolean;
|
|
32
|
+
autoServerValidate?: boolean;
|
|
33
|
+
autoServerValidateThrottle?: number;
|
|
34
|
+
fieldContainerComponent?: CommandFormProps['fieldContainerComponent'];
|
|
35
|
+
fieldDecoratorComponent?: CommandFormProps['fieldDecoratorComponent'];
|
|
36
|
+
errorDisplayComponent?: CommandFormProps['errorDisplayComponent'];
|
|
37
|
+
tooltipComponent?: CommandFormProps['tooltipComponent'];
|
|
38
|
+
errorClassName?: string;
|
|
39
|
+
iconAddonClassName?: string;
|
|
25
40
|
}
|
|
26
41
|
interface CommandDialogContextValue<TCommand = unknown> {
|
|
27
42
|
onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;
|
|
@@ -40,6 +55,12 @@ export declare const CommandDialog: {
|
|
|
40
55
|
Fields: (props: {
|
|
41
56
|
children: React.ReactNode;
|
|
42
57
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
Column: {
|
|
59
|
+
({ children }: {
|
|
60
|
+
children: React.ReactNode;
|
|
61
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
displayName: string;
|
|
63
|
+
};
|
|
43
64
|
};
|
|
44
65
|
export {};
|
|
45
66
|
//# sourceMappingURL=CommandDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,KAAoC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CommandDialog.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EACH,WAAW,EAId,MAAM,4BAA4B,CAAC;AAEpC,KAAK,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC;AAGjE,MAAM,MAAM,qBAAqB,CAAC,QAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,KAAK,QAAQ,CAAC;AAE7E,MAAM,MAAM,cAAc,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE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E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;uBA4FtB;YAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;SAAE;;;CAQ5B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { DialogButtons } from '@cratis/arc.react/dialogs';
|
|
3
3
|
import { Dialog } from '../Dialogs/Dialog.js';
|
|
4
|
-
import { createContext, useContext } from 'react';
|
|
5
|
-
import { CommandForm, useCommandFormContext, useCommandInstance } from '@cratis/arc.react/commands';
|
|
4
|
+
import React, { createContext, useContext } from 'react';
|
|
5
|
+
import { CommandForm, useCommandFormContext, useCommandInstance, CommandFormFieldWrapper } from '@cratis/arc.react/commands';
|
|
6
6
|
|
|
7
7
|
const CommandDialogContext = createContext(undefined);
|
|
8
8
|
const useCommandDialogContext = () => {
|
|
@@ -13,8 +13,9 @@ const useCommandDialogContext = () => {
|
|
|
13
13
|
return context;
|
|
14
14
|
};
|
|
15
15
|
const CommandDialogWrapper = ({ header, visible, width, confirmLabel, cancelLabel, onConfirm, onCancel, onBeforeExecute, children }) => {
|
|
16
|
-
const {
|
|
16
|
+
const { setCommandValues, setCommandResult, isValid } = useCommandFormContext();
|
|
17
17
|
const commandInstance = useCommandInstance();
|
|
18
|
+
const isDialogValid = isValid;
|
|
18
19
|
const handleConfirm = async () => {
|
|
19
20
|
if (onBeforeExecute) {
|
|
20
21
|
const transformedValues = onBeforeExecute(commandInstance);
|
|
@@ -30,13 +31,31 @@ const CommandDialogWrapper = ({ header, visible, width, confirmLabel, cancelLabe
|
|
|
30
31
|
return false;
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
|
-
|
|
34
|
+
const processChildren = (nodes) => {
|
|
35
|
+
return React.Children.map(nodes, (child) => {
|
|
36
|
+
if (!React.isValidElement(child))
|
|
37
|
+
return child;
|
|
38
|
+
const component = child.type;
|
|
39
|
+
if (component.displayName === 'CommandFormField') {
|
|
40
|
+
return jsx(CommandFormFieldWrapper, { field: child });
|
|
41
|
+
}
|
|
42
|
+
const childProps = child.props;
|
|
43
|
+
if (childProps.children != null) {
|
|
44
|
+
return React.cloneElement(child, {
|
|
45
|
+
children: processChildren(childProps.children)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return child;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const processedChildren = processChildren(children);
|
|
52
|
+
return (jsx(Dialog, { title: header, visible: visible, width: width, onConfirm: handleConfirm, onCancel: onCancel, buttons: DialogButtons.OkCancel, okLabel: confirmLabel, cancelLabel: cancelLabel, isValid: isDialogValid, children: jsx("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: processedChildren }) }));
|
|
34
53
|
};
|
|
35
54
|
const CommandDialogFieldsWrapper = (props) => {
|
|
36
55
|
return (jsx(CommandForm.Fields, { children: props.children }));
|
|
37
56
|
};
|
|
38
57
|
const CommandDialogComponent = (props) => {
|
|
39
|
-
const { command, initialValues, currentValues, visible, header, confirmLabel = 'Confirm', cancelLabel = 'Cancel', confirmIcon = 'pi pi-check', cancelIcon = 'pi pi-times', onConfirm, onCancel, onFieldValidate, onFieldChange, onBeforeExecute, children, width = '50vw' } = props;
|
|
58
|
+
const { command, initialValues, currentValues, visible, header, confirmLabel = 'Confirm', cancelLabel = 'Cancel', confirmIcon = 'pi pi-check', cancelIcon = 'pi pi-times', onConfirm, onCancel, onFieldValidate, onFieldChange, onBeforeExecute, children, width = '50vw', showTitles, showErrors, validateOn, validateAllFieldsOnChange, validateOnInit, autoServerValidate, autoServerValidateThrottle, fieldContainerComponent, fieldDecoratorComponent, errorDisplayComponent, tooltipComponent, errorClassName, iconAddonClassName } = props;
|
|
40
59
|
const contextValue = {
|
|
41
60
|
onSuccess: onConfirm,
|
|
42
61
|
onCancel,
|
|
@@ -48,9 +67,12 @@ const CommandDialogComponent = (props) => {
|
|
|
48
67
|
onFieldChange,
|
|
49
68
|
onBeforeExecute
|
|
50
69
|
};
|
|
51
|
-
return (jsx(CommandDialogContext.Provider, { value: contextValue, children: jsx(CommandForm, { command: command, initialValues: initialValues, currentValues: currentValues, onFieldValidate: onFieldValidate, onFieldChange: onFieldChange, onBeforeExecute: onBeforeExecute, children: jsx(CommandDialogWrapper, { header: header, visible: visible, width: width, confirmLabel: confirmLabel, cancelLabel: cancelLabel, onConfirm: onConfirm, onCancel: onCancel, onBeforeExecute: onBeforeExecute, children: children }) }) }));
|
|
70
|
+
return (jsx(CommandDialogContext.Provider, { value: contextValue, children: jsx(CommandForm, { command: command, initialValues: initialValues, currentValues: currentValues, onFieldValidate: onFieldValidate, onFieldChange: onFieldChange, onBeforeExecute: onBeforeExecute, showTitles: showTitles, showErrors: showErrors, validateOn: validateOn, validateAllFieldsOnChange: validateAllFieldsOnChange, validateOnInit: validateOnInit, autoServerValidate: autoServerValidate, autoServerValidateThrottle: autoServerValidateThrottle, fieldContainerComponent: fieldContainerComponent, fieldDecoratorComponent: fieldDecoratorComponent, errorDisplayComponent: errorDisplayComponent, tooltipComponent: tooltipComponent, errorClassName: errorClassName, iconAddonClassName: iconAddonClassName, children: jsx(CommandDialogWrapper, { header: header, visible: visible, width: width, confirmLabel: confirmLabel, cancelLabel: cancelLabel, onConfirm: onConfirm, onCancel: onCancel, onBeforeExecute: onBeforeExecute, children: children }) }) }));
|
|
52
71
|
};
|
|
72
|
+
const CommandDialogColumnWrapper = ({ children }) => (jsx(CommandForm.Column, { children: children }));
|
|
73
|
+
CommandDialogColumnWrapper.displayName = 'CommandFormColumn';
|
|
53
74
|
CommandDialogComponent.Fields = CommandDialogFieldsWrapper;
|
|
75
|
+
CommandDialogComponent.Column = CommandDialogColumnWrapper;
|
|
54
76
|
const CommandDialog = CommandDialogComponent;
|
|
55
77
|
|
|
56
78
|
export { CommandDialog, useCommandDialogContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Constructor } from '@cratis/fundamentals';\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog } from '../Dialogs/Dialog';\nimport React, { createContext, useContext } from 'react';\nimport { \n CommandForm, \n useCommandFormContext, \n useCommandInstance\n} from '@cratis/arc.react/commands';\n\n// Local type definitions\nexport type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;\n\nexport type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\nexport type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n\nexport interface CommandDialogProps<TCommand, TResponse = object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n visible: boolean;\n header: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmIcon?: string;\n cancelIcon?: string;\n onConfirm: (result: ICommandResult<TResponse>) => void | Promise<void>;\n onCancel: () => void;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n width?: string;\n}\n\ninterface CommandDialogContextValue<TCommand = unknown> {\n onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n confirmLabel: string;\n cancelLabel: string;\n confirmIcon: string;\n cancelIcon: string;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n}\n\nconst CommandDialogContext = createContext<CommandDialogContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandDialogContext = <TCommand = unknown,>() => {\n const context = useContext(CommandDialogContext);\n if (!context) {\n throw new Error('useCommandDialogContext must be used within a CommandDialog');\n }\n return context as CommandDialogContextValue<TCommand>;\n};\n\nconst CommandDialogWrapper = <TCommand extends object>({\n header,\n visible,\n width,\n confirmLabel,\n cancelLabel,\n onConfirm,\n onCancel,\n onBeforeExecute,\n children\n}: {\n header: string;\n visible: boolean;\n width: string;\n confirmLabel: string;\n cancelLabel: string;\n onConfirm: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children: React.ReactNode;\n}) => {\n const { isValid, setCommandValues, setCommandResult } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n\n const handleConfirm = async () => {\n if (onBeforeExecute) {\n const transformedValues = onBeforeExecute(commandInstance);\n setCommandValues(transformedValues);\n }\n const result = await (commandInstance as unknown as { execute: () => Promise<ICommandResult<unknown>> }).execute();\n if (result.isSuccess) {\n await onConfirm(result);\n return true;\n } else {\n setCommandResult(result);\n return false;\n }\n };\n\n return (\n <Dialog\n title={header}\n visible={visible}\n width={width}\n onConfirm={handleConfirm}\n onCancel={onCancel}\n buttons={DialogButtons.OkCancel}\n okLabel={confirmLabel}\n cancelLabel={cancelLabel}\n isValid={isValid}\n >\n {children}\n </Dialog>\n );\n};\n\nconst CommandDialogFieldsWrapper = (props: { children: React.ReactNode }) => {\n return (\n <CommandForm.Fields>\n {props.children}\n </CommandForm.Fields>\n );\n};\n\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(props: CommandDialogProps<TCommand, TResponse>) => {\n const {\n command,\n initialValues,\n currentValues,\n visible,\n header,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmIcon = 'pi pi-check',\n cancelIcon = 'pi pi-times',\n onConfirm,\n onCancel,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute,\n children,\n width = '50vw'\n } = props;\n\n const contextValue: CommandDialogContextValue<TCommand> = {\n onSuccess: onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmIcon,\n cancelIcon,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute\n };\n\n return (\n <CommandDialogContext.Provider value={contextValue}>\n <CommandForm\n command={command}\n initialValues={initialValues}\n currentValues={currentValues}\n onFieldValidate={onFieldValidate}\n onFieldChange={onFieldChange}\n onBeforeExecute={onBeforeExecute}>\n <CommandDialogWrapper\n header={header}\n visible={visible}\n width={width}\n confirmLabel={confirmLabel}\n cancelLabel={cancelLabel}\n onConfirm={onConfirm}\n onCancel={onCancel}\n onBeforeExecute={onBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n </CommandDialogContext.Provider>\n );\n};\n\nCommandDialogComponent.Fields = CommandDialogFieldsWrapper;\n\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["_jsx"],"mappings":";;;;;;AAoDA,MAAM,oBAAoB,GAAG,aAAa,CAAiD,SAAS,CAAC;AAE9F,MAAM,uBAAuB,GAAG,MAA0B;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC;IAClF;AACA,IAAA,OAAO,OAA8C;AACzD;AAEA,MAAM,oBAAoB,GAAG,CAA0B,EACnD,MAAM,EACN,OAAO,EACP,KAAK,EACL,YAAY,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,eAAe,EACf,QAAQ,EAWX,KAAI;IACD,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,qBAAqB,EAAY;AACzF,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAY;AAEtD,IAAA,MAAM,aAAa,GAAG,YAAW;QAC7B,IAAI,eAAe,EAAE;AACjB,YAAA,MAAM,iBAAiB,GAAG,eAAe,CAAC,eAAe,CAAC;YAC1D,gBAAgB,CAAC,iBAAiB,CAAC;QACvC;AACA,QAAA,MAAM,MAAM,GAAG,MAAO,eAAkF,CAAC,OAAO,EAAE;AAClH,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EAAA,EACR,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAAA,QAAA,EAChCA,GAAA,CAAC,oBAAoB,EAAA,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAAA,QAAA,EAE/B,QAAQ,GACU,EAAA,CACb,EAAA,CACc;AAExC,CAAC;AAED,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Constructor } from '@cratis/fundamentals';\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog } from '../Dialogs/Dialog';\nimport React, { createContext, useContext } from 'react';\nimport { \n CommandForm, \n CommandFormFieldWrapper,\n useCommandFormContext, \n useCommandInstance\n} from '@cratis/arc.react/commands';\n\ntype CommandFormProps = React.ComponentProps<typeof CommandForm>;\n\n// Local type definitions\nexport type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;\n\nexport type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\nexport type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n\nexport interface CommandDialogProps<TCommand, TResponse = object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n visible: boolean;\n header: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmIcon?: string;\n cancelIcon?: string;\n onConfirm: (result: ICommandResult<TResponse>) => void | Promise<void>;\n onCancel: () => void;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n width?: string;\n showTitles?: boolean;\n showErrors?: boolean;\n validateOn?: CommandFormProps['validateOn'];\n validateAllFieldsOnChange?: boolean;\n validateOnInit?: boolean;\n autoServerValidate?: boolean;\n autoServerValidateThrottle?: number;\n fieldContainerComponent?: CommandFormProps['fieldContainerComponent'];\n fieldDecoratorComponent?: CommandFormProps['fieldDecoratorComponent'];\n errorDisplayComponent?: CommandFormProps['errorDisplayComponent'];\n tooltipComponent?: CommandFormProps['tooltipComponent'];\n errorClassName?: string;\n iconAddonClassName?: string;\n}\n\ninterface CommandDialogContextValue<TCommand = unknown> {\n onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n confirmLabel: string;\n cancelLabel: string;\n confirmIcon: string;\n cancelIcon: string;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n}\n\nconst CommandDialogContext = createContext<CommandDialogContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandDialogContext = <TCommand = unknown,>() => {\n const context = useContext(CommandDialogContext);\n if (!context) {\n throw new Error('useCommandDialogContext must be used within a CommandDialog');\n }\n return context as CommandDialogContextValue<TCommand>;\n};\n\nconst CommandDialogWrapper = <TCommand extends object>({\n header,\n visible,\n width,\n confirmLabel,\n cancelLabel,\n onConfirm,\n onCancel,\n onBeforeExecute,\n children\n}: {\n header: string;\n visible: boolean;\n width: string;\n confirmLabel: string;\n cancelLabel: string;\n onConfirm: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children: React.ReactNode;\n}) => {\n const { setCommandValues, setCommandResult, isValid } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n\n const isDialogValid = isValid;\n\n const handleConfirm = async () => {\n if (onBeforeExecute) {\n const transformedValues = onBeforeExecute(commandInstance);\n setCommandValues(transformedValues);\n }\n const result = await (commandInstance as unknown as { execute: () => Promise<ICommandResult<unknown>> }).execute();\n if (result.isSuccess) {\n await onConfirm(result);\n return true;\n } else {\n setCommandResult(result);\n return false;\n }\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (component.displayName === 'CommandFormField') {\n type FieldElement = Parameters<typeof CommandFormFieldWrapper>[0]['field'];\n return <CommandFormFieldWrapper field={child as unknown as FieldElement} />;\n }\n\n const childProps = child.props as Record<string, unknown>;\n if (childProps.children != null) {\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n children: processChildren(childProps.children as React.ReactNode)\n });\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n\n return (\n <Dialog\n title={header}\n visible={visible}\n width={width}\n onConfirm={handleConfirm}\n onCancel={onCancel}\n buttons={DialogButtons.OkCancel}\n okLabel={confirmLabel}\n cancelLabel={cancelLabel}\n isValid={isDialogValid}\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\nconst CommandDialogFieldsWrapper = (props: { children: React.ReactNode }) => {\n return (\n <CommandForm.Fields>\n {props.children}\n </CommandForm.Fields>\n );\n};\n\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(props: CommandDialogProps<TCommand, TResponse>) => {\n const {\n command,\n initialValues,\n currentValues,\n visible,\n header,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmIcon = 'pi pi-check',\n cancelIcon = 'pi pi-times',\n onConfirm,\n onCancel,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute,\n children,\n width = '50vw',\n showTitles,\n showErrors,\n validateOn,\n validateAllFieldsOnChange,\n validateOnInit,\n autoServerValidate,\n autoServerValidateThrottle,\n fieldContainerComponent,\n fieldDecoratorComponent,\n errorDisplayComponent,\n tooltipComponent,\n errorClassName,\n iconAddonClassName\n } = props;\n\n const contextValue: CommandDialogContextValue<TCommand> = {\n onSuccess: onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmIcon,\n cancelIcon,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute\n };\n\n return (\n <CommandDialogContext.Provider value={contextValue}>\n <CommandForm\n command={command}\n initialValues={initialValues}\n currentValues={currentValues}\n onFieldValidate={onFieldValidate}\n onFieldChange={onFieldChange}\n onBeforeExecute={onBeforeExecute}\n showTitles={showTitles}\n showErrors={showErrors}\n validateOn={validateOn}\n validateAllFieldsOnChange={validateAllFieldsOnChange}\n validateOnInit={validateOnInit}\n autoServerValidate={autoServerValidate}\n autoServerValidateThrottle={autoServerValidateThrottle}\n fieldContainerComponent={fieldContainerComponent}\n fieldDecoratorComponent={fieldDecoratorComponent}\n errorDisplayComponent={errorDisplayComponent}\n tooltipComponent={tooltipComponent}\n errorClassName={errorClassName}\n iconAddonClassName={iconAddonClassName}>\n <CommandDialogWrapper\n header={header}\n visible={visible}\n width={width}\n confirmLabel={confirmLabel}\n cancelLabel={cancelLabel}\n onConfirm={onConfirm}\n onCancel={onCancel}\n onBeforeExecute={onBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n </CommandDialogContext.Provider>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nCommandDialogColumnWrapper.displayName = 'CommandFormColumn';\n\nCommandDialogComponent.Fields = CommandDialogFieldsWrapper;\nCommandDialogComponent.Column = CommandDialogColumnWrap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BAAkB,EAAE,kBAAkB,EAAA,QAAA,EACtCA,GAAA,CAAC,oBAAoB,EAAA,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAAA,QAAA,EAE/B,QAAQ,EAAA,CACU,EAAA,CACb,EAAA,CACc;AAExC,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,QAAQ,EAAiC,MAC3EA,GAAA,CAAC,WAAW,CAAC,MAAM,cAAE,QAAQ,EAAA,CAAsB,CACtD;AACD,0BAA0B,CAAC,WAAW,GAAG,mBAAmB;AAE5D,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAC1D,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;"}
|
|
@@ -5,4 +5,14 @@ declare const meta: Meta<typeof CommandDialog>;
|
|
|
5
5
|
export default meta;
|
|
6
6
|
type Story = StoryObj<typeof CommandDialog>;
|
|
7
7
|
export declare const Default: Story;
|
|
8
|
+
export declare const WithInitialValues: Story;
|
|
9
|
+
export declare const WithCustomValidation: Story;
|
|
10
|
+
export declare const ValidationOnBlur: Story;
|
|
11
|
+
export declare const ValidationOnChange: Story;
|
|
12
|
+
export declare const ValidateOnInit: Story;
|
|
13
|
+
export declare const ValidateAllFieldsOnChange: Story;
|
|
14
|
+
export declare const BeforeExecute: Story;
|
|
15
|
+
export declare const WithIcons: Story;
|
|
16
|
+
export declare const MultiColumnLayout: Story;
|
|
17
|
+
export declare const MixedChildren: Story;
|
|
8
18
|
//# sourceMappingURL=CommandDialog.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.stories.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.stories.tsx"],"names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