Files
nocodb/packages/nc-gui/components/monaco/Placeholder.ts
Anbarasu 0bb5ab9982 feat: button field (#9144)
* feat: static button type

* fix: swagger

* fix: style corrections

* feat: webhook trigger

* fix: disables

* feat: Button icons fix: row Delete failing

* fix: expanded-form ux fix: disable buttons in forms fix: update PlainCell button handling fix: webhook delete, active change handling

* fix: disable case

* fix: disable case

* fix: update Button styles

* fix: refactor min/max with limit for columns fix: disable filter, groupby for Button Field fix: disable aggregation for Buttons

* fix: hide button field in Filters

* fix: fields menu corrections fix: update menu corrections

* fix: rebase

* feat: support webhook creation from ButtonOptions

* fix: sort related tests

* fix: keep webhook modal open

* fix: ui fixes

* fix: icon duplicate

* fix: syntax highlighing for handlebar fix: disable mascot fix: truncate selected webhook

* fix: sort disable tooltip

* test: button playwright test

* fix: button column duplication

* fix: add error fix: column options

* fix: EditOrAddProvider.vue

* fix: add invalid configuration

* fix: ux corrections

* fix: ux corrections

* fix: error handling fix: clear single query cache on hook delete

* fix: include button type in api

* fix: update overlay styles fix: webhook update

* fix: formula placeholder

* fix: playwright tests

* fix: playwright tests

* feat: refactor formula input

* fix: added more spacing

* fix: no icon text

* fix: lint

* fix: handle invalid url

* fix: handle sort by for button causes issue when button used as lookup

* fix: button field position

* docs: button field

* fix: tooltip correction

* fix: link

* fix: add btn href

* fix: handle some edge cases

* fix: handle some edge cases

* fix: update font color

* fix: add manual trigger docs

* fix: sqlite BaseModel fix

* docs: button share view info

* fix: rebase

* fix: reduce height and added resize support fix: added tooltip if label overflow

* fix: manual hook disable state

* docs: manual trigger details in webhook page

* fix: chevron grey shade to 500

* docs: sample payload for manual trigger

* fix: style update

* fix: pr review comments

* fix: pr review changes

* fix: reactivity issue

* fix: reactivity issue

* fix: filter enabled on button

* fix: reload meta on webhook change

* fix: error handling in formula filter

* fix: handle url error

---------

Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
2024-08-14 15:32:19 +05:30

54 lines
1.4 KiB
TypeScript

import { editor } from 'monaco-editor'
export default class PlaceholderContentWidget implements editor.IEditorContribution {
static ID = 'editor.widget.placeholderHint'
protected placeholder: string
protected editor: editor.ICodeEditor
protected domNode: HTMLElement | null = null
constructor(placeholder: string, editor: editor.ICodeEditor) {
this.placeholder = placeholder
this.editor = editor
// register a listener for editor code changes
editor.onDidChangeModelContent(() => this.onDidChangeModelContent())
// ensure that on initial load the placeholder is shown
this.onDidChangeModelContent()
}
onDidChangeModelContent() {
if (this.editor.getValue() === '') {
this.editor.addContentWidget(this)
} else {
this.editor.removeContentWidget(this)
}
}
getId() {
return PlaceholderContentWidget.ID
}
getDomNode() {
if (!this.domNode) {
this.domNode = document.createElement('div')
this.domNode.classList.add('formula-placeholder')
this.domNode.style.width = 'max-content'
this.domNode.textContent = this.placeholder
this.editor.applyFontInfo(this.domNode)
}
return this.domNode
}
getPosition() {
return {
position: { lineNumber: 1, column: 1 },
preference: [editor.ContentWidgetPositionPreference.EXACT],
}
}
dispose() {
this.editor.removeContentWidget(this)
}
}