@cratis/components 1.4.1 → 1.4.2

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.
@@ -35,10 +35,10 @@ const MenuItems = ({ children }) => {
35
35
  const Columns = ({ children }) => {
36
36
  const context = React.useContext(DataPageContext);
37
37
  if (context.query.prototype instanceof queries.QueryFor) {
38
- return (jsxRuntime.jsx(DataTableForQuery.DataTableForQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, children: children }));
38
+ return (jsxRuntime.jsx(DataTableForQuery.DataTableForQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, clientFiltering: context.clientFiltering, children: children }));
39
39
  }
40
40
  else {
41
- return (jsxRuntime.jsx(DataTableForObservableQuery.DataTableForObservableQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, children: children }));
41
+ return (jsxRuntime.jsx(DataTableForObservableQuery.DataTableForObservableQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, clientFiltering: context.clientFiltering, children: children }));
42
42
  }
43
43
  };
44
44
  const DataPageContext = React.createContext(null);
@@ -52,7 +52,7 @@ const DataPage = (props) => {
52
52
  };
53
53
  const context = { ...props, selectedItem, onSelectionChanged: selectionChanged };
54
54
  return (jsxRuntime.jsx(DataPageContext.Provider, { value: context, children: jsxRuntime.jsx(Page.Page, { title: props.title, panel: true, children: jsxRuntime.jsxs(allotment.Allotment, { className: "h-full", proportionalLayout: false, children: [jsxRuntime.jsx(allotment.Allotment.Pane, { className: "flex-grow", children: props.children }), props.detailsComponent && selectedItem &&
55
- jsxRuntime.jsx(allotment.Allotment.Pane, { preferredSize: "450px", children: jsxRuntime.jsx(props.detailsComponent, { item: selectedItem }) })] }) }) }));
55
+ jsxRuntime.jsx(allotment.Allotment.Pane, { preferredSize: "450px", children: jsxRuntime.jsx(props.detailsComponent, { item: selectedItem, onRefresh: props.onRefresh }) })] }) }) }));
56
56
  };
57
57
  DataPage.MenuItems = MenuItems;
58
58
  DataPage.Columns = Columns;
