@praxisui/table 10.0.0-rc.38 → 10.0.0-rc.39

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.
@@ -2080,7 +2080,7 @@ function pointer(key) { return key.replace(/~/g, '~0').replace(/\//g, '~1'); }
2080
2080
  function record(value) { return value !== null && typeof value === 'object' && !Array.isArray(value); }
2081
2081
  function problem(code, path) { return { level: 'error', code, path, message: code }; }
2082
2082
  /** Derive execution-only identity and disable independent preferences. Never persist this projection. */
2083
- function materializeTablePageRuntimeInputs(value, pageId, widgetKey) {
2083
+ function materializeTablePageRuntimeInputs(value, pageId, widgetKey, options) {
2084
2084
  const decoded = decodeTablePageInputs(value);
2085
2085
  if (!decoded.document)
2086
2086
  return { inputs: null, diagnostics: decoded.diagnostics };
@@ -2091,12 +2091,70 @@ function materializeTablePageRuntimeInputs(value, pageId, widgetKey) {
2091
2091
  catch {
2092
2092
  return { inputs: null, diagnostics: [problem('table.page.identity.invalid', '/key')] };
2093
2093
  }
2094
+ const cloned = cloneBoundedUiLayoutJsonDocument(value);
2095
+ if (options?.preview && record(cloned['config'])) {
2096
+ const previewConfig = { ...cloned['config'] };
2097
+ if (record(previewConfig['actions'])) {
2098
+ const actions = { ...previewConfig['actions'] };
2099
+ if (record(actions['row'])) {
2100
+ actions['row'] = {
2101
+ ...actions['row'],
2102
+ edit: false,
2103
+ delete: false,
2104
+ duplicate: false,
2105
+ custom: [],
2106
+ };
2107
+ }
2108
+ if (record(actions['toolbar'])) {
2109
+ actions['toolbar'] = {
2110
+ ...actions['toolbar'],
2111
+ add: false,
2112
+ create: false,
2113
+ delete: false,
2114
+ import: false,
2115
+ custom: [],
2116
+ };
2117
+ }
2118
+ if (record(actions['bulk'])) {
2119
+ actions['bulk'] = {
2120
+ ...actions['bulk'],
2121
+ enabled: false,
2122
+ actions: [],
2123
+ };
2124
+ }
2125
+ previewConfig['actions'] = actions;
2126
+ }
2127
+ if (record(previewConfig['editing'])) {
2128
+ previewConfig['editing'] = {
2129
+ ...previewConfig['editing'],
2130
+ enabled: false,
2131
+ };
2132
+ }
2133
+ cloned['config'] = previewConfig;
2134
+ }
2094
2135
  return {
2095
- inputs: { ...cloneBoundedUiLayoutJsonDocument(value), tableId: id, componentInstanceId: id,
2096
- configPersistenceStrategy: 'volatile', enableCustomization: false },
2136
+ inputs: {
2137
+ ...cloned,
2138
+ tableId: id,
2139
+ componentInstanceId: id,
2140
+ configPersistenceStrategy: 'volatile',
2141
+ enableCustomization: false,
2142
+ },
2097
2143
  diagnostics: [],
2098
2144
  };
2099
2145
  }
2146
+ const TABLE_GOVERNED_PAGE_PREVIEW_ADAPTER = {
2147
+ widgetDefinitionId: 'praxis-table',
2148
+ certifiedForInteractivePreview: true,
2149
+ validate: validateTablePageWidget,
2150
+ materializePreviewInputs: (widget, pageId) => {
2151
+ const materialized = materializeTablePageRuntimeInputs(widget.definition.inputs, pageId, widget.key, { preview: true });
2152
+ if (!materialized.inputs) {
2153
+ throw new Error(materialized.diagnostics[0]?.code ?? 'table.page.preview.invalid');
2154
+ }
2155
+ return materialized.inputs;
2156
+ },
2157
+ };
2100
2158
  function nativePath(value) {
2101
2159
  // The native dot-path protocol does not escape dynamic field identities. Its
2102
2160
  // overrides ancestor is precise; splitting that field would invent a pointer.
@@ -2112,4 +2170,4 @@ function nativePath(value) {
2112
2170
  * Generated bundle index. Do not edit.
2113
2171
  */
2114
2172
 
2115
- export { buildTableApplyPlan, createTableAuthoringDocument, decodeTablePageInputs, deriveTableEditorDocument, encodeTablePageInputs, materializeTablePageRuntimeInputs, normalizeTableAuthoringDocument, parseLegacyOrTableDocument, projectTablePageEditorChanges, serializeTableAuthoringDocument, toCanonicalTableConfig, validateTableAuthoringDocument, validateTablePageWidget };
2173
+ export { TABLE_GOVERNED_PAGE_PREVIEW_ADAPTER, buildTableApplyPlan, createTableAuthoringDocument, decodeTablePageInputs, deriveTableEditorDocument, encodeTablePageInputs, materializeTablePageRuntimeInputs, normalizeTableAuthoringDocument, parseLegacyOrTableDocument, projectTablePageEditorChanges, serializeTableAuthoringDocument, toCanonicalTableConfig, validateTableAuthoringDocument, validateTablePageWidget };