@aquera/ngx-smart-table 0.0.17-patch-0.3 → 0.0.17-patch-0.4

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.
@@ -4731,11 +4731,13 @@ function injectCodeEditorStyles() {
4731
4731
  const style = document.createElement('style');
4732
4732
  style.id = styleId;
4733
4733
  style.textContent = `
4734
- /* Nile Code Editor cell styling */
4734
+ /* Nile Code Editor cell styling - constrained to cell height */
4735
4735
  nile-code-editor.st-cell-editor {
4736
4736
  display: block;
4737
4737
  width: 100%;
4738
4738
  height: 100%;
4739
+ max-height: 32px;
4740
+ overflow: hidden;
4739
4741
  font-size: inherit !important;
4740
4742
  font-family: inherit !important;
4741
4743
  line-height: inherit !important;
@@ -4743,19 +4745,31 @@ function injectCodeEditorStyles() {
4743
4745
  nile-code-editor.st-cell-editor::part(code-editor-base) {
4744
4746
  border: none !important;
4745
4747
  min-height: 100% !important;
4748
+ max-height: 32px !important;
4746
4749
  background: transparent !important;
4747
4750
  font-size: inherit !important;
4748
4751
  font-family: inherit !important;
4749
4752
  line-height: inherit !important;
4753
+ overflow: hidden !important;
4750
4754
  }
4751
4755
  /* Ensure proper sizing within table cell */
4752
4756
  .st-nile-code-editor {
4753
4757
  width: 100%;
4754
4758
  height: 100%;
4759
+ max-height: 32px;
4755
4760
  min-height: 28px;
4756
4761
  font-size: inherit !important;
4762
+ overflow: hidden;
4763
+ }
4764
+ /* CodeMirror content should inherit font size and be constrained */
4765
+ nile-code-editor.st-cell-editor .cm-editor {
4766
+ max-height: 32px !important;
4767
+ overflow: hidden !important;
4768
+ }
4769
+ nile-code-editor.st-cell-editor .cm-scroller {
4770
+ max-height: 32px !important;
4771
+ overflow: hidden !important;
4757
4772
  }
4758
- /* CodeMirror content should inherit font size */
4759
4773
  nile-code-editor.st-cell-editor .cm-content,
4760
4774
  nile-code-editor.st-cell-editor .cm-line {
4761
4775
  font-size: inherit !important;
@@ -4768,12 +4782,15 @@ function injectCodeEditorStyles() {
4768
4782
  align-items: center;
4769
4783
  width: 100%;
4770
4784
  height: 100%;
4785
+ max-height: 32px;
4771
4786
  gap: 4px;
4772
4787
  }
4773
4788
  .st-code-editor-wrapper .st-code-editor-input {
4774
4789
  flex: 1;
4775
4790
  min-width: 0;
4776
4791
  height: 100%;
4792
+ max-height: 32px;
4793
+ overflow: hidden;
4777
4794
  }
4778
4795
  .st-code-editor-wrapper .st-expand-button {
4779
4796
  display: flex;
@@ -4794,13 +4811,22 @@ function injectCodeEditorStyles() {
4794
4811
  background: var(--nile-color-neutral-100, #f3f4f6);
4795
4812
  color: var(--nile-color-neutral-700, #374151);
4796
4813
  }
4797
- /* Dialog code editor styling */
4814
+ /* Dialog code editor styling - fixed header/footer, scrollable content */
4798
4815
  .st-code-editor-dialog::part(panel) {
4799
4816
  max-height: var(--max-height, 80vh) !important;
4800
4817
  overflow: hidden !important;
4818
+ display: flex !important;
4819
+ flex-direction: column !important;
4820
+ }
4821
+ .st-code-editor-dialog::part(header) {
4822
+ flex-shrink: 0 !important;
4801
4823
  }
4802
4824
  .st-code-editor-dialog::part(body) {
4803
- overflow: auto !important;
4825
+ overflow: hidden !important;
4826
+ flex: 1 !important;
4827
+ display: flex !important;
4828
+ flex-direction: column !important;
4829
+ padding: 0 !important;
4804
4830
  }
4805
4831
  .st-code-editor-dialog nile-code-editor {
4806
4832
  width: 100%;
@@ -4809,14 +4835,6 @@ function injectCodeEditorStyles() {
4809
4835
  .st-code-editor-dialog nile-code-editor::part(code-editor-base) {
4810
4836
  border: 1px solid var(--nile-color-neutral-200, #e5e7eb) !important;
4811
4837
  border-radius: 4px !important;
4812
- overflow: auto !important;
4813
- min-height: var(--dialog-editor-min-height, 300px) !important;
4814
- }
4815
- .st-code-editor-dialog nile-code-editor .cm-editor {
4816
- min-height: var(--dialog-editor-min-height, 300px) !important;
4817
- }
4818
- .st-code-editor-dialog nile-code-editor .cm-content {
4819
- min-height: var(--dialog-editor-min-height, 300px) !important;
4820
4838
  }
4821
4839
  `;
4822
4840
  document.head.appendChild(style);
@@ -4833,19 +4851,26 @@ class NileCodeEditor {
4833
4851
  this.dialogOpen = false;
4834
4852
  this.expandButtonClicked = false;
4835
4853
  this.trackedValue = null;
4854
+ this.syncingFromDialog = false; // Flag to prevent inline editor from overwriting multiline content
4855
+ this.userEditedInline = false; // Flag to track if user has typed in inline editor
4856
+ this.dialogOriginalValue = ''; // Store original value when dialog opens
4857
+ this.dialogCurrentValue = ''; // Track current value in dialog
4836
4858
  }
4837
4859
  edit(context) {
4838
- var _a, _b, _c, _d, _e, _f;
4860
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
4839
4861
  if (!context.container) {
4840
4862
  console.warn('NileCodeEditor requires a container element');
4841
4863
  return;
4842
4864
  }
4843
4865
  this.context = context;
4844
- this.trackedValue = null;
4866
+ // Initialize tracked value from context
4867
+ this.trackedValue = String((_a = context.value) !== null && _a !== void 0 ? _a : '');
4868
+ this.syncingFromDialog = false;
4869
+ this.userEditedInline = false;
4845
4870
  // Inject global styles once
4846
4871
  injectCodeEditorStyles();
4847
4872
  // Check if we should show expand button (default: true)
4848
- const showExpandButton = ((_a = this.options) === null || _a === void 0 ? void 0 : _a.showExpandButton) !== false;
4873
+ const showExpandButton = ((_b = this.options) === null || _b === void 0 ? void 0 : _b.showExpandButton) !== false;
4849
4874
  if (showExpandButton) {
4850
4875
  // Create wrapper for editor + expand button
4851
4876
  this.wrapper = document.createElement('div');
@@ -4855,12 +4880,17 @@ class NileCodeEditor {
4855
4880
  editorContainer.className = 'st-code-editor-input';
4856
4881
  // Create NileCodeEditor custom element
4857
4882
  this.editor = document.createElement('nile-code-editor');
4858
- this.editor.value = String((_b = context.value) !== null && _b !== void 0 ? _b : '');
4883
+ this.editor.value = String((_c = context.value) !== null && _c !== void 0 ? _c : '');
4859
4884
  this.editor.className = 'st-cell-editor st-nile-code-editor';
4860
4885
  this.editor.style.width = '100%';
4861
4886
  this.editor.style.height = '100%';
4862
4887
  this.editor.style.boxSizing = 'border-box';
4863
- this.editor.noborder = ((_c = this.options) === null || _c === void 0 ? void 0 : _c.noborder) !== false;
4888
+ this.editor.noborder = ((_d = this.options) === null || _d === void 0 ? void 0 : _d.noborder) !== false;
4889
+ // Enable multiline by default for inline editor to support paste and multiline content
4890
+ this.editor.multiline = ((_e = this.options) === null || _e === void 0 ? void 0 : _e.multiline) !== false;
4891
+ this.editor.hasScroller = true;
4892
+ // No line numbers for inline editor
4893
+ this.editor.lineNumbers = false;
4864
4894
  editorContainer.appendChild(this.editor);
4865
4895
  this.wrapper.appendChild(editorContainer);
4866
4896
  // Create expand button
@@ -4888,12 +4918,17 @@ class NileCodeEditor {
4888
4918
  else {
4889
4919
  // Create NileCodeEditor custom element without wrapper
4890
4920
  this.editor = document.createElement('nile-code-editor');
4891
- this.editor.value = String((_d = context.value) !== null && _d !== void 0 ? _d : '');
4921
+ this.editor.value = String((_f = context.value) !== null && _f !== void 0 ? _f : '');
4892
4922
  this.editor.className = 'st-cell-editor st-nile-code-editor';
4893
4923
  this.editor.style.width = '100%';
4894
4924
  this.editor.style.height = '100%';
4895
4925
  this.editor.style.boxSizing = 'border-box';
4896
- this.editor.noborder = ((_e = this.options) === null || _e === void 0 ? void 0 : _e.noborder) !== false;
4926
+ this.editor.noborder = ((_g = this.options) === null || _g === void 0 ? void 0 : _g.noborder) !== false;
4927
+ // Enable multiline by default for inline editor to support paste and multiline content
4928
+ this.editor.multiline = ((_h = this.options) === null || _h === void 0 ? void 0 : _h.multiline) !== false;
4929
+ this.editor.hasScroller = true;
4930
+ // No line numbers for inline editor
4931
+ this.editor.lineNumbers = false;
4897
4932
  // Clear container and append editor
4898
4933
  context.container.innerHTML = '';
4899
4934
  context.container.appendChild(this.editor);
@@ -4903,7 +4938,7 @@ class NileCodeEditor {
4903
4938
  // Set up event listeners
4904
4939
  this.setupEventListeners(context);
4905
4940
  // Auto focus - need a slight delay for nile-code-editor to fully initialize
4906
- if (((_f = this.options) === null || _f === void 0 ? void 0 : _f.autoFocus) !== false) {
4941
+ if (((_j = this.options) === null || _j === void 0 ? void 0 : _j.autoFocus) !== false) {
4907
4942
  // Listen for the nile-after-init event which fires when editor is ready
4908
4943
  const initHandler = () => {
4909
4944
  var _a;
@@ -4945,9 +4980,18 @@ class NileCodeEditor {
4945
4980
  /**
4946
4981
  * Read the live value directly from CodeMirror's internal state,
4947
4982
  * bypassing debounced nile-change events and the possibly-stale .value property.
4983
+ *
4984
+ * Priority order:
4985
+ * 1. trackedValue - always up to date from change events
4986
+ * 2. CodeMirror internal state - for real-time reading
4987
+ * 3. editor.value property - fallback
4948
4988
  */
4949
4989
  getLiveEditorValue() {
4950
4990
  var _a, _b;
4991
+ // Use tracked value if available (updated by change events)
4992
+ if (this.trackedValue !== null) {
4993
+ return this.trackedValue;
4994
+ }
4951
4995
  if (!this.editor)
4952
4996
  return '';
4953
4997
  try {
@@ -4962,19 +5006,19 @@ class NileCodeEditor {
4962
5006
  catch (_c) {
4963
5007
  // Fall through to other methods
4964
5008
  }
4965
- if (this.trackedValue !== null)
4966
- return this.trackedValue;
4967
5009
  return (_b = this.editor.value) !== null && _b !== void 0 ? _b : '';
4968
5010
  }
4969
5011
  /**
4970
5012
  * Open the full editor dialog
4971
5013
  */
4972
5014
  openDialog() {
4973
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5015
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
4974
5016
  if (this.dialogOpen)
4975
5017
  return;
4976
5018
  this.dialogOpen = true;
4977
5019
  this.expandButtonClicked = false; // Reset flag now that dialog is opening
5020
+ // Store original value for cancel functionality
5021
+ this.dialogOriginalValue = this.getLiveEditorValue();
4978
5022
  // Create dialog with configurable dimensions
4979
5023
  const dialogWidth = ((_a = this.options) === null || _a === void 0 ? void 0 : _a.dialogWidth) || '600px';
4980
5024
  const dialogMaxHeight = ((_b = this.options) === null || _b === void 0 ? void 0 : _b.dialogMaxHeight) || '80vh';
@@ -4985,86 +5029,91 @@ class NileCodeEditor {
4985
5029
  this.dialog.label = dialogTitle;
4986
5030
  this.dialog.style.setProperty('--width', dialogWidth);
4987
5031
  this.dialog.style.setProperty('--max-height', dialogMaxHeight);
4988
- // Create dialog content
5032
+ // Create dialog content wrapper - flex column to handle fixed header/footer
5033
+ const contentWrapper = document.createElement('div');
5034
+ contentWrapper.style.display = 'flex';
5035
+ contentWrapper.style.flexDirection = 'column';
5036
+ contentWrapper.style.height = `calc(${dialogMaxHeight} - 60px)`; // Account for dialog header
5037
+ contentWrapper.style.maxHeight = `calc(${dialogMaxHeight} - 60px)`;
5038
+ // Create editor content area - this is the scrollable part
4989
5039
  const content = document.createElement('div');
4990
5040
  content.style.padding = '16px';
4991
- content.style.maxHeight = `calc(${dialogMaxHeight} - 80px)`;
5041
+ content.style.paddingBottom = '8px';
5042
+ content.style.flex = '1';
4992
5043
  content.style.overflow = 'auto';
5044
+ content.style.minHeight = '0'; // Important for flex shrinking
4993
5045
  // Create full editor
4994
5046
  this.dialogEditor = document.createElement('nile-code-editor');
4995
- const minLines = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.dialogMinLines) !== null && _f !== void 0 ? _f : 20;
4996
- const currentValue = this.getLiveEditorValue();
4997
- const currentLineCount = (currentValue.match(/\n/g) || []).length + 1;
4998
- const paddingLines = Math.max(0, minLines - currentLineCount);
4999
- this.dialogEditor.value = currentValue + '\n'.repeat(paddingLines);
5047
+ this.dialogEditor.value = this.dialogOriginalValue;
5000
5048
  this.dialogEditor.multiline = true;
5001
5049
  this.dialogEditor.lineNumbersMultiline = true;
5002
5050
  this.dialogEditor.hasScroller = true;
5003
- const lineHeightPx = 20;
5004
- const minHeightFromLines = `${minLines * lineHeightPx}px`;
5005
- this.dialogEditor.style.minHeight = `max(${dialogEditorHeight}, ${minHeightFromLines})`;
5006
- this.dialogEditor.style.maxHeight = `calc(${dialogMaxHeight} - 120px)`;
5007
- content.style.setProperty('--dialog-editor-min-height', `max(${dialogEditorHeight}, ${minHeightFromLines})`);
5051
+ this.dialogEditor.style.minHeight = dialogEditorHeight;
5008
5052
  // Apply same options to dialog editor
5009
- if ((_g = this.options) === null || _g === void 0 ? void 0 : _g.language) {
5053
+ if ((_e = this.options) === null || _e === void 0 ? void 0 : _e.language) {
5010
5054
  this.dialogEditor.language = this.options.language;
5011
5055
  }
5012
- if ((_h = this.options) === null || _h === void 0 ? void 0 : _h.placeholder) {
5056
+ if ((_f = this.options) === null || _f === void 0 ? void 0 : _f.placeholder) {
5013
5057
  this.dialogEditor.placeholder = this.options.placeholder;
5014
5058
  }
5015
- if (((_j = this.options) === null || _j === void 0 ? void 0 : _j.tabCompletion) !== undefined) {
5059
+ if (((_g = this.options) === null || _g === void 0 ? void 0 : _g.tabCompletion) !== undefined) {
5016
5060
  this.dialogEditor.tabCompletion = this.options.tabCompletion;
5017
5061
  }
5018
- if (((_k = this.options) === null || _k === void 0 ? void 0 : _k.enableSearch) !== undefined) {
5062
+ if (((_h = this.options) === null || _h === void 0 ? void 0 : _h.enableSearch) !== undefined) {
5019
5063
  this.dialogEditor.enableSearch = this.options.enableSearch;
5020
5064
  }
5021
- if (((_l = this.options) === null || _l === void 0 ? void 0 : _l.enableFoldGutters) !== undefined) {
5065
+ if (((_j = this.options) === null || _j === void 0 ? void 0 : _j.enableFoldGutters) !== undefined) {
5022
5066
  this.dialogEditor.enableFoldGutters = this.options.enableFoldGutters;
5023
5067
  }
5024
- if ((_m = this.options) === null || _m === void 0 ? void 0 : _m.customAutoCompletions) {
5068
+ if ((_k = this.options) === null || _k === void 0 ? void 0 : _k.customAutoCompletions) {
5025
5069
  this.dialogEditor.customAutoCompletions = this.options.customAutoCompletions;
5026
5070
  }
5027
- if ((_o = this.options) === null || _o === void 0 ? void 0 : _o.customCompletionsPaths) {
5071
+ if ((_l = this.options) === null || _l === void 0 ? void 0 : _l.customCompletionsPaths) {
5028
5072
  this.dialogEditor.customCompletionsPaths = this.options.customCompletionsPaths;
5029
5073
  }
5030
- if ((_p = this.options) === null || _p === void 0 ? void 0 : _p.customThemeCSS) {
5074
+ if ((_m = this.options) === null || _m === void 0 ? void 0 : _m.customThemeCSS) {
5031
5075
  this.dialogEditor.customThemeCSS = this.options.customThemeCSS;
5032
5076
  }
5033
5077
  this.dialogEditor.expandable = false;
5034
- // Real-time sync: Update cell editor whenever dialog editor changes
5078
+ // Initialize dialog current value
5079
+ this.dialogCurrentValue = this.dialogOriginalValue;
5080
+ // Track changes in dialog editor
5035
5081
  this.dialogEditor.addEventListener('nile-change', (e) => {
5036
- var _a;
5037
- const dialogValue = ((_a = e.detail) === null || _a === void 0 ? void 0 : _a.value) || '';
5038
- this.trackedValue = dialogValue;
5039
- if (this.editor) {
5040
- this.editor.value = dialogValue;
5041
- }
5042
- if (this.context) {
5043
- this.context.onChange(dialogValue);
5044
- }
5082
+ var _a, _b;
5083
+ this.dialogCurrentValue = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
5045
5084
  });
5046
5085
  content.appendChild(this.dialogEditor);
5047
- this.dialog.appendChild(content);
5048
- // Handle dialog close events (clicking X button - stay in edit mode)
5086
+ contentWrapper.appendChild(content);
5087
+ // Create footer with Ok button - fixed at bottom
5088
+ const footer = document.createElement('div');
5089
+ footer.style.display = 'flex';
5090
+ footer.style.justifyContent = 'flex-end';
5091
+ footer.style.padding = '12px 16px';
5092
+ footer.style.borderTop = '1px solid var(--nile-color-neutral-200, #e5e7eb)';
5093
+ footer.style.gap = '8px';
5094
+ footer.style.flexShrink = '0'; // Prevent footer from shrinking
5095
+ footer.style.backgroundColor = 'var(--nile-color-neutral-0, #ffffff)';
5096
+ const okButton = document.createElement('nile-button');
5097
+ okButton.setAttribute('variant', 'primary');
5098
+ okButton.textContent = 'Ok';
5099
+ okButton.addEventListener('click', () => {
5100
+ this.applyDialogChanges();
5101
+ });
5102
+ footer.appendChild(okButton);
5103
+ contentWrapper.appendChild(footer);
5104
+ this.dialog.appendChild(contentWrapper);
5105
+ // Handle dialog close events (clicking X button - cancel changes)
5049
5106
  this.dialog.addEventListener('nile-request-close', (e) => {
5050
- var _a;
5051
- const customEvent = e;
5052
- // Check if close was triggered by overlay click (clicking outside)
5053
- if (((_a = customEvent.detail) === null || _a === void 0 ? void 0 : _a.source) === 'overlay') {
5054
- // Clicking outside the dialog - save and exit edit mode
5055
- this.closeDialog(true);
5056
- }
5057
- else {
5058
- // Clicking X button - stay in edit mode
5059
- this.closeDialog(false);
5060
- }
5107
+ e.preventDefault();
5108
+ // X button or overlay click - cancel changes
5109
+ this.cancelDialogChanges();
5061
5110
  });
5062
- // Handle Escape key in dialog - stay in edit mode
5111
+ // Handle Escape key in dialog - cancel changes
5063
5112
  this.dialog.addEventListener('keydown', (e) => {
5064
5113
  if (e.key === 'Escape') {
5065
5114
  e.preventDefault();
5066
5115
  e.stopPropagation();
5067
- this.closeDialog(false);
5116
+ this.cancelDialogChanges();
5068
5117
  }
5069
5118
  });
5070
5119
  // Append to body and show
@@ -5082,34 +5131,115 @@ class NileCodeEditor {
5082
5131
  }, 0);
5083
5132
  }
5084
5133
  /**
5085
- * Close the dialog and optionally save/exit edit mode
5134
+ * Get the current value from the dialog editor
5086
5135
  */
5087
- closeDialog(saveAndExit = false) {
5136
+ getDialogEditorValue() {
5137
+ var _a;
5138
+ // Use tracked value from change events (most reliable)
5139
+ if (this.dialogCurrentValue) {
5140
+ return this.dialogCurrentValue.replace(/\n+$/, '');
5141
+ }
5142
+ if (!this.dialogEditor)
5143
+ return this.dialogOriginalValue;
5144
+ // Try to get value from CodeMirror's internal state
5145
+ try {
5146
+ const shadowRoot = this.dialogEditor.shadowRoot;
5147
+ if (shadowRoot) {
5148
+ const cmEditor = shadowRoot.querySelector('.cm-editor');
5149
+ if ((_a = cmEditor === null || cmEditor === void 0 ? void 0 : cmEditor.cmView) === null || _a === void 0 ? void 0 : _a.view) {
5150
+ const value = cmEditor.cmView.view.state.doc.toString();
5151
+ return value.replace(/\n+$/, '');
5152
+ }
5153
+ }
5154
+ }
5155
+ catch (_b) {
5156
+ // Fall through to other methods
5157
+ }
5158
+ // Fallback to value property
5159
+ const value = this.dialogEditor.value;
5160
+ return (value !== null && value !== void 0 ? value : '').replace(/\n+$/, '');
5161
+ }
5162
+ /**
5163
+ * Apply changes from dialog and close it
5164
+ */
5165
+ applyDialogChanges() {
5166
+ var _a, _b;
5167
+ if (!this.dialogOpen)
5168
+ return;
5169
+ // Get the value from dialog editor - try multiple sources
5170
+ let dialogValue = this.dialogCurrentValue;
5171
+ // If no tracked value, try reading directly from dialog editor
5172
+ if (!dialogValue && this.dialogEditor) {
5173
+ try {
5174
+ const shadowRoot = this.dialogEditor.shadowRoot;
5175
+ if (shadowRoot) {
5176
+ const cmEditor = shadowRoot.querySelector('.cm-editor');
5177
+ if ((_a = cmEditor === null || cmEditor === void 0 ? void 0 : cmEditor.cmView) === null || _a === void 0 ? void 0 : _a.view) {
5178
+ dialogValue = cmEditor.cmView.view.state.doc.toString();
5179
+ }
5180
+ }
5181
+ }
5182
+ catch (_c) {
5183
+ // Fall through
5184
+ }
5185
+ // Fallback to value property
5186
+ if (!dialogValue) {
5187
+ dialogValue = (_b = this.dialogEditor.value) !== null && _b !== void 0 ? _b : '';
5188
+ }
5189
+ }
5190
+ // Strip trailing newlines
5191
+ dialogValue = (dialogValue || '').replace(/\n+$/, '');
5192
+ // Update tracked value and inline editor
5193
+ this.trackedValue = dialogValue;
5194
+ this.userEditedInline = false;
5195
+ this.syncingFromDialog = true;
5196
+ if (this.editor) {
5197
+ this.editor.value = dialogValue;
5198
+ }
5199
+ setTimeout(() => {
5200
+ this.syncingFromDialog = false;
5201
+ }, 0);
5202
+ // Notify context of the change
5203
+ if (this.context) {
5204
+ this.context.onChange(dialogValue);
5205
+ }
5206
+ // Close dialog
5207
+ this.closeDialogUI();
5208
+ // Refocus the cell editor to stay in edit mode
5209
+ setTimeout(() => {
5210
+ this.focusEditor();
5211
+ }, 50);
5212
+ }
5213
+ /**
5214
+ * Cancel dialog changes and revert to original value
5215
+ */
5216
+ cancelDialogChanges() {
5088
5217
  if (!this.dialogOpen)
5089
5218
  return;
5090
- // Reset flag immediately so document click handler works
5219
+ // Revert to original value (don't change anything)
5220
+ // trackedValue and inline editor remain as they were before dialog opened
5221
+ // Close dialog
5222
+ this.closeDialogUI();
5223
+ // Refocus the cell editor to stay in edit mode
5224
+ setTimeout(() => {
5225
+ this.focusEditor();
5226
+ }, 50);
5227
+ }
5228
+ /**
5229
+ * Close and remove the dialog UI
5230
+ */
5231
+ closeDialogUI() {
5091
5232
  this.dialogOpen = false;
5092
- // Close and remove dialog
5233
+ this.dialogCurrentValue = '';
5093
5234
  if (this.dialog) {
5094
5235
  this.dialog.open = false;
5095
5236
  const dialogRef = this.dialog;
5096
- const dialogEditorRef = this.dialogEditor;
5097
5237
  this.dialog = undefined;
5098
5238
  this.dialogEditor = undefined;
5099
5239
  // Remove from DOM after animation
5100
5240
  setTimeout(() => {
5101
5241
  dialogRef === null || dialogRef === void 0 ? void 0 : dialogRef.remove();
5102
5242
  }, 200);
5103
- if (saveAndExit && this.context) {
5104
- // Save and exit edit mode
5105
- this.context.onSave(this.getCurrentValue());
5106
- }
5107
- else {
5108
- // Refocus the cell editor to stay in edit mode
5109
- setTimeout(() => {
5110
- this.focusEditor();
5111
- }, 50);
5112
- }
5113
5243
  }
5114
5244
  }
5115
5245
  /**
@@ -5275,6 +5405,11 @@ class NileCodeEditor {
5275
5405
  var _a, _b;
5276
5406
  const customEvent = e;
5277
5407
  const newValue = (_b = (_a = customEvent.detail) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
5408
+ // Don't process if we're syncing from dialog (prevents feedback loop)
5409
+ if (this.syncingFromDialog) {
5410
+ return;
5411
+ }
5412
+ // Update tracked value
5278
5413
  this.trackedValue = newValue;
5279
5414
  context.onChange(newValue);
5280
5415
  };
@@ -5343,6 +5478,11 @@ class NileCodeEditor {
5343
5478
  this.expandButton = undefined;
5344
5479
  this.context = undefined;
5345
5480
  this.expandButtonClicked = false;
5481
+ this.syncingFromDialog = false;
5482
+ this.trackedValue = null;
5483
+ this.userEditedInline = false;
5484
+ this.dialogOriginalValue = '';
5485
+ this.dialogCurrentValue = '';
5346
5486
  }
5347
5487
  focus() {
5348
5488
  var _a;