@@ -1 +1 @@
1
- {"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.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 { ReactNode, useMemo } from 'react';\nimport { Page } from '../Common/Page';\nimport React from 'react';\nimport { MenuItem as PrimeMenuItem } from 'primereact/menuitem';\nimport { Menubar } from 'primereact/menubar';\nimport { IObservableQueryFor, IQueryFor, QueryFor } from '@cratis/arc/queries';\nimport { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery';\nimport { DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';\nimport { DataTableForQuery } from '../DataTables/DataTableForQuery';\nimport { Allotment } from 'allotment';\nimport { Constructor } from '@cratis/fundamentals';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport interface MenuItemProps extends PrimeMenuItem {\n disableOnUnselected?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const MenuItem = (_: MenuItemProps) => {\n return null;\n};\n\nexport interface MenuItemsProps {\n children: ReactNode;\n}\n\nexport interface ColumnProps {\n children: ReactNode;\n}\n\nexport const MenuItems = ({ children }: MenuItemsProps) => {\n const context = React.useContext(DataPageContext);\n\n const isDisabled = useMemo(() => {\n return !context.selectedItem;\n }, [context.selectedItem]);\n\n const items = useMemo(() => {\n const menuItems: PrimeMenuItem[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<MenuItemProps>(child) && child.type == MenuItem) {\n const Icon = child.props.icon;\n const menuItem = { ...child.props };\n menuItem.icon = <Icon className='mr-2' />;\n menuItem.disabled = isDisabled && child.props.disableOnUnselected;\n menuItems.push(menuItem);\n }\n });\n\n return menuItems;\n }, [children, context.selectedItem]);\n\n return (\n <div className=\"px-4 py-2\">\n <Menubar aria-label=\"Actions\" model={items} />\n </div>);\n};\n\nexport const Columns = ({ children }: ColumnProps) => {\n\n const context = React.useContext(DataPageContext);\n\n if (context.query.prototype instanceof QueryFor) {\n return (\n <DataTableForQuery {...context} selection={context.selectedItem} onSelectionChange={context.onSelectionChanged}>\n {children}\n </DataTableForQuery>);\n\n } else {\n return (\n <DataTableForObservableQuery {...context} selection={context.selectedItem} onSelectionChange={context.onSelectionChanged}>\n {children}\n </DataTableForObservableQuery>);\n }\n};\n\nexport interface IDetailsComponentProps<TDataType> {\n item: TDataType;\n\n}\n\ninterface IDataPageContext extends DataPageProps<any, any, any> {\n selectedItem: any;\n onSelectionChanged: (e: DataTableSelectionSingleChangeEvent<any>) => void;\n}\n\nconst DataPageContext = React.createContext<IDataPageContext>(null as any);\n\n/**\n * Props for the DataPage component\n */\nexport interface DataPageProps<TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType>, TDataType, TArguments> {\n /**\n * The title of the page\n */\n title: string;\n\n /**\n * Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.\n */\n children: ReactNode;\n\n /**\n * Component to render when the selection changes\n */\n detailsComponent?: React.FC<IDetailsComponentProps<any>>;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: any | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionSingleChangeEvent<any>): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n}\n\n/**\n * Represents a data driven page with a menu and custom defined columns for the data table.\n * @param props Props for the DataPage component\n * @returns Function to render the DataPage component\n */\nconst DataPage = <TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType, TArguments>, TDataType, TArguments extends object>(props: DataPageProps<TQuery, TDataType, TArguments>) => {\n const [selectedItem, setSelectedItem] = React.useState(undefined);\n\n const selectionChanged = (e: DataTableSelectionSingleChangeEvent<any>) => {\n setSelectedItem(e.value);\n if (props.onSelectionChange) {\n props.onSelectionChange(e);\n }\n };\n\n const context = { ...props, selectedItem, onSelectionChanged: selectionChanged };\n\n return (\n <DataPageContext.Provider value={context}>\n <Page title={props.title} panel={true}>\n <Allotment className=\"h-full\" proportionalLayout={false}>\n <Allotment.Pane className=\"flex-grow\">\n {props.children}\n </Allotment.Pane>\n {props.detailsComponent && selectedItem &&\n <Allotment.Pane preferredSize=\"450px\">\n <props.detailsComponent item={selectedItem} />\n </Allotment.Pane>\n }\n </Allotment>\n </Page>\n </DataPageContext.Provider>\n );\n};\n\nDataPage.MenuItems = MenuItems;\nDataPage.Columns = Columns;\n\nexport { DataPage };\n"],"names":["useMemo","_jsx","Menubar","QueryFor","DataTableForQuery","DataTableForObservableQuery","Page","_jsxs","Allotment"],"mappings":";;;;;;;;;;;AAsBO,MAAM,QAAQ,GAAG,CAAC,CAAgB,KAAI;AACzC,IAAA,OAAO,IAAI;AACf;MAUa,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAkB,KAAI;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC;AAEjD,IAAA,MAAM,UAAU,GAAGA,aAAO,CAAC,MAAK;AAC5B,QAAA,OAAO,CAAC,OAAO,CAAC,YAAY;AAChC,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1B,IAAA,MAAM,KAAK,GAAGA,aAAO,CAAC,MAAK;QACvB,MAAM,SAAS,GAAoB,EAAE;QACrC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,KAAI;AACvC,YAAA,IAAI,KAAK,CAAC,cAAc,CAAgB,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,QAAQ,EAAE;AACtE,gB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["// 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 { ReactNode, useMemo } from 'react';\nimport { Page } from '../Common/Page';\nimport React from 'react';\nimport { MenuItem as PrimeMenuItem } from 'primereact/menuitem';\nimport { Menubar } from 'primereact/menubar';\nimport { IObservableQueryFor, IQueryFor, QueryFor } from '@cratis/arc/queries';\nimport { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery';\nimport { DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';\nimport { DataTableForQuery } from '../DataTables/DataTableForQuery';\nimport { Allotment } from 'allotment';\nimport { Constructor } from '@cratis/fundamentals';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport interface MenuItemProps extends PrimeMenuItem {\n disableOnUnselected?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const MenuItem = (_: MenuItemProps) => {\n return null;\n};\n\nexport interface MenuItemsProps {\n children: ReactNode;\n}\n\nexport interface ColumnProps {\n children: ReactNode;\n}\n\nexport const MenuItems = ({ children }: MenuItemsProps) => {\n const context = React.useContext(DataPageContext);\n\n const isDisabled = useMemo(() => {\n return !context.selectedItem;\n }, [context.selectedItem]);\n\n const items = useMemo(() => {\n const menuItems: PrimeMenuItem[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<MenuItemProps>(child) && child.type == MenuItem) {\n const Icon = child.props.icon;\n const menuItem = { ...child.props };\n menuItem.icon = <Icon className='mr-2' />;\n menuItem.disabled = isDisabled && child.props.disableOnUnselected;\n menuItems.push(menuItem);\n }\n });\n\n return menuItems;\n }, [children, context.selectedItem]);\n\n return (\n <div className=\"px-4 py-2\">\n <Menubar aria-label=\"Actions\" model={items} />\n </div>);\n};\n\nexport const Columns = ({ children }: ColumnProps) => {\n\n const context = React.useContext(DataPageContext);\n\n if (context.query.prototype instanceof QueryFor) {\n return (\n <DataTableForQuery\n {...context}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n clientFiltering={context.clientFiltering}>\n {children}\n </DataTableForQuery>);\n\n } else {\n return (\n <DataTableForObservableQuery\n {...context}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n clientFiltering={context.clientFiltering}>\n {children}\n </DataTableForObservableQuery>);\n }\n};\n\nexport interface IDetailsComponentProps<TDataType> {\n item: TDataType;\n onRefresh?: () => void;\n}\n\ninterface IDataPageContext extends DataPageProps<any, any, any> {\n selectedItem: any;\n onSelectionChanged: (e: DataTableSelectionSingleChangeEvent<any>) => void;\n}\n\nconst DataPageContext = React.createContext<IDataPageContext>(null as any);\n\n/**\n * Props for the DataPage component\n */\nexport interface DataPageProps<TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType>, TDataType, TArguments> {\n /**\n * The title of the page\n */\n title: string;\n\n /**\n * Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.\n */\n children: ReactNode;\n\n /**\n * Component to render when the selection changes\n */\n detailsComponent?: React.FC<IDetailsComponentProps<any>>;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: any | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionSingleChangeEvent<any>): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n\n /**\n * When true, filtering is performed client-side only\n */\n clientFiltering?: boolean;\n\n /**\n * Callback triggered to signal data refresh\n */\n onRefresh?(): void;\n}\n\n/**\n * Represents a data driven page with a menu and custom defined columns for the data table.\n * @param props Props for the DataPage component\n * @returns Function to render the DataPage component\n */\nconst DataPage = <TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType, TArguments>, TDataType, TArguments extends object>(props: DataPageProps<TQuery, TDataType, TArguments>) => {\n const [selectedItem, setSelectedItem] = React.useState(undefined);\n\n const selectionChanged = (e: DataTableSelectionSingleChangeEvent<any>) => {\n setSelectedItem(e.value);\n if (props.onSelectionChange) {\n props.onSelectionChange(e);\n }\n };\n\n const context = { ...props, selectedItem, onSelectionChanged: selectionChanged };\n\n return (\n <DataPageContext.Provider value={context}>\n <Page title={props.title} panel={true}>\n <Allotment className=\"h-full\" proportionalLayout={false}>\n <Allotment.Pane className=\"flex-grow\">\n {props.children}\n </Allotment.Pane>\n {props.detailsComponent && selectedItem &&\n <Allotment.Pane preferredSize=\"450px\">\n <props.detailsComponent item={selectedItem} onRefresh={props.onRefresh} />\n </Allotment.Pane>\n }\n </Allotment>\n </Page>\n </DataPageContext.Provider>\n );\n};\n\nDataPage.MenuItems = MenuItems;\nDataPage.Columns = Columns;\n\nexport { DataPage };\n"],"names":["useMemo","_jsx","Menubar","QueryFor","DataTableForQuery","DataTableForObservableQuery","Page","_jsxs","Allotment"],"mappings":";;;;;;;;;;;AAsBO,MAAM,QAAQ,GAAG,CAAC,CAAgB,KAAI;AACzC,IAAA,OAAO,IAAI;AACf;MAUa,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAkB,KAAI;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC;AAEjD,IAAA,MAAM,UAAU,GAAGA,aAAO,CAAC,MAAK;AAC5B,QAAA,OAAO,CAAC,OAAO,CAAC,YAAY;AAChC,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1B,IAAA,MAAM,KAAK,GAAGA,aAAO,CAAC,MAAK;QACvB,MAAM,SAAS,GAAoB,EAAE;QACrC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,KAAI;AACvC,YAAA,IAAI,KAAK,CAAC,cAAc,CAAgB,KAA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AAA,EAAA,CAEb,EAAA,CACT,EAAA,CACgB;AAEnC;AAEA,QAAQ,CAAC,SAAS,GAAG,SAAS;AAC9B,QAAQ,CAAC,OAAO,GAAG,OAAO;;;;;;;"}
@@ -6,6 +6,11 @@ var React = require('react');
6
6
  var faIcons = require('react-icons/fa6');
7
7
  var ObjectNavigationalBar = require('../ObjectNavigationalBar/ObjectNavigationalBar.js');
8
8
  var objectHelpers = require('./objectHelpers.js');
9
+ var inputtext = require('primereact/inputtext');
10
+ var inputnumber = require('primereact/inputnumber');
11
+ var checkbox = require('primereact/checkbox');
12
+ var calendar = require('primereact/calendar');
13
+ var inputtextarea = require('primereact/inputtextarea');
9
14
 
