@ngstarter-ui/components 22.3.2 → 22.3.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.
- package/ai/component-registry.json +164 -1
- package/content-editor/BLOCK_FORMAT.md +3 -1
- package/content-editor/document.schema.json +6 -1
- package/fesm2022/ngstarter-ui-components-color-switcher.mjs +2 -2
- package/fesm2022/ngstarter-ui-components-color-switcher.mjs.map +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-attachment-block-B6mH59CJ.mjs → ngstarter-ui-components-content-editor-attachment-block-DEhEH1p7.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-attachment-block-B6mH59CJ.mjs.map → ngstarter-ui-components-content-editor-attachment-block-DEhEH1p7.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-callout-block-RzZKnnHM.mjs → ngstarter-ui-components-content-editor-callout-block-BVmVigRq.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-callout-block-RzZKnnHM.mjs.map → ngstarter-ui-components-content-editor-callout-block-BVmVigRq.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-Cylo8_2O.mjs → ngstarter-ui-components-content-editor-code-block.component-DAT-0k8D.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-Cylo8_2O.mjs.map → ngstarter-ui-components-content-editor-code-block.component-DAT-0k8D.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-DhXyoyJB.mjs → ngstarter-ui-components-content-editor-embed-block-CvWe0gj7.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-DhXyoyJB.mjs.map → ngstarter-ui-components-content-editor-embed-block-CvWe0gj7.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-gallery-block-DnJSE4vS.mjs → ngstarter-ui-components-content-editor-gallery-block-BUZHo0tg.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-gallery-block-DnJSE4vS.mjs.map → ngstarter-ui-components-content-editor-gallery-block-BUZHo0tg.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-grid-block-D_U7EB1D.mjs → ngstarter-ui-components-content-editor-grid-block-Wnopwn9N.mjs} +3 -3
- package/fesm2022/{ngstarter-ui-components-content-editor-grid-block-D_U7EB1D.mjs.map → ngstarter-ui-components-content-editor-grid-block-Wnopwn9N.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-Cz1X7jal.mjs → ngstarter-ui-components-content-editor-heading-block.component-BdNrTdgp.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-Cz1X7jal.mjs.map → ngstarter-ui-components-content-editor-heading-block.component-BdNrTdgp.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-image-block.component-kom7wlhu.mjs → ngstarter-ui-components-content-editor-image-block.component-CY0vNbTB.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-image-block.component-kom7wlhu.mjs.map → ngstarter-ui-components-content-editor-image-block.component-CY0vNbTB.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-CQWAkgUi.mjs → ngstarter-ui-components-content-editor-list-block.component-BBtOG51W.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-CQWAkgUi.mjs.map → ngstarter-ui-components-content-editor-list-block.component-BBtOG51W.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-nested-blocks-B4mRBvop.mjs → ngstarter-ui-components-content-editor-nested-blocks-cAg6p-80.mjs} +4 -4
- package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-cAg6p-80.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CV1wGoEd.mjs → ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-67JfJX3V.mjs} +55 -29
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-67JfJX3V.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-C0k4hLYT.mjs → ngstarter-ui-components-content-editor-paragraph-block.component-eTzRkEH0.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-C0k4hLYT.mjs.map → ngstarter-ui-components-content-editor-paragraph-block.component-eTzRkEH0.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-SpGN1HDp.mjs → ngstarter-ui-components-content-editor-quote-block.component-5DMAhqu0.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-SpGN1HDp.mjs.map → ngstarter-ui-components-content-editor-quote-block.component-5DMAhqu0.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-BbnbOjOT.mjs → ngstarter-ui-components-content-editor-table-block.component-CfOtM5sz.mjs} +45 -22
- package/fesm2022/ngstarter-ui-components-content-editor-table-block.component-CfOtM5sz.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-toggle-block-BYagtSre.mjs → ngstarter-ui-components-content-editor-toggle-block-D2ZQIQwO.mjs} +3 -3
- package/fesm2022/{ngstarter-ui-components-content-editor-toggle-block-BYagtSre.mjs.map → ngstarter-ui-components-content-editor-toggle-block-D2ZQIQwO.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-video-block.component-B6QVADBA.mjs → ngstarter-ui-components-content-editor-video-block.component-q0pWYQOU.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-video-block.component-B6QVADBA.mjs.map → ngstarter-ui-components-content-editor-video-block.component-q0pWYQOU.mjs.map} +1 -1
- package/fesm2022/ngstarter-ui-components-content-editor.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-tiles.mjs +117 -106
- package/fesm2022/ngstarter-ui-components-tiles.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-timepicker.mjs +3 -2
- package/fesm2022/ngstarter-ui-components-timepicker.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-whiteboard.mjs +1868 -0
- package/fesm2022/ngstarter-ui-components-whiteboard.mjs.map +1 -0
- package/package.json +5 -1
- package/types/ngstarter-ui-components-content-editor.d.ts +4 -0
- package/types/ngstarter-ui-components-tiles.d.ts +5 -7
- package/types/ngstarter-ui-components-whiteboard.d.ts +350 -0
- package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-B4mRBvop.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CV1wGoEd.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-table-block.component-BbnbOjOT.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ContentBuilderStore, a as CONTENT_BUILDER, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-
|
|
1
|
+
import { C as ContentBuilderStore, a as CONTENT_BUILDER, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-67JfJX3V.mjs';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, DestroyRef, viewChild, input, signal, effect, untracked, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -129,4 +129,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
129
129
|
}], ctorParameters: () => [], propDecorators: { _contentRef: [{ type: i0.ViewChild, args: ['contentRef', { isSignal: true }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
|
|
130
130
|
|
|
131
131
|
export { ParagraphBlockComponent };
|
|
132
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-paragraph-block.component-
|
|
132
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-paragraph-block.component-eTzRkEH0.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-content-editor-paragraph-block.component-C0k4hLYT.mjs","sources":["../../../projects/components/content-editor/src/_builder/paragraph-block/paragraph-block.component.ts","../../../projects/components/content-editor/src/_builder/paragraph-block/paragraph-block.component.html"],"sourcesContent":["import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n ChangeDetectionStrategy,\n Component, effect, untracked, DestroyRef,\n ElementRef, forwardRef,\n inject,\n input,\n OnInit, signal,\n viewChild\n} from '@angular/core';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorItemProperty\n} from '../../types';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { CursorController } from '../../utils/cursor-controller';\n\n@Component({\n selector: 'ngs-paragraph-block',\n imports: [\n ContentEditorContentEditableDirective\n ],\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: forwardRef(() => ParagraphBlockComponent),\n multi: true\n }\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './paragraph-block.component.html',\n styleUrl: './paragraph-block.component.scss',\n host: {\n 'class': 'ngs-paragraph-block',\n '[class.is-empty]': '_isEmpty()'\n }\n})\nexport class ParagraphBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n private _destroyRef = inject(DestroyRef);\n\n private _contentRef = viewChild.required<ElementRef<HTMLParagraphElement>>('contentRef');\n\n id = input.required<string>();\n content = input.required<readonly NgsHeadlessEditorText[]>();\n settings = input.required<any>();\n props = input<ContentEditorItemProperty[]>([]);\n index = input.required<number>();\n placeholder = input('Enter text here');\n\n protected _content = signal<readonly NgsHeadlessEditorText[]>([]);\n protected _props = signal<ContentEditorItemProperty[]>([]);\n protected _isEmpty = signal<boolean>(true);\n readonly initialized = signal(false);\n\n constructor() {\n effect(() => {\n const content = this.content();\n const props = this.props();\n untracked(() => {\n this._content.set(content);\n this._props.set(cloneContentEditorValue(props));\n this._isEmpty.set(!contentEditorText(content).trim());\n });\n });\n }\n\n ngOnInit() {\n this._content.set(this.content());\n this._props.set(this.props());\n this._isEmpty.set(!contentEditorText(this.content()).trim());\n this._contentBuilder\n .focusChanged\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n });\n }\n\n focus() {\n const element = this._contentRef().nativeElement;\n const cursorController = new CursorController(element);\n cursorController.setToEnd();\n }\n\n getData(): any {\n return {\n content: this._content(),\n props: this._props(),\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !contentEditorText(this._content()).trim();\n }\n\n protected onContentChanged(content: readonly NgsHeadlessEditorText[]) {\n if (!this.initialized()) {\n return;\n }\n\n this._content.set(content);\n this._isEmpty.set(!contentEditorText(content).trim());\n\n this.update();\n }\n\n protected onPropsChanged(props: ContentEditorItemProperty[]) {\n this._props.set(props);\n this.update();\n }\n\n protected onPressedEnter(event: KeyboardEvent) {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n\n protected onContentEditableInitialized() {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n\n this.initialized.set(true);\n }\n\n protected _onKeyDown(event: KeyboardEvent) {\n if (event.key === 'Backspace' && !contentEditorText(this._content())) {\n this._contentBuilder.deleteBlock(this.id());\n }\n }\n\n private update() {\n this._contentBuilder.updateParagraph(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<div #contentRef\n class=\"content\"\n [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"_content()\"\n [settings]=\"settings()\"\n [props]=\"props()\"\n (propsChanged)=\"onPropsChanged($event)\"\n [attr.data-empty-placeholder]=\"placeholder()\"\n (contentChanged)=\"onContentChanged($event)\"\n (pressedEnter)=\"onPressedEnter($event)\"\n (keydown)=\"_onKeyDown($event)\"\n (initialized)=\"onContentEditableInitialized()\"></div>\n"],"names":[],"mappings":";;;;;;MA2Ca,uBAAuB,CAAA;AAC1B,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;AAClE,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhC,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmC,YAAY;oFAAC;IAExF,EAAE,GAAG,KAAK,CAAC,QAAQ;2EAAU;IAC7B,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAAoC;IAC5D,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAO;IAChC,KAAK,GAAG,KAAK,CAA8B,EAAE;8EAAC;IAC9C,KAAK,GAAG,KAAK,CAAC,QAAQ;8EAAU;IAChC,WAAW,GAAG,KAAK,CAAC,iBAAiB;oFAAC;IAE5B,QAAQ,GAAG,MAAM,CAAmC,EAAE;iFAAC;IACvD,MAAM,GAAG,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,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-paragraph-block.component-eTzRkEH0.mjs","sources":["../../../projects/components/content-editor/src/_builder/paragraph-block/paragraph-block.component.ts","../../../projects/components/content-editor/src/_builder/paragraph-block/paragraph-block.component.html"],"sourcesContent":["import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n ChangeDetectionStrategy,\n Component, effect, untracked, DestroyRef,\n ElementRef, forwardRef,\n inject,\n input,\n OnInit, signal,\n viewChild\n} from '@angular/core';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorItemProperty\n} from '../../types';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { CursorController } from '../../utils/cursor-controller';\n\n@Component({\n selector: 'ngs-paragraph-block',\n imports: [\n ContentEditorContentEditableDirective\n ],\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: forwardRef(() => ParagraphBlockComponent),\n multi: true\n }\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './paragraph-block.component.html',\n styleUrl: './paragraph-block.component.scss',\n host: {\n 'class': 'ngs-paragraph-block',\n '[class.is-empty]': '_isEmpty()'\n }\n})\nexport class ParagraphBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n private _destroyRef = inject(DestroyRef);\n\n private _contentRef = viewChild.required<ElementRef<HTMLParagraphElement>>('contentRef');\n\n id = input.required<string>();\n content = input.required<readonly NgsHeadlessEditorText[]>();\n settings = input.required<any>();\n props = input<ContentEditorItemProperty[]>([]);\n index = input.required<number>();\n placeholder = input('Enter text here');\n\n protected _content = signal<readonly NgsHeadlessEditorText[]>([]);\n protected _props = signal<ContentEditorItemProperty[]>([]);\n protected _isEmpty = signal<boolean>(true);\n readonly initialized = signal(false);\n\n constructor() {\n effect(() => {\n const content = this.content();\n const props = this.props();\n untracked(() => {\n this._content.set(content);\n this._props.set(cloneContentEditorValue(props));\n this._isEmpty.set(!contentEditorText(content).trim());\n });\n });\n }\n\n ngOnInit() {\n this._content.set(this.content());\n this._props.set(this.props());\n this._isEmpty.set(!contentEditorText(this.content()).trim());\n this._contentBuilder\n .focusChanged\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n });\n }\n\n focus() {\n const element = this._contentRef().nativeElement;\n const cursorController = new CursorController(element);\n cursorController.setToEnd();\n }\n\n getData(): any {\n return {\n content: this._content(),\n props: this._props(),\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !contentEditorText(this._content()).trim();\n }\n\n protected onContentChanged(content: readonly NgsHeadlessEditorText[]) {\n if (!this.initialized()) {\n return;\n }\n\n this._content.set(content);\n this._isEmpty.set(!contentEditorText(content).trim());\n\n this.update();\n }\n\n protected onPropsChanged(props: ContentEditorItemProperty[]) {\n this._props.set(props);\n this.update();\n }\n\n protected onPressedEnter(event: KeyboardEvent) {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n\n protected onContentEditableInitialized() {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n\n this.initialized.set(true);\n }\n\n protected _onKeyDown(event: KeyboardEvent) {\n if (event.key === 'Backspace' && !contentEditorText(this._content())) {\n this._contentBuilder.deleteBlock(this.id());\n }\n }\n\n private update() {\n this._contentBuilder.updateParagraph(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<div #contentRef\n class=\"content\"\n [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"_content()\"\n [settings]=\"settings()\"\n [props]=\"props()\"\n (propsChanged)=\"onPropsChanged($event)\"\n [attr.data-empty-placeholder]=\"placeholder()\"\n (contentChanged)=\"onContentChanged($event)\"\n (pressedEnter)=\"onPressedEnter($event)\"\n (keydown)=\"_onKeyDown($event)\"\n (initialized)=\"onContentEditableInitialized()\"></div>\n"],"names":[],"mappings":";;;;;;MA2Ca,uBAAuB,CAAA;AAC1B,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;AAClE,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhC,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmC,YAAY;oFAAC;IAExF,EAAE,GAAG,KAAK,CAAC,QAAQ;2EAAU;IAC7B,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAAoC;IAC5D,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAO;IAChC,KAAK,GAAG,KAAK,CAA8B,EAAE;8EAAC;IAC9C,KAAK,GAAG,KAAK,CAAC,QAAQ;8EAAU;IAChC,WAAW,GAAG,KAAK,CAAC,iBAAiB;oFAAC;IAE5B,QAAQ,GAAG,MAAM,CAAmC,EAAE;iFAAC;IACvD,MAA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AA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ContentBuilderStore, a as CONTENT_BUILDER, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-
|
|
1
|
+
import { C as ContentBuilderStore, a as CONTENT_BUILDER, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-67JfJX3V.mjs';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, DestroyRef, viewChild, input, signal, computed, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -168,4 +168,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
168
168
|
}], ctorParameters: () => [], propDecorators: { _contentRef: [{ type: i0.ViewChild, args: ['contentRef', { isSignal: true }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], captionPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionPlaceholder", required: false }] }] } });
|
|
169
169
|
|
|
170
170
|
export { QuoteBlockComponent };
|
|
171
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-quote-block.component-
|
|
171
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-quote-block.component-5DMAhqu0.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-content-editor-quote-block.component-SpGN1HDp.mjs","sources":["../../../projects/components/content-editor/src/_builder/quote-block/quote-block.component.ts","../../../projects/components/content-editor/src/_builder/quote-block/quote-block.component.html"],"sourcesContent":["import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { ContentEditorText } from '../../types';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n ChangeDetectionStrategy,\n Component, computed, effect, untracked,\n DestroyRef,\n ElementRef,\n inject,\n input,\n OnInit,\n signal,\n viewChild\n} from '@angular/core';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorItemProperty\n} from '../../types';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\n\nexport interface ContentEditorQuoteBlockContent {\n cite: {\n content: ContentEditorText;\n props: ContentEditorItemProperty[];\n };\n caption?: {\n content: ContentEditorText;\n props: ContentEditorItemProperty[];\n }\n}\n\nexport interface ContentEditorQuoteBlock {\n content: ContentEditorQuoteBlockContent,\n settings: any\n}\n\n@Component({\n selector: 'ngs-quote-block',\n exportAs: 'ngsQuoteBlock',\n imports: [\n ContentEditorContentEditableDirective,\n ],\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: QuoteBlockComponent,\n multi: true\n }\n ],\n templateUrl: './quote-block.component.html',\n styleUrl: './quote-block.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class QuoteBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n private _destroyRef = inject(DestroyRef);\n\n private _contentRef = viewChild.required<ElementRef<HTMLParagraphElement>>('contentRef');\n\n id = input.required<string>();\n content = input.required<ContentEditorQuoteBlockContent>();\n settings = input.required<any>();\n index = input.required<number>();\n props = input<ContentEditorItemProperty[]>([]);\n placeholder = input('Enter quote here');\n captionPlaceholder = input('Enter caption here');\n\n protected _citeContent = signal<ContentEditorText>([]);\n protected _citeProps = signal<ContentEditorItemProperty[]>([]);\n protected _captionContent = signal<ContentEditorText>([]);\n protected _captionProps = signal<ContentEditorItemProperty[]>([]);\n protected _isEmpty = signal<boolean>(true);\n readonly initialized = signal(false);\n\n citeOriginalContent = computed(() => {\n return this.content().cite.content || [];\n });\n citeOriginalProps = computed(() => {\n return this.content().cite.props || [];\n });\n captionOriginalContent = computed(() => {\n return this.content().caption?.content || [];\n });\n captionOriginalProps = computed(() => {\n return this.content().caption?.props || [];\n });\n\n constructor() {\n effect(() => {\n const content = this.content();\n untracked(() => {\n this._citeContent.set(content.cite.content);\n this._citeProps.set(cloneContentEditorValue(content.cite.props));\n this._captionContent.set(content.caption?.content ?? []);\n this._captionProps.set(cloneContentEditorValue(content.caption?.props ?? []));\n this._isEmpty.set(!contentEditorText(content.cite.content).trim());\n });\n });\n }\n\n ngOnInit() {\n this._citeContent.set(this.citeOriginalContent());\n this._citeProps.set(this.citeOriginalProps());\n this._captionContent.set(this.captionOriginalContent());\n this._captionProps.set(this.captionOriginalProps());\n this._isEmpty.set(this._citeContent().length === 0);\n this._contentBuilder\n .focusChanged\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n });\n }\n\n focus() {\n const element = this._contentRef().nativeElement;\n const range = window.document.createRange();\n range.setStart(element, 0);\n range.setEnd(element, 0);\n const selection = window.getSelection() as Selection;\n selection.removeAllRanges();\n selection.addRange(range);\n }\n\n getData(): any {\n return {\n content: {\n cite: {\n content: this._citeContent(),\n props: this._citeProps(),\n },\n caption: {\n content: this._captionContent(),\n props: this._captionProps(),\n }\n },\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !contentEditorText(this._citeContent()).trim();\n }\n\n protected onCiteContentChanged(content: readonly NgsHeadlessEditorText[]) {\n if (!this.initialized()) {\n return;\n }\n\n this._isEmpty.set(!contentEditorText(content).trim());\n this._citeContent.set(content);\n this.update();\n }\n\n protected onCaptionContentChanged(content: readonly NgsHeadlessEditorText[]) {\n if (!this.initialized()) {\n return;\n }\n\n this._captionContent.set(content);\n this.update();\n }\n\n protected onCitePropsChanged(props: ContentEditorItemProperty[]) {\n this._citeProps.set(props);\n this.update();\n }\n\n protected onCaptionPropsChanged(props: ContentEditorItemProperty[]) {\n this._captionProps.set(props);\n this.update();\n }\n\n protected onPressedEnter(event: KeyboardEvent) {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n\n protected onContentEditableInitialized() {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n\n this.initialized.set(true);\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<blockquote #contentRef\n #contentEditableRef=\"ngsContentEditorContentEditable\"\n class=\"content\"\n [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"citeOriginalContent()\"\n [props]=\"citeOriginalProps()\"\n (propsChanged)=\"onCitePropsChanged($event)\"\n [attr.data-empty-placeholder]=\"placeholder()\"\n (contentChanged)=\"onCiteContentChanged($event)\"\n (pressedEnter)=\"onPressedEnter($event)\"\n (initialized)=\"onContentEditableInitialized()\"></blockquote>\n<div class=\"caption\"\n #captionRef\n #captionEditableRef=\"ngsContentEditorContentEditable\"\n [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"captionOriginalContent()\"\n [props]=\"captionOriginalProps()\"\n (propsChanged)=\"onCaptionPropsChanged($event)\"\n [attr.data-empty-placeholder]=\"placeholder()\"\n (contentChanged)=\"onCaptionContentChanged($event)\"\n (pressedEnter)=\"onPressedEnter($event)\"></div>\n"],"names":[],"mappings":";;;;;MA0Da,mBAAmB,CAAA;AACtB,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;AAClE,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhC,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmC,YAAY;oFAAC;IAExF,EAAE,GAAG,KAAK,CAAC,QAAQ;2EAAU;IAC7B,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAAkC;IAC1D,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAO;IAChC,KAAK,GAAG,KAAK,CAAC,QAAQ;8EAAU;IAChC,KAAK,GAAG,KAAK,CAA8B,EAAE;8EAAC;IAC9C,WAAW,GAAG,KAAK,CAAC,kBAAkB;oFAAC;IACvC,kBAAkB,GAAG,KAAK,CAAC,oBAAoB;2FAAC;IAEtC,YAAY,GAAG,MAAM,CAAoB,EAAE;qFAAC;IAC5C,UAAU,GAAG,MAAM,CAA8B,EAAE;mFAAC;IACpD,eAAe,GAAG,MAAM,CAAoB,EAAE;wFAAC;IAC/C,aAAa,GAAG,MAAM,CAA8B,EAAE;sFAAC;IACvD,QAAQ,GAAG,MAAM,CAAU,IAAI;iFAAC;IACjC,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AAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,kBAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,oBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-quote-block.component-5DMAhqu0.mjs","sources":["../../../projects/components/content-editor/src/_builder/quote-block/quote-block.component.ts","../../../projects/components/content-editor/src/_builder/quote-block/quote-block.component.html"],"sourcesContent":["import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { ContentEditorText } from '../../types';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n ChangeDetectionStrategy,\n Component, computed, effect, untracked,\n DestroyRef,\n ElementRef,\n inject,\n input,\n OnInit,\n signal,\n viewChild\n} from '@angular/core';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorItemProperty\n} from '../../types';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\n\nexport interface ContentEditorQuoteBlockContent {\n cite: {\n content: ContentEditorText;\n props: ContentEditorItemProperty[];\n };\n caption?: {\n content: ContentEditorText;\n props: ContentEditorItemProperty[];\n }\n}\n\nexport interface ContentEditorQuoteBlock {\n content: ContentEditorQuoteBlockContent,\n settings: any\n}\n\n@Component({\n selector: 'ngs-quote-block',\n exportAs: 'ngsQuoteBlock',\n imports: [\n ContentEditorContentEditableDirective,\n ],\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: QuoteBlockComponent,\n multi: true\n }\n ],\n templateUrl: './quote-block.component.html',\n styleUrl: './quote-block.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class QuoteBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n private _destroyRef = inject(DestroyRef);\n\n private _contentRef = viewChild.required<ElementRef<HTMLParagraphElement>>('contentRef');\n\n id = input.required<string>();\n content = input.required<ContentEditorQuoteBlockContent>();\n settings = input.required<any>();\n index = input.required<number>();\n props = input<ContentEditorItemProperty[]>([]);\n placeholder = input('Enter quote here');\n captionPlaceholder = input('Enter caption here');\n\n protected _citeContent = signal<ContentEditorText>([]);\n protected _citeProps = signal<ContentEditorItemProperty[]>([]);\n protected _captionContent = signal<ContentEditorText>([]);\n protected _captionProps = signal<ContentEditorItemProperty[]>([]);\n protected _isEmpty = signal<boolean>(true);\n readonly initialized = signal(false);\n\n citeOriginalContent = computed(() => {\n return this.content().cite.content || [];\n });\n citeOriginalProps = computed(() => {\n return this.content().cite.props || [];\n });\n captionOriginalContent = computed(() => {\n return this.content().caption?.content || [];\n });\n captionOriginalProps = computed(() => {\n return this.content().caption?.props || [];\n });\n\n constructor() {\n effect(() => {\n const content = this.content();\n untracked(() => {\n this._citeContent.set(content.cite.content);\n this._citeProps.set(cloneContentEditorValue(content.cite.props));\n this._captionContent.set(content.caption?.content ?? []);\n this._captionProps.set(cloneContentEditorValue(content.caption?.props ?? []));\n this._isEmpty.set(!contentEditorText(content.cite.content).trim());\n });\n });\n }\n\n ngOnInit() {\n this._citeContent.set(this.citeOriginalContent());\n this._citeProps.set(this.citeOriginalProps());\n this._captionContent.set(this.captionOriginalContent());\n this._captionProps.set(this.captionOriginalProps());\n this._isEmpty.set(this._citeContent().length === 0);\n this._contentBuilder\n .focusChanged\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n });\n }\n\n focus() {\n const element = this._contentRef().nativeElement;\n const range = window.document.createRange();\n range.setStart(element, 0);\n range.setEnd(element, 0);\n const selection = window.getSelection() as Selection;\n selection.removeAllRanges();\n selection.addRange(range);\n }\n\n getData(): any {\n return {\n content: {\n cite: {\n content: this._citeContent(),\n props: this._citeProps(),\n },\n caption: {\n content: this._captionContent(),\n props: this._captionProps(),\n }\n },\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !contentEditorText(this._citeContent()).trim();\n }\n\n protected onCiteContentChanged(content: readonly NgsHeadlessEditorText[]) {\n if (!this.initialized()) {\n return;\n }\n\n this._isEmpty.set(!contentEditorText(content).trim());\n this._citeContent.set(content);\n this.update();\n }\n\n protected onCaptionContentChanged(content: readonly NgsHeadlessEditorText[]) {\n if (!this.initialized()) {\n return;\n }\n\n this._captionContent.set(content);\n this.update();\n }\n\n protected onCitePropsChanged(props: ContentEditorItemProperty[]) {\n this._citeProps.set(props);\n this.update();\n }\n\n protected onCaptionPropsChanged(props: ContentEditorItemProperty[]) {\n this._captionProps.set(props);\n this.update();\n }\n\n protected onPressedEnter(event: KeyboardEvent) {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n\n protected onContentEditableInitialized() {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n\n this.initialized.set(true);\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<blockquote #contentRef\n #contentEditableRef=\"ngsContentEditorContentEditable\"\n class=\"content\"\n [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"citeOriginalContent()\"\n [props]=\"citeOriginalProps()\"\n (propsChanged)=\"onCitePropsChanged($event)\"\n [attr.data-empty-placeholder]=\"placeholder()\"\n (contentChanged)=\"onCiteContentChanged($event)\"\n (pressedEnter)=\"onPressedEnter($event)\"\n (initialized)=\"onContentEditableInitialized()\"></blockquote>\n<div class=\"caption\"\n #captionRef\n #captionEditableRef=\"ngsContentEditorContentEditable\"\n [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"captionOriginalContent()\"\n [props]=\"captionOriginalProps()\"\n (propsChanged)=\"onCaptionPropsChanged($event)\"\n [attr.data-empty-placeholder]=\"placeholder()\"\n (contentChanged)=\"onCaptionContentChanged($event)\"\n (pressedEnter)=\"onPressedEnter($event)\"></div>\n"],"names":[],"mappings":";;;;;MA0Da,mBAAmB,CAAA;AACtB,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;AAClE,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhC,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmC,YAAY;oFAAC;IAExF,EAAE,GAAG,KAAK,CAAC,QAAQ;2EAAU;IAC7B,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAAkC;IAC1D,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAO;IAChC,KAAK,GAAG,KAAK,CAAC,QAAQ;8EAAU;IAChC,KAAK,GAAG,KAAK,CAA8B,EAAE;8EAAC;IAC9C,WAAW,GAAG,KAAK,CAAC,kBAAkB;oFAAC;IACvC,kBAAkB,G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AAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,kBAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,oBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as CONTENT_BUILDER, C as ContentBuilderStore, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-
|
|
1
|
+
import { a as CONTENT_BUILDER, C as ContentBuilderStore, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-67JfJX3V.mjs';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, ElementRef, DestroyRef, output, afterNextRender, Directive, PLATFORM_ID, Input, Renderer2, NgZone,
|
|
3
|
+
import { inject, ElementRef, DestroyRef, output, afterNextRender, Directive, PLATFORM_ID, input, effect, Input, Renderer2, NgZone, booleanAttribute, HostBinding, ChangeDetectionStrategy, Component, ChangeDetectorRef, viewChild, computed, signal, untracked } from '@angular/core';
|
|
4
4
|
import { DOCUMENT, isPlatformServer, isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import SelectionArea from '@viselect/vanilla';
|
|
6
6
|
import { Icon } from '@ngstarter-ui/components/icon';
|
|
@@ -47,11 +47,11 @@ class TableColumnsManagerDirective {
|
|
|
47
47
|
const elementRightPosition = elementRect.x + elementRect.width;
|
|
48
48
|
const elementLeftPosition = elementRect.x;
|
|
49
49
|
if (event.clientX > (this._elementPosition + this._cellWidth) && event.clientX > (elementRightPosition + this._cellWidth)) {
|
|
50
|
-
this._elementPosition = elementRightPosition + this._cellWidth;
|
|
50
|
+
this._elementPosition = Math.max(this._elementPosition, elementRightPosition) + this._cellWidth;
|
|
51
51
|
this.columnAdded.emit();
|
|
52
52
|
}
|
|
53
53
|
else if (event.clientX < (this._elementPosition - this._cellWidth) && event.clientX < (elementLeftPosition - this._cellWidth)) {
|
|
54
|
-
this._elementPosition = elementLeftPosition - this._cellWidth;
|
|
54
|
+
this._elementPosition = Math.min(this._elementPosition, elementLeftPosition) - this._cellWidth;
|
|
55
55
|
this.columnDeleted.emit();
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -156,6 +156,8 @@ class ResizableTableDirective {
|
|
|
156
156
|
minColumnWidth = 120;
|
|
157
157
|
resizeHandleWidth = 5;
|
|
158
158
|
mutationObserverDebounceTime = 20;
|
|
159
|
+
resizeEnabled = input(true, /* @ts-ignore */
|
|
160
|
+
...(ngDevMode ? [{ debugName: "resizeEnabled" }] : /* istanbul ignore next */ []));
|
|
159
161
|
columnWidthChange = output();
|
|
160
162
|
columnWidthChangeStart = output();
|
|
161
163
|
columnWidthChangeEnd = output();
|
|
@@ -190,6 +192,14 @@ class ResizableTableDirective {
|
|
|
190
192
|
this.hideResizeHandle();
|
|
191
193
|
}
|
|
192
194
|
}, this.mutationObserverDebounceTime);
|
|
195
|
+
effect(() => {
|
|
196
|
+
if (!this.resizeEnabled()) {
|
|
197
|
+
if (this.isResizing)
|
|
198
|
+
this.stopResizing(false);
|
|
199
|
+
else
|
|
200
|
+
this.hideResizeHandle();
|
|
201
|
+
}
|
|
202
|
+
});
|
|
193
203
|
}
|
|
194
204
|
ngOnInit() {
|
|
195
205
|
}
|
|
@@ -260,6 +270,8 @@ class ResizableTableDirective {
|
|
|
260
270
|
this.colElements = Array.from(this.colgroup.querySelectorAll('col'));
|
|
261
271
|
}
|
|
262
272
|
ensureColWidths() {
|
|
273
|
+
if (!this.resizeEnabled())
|
|
274
|
+
return;
|
|
263
275
|
const referenceRow = this.table.querySelector('tbody > tr:first-child, thead > tr:first-child');
|
|
264
276
|
if (!referenceRow || this.colElements.length !== referenceRow.cells.length) {
|
|
265
277
|
return;
|
|
@@ -342,7 +354,7 @@ class ResizableTableDirective {
|
|
|
342
354
|
this.listeners.push(md, ml);
|
|
343
355
|
}
|
|
344
356
|
handleMouseMoveWrapper(event) {
|
|
345
|
-
if (this.isResizing || !this.wrapper) {
|
|
357
|
+
if (!this.resizeEnabled() || this.isResizing || !this.wrapper) {
|
|
346
358
|
return;
|
|
347
359
|
}
|
|
348
360
|
const wrapperRect = this.wrapper.getBoundingClientRect();
|
|
@@ -380,12 +392,13 @@ class ResizableTableDirective {
|
|
|
380
392
|
}
|
|
381
393
|
}
|
|
382
394
|
handleMouseDownWrapper(event) {
|
|
383
|
-
if (this.activeHoverColumnIndex !== -1 && this.isHandleVisible && this.wrapper) {
|
|
395
|
+
if (this.resizeEnabled() && this.activeHoverColumnIndex !== -1 && this.isHandleVisible && this.wrapper) {
|
|
384
396
|
const targetCol = this.colElements[this.activeHoverColumnIndex];
|
|
385
397
|
const firstRow = this.table.querySelector('tbody > tr:first-child, thead > tr:first-child');
|
|
386
398
|
if (!targetCol || !firstRow || !firstRow.cells[this.activeHoverColumnIndex]) {
|
|
387
399
|
return;
|
|
388
400
|
}
|
|
401
|
+
this.ensureColWidths();
|
|
389
402
|
this.isResizing = true;
|
|
390
403
|
this.resizingColumnIndex = this.activeHoverColumnIndex;
|
|
391
404
|
this.resizingColElement = targetCol;
|
|
@@ -435,7 +448,7 @@ class ResizableTableDirective {
|
|
|
435
448
|
fromEvent(document, 'mousemove')
|
|
436
449
|
.pipe(takeUntil(this.destroy$))
|
|
437
450
|
.subscribe(event => {
|
|
438
|
-
if (!this.isResizing || !this.resizingColElement || !this.wrapper || !this.resizeHandle)
|
|
451
|
+
if (!this.resizeEnabled() || !this.isResizing || !this.resizingColElement || !this.wrapper || !this.resizeHandle)
|
|
439
452
|
return;
|
|
440
453
|
if (!this.resizingColElement.parentElement) {
|
|
441
454
|
this.stopResizing();
|
|
@@ -460,17 +473,22 @@ class ResizableTableDirective {
|
|
|
460
473
|
.subscribe(() => {
|
|
461
474
|
if (this.isResizing) {
|
|
462
475
|
this.ngZone.run(() => {
|
|
463
|
-
this.stopResizing();
|
|
476
|
+
this.stopResizing(this.resizeEnabled());
|
|
464
477
|
});
|
|
465
478
|
}
|
|
466
479
|
});
|
|
467
480
|
});
|
|
468
481
|
}
|
|
469
|
-
stopResizing() {
|
|
470
|
-
this.
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
482
|
+
stopResizing(commit = true) {
|
|
483
|
+
if (commit && this.resizingColElement) {
|
|
484
|
+
this.columnWidthChange.emit({
|
|
485
|
+
columnIndex: this.resizingColumnIndex,
|
|
486
|
+
width: this.resizingColElement.getBoundingClientRect().width
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
else if (this.resizingColElement) {
|
|
490
|
+
this.renderer.setStyle(this.resizingColElement, 'width', `${this.startWidth}px`);
|
|
491
|
+
}
|
|
474
492
|
this.renderer.removeClass(this.table, RESIZING_TABLE_CLASS);
|
|
475
493
|
this.hideResizeHandle();
|
|
476
494
|
this.isResizing = false;
|
|
@@ -489,7 +507,7 @@ class ResizableTableDirective {
|
|
|
489
507
|
}
|
|
490
508
|
}
|
|
491
509
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ResizableTableDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
492
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
510
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.7", type: ResizableTableDirective, isStandalone: true, selector: "table[ngsResizableTable]", inputs: { minColumnWidth: { classPropertyName: "minColumnWidth", publicName: "minColumnWidth", isSignal: false, isRequired: false, transformFunction: null }, resizeHandleWidth: { classPropertyName: "resizeHandleWidth", publicName: "resizeHandleWidth", isSignal: false, isRequired: false, transformFunction: null }, mutationObserverDebounceTime: { classPropertyName: "mutationObserverDebounceTime", publicName: "mutationObserverDebounceTime", isSignal: false, isRequired: false, transformFunction: null }, resizeEnabled: { classPropertyName: "resizeEnabled", publicName: "resizeEnabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { columnWidthChange: "columnWidthChange", columnWidthChangeStart: "columnWidthChangeStart", columnWidthChangeEnd: "columnWidthChangeEnd" }, ngImport: i0 });
|
|
493
511
|
}
|
|
494
512
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ResizableTableDirective, decorators: [{
|
|
495
513
|
type: Directive,
|
|
@@ -502,7 +520,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
502
520
|
type: Input
|
|
503
521
|
}], mutationObserverDebounceTime: [{
|
|
504
522
|
type: Input
|
|
505
|
-
}], columnWidthChange: [{ type: i0.Output, args: ["columnWidthChange"] }], columnWidthChangeStart: [{ type: i0.Output, args: ["columnWidthChangeStart"] }], columnWidthChangeEnd: [{ type: i0.Output, args: ["columnWidthChangeEnd"] }] } });
|
|
523
|
+
}], resizeEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeEnabled", required: false }] }], columnWidthChange: [{ type: i0.Output, args: ["columnWidthChange"] }], columnWidthChangeStart: [{ type: i0.Output, args: ["columnWidthChangeStart"] }], columnWidthChangeEnd: [{ type: i0.Output, args: ["columnWidthChangeEnd"] }] } });
|
|
506
524
|
|
|
507
525
|
const HIDE_DELAY_MS = 300;
|
|
508
526
|
class DraggableTableComponent {
|
|
@@ -1375,6 +1393,8 @@ class TableBlockComponent {
|
|
|
1375
1393
|
...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
1376
1394
|
props = input([], /* @ts-ignore */
|
|
1377
1395
|
...(ngDevMode ? [{ debugName: "props" }] : /* istanbul ignore next */ []));
|
|
1396
|
+
fullWidth = computed(() => this.settings().fullWidth !== false, /* @ts-ignore */
|
|
1397
|
+
...(ngDevMode ? [{ debugName: "fullWidth" }] : /* istanbul ignore next */ []));
|
|
1378
1398
|
_content = signal([], /* @ts-ignore */
|
|
1379
1399
|
...(ngDevMode ? [{ debugName: "_content" }] : /* istanbul ignore next */ []));
|
|
1380
1400
|
_columnManaging = signal(false, /* @ts-ignore */
|
|
@@ -1538,10 +1558,12 @@ class TableBlockComponent {
|
|
|
1538
1558
|
onRowManagingEnd() {
|
|
1539
1559
|
this._rowManaging.set(false);
|
|
1540
1560
|
}
|
|
1541
|
-
onColumnWidthChange(
|
|
1561
|
+
onColumnWidthChange({ columnIndex, width }) {
|
|
1542
1562
|
this._content.update((content) => {
|
|
1543
1563
|
content.forEach(row => {
|
|
1544
|
-
row[
|
|
1564
|
+
const cell = row[columnIndex];
|
|
1565
|
+
if (cell)
|
|
1566
|
+
cell.options.width = width;
|
|
1545
1567
|
});
|
|
1546
1568
|
return content;
|
|
1547
1569
|
});
|
|
@@ -1592,17 +1614,17 @@ class TableBlockComponent {
|
|
|
1592
1614
|
return false;
|
|
1593
1615
|
}
|
|
1594
1616
|
update() {
|
|
1595
|
-
this._store.updateBlock(this.id(), {
|
|
1617
|
+
this._store.updateBlock(this.id(), { content: this._content(), isEmpty: this.isEmpty() });
|
|
1596
1618
|
this._contentBuilder.emitContentChangeEvent();
|
|
1597
1619
|
}
|
|
1598
1620
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TableBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1599
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: TableBlockComponent, isStandalone: true, selector: "ngs-table-block", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.is-column-managing": "_columnManaging()", "class.is-row-managing": "_rowManaging()" } }, providers: [
|
|
1621
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: TableBlockComponent, isStandalone: true, selector: "ngs-table-block", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.is-full-width": "fullWidth()", "class.is-column-managing": "_columnManaging()", "class.is-row-managing": "_rowManaging()" } }, providers: [
|
|
1600
1622
|
{
|
|
1601
1623
|
provide: CONTENT_EDITOR_BLOCK,
|
|
1602
1624
|
useExisting: TableBlockComponent,
|
|
1603
1625
|
multi: true
|
|
1604
1626
|
}
|
|
1605
|
-
], viewQueries: [{ propertyName: "_tableRef", first: true, predicate: ["table"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"table-overflow\">\n <div class=\"table-container\">\n <ngs-draggable-table [disabled]=\"_resizeManging() || _columnManaging() || _rowManaging()\"\n (columnMoved)=\"onColumnMoved($event)\"\n (rowMoved)=\"onRowMoved($event)\"\n (moveStart)=\"onMoveStart()\"\n (moveEnd)=\"onMoveEnd()\">\n <table #table class=\"table\"\n ngsResizableTable\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"onTableFocusChange($event)\"\n (columnWidthChangeStart)=\"onColumnWidthChangeStart()\"\n (columnWidthChangeEnd)=\"onColumnWidthChangeEnd()\"\n (columnWidthChange)=\"onColumnWidthChange($event)\">\n <colgroup>\n @for (cell of _content()[0]; track $index) {\n <col [style.width.px]=\"cell.options.width || null\">\n }\n </colgroup>\n <tbody>\n @for (row of _content(); track $index) {\n <tr>\n @for (cell of row; track $index) {\n <td\n [ngsContentEditorContentEditable]=\"cell.content\"\n [props]=\"cell.props\"\n (contentChanged)=\"onCellContentChanged(cell, $event)\"\n (propsChanged)=\"onCellPropsChanged(cell, $event)\"\n (blur)=\"clearCellsSelection()\"\n [rowSpan]=\"cell.options.rowspan\"\n [colSpan]=\"cell.options.colspan\"></td>\n }\n </tr>\n }\n </tbody>\n </table>\n <div class=\"resize-end\" ngsTableColumnsManager\n (columnManagingStart)=\"onColumnManagingStart()\"\n (columnManagingEnd)=\"onColumnManagingEnd()\"\n (columnAdded)=\"onColAdded()\"\n (columnDeleted)=\"onColDeleted()\">\n <ngs-icon name=\"fluent:add-24-regular\" class=\"resize-icon\" />\n </div>\n <div class=\"resize-bottom\" ngsTableRowsManager\n (rowManagingStart)=\"onRowManagingStart()\"\n (rowManagingEnd)=\"onRowManagingEnd()\"\n (rowAdded)=\"onRowAdded()\"\n (rowDeleted)=\"onRowDeleted()\">\n <ngs-icon name=\"fluent:add-24-regular\" class=\"resize-icon\" />\n </div>\n </ngs-draggable-table>\n </div>\n</div>\n", styles: [":host{display:block}:host.is-column-managing{cursor:col-resize;-webkit-user-select:none;user-select:none}:host.is-row-managing{cursor:row-resize;-webkit-user-select:none;user-select:none}:host .table-overflow{position:relative;padding-bottom:26px;overflow-y:hidden;overflow-x:auto;max-width:100%;width:var(--ngs-content-editor-builder-content-width, 704px)}:host .table-container{position:relative;width:max-content}:host table{width:auto
|
|
1627
|
+
], viewQueries: [{ propertyName: "_tableRef", first: true, predicate: ["table"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"table-overflow\">\n <div class=\"table-container\">\n <ngs-draggable-table [disabled]=\"_resizeManging() || _columnManaging() || _rowManaging()\"\n (columnMoved)=\"onColumnMoved($event)\"\n (rowMoved)=\"onRowMoved($event)\"\n (moveStart)=\"onMoveStart()\"\n (moveEnd)=\"onMoveEnd()\">\n <table #table class=\"table\"\n ngsResizableTable\n [resizeEnabled]=\"!fullWidth()\"\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"onTableFocusChange($event)\"\n (columnWidthChangeStart)=\"onColumnWidthChangeStart()\"\n (columnWidthChangeEnd)=\"onColumnWidthChangeEnd()\"\n (columnWidthChange)=\"onColumnWidthChange($event)\">\n <colgroup>\n @for (cell of _content()[0]; track $index) {\n <col [style.width.px]=\"cell.options.width || null\">\n }\n </colgroup>\n <tbody>\n @for (row of _content(); track $index) {\n <tr>\n @for (cell of row; track $index) {\n <td\n [ngsContentEditorContentEditable]=\"cell.content\"\n [props]=\"cell.props\"\n (contentChanged)=\"onCellContentChanged(cell, $event)\"\n (propsChanged)=\"onCellPropsChanged(cell, $event)\"\n (blur)=\"clearCellsSelection()\"\n [rowSpan]=\"cell.options.rowspan\"\n [colSpan]=\"cell.options.colspan\"></td>\n }\n </tr>\n }\n </tbody>\n </table>\n <div class=\"resize-end\" ngsTableColumnsManager\n (columnManagingStart)=\"onColumnManagingStart()\"\n (columnManagingEnd)=\"onColumnManagingEnd()\"\n (columnAdded)=\"onColAdded()\"\n (columnDeleted)=\"onColDeleted()\">\n <ngs-icon name=\"fluent:add-24-regular\" class=\"resize-icon\" />\n </div>\n <div class=\"resize-bottom\" ngsTableRowsManager\n (rowManagingStart)=\"onRowManagingStart()\"\n (rowManagingEnd)=\"onRowManagingEnd()\"\n (rowAdded)=\"onRowAdded()\"\n (rowDeleted)=\"onRowDeleted()\">\n <ngs-icon name=\"fluent:add-24-regular\" class=\"resize-icon\" />\n </div>\n </ngs-draggable-table>\n </div>\n</div>\n", styles: [":host{display:block}:host.is-column-managing{cursor:col-resize;-webkit-user-select:none;user-select:none}:host.is-row-managing{cursor:row-resize;-webkit-user-select:none;user-select:none}:host .table-overflow{position:relative;padding-bottom:26px;overflow-y:hidden;overflow-x:auto;max-width:100%;width:var(--ngs-content-editor-builder-content-width, 704px)}:host .table-container{position:relative;width:max-content}:host table{width:auto;word-break:break-word;border-collapse:collapse;table-layout:fixed;border:1px solid var(--ngs-color-border);outline:none}:host table tr:not(:last-child){border-bottom:1px solid var(--ngs-color-border)}:host table td{min-width:120px;height:40px;padding:calc(var(--spacing, .25rem) * 2) calc(var(--spacing, .25rem) * 3);outline:none}:host table td:not(:last-child){border-right:1px solid var(--ngs-color-border)}:host table td.selected{background:var(--ngs-content-editor-selected-bg, var(--ngs-color-primary-container))}:host.is-full-width .table-overflow{width:auto;padding-inline-end:calc(var(--spacing, .25rem) * 5)}:host.is-full-width .table-container,:host.is-full-width table{width:100%}:host.is-full-width table col{width:auto!important}:host.is-full-width table td{min-width:0}:host .resize-end{position:absolute;width:calc(var(--spacing, .25rem) * 4);right:calc(calc(var(--spacing, .25rem) * 5) * -1);top:0;bottom:0;border-radius:var(--spacing, .25rem);background:var(--ngs-color-surface-container);display:flex;align-items:center;justify-content:center}:host .resize-end:hover{cursor:col-resize;background:var(--ngs-color-surface-container-high)}:host .resize-bottom{position:absolute;height:calc(var(--spacing, .25rem) * 4);bottom:calc(calc(var(--spacing, .25rem) * 5) * -1);left:0;right:0;border-radius:var(--spacing, .25rem);background:var(--ngs-color-surface-container);display:flex;align-items:center;justify-content:center}:host .resize-bottom:hover{cursor:row-resize;background:var(--ngs-color-surface-container-high)}:host .resize-icon{font-size:14px!important;height:14px!important;width:14px!important}:host.is-resizing{-webkit-user-select:none;user-select:none}:host table[ngsResizableTable] th.resizable-hover-handle:after,:host table[ngsResizableTable] td.resizable-hover-handle:after{opacity:1;visibility:visible}:host .table-resizing{cursor:col-resize!important;-webkit-user-select:none;user-select:none}:host .table-resizing+.resizable-table-handle{opacity:1;visibility:visible}:host .resizable-table-wrapper{position:relative}:host .resizable-table-handle{position:absolute;top:0;height:100%;background-color:var(--ngs-color-primary-400);cursor:col-resize;z-index:10;opacity:0;visibility:hidden;left:-9999px;transition:opacity .05s ease-in-out,visibility .05s ease-in-out}:host .resizable-table-handle.resize-handle--active{opacity:1;visibility:visible}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: ContentEditorContentEditableDirective, selector: "[ngsContentEditorContentEditable]", inputs: ["ngsContentEditorContentEditable", "settings", "props", "singleLine"], outputs: ["contentChanged", "propsChanged", "pressedEnter", "initialized"], exportAs: ["ngsContentEditorContentEditable"] }, { kind: "component", type: Icon, selector: "ngs-icon", inputs: ["name"], exportAs: ["ngsIcon"] }, { kind: "directive", type: TableColumnsManagerDirective, selector: "[ngsTableColumnsManager]", outputs: ["columnAdded", "columnDeleted", "columnManagingStart", "columnManagingEnd"] }, { kind: "directive", type: TableRowsManagerDirective, selector: "[ngsTableRowsManager]", outputs: ["rowManagingStart", "rowManagingEnd", "rowAdded", "rowDeleted"] }, { kind: "directive", type: CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }, { kind: "directive", type: ResizableTableDirective, selector: "table[ngsResizableTable]", inputs: ["minColumnWidth", "resizeHandleWidth", "mutationObserverDebounceTime", "resizeEnabled"], outputs: ["columnWidthChange", "columnWidthChangeStart", "columnWidthChangeEnd"] }, { kind: "component", type: DraggableTableComponent, selector: "ngs-draggable-table", inputs: ["disabled"], outputs: ["columnMoved", "rowMoved", "moveStart", "moveEnd"], exportAs: ["ngsDraggableTable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1606
1628
|
}
|
|
1607
1629
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TableBlockComponent, decorators: [{
|
|
1608
1630
|
type: Component,
|
|
@@ -1621,10 +1643,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
1621
1643
|
multi: true
|
|
1622
1644
|
}
|
|
1623
1645
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1646
|
+
'[class.is-full-width]': 'fullWidth()',
|
|
1624
1647
|
'[class.is-column-managing]': '_columnManaging()',
|
|
1625
1648
|
'[class.is-row-managing]': '_rowManaging()',
|
|
1626
|
-
}, template: "<div class=\"table-overflow\">\n <div class=\"table-container\">\n <ngs-draggable-table [disabled]=\"_resizeManging() || _columnManaging() || _rowManaging()\"\n (columnMoved)=\"onColumnMoved($event)\"\n (rowMoved)=\"onRowMoved($event)\"\n (moveStart)=\"onMoveStart()\"\n (moveEnd)=\"onMoveEnd()\">\n <table #table class=\"table\"\n ngsResizableTable\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"onTableFocusChange($event)\"\n (columnWidthChangeStart)=\"onColumnWidthChangeStart()\"\n (columnWidthChangeEnd)=\"onColumnWidthChangeEnd()\"\n (columnWidthChange)=\"onColumnWidthChange($event)\">\n <colgroup>\n @for (cell of _content()[0]; track $index) {\n <col [style.width.px]=\"cell.options.width || null\">\n }\n </colgroup>\n <tbody>\n @for (row of _content(); track $index) {\n <tr>\n @for (cell of row; track $index) {\n <td\n [ngsContentEditorContentEditable]=\"cell.content\"\n [props]=\"cell.props\"\n (contentChanged)=\"onCellContentChanged(cell, $event)\"\n (propsChanged)=\"onCellPropsChanged(cell, $event)\"\n (blur)=\"clearCellsSelection()\"\n [rowSpan]=\"cell.options.rowspan\"\n [colSpan]=\"cell.options.colspan\"></td>\n }\n </tr>\n }\n </tbody>\n </table>\n <div class=\"resize-end\" ngsTableColumnsManager\n (columnManagingStart)=\"onColumnManagingStart()\"\n (columnManagingEnd)=\"onColumnManagingEnd()\"\n (columnAdded)=\"onColAdded()\"\n (columnDeleted)=\"onColDeleted()\">\n <ngs-icon name=\"fluent:add-24-regular\" class=\"resize-icon\" />\n </div>\n <div class=\"resize-bottom\" ngsTableRowsManager\n (rowManagingStart)=\"onRowManagingStart()\"\n (rowManagingEnd)=\"onRowManagingEnd()\"\n (rowAdded)=\"onRowAdded()\"\n (rowDeleted)=\"onRowDeleted()\">\n <ngs-icon name=\"fluent:add-24-regular\" class=\"resize-icon\" />\n </div>\n </ngs-draggable-table>\n </div>\n</div>\n", styles: [":host{display:block}:host.is-column-managing{cursor:col-resize;-webkit-user-select:none;user-select:none}:host.is-row-managing{cursor:row-resize;-webkit-user-select:none;user-select:none}:host .table-overflow{position:relative;padding-bottom:26px;overflow-y:hidden;overflow-x:auto;max-width:100%;width:var(--ngs-content-editor-builder-content-width, 704px)}:host .table-container{position:relative;width:max-content}:host table{width:auto
|
|
1649
|
+
}, template: "<div class=\"table-overflow\">\n <div class=\"table-container\">\n <ngs-draggable-table [disabled]=\"_resizeManging() || _columnManaging() || _rowManaging()\"\n (columnMoved)=\"onColumnMoved($event)\"\n (rowMoved)=\"onRowMoved($event)\"\n (moveStart)=\"onMoveStart()\"\n (moveEnd)=\"onMoveEnd()\">\n <table #table class=\"table\"\n ngsResizableTable\n [resizeEnabled]=\"!fullWidth()\"\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"onTableFocusChange($event)\"\n (columnWidthChangeStart)=\"onColumnWidthChangeStart()\"\n (columnWidthChangeEnd)=\"onColumnWidthChangeEnd()\"\n (columnWidthChange)=\"onColumnWidthChange($event)\">\n <colgroup>\n @for (cell of _content()[0]; track $index) {\n <col [style.width.px]=\"cell.options.width || null\">\n }\n </colgroup>\n <tbody>\n @for (row of _content(); track $index) {\n <tr>\n @for (cell of row; track $index) {\n <td\n [ngsContentEditorContentEditable]=\"cell.content\"\n [props]=\"cell.props\"\n (contentChanged)=\"onCellContentChanged(cell, $event)\"\n (propsChanged)=\"onCellPropsChanged(cell, $event)\"\n (blur)=\"clearCellsSelection()\"\n [rowSpan]=\"cell.options.rowspan\"\n [colSpan]=\"cell.options.colspan\"></td>\n }\n </tr>\n }\n </tbody>\n </table>\n <div class=\"resize-end\" ngsTableColumnsManager\n (columnManagingStart)=\"onColumnManagingStart()\"\n (columnManagingEnd)=\"onColumnManagingEnd()\"\n (columnAdded)=\"onColAdded()\"\n (columnDeleted)=\"onColDeleted()\">\n <ngs-icon name=\"fluent:add-24-regular\" class=\"resize-icon\" />\n </div>\n <div class=\"resize-bottom\" ngsTableRowsManager\n (rowManagingStart)=\"onRowManagingStart()\"\n (rowManagingEnd)=\"onRowManagingEnd()\"\n (rowAdded)=\"onRowAdded()\"\n (rowDeleted)=\"onRowDeleted()\">\n <ngs-icon name=\"fluent:add-24-regular\" class=\"resize-icon\" />\n </div>\n </ngs-draggable-table>\n </div>\n</div>\n", styles: [":host{display:block}:host.is-column-managing{cursor:col-resize;-webkit-user-select:none;user-select:none}:host.is-row-managing{cursor:row-resize;-webkit-user-select:none;user-select:none}:host .table-overflow{position:relative;padding-bottom:26px;overflow-y:hidden;overflow-x:auto;max-width:100%;width:var(--ngs-content-editor-builder-content-width, 704px)}:host .table-container{position:relative;width:max-content}:host table{width:auto;word-break:break-word;border-collapse:collapse;table-layout:fixed;border:1px solid var(--ngs-color-border);outline:none}:host table tr:not(:last-child){border-bottom:1px solid var(--ngs-color-border)}:host table td{min-width:120px;height:40px;padding:calc(var(--spacing, .25rem) * 2) calc(var(--spacing, .25rem) * 3);outline:none}:host table td:not(:last-child){border-right:1px solid var(--ngs-color-border)}:host table td.selected{background:var(--ngs-content-editor-selected-bg, var(--ngs-color-primary-container))}:host.is-full-width .table-overflow{width:auto;padding-inline-end:calc(var(--spacing, .25rem) * 5)}:host.is-full-width .table-container,:host.is-full-width table{width:100%}:host.is-full-width table col{width:auto!important}:host.is-full-width table td{min-width:0}:host .resize-end{position:absolute;width:calc(var(--spacing, .25rem) * 4);right:calc(calc(var(--spacing, .25rem) * 5) * -1);top:0;bottom:0;border-radius:var(--spacing, .25rem);background:var(--ngs-color-surface-container);display:flex;align-items:center;justify-content:center}:host .resize-end:hover{cursor:col-resize;background:var(--ngs-color-surface-container-high)}:host .resize-bottom{position:absolute;height:calc(var(--spacing, .25rem) * 4);bottom:calc(calc(var(--spacing, .25rem) * 5) * -1);left:0;right:0;border-radius:var(--spacing, .25rem);background:var(--ngs-color-surface-container);display:flex;align-items:center;justify-content:center}:host .resize-bottom:hover{cursor:row-resize;background:var(--ngs-color-surface-container-high)}:host .resize-icon{font-size:14px!important;height:14px!important;width:14px!important}:host.is-resizing{-webkit-user-select:none;user-select:none}:host table[ngsResizableTable] th.resizable-hover-handle:after,:host table[ngsResizableTable] td.resizable-hover-handle:after{opacity:1;visibility:visible}:host .table-resizing{cursor:col-resize!important;-webkit-user-select:none;user-select:none}:host .table-resizing+.resizable-table-handle{opacity:1;visibility:visible}:host .resizable-table-wrapper{position:relative}:host .resizable-table-handle{position:absolute;top:0;height:100%;background-color:var(--ngs-color-primary-400);cursor:col-resize;z-index:10;opacity:0;visibility:hidden;left:-9999px;transition:opacity .05s ease-in-out,visibility .05s ease-in-out}:host .resizable-table-handle.resize-handle--active{opacity:1;visibility:visible}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
1627
1650
|
}], ctorParameters: () => [], propDecorators: { _tableRef: [{ type: i0.ViewChild, args: ['table', { isSignal: true }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
|
|
1628
1651
|
|
|
1629
1652
|
export { TableBlockComponent };
|
|
1630
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-table-block.component-
|
|
1653
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-table-block.component-CfOtM5sz.mjs.map
|