10
15
  function _interopNamespaceDefault(e) {
11
16
  var n = Object.create(null);
@@ -26,8 +31,56 @@ function _interopNamespaceDefault(e) {
26
31
 
27
32
  var faIcons__namespace = /*#__PURE__*/_interopNamespaceDefault(faIcons);
28
33
 
29
- const ObjectContentEditor = ({ object, timestamp, schema }) => {
34
+ const ObjectContentEditor = ({ object, timestamp, schema, editMode = false, onChange, onValidationChange }) => {
30
35
  const [navigationPath, setNavigationPath] = React.useState([]);
36
+ const [validationErrors, setValidationErrors] = React.useState({});
37
+ const validateValue = React.useCallback((propertyName, value, property) => {
38
+ if (editMode) {
39
+ if (value === null || value === undefined || value === '') {
40
+ return 'This field is required';
41
+ }
42
+ }
43
+ else {
44
+ const isRequired = schema.required?.includes(propertyName);
45
+ if (isRequired && (value === null || value === undefined || value === '')) {
46
+ return 'This field is required';
47
+ }
48
+ }
49
+ if (property.type === 'string' && typeof value === 'string') {
50
+ if (property.format === 'email' && value && !value.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
51
+ return 'Invalid email format';
52
+ }
53
+ if (property.format === 'uri' && value && !value.match(/^https?:\/\/.+/)) {
54
+ return 'Invalid URI format';
55
+ }
56
+ }
57
+ if (property.type === 'number' || property.type === 'integer') {
58
+ if (value !== null && value !== undefined && value !== '' && isNaN(Number(value))) {
59
+ return 'Must be a valid number';
60
+ }
61
+ }
62
+ return undefined;
63
+ }, [schema, editMode]);
64
+ React.useEffect(() => {
65
+ if (!editMode || navigationPath.length > 0)
66
+ return;
67
+ const errors = {};
68
+ const properties = schema.properties || {};
69
+ Object.entries(properties).forEach(([propertyName, property]) => {
70
+ const value = object[propertyName];
71
+ const error = validateValue(propertyName, value, property);
72
+ if (error) {
73
+ errors[propertyName] = error;
74
+ }
75
+ });
76
+ setValidationErrors(errors);
77
+ }, [object, schema, editMode, navigationPath, validateValue]);
78
+ React.useEffect(() => {
79
+ if (editMode && onValidationChange) {
80
+ const hasErrors = Object.keys(validationErrors).length > 0;
81
+ onValidationChange(hasErrors);
82
+ }
83
+ }, [validationErrors, editMode, onValidationChange]);
31
84
  const navigateToProperty = React.useCallback((key) => {
32
85
  setNavigationPath([...navigationPath, key]);
33
86
  }, [navigationPath]);
@@ -81,6 +134,7 @@ const ObjectContentEditor = ({ object, timestamp, schema }) => {
81
134
  textAlign: 'left',
82
135
  fontWeight: 500,
83
136
  width: '140px',
137
+ whiteSpace: 'nowrap',
84
138
  };
85
139
  const valueStyle = {
86
140
  padding: '8px 12px',
@@ -88,10 +142,62 @@ const ObjectContentEditor = ({ object, timestamp, schema }) => {
88
142
  textAlign: 'left',
89
143
  };
90
144
  const infoIconStyle = {
91
- marginLeft: '6px',
92
- fontSize: '12px',
93
- color: 'rgba(100, 150, 255, 0.6)',
94
- cursor: 'help',
145
+ fontSize: '0.875rem',
146
+ color: 'var(--text-color-secondary)',
147
+ flexShrink: 0,
148
+ };
149
+ const updateValue = React.useCallback((propertyName, newValue) => {
150
+ if (!onChange)
151
+ return;
152
+ const updatedObject = { ...object };
153
+ updatedObject[propertyName] = newValue;
154
+ onChange(updatedObject);
155
+ }, [object, onChange]);
156
+ const renderEditField = (propertyName, property, value) => {
157
+ const error = validationErrors[propertyName];
158
+ const handleChange = (newValue) => {
159
+ updateValue(propertyName, newValue);
160
+ const validationError = validateValue(propertyName, newValue, property);
161
+ setValidationErrors(prev => {
162
+ const newErrors = { ...prev };
163
+ if (validationError) {
164
+ newErrors[propertyName] = validationError;
165
+ }
166
+ else {
167
+ delete newErrors[propertyName];
168
+ }
169
+ return newErrors;
170
+ });
171
+ };
172
+ const inputStyle = {
173
+ width: '100%',
174
+ ...(error ? { borderColor: 'var(--red-500)' } : {})
175
+ };
176
+ if (property.type === 'boolean') {
177
+ return (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsxRuntime.jsx(checkbox.Checkbox, { checked: Boolean(value), onChange: (e) => handleChange(e.checked ?? false) }), error && jsxRuntime.jsx("small", { className: "p-error", children: error })] }));
178
+ }
179
+ if (property.type === 'number' || property.type === 'integer') {
180
+ return (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsxRuntime.jsx(inputnumber.InputNumber, { value: (value === null || value === undefined) ? null : Number(value), onValueChange: (e) => handleChange(e.value ?? null), mode: "decimal", useGrouping: false, style: inputStyle }), error && jsxRuntime.jsx("small", { className: "p-error", children: error })] }));
181
+ }
182
+ if (property.type === 'string' && property.format === 'date-time') {
183
+ const dateValue = value ? new Date(value) : null;
184
+ return (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsxRuntime.jsx(calendar.Calendar, { value: dateValue, onChange: (e) => handleChange(e.value instanceof Date ? e.value.toISOString() : null), showTime: true, showIcon: true, style: inputStyle }), error && jsxRuntime.jsx("small", { className: "p-error", children: error })] }));
185
+ }
186
+ if (property.type === 'string' && property.format === 'date') {
187
+ const dateValue = value ? new Date(value) : null;
188
+ return (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsxRuntime.jsx(calendar.Calendar, { value: dateValue, onChange: (e) => handleChange(e.value instanceof Date ? e.value.toISOString().split('T')[0] : null), showIcon: true, style: inputStyle }), error && jsxRuntime.jsx("small", { className: "p-error", children: error })] }));
189
+ }
190
+ if (property.type === 'array') {
191
+ return (jsxRuntime.jsx("div", { className: "flex align-items-center gap-2", style: { color: 'rgba(255,255,255,0.6)', fontStyle: 'italic' }, children: jsxRuntime.jsx("span", { children: "Array editing not yet supported" }) }));
192
+ }
193
+ if (property.type === 'object') {
194
+ return (jsxRuntime.jsx("div", { className: "flex align-items-center gap-2", style: { color: 'rgba(255,255,255,0.6)', fontStyle: 'italic' }, children: jsxRuntime.jsx("span", { children: "Object editing not yet supported" }) }));
195
+ }
196
+ const isLongText = value?.length > 50;
197
+ if (isLongText) {
198
+ return (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsxRuntime.jsx(inputtextarea.InputTextarea, { value: String(value ?? ''), onChange: (e) => handleChange(e.target.value), rows: 3, style: inputStyle }), error && jsxRuntime.jsx("small", { className: "p-error", children: error })] }));
199
+ }
200
+ return (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsxRuntime.jsx(inputtext.InputText, { value: String(value ?? ''), onChange: (e) => handleChange(e.target.value), style: inputStyle }), error && jsxRuntime.jsx("small", { className: "p-error", children: error })] }));
95
201
  };
96
202
  const renderValue = (value, propertyName) => {
97
203
  if (value === null || value === undefined)
@@ -123,13 +229,16 @@ const ObjectContentEditor = ({ object, timestamp, schema }) => {
123
229
  return (jsxRuntime.jsx("table", { style: tableStyle, children: jsxRuntime.jsx("tbody", { children: entries.map(([propertyName, propertyDef]) => {
124
230
  const value = currentData[propertyName];
125
231
  const isSchemaProperty = navigationPath.length === 0;
126
- const description = isSchemaProperty && typeof propertyDef === 'object' && propertyDef !== null && 'description' in propertyDef
127
- ? propertyDef.description
128
- : undefined;
129
- return (jsxRuntime.jsxs("tr", { style: rowStyle, children: [jsxRuntime.jsxs("td", { style: labelStyle, children: [propertyName, description && (jsxRuntime.jsx("i", { className: "pi pi-info-circle property-info-icon", style: infoIconStyle, "data-pr-tooltip": description }))] }), jsxRuntime.jsx("td", { style: valueStyle, children: renderValue(value, propertyName) })] }, propertyName));
232
+ const property = isSchemaProperty && typeof propertyDef === 'object' && propertyDef !== null && 'type' in propertyDef
233
+ ? propertyDef
234
+ : null;
235
+ const description = property?.description;
236
+ return (jsxRuntime.jsxs("tr", { style: rowStyle, children: [jsxRuntime.jsx("td", { style: labelStyle, children: jsxRuntime.jsxs("span", { style: { display: 'inline-flex', alignItems: 'center', gap: '6px' }, children: [propertyName, description && (jsxRuntime.jsx(faIcons__namespace.FaCircleInfo, { className: "property-info-icon", style: infoIconStyle, "data-pr-tooltip": description, "data-pr-position": "right" }))] }) }), jsxRuntime.jsx("td", { style: valueStyle, children: editMode && property
237
+ ? renderEditField(propertyName, property, value)
238
+ : renderValue(value, propertyName) })] }, propertyName));
130
239
  }) }) }));
131
240
  };
132
- return (jsxRuntime.jsxs("div", { className: "order-content", style: { display: 'flex', flexDirection: 'column', height: '100%' }, children: [jsxRuntime.jsx(tooltip.Tooltip, { target: ".property-info-icon" }), jsxRuntime.jsx(ObjectNavigationalBar.ObjectNavigationalBar, { navigationPath: navigationPath, onNavigate: navigateToBreadcrumb }), renderTable(), timestamp && (jsxRuntime.jsxs("div", { style: {
241
+ return (jsxRuntime.jsxs("div", { className: "order-content", style: { display: 'flex', flexDirection: 'column', height: '100%' }, children: [jsxRuntime.jsx(tooltip.Tooltip, { target: "[data-pr-tooltip]" }), jsxRuntime.jsx(ObjectNavigationalBar.ObjectNavigationalBar, { navigationPath: navigationPath, onNavigate: navigateToBreadcrumb }), renderTable(), timestamp && (jsxRuntime.jsxs("div", { style: {
133
242
  marginTop: '20px',
134
243
  padding: '12px',
135
244
  background: 'rgba(100, 150, 255, 0.1)',
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectContentEditor.js","sources":["../../../ObjectContentEditor/ObjectContentEditor.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 { Tooltip } from 'primereact/tooltip';\nimport React, { useState, useCallback, useMemo } from 'react';\nimport * as faIcons from 'react-icons/fa6';\nimport { ObjectNavigationalBar } from '../ObjectNavigationalBar';\nimport { Json, JsonSchema, JsonSchemaProperty } from '../types/JsonSchema';\nimport { getValueAtPath } from './objectHelpers';\n\nexport interface ObjectContentEditorProps {\n object: Json;\n timestamp?: Date;\n schema: JsonSchema;\n}\n\nexport const ObjectContentEditor = ({ object, timestamp, schema }: ObjectContentEditorProps) => {\n const [navigationPath, setNavigationPath] = useState<string[]>([]);\n\n const navigateToProperty = useCallback((key: string) => {\n setNavigationPath([...navigationPath, key]);\n }, [navigationPath]);\n\n const navigateToBreadcrumb = useCallback((index: number) => {\n if (index === 0) {\n setNavigationPath([]);\n } else {\n setNavigationPath(navigationPath.slice(0, index));\n }\n }, [navigationPath]);\n\n const currentData = useMemo(() => {\n if (navigationPath.length === 0) {\n return object;\n }\n\n const lastKey = navigationPath[navigationPath.length - 1];\n const pathToParent = navigationPath.slice(0, -1);\n\n const parentValue = pathToParent.length > 0\n ? getValueAtPath(object, pathToParent)\n : object;\n\n if (parentValue && typeof parentValue === 'object' && !Array.isArray(parentValue)) {\n const value = (parentValue as { [k: string]: Json })[lastKey];\n\n if (Array.isArray(value)) {\n return value;\n } else if (value && typeof value === 'object') {\n return value;\n }\n }\n\n return object;\n }, [object, navigationPath, getValueAtPath]);\n\n const currentProperties = useMemo(() => {\n const properties = schema.properties || {};\n\n if (navigationPath.length === 0) {\n return properties;\n }\n\n return {};\n }, [schema, navigationPath]);\n\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: 'left',\n fontWeight: 500,\n width: '140px',\n };\n\n const valueStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: '#fff',\n textAlign: 'left',\n };\n\n const infoIconStyle: React.CSSProperties = {\n marginLeft: '6px',\n fontSize: '12px',\n color: 'rgba(100, 150, 255, 0.6)',\n cursor: 'help',\n };\n\n const renderValue = (value: Json, propertyName: string) => {\n if (value === null || value === undefined) return '';\n\n if (Array.isArray(value)) {\n return (\n <div\n className=\"flex align-items-center gap-2 cursor-pointer\"\n onClick={() => navigateToProperty(propertyName)}\n style={{ color: 'var(--primary-color)', display: 'flex', alignItems: 'center' }}\n >\n <span>Array[{value.length}]</span>\n <faIcons.FaArrowRight style={{ fontSize: '0.875rem', display: 'inline-flex' }} />\n </div>\n );\n }\n\n if (typeof value === 'object') {\n return (\n <div\n className=\"flex align-items-center gap-2 cursor-pointer\"\n onClick={() => navigateToProperty(propertyName)}\n style={{ color: 'var(--primary-color)', display: 'flex', alignItems: 'center' }}\n >\n <span>Object</span>\n <faIcons.FaArrowRight style={{ fontSize: '0.875rem', display: 'inline-flex' }} />\n </div>\n );\n }\n\n return String(value);\n };\n\n const renderTable = () => {\n if (Array.isArray(currentData)) {\n if (currentData.length === 0) return <div style={{ padding: '12px', color: 'rgba(255,255,255,0.6)' }}>Empty array</div>;\n\n const firstItem = currentData[0];\n if (typeof firstItem === 'object' && firstItem !== null && !Array.isArray(firstItem)) {\n const keys = Object.keys(firstItem);\n\n return (\n <table style={tableStyle}>\n <tbody>\n {currentData.map((item, index) => (\n <React.Fragment key={index}>\n {index > 0 && (\n <tr style={{ height: '8px', background: 'rgba(255,255,255,0.05)' }}>\n <td colSpan={2}></td>\n </tr>\n )}\n {keys.map((key) => (\n <tr key={`${index}-${key}`} style={rowStyle}>\n <td style={labelStyle}>{key}</td>\n <td style={valueStyle}>{renderValue((item as Record<string, Json>)[key], key)}</td>\n </tr>\n ))}\n </React.Fragment>\n ))}\n </tbody>\n </table>\n );\n } else {\n return (\n <table style={tableStyle}>\n <tbody>\n {currentData.map((item, index) => (\n <tr key={index} style={rowStyle}>\n <td style={labelStyle}>[{index}]</td>\n <td style={valueStyle}>{renderValue(item, `[${index}]`)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n }\n }\n\n const entries = navigationPath.length === 0\n ? Object.entries(currentProperties)\n : Object.entries(currentData as { [key: string]: Json });\n\n return (\n <table style={tableStyle}>\n <tbody>\n {entries.map(([propertyName, propertyDef]: [string, JsonSchemaProperty | Json]) => {\n const value = (currentData as Record<string, Json>)[propertyName];\n\n const isSchemaProperty = navigationPath.length === 0;\n const description = isSchemaProperty && typeof propertyDef === 'object' && propertyDef !== null && 'description' in propertyDef\n ? (propertyDef as JsonSchemaProperty).description\n : undefined;\n\n return (\n <tr key={propertyName} style={rowStyle}>\n <td style={labelStyle}>\n {propertyName}\n {description && (\n <i\n className=\"pi pi-info-circle property-info-icon\"\n style={infoIconStyle}\n data-pr-tooltip={description} />\n )}\n </td>\n <td style={valueStyle}>{renderValue(value as Json, propertyName)}</td>\n </tr>\n );\n })}\n </tbody>\n </table>\n );\n };\n\n return (\n <div className=\"order-content\" style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n <Tooltip target=\".property-info-icon\" />\n <ObjectNavigationalBar\n navigationPath={navigationPath}\n onNavigate={navigateToBreadcrumb}\n />\n {renderTable()}\n {timestamp && (\n <div style={{\n marginTop: '20px',\n padding: '12px',\n background: 'rgba(100, 150, 255, 0.1)',\n borderRadius: '8px',\n fontSize: '12px',\n color: 'rgba(255,255,255,0.6)'\n }}>\n Snapshot captured: {timestamp.toLocaleString()}\n </div>\n )}\n </div>\n );\n};\n"],"names":["useState","useCallback","useMemo","getValueAtPath","_jsxs","_jsx","faIcons","Tooltip","ObjectNavigationalBar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAM,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAA4B,KAAI;IAC3F,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAGA,cAAQ,CAAW,EA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["// 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 { Tooltip } from 'primereact/tooltip';\nimport React, { useState, useCallback, useMemo, useEffect } from 'react';\nimport * as faIcons from 'react-icons/fa6';\nimport { ObjectNavigationalBar } from '../ObjectNavigationalBar';\nimport { Json, JsonSchema, JsonSchemaProperty } from '../types/JsonSchema';\nimport { getValueAtPath } from './objectHelpers';\nimport { InputText } from 'primereact/inputtext';\nimport { InputNumber } from 'primereact/inputnumber';\nimport { Checkbox } from 'primereact/checkbox';\nimport { Calendar } from 'primereact/calendar';\nimport { InputTextarea } from 'primereact/inputtextarea';\n\nexport interface ObjectContentEditorProps {\n object: Json;\n timestamp?: Date;\n schema: JsonSchema;\n /**\n * When true, renders editable input fields for each property respecting type/format\n */\n editMode?: boolean;\n /**\n * Called with the updated object after any field edit\n */\n onChange?: (object: Json) => void;\n /**\n * Called when the validation state changes\n */\n onValidationChange?: (hasErrors: boolean) => void;\n}\n\nexport const ObjectContentEditor = ({ object, timestamp, schema, editMode = false, onChange, onValidationChange }: ObjectContentEditorProps) => {\n const [navigationPath, setNavigationPath] = useState<string[]>([]);\n const [validationErrors, setValidationErrors] = useState<Record<string, string>>({});\n\n const validateValue = useCallback((propertyName: string, value: Json, property: JsonSchemaProperty): string | undefined => {\n if (editMode) {\n if (value === null || value === undefined || value === '') {\n return 'This field is required';\n }\n } else {\n const isRequired = schema.required?.includes(propertyName);\n if (isRequired && (value === null || value === undefined || value === '')) {\n return 'This field is required';\n }\n }\n\n if (property.type === 'string' && typeof value === 'string') {\n if (property.format === 'email' && value && !value.match(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/)) {\n return 'Invalid email format';\n }\n if (property.format === 'uri' && value && !value.match(/^https?:\\/\\/.+/)) {\n return 'Invalid URI format';\n }\n }\n\n if (property.type === 'number' || property.type === 'integer') {\n if (value !== null && value !== undefined && value !== '' && isNaN(Number(value))) {\n return 'Must be a valid number';\n }\n }\n\n return undefined;\n }, [schema, editMode]);\n\n useEffect(() => {\n if (!editMode || navigationPath.length > 0) return;\n\n const errors: Record<string, string> = {};\n const properties = schema.properties || {};\n\n Object.entries(properties).forEach(([propertyName, property]) => {\n const value = (object as Record<string, Json>)[propertyName];\n const error = validateValue(propertyName, value, property as JsonSchemaProperty);\n if (error) {\n errors[propertyName] = error;\n }\n });\n\n setValidationErrors(errors);\n }, [object, schema, editMode, navigationPath, validateValue]);\n\n useEffect(() => {\n if (editMode && onValidationChange) {\n const hasErrors = Object.keys(validationErrors).length > 0;\n onValidationChange(hasErrors);\n }\n }, [validationErrors, editMode, onValidationChange]);\n\n const navigateToProperty = useCallback((key: string) => {\n setNavigationPath([...navigationPath, key]);\n }, [navigationPath]);\n\n const navigateToBreadcrumb = useCallback((index: number) => {\n if (index === 0) {\n setNavigationPath([]);\n } else {\n setNavigationPath(navigationPath.slice(0, index));\n }\n }, [navigationPath]);\n\n const currentData = useMemo(() => {\n if (navigationPath.length === 0) {\n return object;\n }\n\n const lastKey = navigationPath[navigationPath.length - 1];\n const pathToParent = navigationPath.slice(0, -1);\n\n const parentValue = pathToParent.length > 0\n ? getValueAtPath(object, pathToParent)\n : object;\n\n if (parentValue && typeof parentValue === 'object' && !Array.isArray(parentValue)) {\n const value = (parentValue as { [k: string]: Json })[lastKey];\n\n if (Array.isArray(value)) {\n return value;\n } else if (value && typeof value === 'object') {\n return value;\n }\n }\n\n return object;\n }, [object, navigationPath, getValueAtPath]);\n\n const currentProperties = useMemo(() => {\n const properties = schema.properties || {};\n\n if (navigationPath.length === 0) {\n return properties;\n }\n\n return {};\n }, [schema, navigationPath]);\n\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: 'left',\n fontWeight: 500,\n width: '140px',\n whiteSpace: 'nowrap',\n };\n\n const valueStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: '#fff',\n textAlign: 'left',\n };\n\n const infoIconStyle: React.CSSProperties = {\n fontSize: '0.875rem',\n color: 'var(--text-color-secondary)',\n flexShrink: 0,\n };\n\n const updateValue = useCallback((propertyName: string, newValue: Json) => {\n if (!onChange) return;\n\n const updatedObject = { ...(object as Record<string, Json>) };\n updatedObject[propertyName] = newValue;\n onChange(updatedObject);\n }, [object, onChange]);\n\n const renderEditField = (propertyName: string, property: JsonSchemaProperty, value: Json) => {\n const error = validationErrors[propertyName];\n\n const handleChange = (newValue: Json) => {\n updateValue(propertyName, newValue);\n const validationError = validateValue(propertyName, newValue, property);\n setValidationErrors(prev => {\n const newErrors = { ...prev };\n if (validationError) {\n newErrors[propertyName] = validationError;\n } else {\n delete newErrors[propertyName];\n }\n return newErrors;\n });\n };\n\n const inputStyle = {\n width: '100%',\n ...(error ? { borderColor: 'var(--red-500)' } : {})\n };\n\n if (property.type === 'boolean') {\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>\n <Checkbox\n checked={Boolean(value)}\n onChange={(e) => handleChange(e.checked ?? false)}\n />\n {error && <small className=\"p-error\">{error}</small>}\n </div>\n );\n }\n\n if (property.type === 'number' || property.type === 'integer') {\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>\n <InputNumber\n value={(value === null || value === undefined) ? null : Number(value)}\n onValueChange={(e) => handleChange(e.value ?? null)}\n mode=\"decimal\"\n useGrouping={false}\n style={inputStyle}\n />\n {error && <small className=\"p-error\">{error}</small>}\n </div>\n );\n }\n\n if (property.type === 'string' && property.format === 'date-time') {\n const dateValue = value ? new Date(value as string) : null;\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>\n <Calendar\n value={dateValue}\n onChange={(e) => handleChange(e.value instanceof Date ? e.value.toISOString() : null)}\n showTime\n showIcon\n style={inputStyle}\n />\n {error && <small className=\"p-error\">{error}</small>}\n </div>\n );\n }\n\n if (property.type === 'string' && property.format === 'date') {\n const dateValue = value ? new Date(value as string) : null;\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>\n <Calendar\n value={dateValue}\n onChange={(e) => handleChange(e.value instanceof Date ? e.value.toISOString().split('T')[0] : null)}\n showIcon\n style={inputStyle}\n />\n {error && <small className=\"p-error\">{error}</small>}\n </div>\n );\n }\n\n if (property.type === 'array') {\n return (\n <div className=\"flex align-items-center gap-2\" style={{ color: 'rgba(255,255,255,0.6)', fontStyle: 'italic' }}>\n <span>Array editing not yet supported</span>\n </div>\n );\n }\n\n if (property.type === 'object') {\n return (\n <div className=\"flex align-items-center gap-2\" style={{ color: 'rgba(255,255,255,0.6)', fontStyle: 'italic' }}>\n <span>Object editing not yet supported</span>\n </div>\n );\n }\n\n const isLongText = (value as string)?.length > 50;\n\n if (isLongText) {\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>\n <InputTextarea\n value={String(value ?? '')}\n onChange={(e) => handleChange(e.target.value)}\n rows={3}\n style={inputStyle}\n />\n {error && <small className=\"p-error\">{error}</small>}\n </div>\n );\n }\n\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>\n <InputText\n value={String(value ?? '')}\n onChange={(e) => handleChange(e.target.value)}\n style={inputStyle}\n />\n {error && <small className=\"p-error\">{error}</small>}\n </div>\n );\n };\n\n const renderValue = (value: Json, propertyName: string) => {\n if (value === null || value === undefined) return '';\n\n if (Array.isArray(value)) {\n return (\n <div\n className=\"flex align-items-center gap-2 cursor-pointer\"\n onClick={() => navigateToProperty(propertyName)}\n style={{ color: 'var(--primary-color)', display: 'flex', alignItems: 'center' }}\n >\n <span>Array[{value.length}]</span>\n <faIcons.FaArrowRight style={{ fontSize: '0.875rem', display: 'inline-flex' }} />\n </div>\n );\n }\n\n if (typeof value === 'object') {\n return (\n <div\n className=\"flex align-items-center gap-2 cursor-pointer\"\n onClick={() => navigateToProperty(propertyName)}\n style={{ color: 'var(--primary-color)', display: 'flex', alignItems: 'center' }}\n >\n <span>Object</span>\n <faIcons.FaArrowRight style={{ fontSize: '0.875rem', display: 'inline-flex' }} />\n </div>\n );\n }\n\n return String(value);\n };\n\n const renderTable = () => {\n if (Array.isArray(currentData)) {\n if (currentData.length === 0) return <div style={{ padding: '12px', color: 'rgba(255,255,255,0.6)' }}>Empty array</div>;\n\n const firstItem = currentData[0];\n if (typeof firstItem === 'object' && firstItem !== null && !Array.isArray(firstItem)) {\n const keys = Object.keys(firstItem);\n\n return (\n <table style={tableStyle}>\n <tbody>\n {currentData.map((item, index) => (\n <React.Fragment key={index}>\n {index > 0 && (\n <tr style={{ height: '8px', background: 'rgba(255,255,255,0.05)' }}>\n <td colSpan={2}></td>\n </tr>\n )}\n {keys.map((key) => (\n <tr key={`${index}-${key}`} style={rowStyle}>\n <td style={labelStyle}>{key}</td>\n <td style={valueStyle}>{renderValue((item as Record<string, Json>)[key], key)}</td>\n </tr>\n ))}\n </React.Fragment>\n ))}\n </tbody>\n </table>\n );\n } else {\n return (\n <table style={tableStyle}>\n <tbody>\n {currentData.map((item, index) => (\n <tr key={index} style={rowStyle}>\n <td style={labelStyle}>[{index}]</td>\n <td style={valueStyle}>{renderValue(item, `[${index}]`)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n }\n }\n\n const entries = navigationPath.length === 0\n ? Object.entries(currentProperties)\n : Object.entries(currentData as { [key: string]: Json });\n\n return (\n <table style={tableStyle}>\n <tbody>\n {entries.map(([propertyName, propertyDef]: [string, JsonSchemaProperty | Json]) => {\n const value = (currentData as Record<string, Json>)[propertyName];\n\n const isSchemaProperty = navigationPath.length === 0;\n const property = isSchemaProperty && typeof propertyDef === 'object' && propertyDef !== null && 'type' in propertyDef\n ? (propertyDef as JsonSchemaProperty)\n : null;\n const description = property?.description;\n\n return (\n <tr key={propertyName} style={rowStyle}>\n <td style={labelStyle}>\n <span style={{ display: 'inline-flex', alignItems: 'center', gap: '6px' }}>\n {propertyName}\n {description && (\n <faIcons.FaCircleInfo\n className=\"property-info-icon\"\n style={infoIconStyle}\n data-pr-tooltip={description}\n data-pr-position=\"right\" />\n )}\n </span>\n </td>\n <td style={valueStyle}>\n {editMode && property\n ? renderEditField(propertyName, property, value)\n : renderValue(value as Json, propertyName)\n }\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n );\n };\n\n return (\n <div className=\"order-content\" style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n <Tooltip target=\"[data-pr-tooltip]\" />\n <ObjectNavigationalBar\n navigationPath={navigationPath}\n onNavigate={navigateToBreadcrumb}\n />\n {renderTable()}\n {timestamp && (\n <div style={{\n marginTop: '20px',\n padding: '12px',\n background: 'rgba(100, 150, 255, 0.1)',\n borderRadius: '8px',\n fontSize: '12px',\n color: 'rgba(255,255,255,0.6)'\n }}>\n Snapshot captured: {timestamp.toLocaleString()}\n </div>\n )}\n </div>\n );\n};\n"],"names":["useState","useCallback","useEffect","useMemo","getValueAtPath","_jsxs","_jsx","Checkbox","InputNumber","Calendar","InputTextarea","InputText","faIcons","Tooltip","ObjectNavigationalBar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiCa,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAA4B,KAAI;IAC3I,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAGA,cAAQ,CAAW,EAAE,CAAC;IAClE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAGA,cAAQ,CAAyB,EAAE,CAAC;IAEpF,MAAM,aAAa,GAAGC,iBAAW,CAAC,CAAC,YAAoB,EAAE,KAAW,EAAE,QAA4B,KAAwB;QACtH,IAAI,QAAQ,EAAE;AACV,YAAA,IAAI,KAAK,KA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AA,SAAS,EAAE,MAAM;AACjB,oBAAA,OAAO,EAAE,MAAM;AACf,oBAAA,UAAU,EAAE,0BAA0B;AACtC,oBAAA,YAAY,EAAE,KAAK;AACnB,oBAAA,QAAQ,EAAE,MAAM;AAChB,oBAAA,KAAK,EAAE;iBACV,EAAA,QAAA,EAAA,CAAA,qBAAA,EACuB,SAAS,CAAC,cAAc,EAAE,IAC5C,CACT,CAAA,EAAA,CACC;AAEd;;;;"}
package/dist/cjs/index.js CHANGED
@@ -13,6 +13,7 @@ var index$9 = require('./PivotViewer/index.js');
13
13
  var index$a = require('./SchemaEditor/index.js');
14
14
  var index$b = require('./TimeMachine/index.js');
15
15
  var index$c = require('./Toolbar/index.js');
16
+ var index$d = require('./types/index.js');
16
17
 
17
18
 
18
19
 
@@ -29,4 +30,5 @@ exports.PivotViewer = index$9;
29
30
  exports.SchemaEditor = index$a;
30
31
  exports.TimeMachine = index$b;
31
32
  exports.Toolbar = index$c;
33
+ exports.Types = index$d;
32
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var TypeFormat = require('./TypeFormat.js');
4
+
5
+
6
+
7
+ exports.DEFAULT_TYPE_FORMATS = TypeFormat.DEFAULT_TYPE_FORMATS;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -18,6 +18,7 @@ export declare const MenuItems: ({ children }: MenuItemsProps) => import("react/
18
18
  export declare const Columns: ({ children }: ColumnProps) => import("react/jsx-runtime").JSX.Element;
19
19
  export interface IDetailsComponentProps<TDataType> {
20
20
  item: TDataType;
21
+ onRefresh?: () => void;
21
22
  }
22
23
  export interface DataPageProps<TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType>, TDataType, TArguments> {
23
24
  title: string;
@@ -31,6 +32,8 @@ export interface DataPageProps<TQuery extends IQueryFor<TDataType> | IObservable
31
32
  onSelectionChange?(event: DataTableSelectionSingleChangeEvent<any>): void;
32
33
  globalFilterFields?: string[] | undefined;
33
34
  defaultFilters?: DataTableFilterMeta;
35
+ clientFiltering?: boolean;
36
+ onRefresh?(): void;
34
37
  }
35
38
  declare const DataPage: {
36
39
  <TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType, TArguments>, TDataType, TArguments extends object>(props: DataPageProps<TQuery, TDataType, TArguments>): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"DataPage.d.ts","sourceRoot":"","sources":["../../../DataPage/DataPage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAY,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAC;AAGhG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,MAAM,WAAW,aAAc,SAAQ,aAAa;IAChD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAGD,eAAO,MAAM,QAAQ,GAAI,GAAG,aAAa,SAExC,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IACxB,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,SAAS,GAAI,cAAc,cAAc,4CA0BrD,CAAC;A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IAK7B,SAAS,CAAC,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC;IAKnC,iBAAiB,CAAC,CAAC,KAAK,EAAE,mCAAmC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAK1E,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAK1C,cAAc,CAAC,EAAE,mBAAmB,CAAC;IAKrC,eAAe,CAAC,EAAE,OAAO,CAAC;IAK1B,SAAS,CAAC,IAAI,IAAI,CAAC;CACtB;AAOD,QAAA,MAAM,QAAQ;KAAI,MAAM,SAAS,SAAS,CAAC,SAAS,CAAC,GAAG,mBAAmB,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,SAAS,EAAE,UAAU,SAAS,MAAM,SAAS,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC;8BA7IrJ,cAAc;4BA4BhB,WAAW;CA6IhD,CAAC;AAKF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -33,10 +33,10 @@ const MenuItems = ({ children }) => {
33
33
  const Columns = ({ children }) => {
34
34
  const context = React.useContext(DataPageContext);
35
35
  if (context.query.prototype instanceof QueryFor) {
36
- return (jsx(DataTableForQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, children: children }));
36
+ return (jsx(DataTableForQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, clientFiltering: context.clientFiltering, children: children }));
37
37
  }
38
38
  else {
39
- return (jsx(DataTableForObservableQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, children: children }));
39
+ return (jsx(DataTableForObservableQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, clientFiltering: context.clientFiltering, children: children }));
40
40
  }
41
41
  };
42
42
  const DataPageContext = React.createContext(null);
@@ -50,7 +50,7 @@ const DataPage = (props) => {
50
50
  };
51
51
  const context = { ...props, selectedItem, onSelectionChanged: selectionChanged };
52
52
  return (jsx(DataPageContext.Provider, { value: context, children: jsx(Page, { title: props.title, panel: true, children: jsxs(Allotment, { className: "h-full", proportionalLayout: false, children: [jsx(Allotment.Pane, { className: "flex-grow", children: props.children }), props.detailsComponent && selectedItem &&
53
- jsx(Allotment.Pane, { preferredSize: "450px", children: jsx(props.detailsComponent, { item: selectedItem }) })] }) }) }));
53
+ jsx(Allotment.Pane, { preferredSize: "450px", children: jsx(props.detailsComponent, { item: selectedItem, onRefresh: props.onRefresh }) })] }) }) }));
54
54
  };
55
55
  DataPage.MenuItems = MenuItems;
56
56
  DataPage.Columns = Columns;
@@ -1 +1 @@
1
- {"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.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 { ReactNode, useMemo } from 'react';\nimport { Page } from '../Common/Page';\nimport React from 'react';\nimport { MenuItem as PrimeMenuItem } from 'primereact/menuitem';\nimport { Menubar } from 'primereact/menubar';\nimport { IObservableQueryFor, IQueryFor, QueryFor } from '@cratis/arc/queries';\nimport { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery';\nimport { DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';\nimport { DataTableForQuery } from '../DataTables/DataTableForQuery';\nimport { Allotment } from 'allotment';\nimport { Constructor } from '@cratis/fundamentals';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport interface MenuItemProps extends PrimeMenuItem {\n disableOnUnselected?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const MenuItem = (_: MenuItemProps) => {\n return null;\n};\n\nexport interface MenuItemsProps {\n children: ReactNode;\n}\n\nexport interface ColumnProps {\n children: ReactNode;\n}\n\nexport const MenuItems = ({ children }: MenuItemsProps) => {\n const context = React.useContext(DataPageContext);\n\n const isDisabled = useMemo(() => {\n return !context.selectedItem;\n }, [context.selectedItem]);\n\n const items = useMemo(() => {\n const menuItems: PrimeMenuItem[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<MenuItemProps>(child) && child.type == MenuItem) {\n const Icon = child.props.icon;\n const menuItem = { ...child.props };\n menuItem.icon = <Icon className='mr-2' />;\n menuItem.disabled = isDisabled && child.props.disableOnUnselected;\n menuItems.push(menuItem);\n }\n });\n\n return menuItems;\n }, [children, context.selectedItem]);\n\n return (\n <div className=\"px-4 py-2\">\n <Menubar aria-label=\"Actions\" model={items} />\n </div>);\n};\n\nexport const Columns = ({ children }: ColumnProps) => {\n\n const context = React.useContext(DataPageContext);\n\n if (context.query.prototype instanceof QueryFor) {\n return (\n <DataTableForQuery {...context} selection={context.selectedItem} onSelectionChange={context.onSelectionChanged}>\n {children}\n </DataTableForQuery>);\n\n } else {\n return (\n <DataTableForObservableQuery {...context} selection={context.selectedItem} onSelectionChange={context.onSelectionChanged}>\n {children}\n </DataTableForObservableQuery>);\n }\n};\n\nexport interface IDetailsComponentProps<TDataType> {\n item: TDataType;\n\n}\n\ninterface IDataPageContext extends DataPageProps<any, any, any> {\n selectedItem: any;\n onSelectionChanged: (e: DataTableSelectionSingleChangeEvent<any>) => void;\n}\n\nconst DataPageContext = React.createContext<IDataPageContext>(null as any);\n\n/**\n * Props for the DataPage component\n */\nexport interface DataPageProps<TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType>, TDataType, TArguments> {\n /**\n * The title of the page\n */\n title: string;\n\n /**\n * Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.\n */\n children: ReactNode;\n\n /**\n * Component to render when the selection changes\n */\n detailsComponent?: React.FC<IDetailsComponentProps<any>>;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: any | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionSingleChangeEvent<any>): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n}\n\n/**\n * Represents a data driven page with a menu and custom defined columns for the data table.\n * @param props Props for the DataPage component\n * @returns Function to render the DataPage component\n */\nconst DataPage = <TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType, TArguments>, TDataType, TArguments extends object>(props: DataPageProps<TQuery, TDataType, TArguments>) => {\n const [selectedItem, setSelectedItem] = React.useState(undefined);\n\n const selectionChanged = (e: DataTableSelectionSingleChangeEvent<any>) => {\n setSelectedItem(e.value);\n if (props.onSelectionChange) {\n props.onSelectionChange(e);\n }\n };\n\n const context = { ...props, selectedItem, onSelectionChanged: selectionChanged };\n\n return (\n <DataPageContext.Provider value={context}>\n <Page title={props.title} panel={true}>\n <Allotment className=\"h-full\" proportionalLayout={false}>\n <Allotment.Pane className=\"flex-grow\">\n {props.children}\n </Allotment.Pane>\n {props.detailsComponent && selectedItem &&\n <Allotment.Pane preferredSize=\"450px\">\n <props.detailsComponent item={selectedItem} />\n </Allotment.Pane>\n }\n </Allotment>\n </Page>\n </DataPageContext.Provider>\n );\n};\n\nDataPage.MenuItems = MenuItems;\nDataPage.Columns = Columns;\n\nexport { DataPage };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;AAsBO,MAAM,QAAQ,GAAG,CAAC,CAAgB,KAAI;AACzC,IAAA,OAAO,IAAI;AACf;MAUa,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAkB,KAAI;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC;AAEjD,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,MAAK;AAC5B,QAAA,OAAO,CAAC,OAAO,CAAC,YAAY;AAChC,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1B,IA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,EAAA,EAAC,IAAI,EAAE,YAAY,EAAA,CAAI,GACjC,CAAA,EAAA,CAEb,EAAA,CACT,EAAA,CACgB;AAEnC;AAEA,QAAQ,CAAC,SAAS,GAAG,SAAS;AAC9B,QAAQ,CAAC,OAAO,GAAG,OAAO;;;;"}
1
+ {"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.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 { ReactNode, useMemo } from 'react';\nimport { Page } from '../Common/Page';\nimport React from 'react';\nimport { MenuItem as PrimeMenuItem } from 'primereact/menuitem';\nimport { Menubar } from 'primereact/menubar';\nimport { IObservableQueryFor, IQueryFor, QueryFor } from '@cratis/arc/queries';\nimport { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery';\nimport { DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';\nimport { DataTableForQuery } from '../DataTables/DataTableForQuery';\nimport { Allotment } from 'allotment';\nimport { Constructor } from '@cratis/fundamentals';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport interface MenuItemProps extends PrimeMenuItem {\n disableOnUnselected?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const MenuItem = (_: MenuItemProps) => {\n return null;\n};\n\nexport interface MenuItemsProps {\n children: ReactNode;\n}\n\nexport interface ColumnProps {\n children: ReactNode;\n}\n\nexport const MenuItems = ({ children }: MenuItemsProps) => {\n const context = React.useContext(DataPageContext);\n\n const isDisabled = useMemo(() => {\n return !context.selectedItem;\n }, [context.selectedItem]);\n\n const items = useMemo(() => {\n const menuItems: PrimeMenuItem[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<MenuItemProps>(child) && child.type == MenuItem) {\n const Icon = child.props.icon;\n const menuItem = { ...child.props };\n menuItem.icon = <Icon className='mr-2' />;\n menuItem.disabled = isDisabled && child.props.disableOnUnselected;\n menuItems.push(menuItem);\n }\n });\n\n return menuItems;\n }, [children, context.selectedItem]);\n\n return (\n <div className=\"px-4 py-2\">\n <Menubar aria-label=\"Actions\" model={items} />\n </div>);\n};\n\nexport const Columns = ({ children }: ColumnProps) => {\n\n const context = React.useContext(DataPageContext);\n\n if (context.query.prototype instanceof QueryFor) {\n return (\n <DataTableForQuery\n {...context}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n clientFiltering={context.clientFiltering}>\n {children}\n </DataTableForQuery>);\n\n } else {\n return (\n <DataTableForObservableQuery\n {...context}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n clientFiltering={context.clientFiltering}>\n {children}\n </DataTableForObservableQuery>);\n }\n};\n\nexport interface IDetailsComponentProps<TDataType> {\n item: TDataType;\n onRefresh?: () => void;\n}\n\ninterface IDataPageContext extends DataPageProps<any, any, any> {\n selectedItem: any;\n onSelectionChanged: (e: DataTableSelectionSingleChangeEvent<any>) => void;\n}\n\nconst DataPageContext = React.createContext<IDataPageContext>(null as any);\n\n/**\n * Props for the DataPage component\n */\nexport interface DataPageProps<TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType>, TDataType, TArguments> {\n /**\n * The title of the page\n */\n title: string;\n\n /**\n * Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.\n */\n children: ReactNode;\n\n /**\n * Component to render when the selection changes\n */\n detailsComponent?: React.FC<IDetailsComponentProps<any>>;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: any | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionSingleChangeEvent<any>): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n\n /**\n * When true, filtering is performed client-side only\n */\n clientFiltering?: boolean;\n\n /**\n * Callback triggered to signal data refresh\n */\n onRefresh?(): void;\n}\n\n/**\n * Represents a data driven page with a menu and custom defined columns for the data table.\n * @param props Props for the DataPage component\n * @returns Function to render the DataPage component\n */\nconst DataPage = <TQuery extends IQueryFor<TDataType> | IObservableQueryFor<TDataType, TArguments>, TDataType, TArguments extends object>(props: DataPageProps<TQuery, TDataType, TArguments>) => {\n const [selectedItem, setSelectedItem] = React.useState(undefined);\n\n const selectionChanged = (e: DataTableSelectionSingleChangeEvent<any>) => {\n setSelectedItem(e.value);\n if (props.onSelectionChange) {\n props.onSelectionChange(e);\n }\n };\n\n const context = { ...props, selectedItem, onSelectionChanged: selectionChanged };\n\n return (\n <DataPageContext.Provider value={context}>\n <Page title={props.title} panel={true}>\n <Allotment className=\"h-full\" proportionalLayout={false}>\n <Allotment.Pane className=\"flex-grow\">\n {props.children}\n </Allotment.Pane>\n {props.detailsComponent && selectedItem &&\n <Allotment.Pane preferredSize=\"450px\">\n <props.detailsComponent item={selectedItem} onRefresh={props.onRefresh} />\n </Allotment.Pane>\n }\n </Allotment>\n </Page>\n </DataPageContext.Provider>\n );\n};\n\nDataPage.MenuItems = MenuItems;\nDataPage.Columns = Columns;\n\nexport { DataPage };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;AAsBO,MAAM,QAAQ,GAAG,CAAC,CAAgB,KAAI;AACzC,IAAA,OAAO,IAAI;AACf;MAUa,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAkB,KAAI;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC;AAEjD,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,MAAK;AAC5B,QAAA,OAAO,CAAC,OAAO,CAAC,YAAY;AAChC,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1B,IAAA,MAAM,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,EAAA,EAAC,aAAa,EAAC,OAAO,EAAA,QAAA,EACjCA,GAAA,CAAC,KAAK,CAAC,gBAAgB,EAAA,EAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAA,CAAI,EAAA,CAC7D,CAAA,EAAA,CAEb,EAAA,CACT,EAAA,CACgB;AAEnC;AAEA,QAAQ,CAAC,SAAS,GAAG,SAAS;AAC9B,QAAQ,CAAC,OAAO,GAAG,OAAO;;;;"}
@@ -3,6 +3,9 @@ export interface ObjectContentEditorProps {
3
3
  object: Json;
4
4
  timestamp?: Date;
5
5
  schema: JsonSchema;
6
+ editMode?: boolean;
7
+ onChange?: (object: Json) => void;
8
+ onValidationChange?: (hasErrors: boolean) => void;
6
9
  }
7
- export declare const ObjectContentEditor: ({ object, timestamp, schema }: ObjectContentEditorProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const ObjectContentEditor: ({ object, timestamp, schema, editMode, onChange, onValidationChange }: ObjectContentEditorProps) => import("react/jsx-runtime").JSX.Element;
8
11
  //# sourceMappingURL=ObjectContentEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectContentEditor.d.ts","sourceRoot":"","sources":["../../../ObjectContentEditor/ObjectContentEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAsB,MAAM,qBAAqB,CAAC;AAG3E,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,IAAI,CAAC;IACb,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,GAAI,+BAA+B,wBAAwB,4CAwN1F,CAAC"}
1
+ {"version":3,"file":"ObjectContentEditor.d.ts","sourceRoot":"","sources":["../../../ObjectContentEditor/ObjectContentEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAsB,MAAM,qBAAqB,CAAC;AAQ3E,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,IAAI,CAAC;IACb,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IAInB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAInB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC;IAIlC,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACrD;AAED,eAAO,MAAM,mBAAmB,GAAI,uEAA+E,wBAAwB,4CA4Z1I,CAAC"}