@sd-angular/core 0.0.1041 → 0.0.1045
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/assets/scss/quill-mention/quill-mention.css +55 -0
- package/assets/scss/sd-core.scss +1 -0
- package/autocomplete/src/lib/autocomplete.component.d.ts +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.js +4 -1
- package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.min.js +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-chip.umd.js +1 -1
- package/bundles/sd-angular-core-chip.umd.min.js +1 -1
- package/bundles/sd-angular-core-chip.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-comment.umd.js +17 -16
- package/bundles/sd-angular-core-comment.umd.js.map +1 -1
- package/bundles/sd-angular-core-comment.umd.min.js +2 -2
- package/bundles/sd-angular-core-comment.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-editor.umd.js +73 -18
- package/bundles/sd-angular-core-editor.umd.js.map +1 -1
- package/bundles/sd-angular-core-editor.umd.min.js +2 -2
- package/bundles/sd-angular-core-editor.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-form.umd.js +6 -4
- package/bundles/sd-angular-core-form.umd.js.map +1 -1
- package/bundles/sd-angular-core-form.umd.min.js +1 -1
- package/bundles/sd-angular-core-form.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-modal-custom.umd.js +487 -0
- package/bundles/sd-angular-core-modal-custom.umd.js.map +1 -0
- package/bundles/sd-angular-core-modal-custom.umd.min.js +16 -0
- package/bundles/sd-angular-core-modal-custom.umd.min.js.map +1 -0
- package/bundles/sd-angular-core-modal-resizable.umd.js +487 -0
- package/bundles/sd-angular-core-modal-resizable.umd.js.map +1 -0
- package/bundles/sd-angular-core-modal-resizable.umd.min.js +16 -0
- package/bundles/sd-angular-core-modal-resizable.umd.min.js.map +1 -0
- package/bundles/sd-angular-core-setting.umd.js +1 -1
- package/bundles/sd-angular-core-setting.umd.js.map +1 -1
- package/bundles/sd-angular-core-setting.umd.min.js +1 -1
- package/bundles/sd-angular-core-setting.umd.min.js.map +1 -1
- package/bundles/sd-angular-core.umd.js +4 -4
- package/bundles/sd-angular-core.umd.min.js +1 -1
- package/bundles/sd-angular-core.umd.min.js.map +1 -1
- package/chip/sd-angular-core-chip.metadata.json +1 -1
- package/comment/sd-angular-core-comment.metadata.json +1 -1
- package/comment/src/lib/comment.model.d.ts +11 -0
- package/editor/sd-angular-core-editor.metadata.json +1 -1
- package/editor/src/lib/editor.component.d.ts +17 -3
- package/esm2015/autocomplete/src/lib/autocomplete.component.js +6 -3
- package/esm2015/chip/src/lib/chip.component.js +1 -1
- package/esm2015/comment/src/lib/comment.component.js +5 -5
- package/esm2015/comment/src/lib/comment.model.js +1 -1
- package/esm2015/comment/src/lib/comment.module.js +3 -1
- package/esm2015/editor/src/lib/editor.component.js +70 -14
- package/esm2015/editor/src/lib/editor.module.js +4 -2
- package/esm2015/form/src/lib/form.module.js +4 -1
- package/esm2015/modal-custom/index.js +2 -0
- package/esm2015/modal-custom/sd-angular-core-modal-custom.js +5 -0
- package/esm2015/modal-custom/src/lib/modal-custom/modal-custom.component.js +123 -0
- package/esm2015/modal-custom/src/lib/modal-custom.module.js +30 -0
- package/esm2015/modal-custom/src/public-api.js +6 -0
- package/esm2015/modal-resizable/index.js +2 -0
- package/esm2015/modal-resizable/sd-angular-core-modal-resizable.js +5 -0
- package/esm2015/modal-resizable/src/lib/modal-resizable/modal-resizable.component.js +123 -0
- package/esm2015/modal-resizable/src/lib/modal-resizable.module.js +30 -0
- package/esm2015/modal-resizable/src/public-api.js +6 -0
- package/esm2015/public-api.js +2 -1
- package/esm2015/setting/src/lib/setting.service.js +2 -2
- package/fesm2015/sd-angular-core-autocomplete.js +5 -2
- package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
- package/fesm2015/sd-angular-core-chip.js +1 -1
- package/fesm2015/sd-angular-core-comment.js +6 -4
- package/fesm2015/sd-angular-core-comment.js.map +1 -1
- package/fesm2015/sd-angular-core-editor.js +72 -15
- package/fesm2015/sd-angular-core-editor.js.map +1 -1
- package/fesm2015/sd-angular-core-form.js +3 -0
- package/fesm2015/sd-angular-core-form.js.map +1 -1
- package/fesm2015/sd-angular-core-modal-custom.js +161 -0
- package/fesm2015/sd-angular-core-modal-custom.js.map +1 -0
- package/fesm2015/sd-angular-core-modal-resizable.js +161 -0
- package/fesm2015/sd-angular-core-modal-resizable.js.map +1 -0
- package/fesm2015/sd-angular-core-setting.js +1 -1
- package/fesm2015/sd-angular-core-setting.js.map +1 -1
- package/fesm2015/sd-angular-core.js +1 -0
- package/fesm2015/sd-angular-core.js.map +1 -1
- package/form/sd-angular-core-form.metadata.json +1 -1
- package/modal-custom/index.d.ts +1 -0
- package/modal-custom/package.json +12 -0
- package/modal-custom/sd-angular-core-modal-custom.d.ts +4 -0
- package/modal-custom/sd-angular-core-modal-custom.metadata.json +1 -0
- package/modal-custom/src/lib/modal-custom/modal-custom.component.d.ts +31 -0
- package/modal-custom/src/lib/modal-custom.module.d.ts +2 -0
- package/modal-custom/src/public-api.d.ts +2 -0
- package/modal-resizable/index.d.ts +1 -0
- package/modal-resizable/package.json +12 -0
- package/modal-resizable/sd-angular-core-modal-resizable.d.ts +4 -0
- package/modal-resizable/sd-angular-core-modal-resizable.metadata.json +1 -0
- package/modal-resizable/src/lib/modal-resizable/modal-resizable.component.d.ts +31 -0
- package/modal-resizable/src/lib/modal-resizable.module.d.ts +2 -0
- package/modal-resizable/src/public-api.d.ts +2 -0
- package/package.json +3 -2
- package/public-api.d.ts +1 -0
- package/{sd-angular-core-0.0.1041.tgz → sd-angular-core-0.0.1045.tgz} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Directive, TemplateRef, EventEmitter, Component, ChangeDetectionStrategy, ChangeDetectorRef, ViewChild, Input, ContentChild, Output, NgModule } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
3
|
+
import { NgForm, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
5
|
import { MatInputModule } from '@angular/material/input';
|
|
6
6
|
import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
|
|
@@ -47,7 +47,7 @@ class SdAutocomplete {
|
|
|
47
47
|
_delay.set(this, 0); // Sau khoảng thời gian delay nếu không có thay đổi thì thì mới bắt đầu thực hiện gọi hàm
|
|
48
48
|
_name.set(this, v4());
|
|
49
49
|
this.loading = false;
|
|
50
|
-
this.inputControl = new
|
|
50
|
+
this.inputControl = new SdFormControl();
|
|
51
51
|
this.formControl = new SdFormControl();
|
|
52
52
|
this.matcher = new SdAutocompleteErrotStateMatcher(this.formControl);
|
|
53
53
|
_form.set(this, void 0);
|
|
@@ -196,6 +196,9 @@ class SdAutocomplete {
|
|
|
196
196
|
__classPrivateFieldGet(this, _subscription).add(this.formControl.touchedChanges.subscribe(() => {
|
|
197
197
|
this.ref.markForCheck();
|
|
198
198
|
}));
|
|
199
|
+
__classPrivateFieldGet(this, _subscription).add(this.inputControl.touchedChanges.subscribe(() => {
|
|
200
|
+
this.ref.markForCheck();
|
|
201
|
+
}));
|
|
199
202
|
this.filteredItems = combineLatest([
|
|
200
203
|
__classPrivateFieldGet(this, _itemsChanges).asObservable(),
|
|
201
204
|
this.inputControl.valueChanges.pipe(debounceTime(__classPrivateFieldGet(this, _delay)))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-autocomplete.js","sources":["../../../../projects/sd-core/autocomplete/src/lib/autocomplete-display-def.directive.ts","../../../../projects/sd-core/autocomplete/src/lib/autocomplete.component.ts","../../../../projects/sd-core/autocomplete/src/lib/autocomplete.module.ts","../../../../projects/sd-core/autocomplete/src/public-api.ts","../../../../projects/sd-core/autocomplete/sd-angular-core-autocomplete.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdAutocompleteDisplayDef]'\r\n})\r\nexport class SdAutocompleteDisplayDefDirective {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n OnInit,\r\n OnDestroy,\r\n AfterViewInit,\r\n ChangeDetectorRef,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n ElementRef\r\n} from '@angular/core';\r\nimport { startWith, switchMap, debounceTime, map, finalize } from 'rxjs/operators';\r\n\r\nimport * as uuid from 'uuid';\r\nimport { FormControl, NgForm, Validators, FormGroupDirective, FormGroup } from '@angular/forms';\r\nimport { BehaviorSubject, combineLatest, defer, from, Observable, of, Subscription } from 'rxjs';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nimport { SdAutocompleteDisplayDefDirective } from './autocomplete-display-def.directive';\r\nimport { MatAutocompleteTrigger } from '@angular/material/autocomplete';\r\nimport { SdFormControl, SdViewDefDirective } from '@sd-angular/core/common';\r\n\r\nclass SdAutocompleteErrotStateMatcher implements ErrorStateMatcher {\r\n constructor(private formControl: FormControl) { }\r\n isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {\r\n const isSubmitted = form && form.submitted;\r\n return !!(this.formControl?.invalid && (this.formControl?.dirty || this.formControl?.touched || isSubmitted));\r\n }\r\n}\r\n\r\n@Component({\r\n selector: 'sd-autocomplete',\r\n templateUrl: './autocomplete.component.html',\r\n styleUrls: ['./autocomplete.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdAutocomplete implements OnInit, OnDestroy, AfterViewInit {\r\n @ViewChild(MatAutocompleteTrigger, { read: MatAutocompleteTrigger }) autocompleteTrigger: MatAutocompleteTrigger;\r\n id = `I${uuid.v4()}`;\r\n #model: string | number;\r\n\r\n #delay = 0; // Sau khoảng thời gian delay nếu không có thay đổi thì thì mới bắt đầu thực hiện gọi hàm\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n loading = false;\r\n inputControl = new FormControl();\r\n formControl = new SdFormControl();\r\n matcher = new SdAutocompleteErrotStateMatcher(this.formControl);\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() valueField: string;\r\n @Input() displayField: string;\r\n @Input() placeholder: string;\r\n\r\n #itemsChanges = new BehaviorSubject<any[] | SearchFunc>([]);\r\n @Input() set items(items: undefined | any[] | SearchFunc) {\r\n if (!items) {\r\n this.#itemsChanges.next([]);\r\n } else if (Array.isArray(items)) {\r\n this.#itemsChanges.next(items.filter(e => e !== null && e !== undefined));\r\n } else {\r\n this.#itemsChanges.next(items);\r\n this.#delay = 500;\r\n }\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n @Input() limit = 100;\r\n\r\n filteredItems: Observable<any[]>;\r\n controlPlaceHolder: Observable<string | number>;\r\n controlPlaceHolder2: Observable<string | number>;\r\n @Input() set model(value: undefined | number | string) {\r\n this.#model = value;\r\n this.formControl.setValue(value);\r\n }\r\n\r\n @ContentChild(SdAutocompleteDisplayDefDirective) autocompleteDisplayDef: SdAutocompleteDisplayDefDirective;\r\n @Input() actionIcon: string;\r\n @Output() action = new EventEmitter();\r\n @Output() modelChange = new EventEmitter();\r\n @Output() sdChange = new EventEmitter();\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.inputControl.disable();\r\n this.formControl.disable();\r\n } else {\r\n this.inputControl.enable();\r\n this.formControl.disable();\r\n }\r\n }\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n if (this.isRequired) {\r\n this.formControl.setValidators([Validators.required]);\r\n } else {\r\n this.formControl.clearValidators();\r\n }\r\n }\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n #subscription = new Subscription();\r\n @ViewChild('input') input: ElementRef;\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n selected: Observable<any>;\r\n\r\n #cache: {\r\n [key: string]: any[]\r\n } = {};\r\n #item: {\r\n [key: string]: any\r\n } = {};\r\n constructor(\r\n private ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.filteredItems = combineLatest([\r\n this.#itemsChanges.asObservable(),\r\n this.inputControl.valueChanges.pipe(debounceTime(this.#delay))]).pipe(\r\n switchMap(([items, searchText]) => {\r\n searchText = searchText || '';\r\n if (typeof (items) === 'function') {\r\n if (this.#cache[searchText] !== undefined) {\r\n return this.#cache[searchText].asObservable();\r\n }\r\n let obs: Observable<any[]>;\r\n const func = items(searchText, true);\r\n if (func instanceof Promise) {\r\n obs = defer(() => from(func));\r\n } else {\r\n obs = func\r\n }\r\n this.loading = true;\r\n return obs.pipe(map(data => {\r\n this.#cache[searchText] = data || [];\r\n Object.assign(this.#item, Array.toObject(this.#cache[searchText], this.valueField));\r\n return this.#cache[searchText];\r\n }), finalize(() => this.loading = false));\r\n }\r\n return items\r\n .search(searchText, [this.valueField, this.displayField])\r\n .paging(this.limit)\r\n .asObservable();\r\n })\r\n );\r\n this.selected = combineLatest([\r\n this.#itemsChanges.asObservable(),\r\n this.formControl.valueChanges.pipe(startWith(this.formControl.value))])\r\n .pipe(\r\n switchMap(([items, val]) => {\r\n if (!this.valueField) {\r\n return of(val);\r\n }\r\n if (val || val === 0) {\r\n if (typeof (items) === 'function') {\r\n if (this.#item[val]) {\r\n return of(this.#item[val]);\r\n }\r\n let obs: Observable<any[]>;\r\n const func = items(val, true);\r\n if (func instanceof Promise) {\r\n obs = defer(() => from(func));\r\n } else {\r\n obs = func\r\n }\r\n return obs.pipe(map(data => {\r\n Object.assign(this.#item, Array.toObject(data, this.valueField));\r\n return this.#item[val] || {\r\n [this.valueField]: val,\r\n [this.displayField]: val\r\n };\r\n }));\r\n }\r\n return of(items.find(e => e[this.valueField] === val));\r\n }\r\n return of('');\r\n })\r\n );\r\n this.controlPlaceHolder = this.selected.pipe(map(item => item?.[this.displayField] ?? item ?? this.placeholder ?? this.label ?? ''));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#subscription.unsubscribe();\r\n this.#form?.removeControl(this.#name);\r\n }\r\n onSelect = (item: any) => {\r\n if (item) {\r\n if (typeof (item) === 'string' || typeof (item) === 'number') {\r\n if (this.formControl.value !== item) {\r\n this.formControl.setValue(item);\r\n this.modelChange.emit(item);\r\n this.sdChange.emit(item);\r\n }\r\n } else if (this.valueField && this.displayField) {\r\n const val = item?.[this.valueField] || null;\r\n if (this.formControl.value !== val) {\r\n this.formControl.setValue(val);\r\n this.modelChange.emit(val);\r\n this.sdChange.emit(item);\r\n }\r\n }\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.inputControl.setValue('');\r\n // this.inputControl.updateValueAndValidity();\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.input?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.autocompleteTrigger?.openPanel();\r\n this.input?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n clear = ($event?: any) => {\r\n $event?.stopPropagation();\r\n this.inputControl?.setValue('');\r\n if (this.#model) {\r\n this.formControl.setValue(null);\r\n this.modelChange.emit(null);\r\n this.sdChange.emit(null);\r\n }\r\n }\r\n\r\n onAction = ($event: Event) => {\r\n $event?.stopPropagation();\r\n this.autocompleteTrigger?.closePanel();\r\n this.action.emit();\r\n }\r\n\r\n reValidate = () => {\r\n this.inputControl.updateValueAndValidity({ emitEvent: true });\r\n }\r\n}\r\n\r\ntype SearchFunc = (searchText?: string | number, isFormValue?: boolean) => Promise<any[]> | Observable<any[]>;","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { SdAutocomplete } from './autocomplete.component';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdAutocompleteDisplayDefDirective } from './autocomplete-display-def.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatAutocompleteModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n SdTranslateModule,\r\n SdCommonModule\r\n ],\r\n declarations: [\r\n SdAutocomplete,\r\n SdAutocompleteDisplayDefDirective\r\n ],\r\n exports: [\r\n SdAutocomplete,\r\n SdAutocompleteDisplayDefDirective,\r\n SdCommonModule\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdAutocompleteModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/autocomplete.module';\r\nexport * from './lib/autocomplete.component';\r\nexport * from './lib/autocomplete-display-def.directive';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;MAKa,iCAAiC;IAC5C,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,4BAA4B;aACvC;;;YAJmB,WAAW;;;;ACwB/B,MAAM,+BAA+B;IACnC,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;KAAK;IACjD,YAAY,CAAC,OAA2B,EAAE,IAAwC;;QAChF,MAAM,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC;QAC3C,OAAO,CAAC,EAAE,OAAA,IAAI,CAAC,WAAW,0CAAE,OAAO,MAAK,OAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,YAAI,IAAI,CAAC,WAAW,0CAAE,OAAO,CAAA,IAAI,WAAW,CAAC,CAAC,CAAC;KAC/G;CACF;MAQY,cAAc;IAkGzB,YACU,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QAjGhC,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,yBAAwB;QAExB,iBAAS,CAAC,EAAC;QACX,gBAAQA,EAAO,EAAE,EAAC;QAMlB,YAAO,GAAG,KAAK,CAAC;QAChB,iBAAY,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,gBAAW,GAAG,IAAI,aAAa,EAAE,CAAC;QAClC,YAAO,GAAG,IAAI,+BAA+B,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEhE,wBAAiB;QAejB,wBAAgB,IAAI,eAAe,CAAqB,EAAE,CAAC,EAAC;QAanD,UAAK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;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-autocomplete.js","sources":["../../../../projects/sd-core/autocomplete/src/lib/autocomplete-display-def.directive.ts","../../../../projects/sd-core/autocomplete/src/lib/autocomplete.component.ts","../../../../projects/sd-core/autocomplete/src/lib/autocomplete.module.ts","../../../../projects/sd-core/autocomplete/src/public-api.ts","../../../../projects/sd-core/autocomplete/sd-angular-core-autocomplete.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdAutocompleteDisplayDef]'\r\n})\r\nexport class SdAutocompleteDisplayDefDirective {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n OnInit,\r\n OnDestroy,\r\n AfterViewInit,\r\n ChangeDetectorRef,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n ElementRef\r\n} from '@angular/core';\r\nimport { startWith, switchMap, debounceTime, map, finalize } from 'rxjs/operators';\r\n\r\nimport * as uuid from 'uuid';\r\nimport { FormControl, NgForm, Validators, FormGroupDirective, FormGroup } from '@angular/forms';\r\nimport { BehaviorSubject, combineLatest, defer, from, Observable, of, Subscription } from 'rxjs';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nimport { SdAutocompleteDisplayDefDirective } from './autocomplete-display-def.directive';\r\nimport { MatAutocompleteTrigger } from '@angular/material/autocomplete';\r\nimport { SdFormControl, SdViewDefDirective } from '@sd-angular/core/common';\r\n\r\nclass SdAutocompleteErrotStateMatcher implements ErrorStateMatcher {\r\n constructor(private formControl: FormControl) { }\r\n isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {\r\n const isSubmitted = form && form.submitted;\r\n return !!(this.formControl?.invalid && (this.formControl?.dirty || this.formControl?.touched || isSubmitted));\r\n }\r\n}\r\n\r\n@Component({\r\n selector: 'sd-autocomplete',\r\n templateUrl: './autocomplete.component.html',\r\n styleUrls: ['./autocomplete.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdAutocomplete implements OnInit, OnDestroy, AfterViewInit {\r\n @ViewChild(MatAutocompleteTrigger, { read: MatAutocompleteTrigger }) autocompleteTrigger: MatAutocompleteTrigger;\r\n id = `I${uuid.v4()}`;\r\n #model: string | number;\r\n\r\n #delay = 0; // Sau khoảng thời gian delay nếu không có thay đổi thì thì mới bắt đầu thực hiện gọi hàm\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n loading = false;\r\n inputControl = new SdFormControl();\r\n formControl = new SdFormControl();\r\n matcher = new SdAutocompleteErrotStateMatcher(this.formControl);\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() valueField: string;\r\n @Input() displayField: string;\r\n @Input() placeholder: string;\r\n\r\n #itemsChanges = new BehaviorSubject<any[] | SearchFunc>([]);\r\n @Input() set items(items: undefined | any[] | SearchFunc) {\r\n if (!items) {\r\n this.#itemsChanges.next([]);\r\n } else if (Array.isArray(items)) {\r\n this.#itemsChanges.next(items.filter(e => e !== null && e !== undefined));\r\n } else {\r\n this.#itemsChanges.next(items);\r\n this.#delay = 500;\r\n }\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n @Input() limit = 100;\r\n\r\n filteredItems: Observable<any[]>;\r\n controlPlaceHolder: Observable<string | number>;\r\n controlPlaceHolder2: Observable<string | number>;\r\n @Input() set model(value: undefined | number | string) {\r\n this.#model = value;\r\n this.formControl.setValue(value);\r\n }\r\n\r\n @ContentChild(SdAutocompleteDisplayDefDirective) autocompleteDisplayDef: SdAutocompleteDisplayDefDirective;\r\n @Input() actionIcon: string;\r\n @Output() action = new EventEmitter();\r\n @Output() modelChange = new EventEmitter();\r\n @Output() sdChange = new EventEmitter();\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.inputControl.disable();\r\n this.formControl.disable();\r\n } else {\r\n this.inputControl.enable();\r\n this.formControl.disable();\r\n }\r\n }\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n if (this.isRequired) {\r\n this.formControl.setValidators([Validators.required]);\r\n } else {\r\n this.formControl.clearValidators();\r\n }\r\n }\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n #subscription = new Subscription();\r\n @ViewChild('input') input: ElementRef;\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n selected: Observable<any>;\r\n\r\n #cache: {\r\n [key: string]: any[]\r\n } = {};\r\n #item: {\r\n [key: string]: any\r\n } = {};\r\n constructor(\r\n private ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.#subscription.add(this.inputControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.filteredItems = combineLatest([\r\n this.#itemsChanges.asObservable(),\r\n this.inputControl.valueChanges.pipe(debounceTime(this.#delay))]).pipe(\r\n switchMap(([items, searchText]) => {\r\n searchText = searchText || '';\r\n if (typeof (items) === 'function') {\r\n if (this.#cache[searchText] !== undefined) {\r\n return this.#cache[searchText].asObservable();\r\n }\r\n let obs: Observable<any[]>;\r\n const func = items(searchText, true);\r\n if (func instanceof Promise) {\r\n obs = defer(() => from(func));\r\n } else {\r\n obs = func\r\n }\r\n this.loading = true;\r\n return obs.pipe(map(data => {\r\n this.#cache[searchText] = data || [];\r\n Object.assign(this.#item, Array.toObject(this.#cache[searchText], this.valueField));\r\n return this.#cache[searchText];\r\n }), finalize(() => this.loading = false));\r\n }\r\n return items\r\n .search(searchText, [this.valueField, this.displayField])\r\n .paging(this.limit)\r\n .asObservable();\r\n })\r\n );\r\n this.selected = combineLatest([\r\n this.#itemsChanges.asObservable(),\r\n this.formControl.valueChanges.pipe(startWith(this.formControl.value))])\r\n .pipe(\r\n switchMap(([items, val]) => {\r\n if (!this.valueField) {\r\n return of(val);\r\n }\r\n if (val || val === 0) {\r\n if (typeof (items) === 'function') {\r\n if (this.#item[val]) {\r\n return of(this.#item[val]);\r\n }\r\n let obs: Observable<any[]>;\r\n const func = items(val, true);\r\n if (func instanceof Promise) {\r\n obs = defer(() => from(func));\r\n } else {\r\n obs = func\r\n }\r\n return obs.pipe(map(data => {\r\n Object.assign(this.#item, Array.toObject(data, this.valueField));\r\n return this.#item[val] || {\r\n [this.valueField]: val,\r\n [this.displayField]: val\r\n };\r\n }));\r\n }\r\n return of(items.find(e => e[this.valueField] === val));\r\n }\r\n return of('');\r\n })\r\n );\r\n this.controlPlaceHolder = this.selected.pipe(map(item => item?.[this.displayField] ?? item ?? this.placeholder ?? this.label ?? ''));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#subscription.unsubscribe();\r\n this.#form?.removeControl(this.#name);\r\n }\r\n onSelect = (item: any) => {\r\n if (item) {\r\n if (typeof (item) === 'string' || typeof (item) === 'number') {\r\n if (this.formControl.value !== item) {\r\n this.formControl.setValue(item);\r\n this.modelChange.emit(item);\r\n this.sdChange.emit(item);\r\n }\r\n } else if (this.valueField && this.displayField) {\r\n const val = item?.[this.valueField] || null;\r\n if (this.formControl.value !== val) {\r\n this.formControl.setValue(val);\r\n this.modelChange.emit(val);\r\n this.sdChange.emit(item);\r\n }\r\n }\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.inputControl.setValue('');\r\n // this.inputControl.updateValueAndValidity();\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.input?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.autocompleteTrigger?.openPanel();\r\n this.input?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n clear = ($event?: any) => {\r\n $event?.stopPropagation();\r\n this.inputControl?.setValue('');\r\n if (this.#model) {\r\n this.formControl.setValue(null);\r\n this.modelChange.emit(null);\r\n this.sdChange.emit(null);\r\n }\r\n }\r\n\r\n onAction = ($event: Event) => {\r\n $event?.stopPropagation();\r\n this.autocompleteTrigger?.closePanel();\r\n this.action.emit();\r\n }\r\n\r\n reValidate = () => {\r\n this.inputControl.updateValueAndValidity({ emitEvent: true });\r\n }\r\n}\r\n\r\ntype SearchFunc = (searchText?: string | number, isFormValue?: boolean) => Promise<any[]> | Observable<any[]>;","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { SdAutocomplete } from './autocomplete.component';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdAutocompleteDisplayDefDirective } from './autocomplete-display-def.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatAutocompleteModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n SdTranslateModule,\r\n SdCommonModule\r\n ],\r\n declarations: [\r\n SdAutocomplete,\r\n SdAutocompleteDisplayDefDirective\r\n ],\r\n exports: [\r\n SdAutocomplete,\r\n SdAutocompleteDisplayDefDirective,\r\n SdCommonModule\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdAutocompleteModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/autocomplete.module';\r\nexport * from './lib/autocomplete.component';\r\nexport * from './lib/autocomplete-display-def.directive';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;MAKa,iCAAiC;IAC5C,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,4BAA4B;aACvC;;;YAJmB,WAAW;;;;ACwB/B,MAAM,+BAA+B;IACnC,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;KAAK;IACjD,YAAY,CAAC,OAA2B,EAAE,IAAwC;;QAChF,MAAM,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC;QAC3C,OAAO,CAAC,EAAE,OAAA,IAAI,CAAC,WAAW,0CAAE,OAAO,MAAK,OAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,YAAI,IAAI,CAAC,WAAW,0CAAE,OAAO,CAAA,IAAI,WAAW,CAAC,CAAC,CAAC;KAC/G;CACF;MAQY,cAAc;IAkGzB,YACU,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QAjGhC,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,yBAAw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;mCASL,KAAK,SAAC,qBAAqB;oBAK3B,SAAS,SAAC,OAAO;qBACjB,YAAY,SAAC,kBAAkB;;;MCtFrB,oBAAoB;;;YA1BhC,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,cAAc;oBACd,gBAAgB;oBAChB,kBAAkB;oBAClB,qBAAqB;oBACrB,aAAa;oBACb,wBAAwB;oBACxB,iBAAiB;oBACjB,cAAc;iBACf;gBACD,YAAY,EAAE;oBACZ,cAAc;oBACd,iCAAiC;iBAClC;gBACD,OAAO,EAAE;oBACP,cAAc;oBACd,iCAAiC;oBACjC,cAAc;iBACf;gBACD,SAAS,EAAE,EACV;aACF;;;ACvCD;;;;ACAA;;;;;;"}
|
|
@@ -296,7 +296,7 @@ SdChip.decorators = [
|
|
|
296
296
|
{ type: Component, args: [{
|
|
297
297
|
selector: 'sd-chip',
|
|
298
298
|
template: "<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !autocompleteTrigger?.panelOpen && !isFocused; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"c-md\" [ngClass]=\"{'c-sm': size === 'sm'}\" appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-chip-list [formControl]=\"formControl\" #chipList>\r\n <ng-container *ngFor=\"let item of selectedItems\">\r\n <mat-chip *ngIf=\"item\" [selectable]=\"selectable\" [removable]=\"true\" (removed)=\"onRemove(item)\"\r\n [selected]=\"item.isSelected\" (selectionChange)=\"select(item)\" [disabled]=\"inputControl.disabled\"\r\n (click)=\"item.isSelected = !item.isSelected\">\r\n <ng-container *ngIf=\"sdChipDisplay?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdChipDisplay.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <span *ngIf=\"!sdChipDisplay?.templateRef\">{{item[displayField] || item[valueField]}}</span>\r\n <mat-icon *ngIf=\"!inputControl.disabled && item | sdRemovableChip:removable\" matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n </ng-container>\r\n <input #autocompleteTrigger [formControl]=\"inputControl\" [placeholder]=\"placeholder || label\"\r\n [matAutocomplete]=\"auto\" [matChipInputFor]=\"chipList\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\" autocomplete=\"off\" [errorStateMatcher]=\"matcher\" (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\" matInput #input>\r\n </mat-chip-list>\r\n <mat-error *ngIf=\"formControl?.errors?.minItem\">\r\n {{formControl?.errors?.minItem}}\r\n </mat-error>\r\n <mat-autocomplete #auto=\"matAutocomplete\" [displayWith]=\"displayFn\" (optionSelected)=\"onSelect($event)\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item\">\r\n {{item[displayField]}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>",
|
|
299
|
-
styles: [":host{display:block;padding-top:5px}:host ::ng-deep mat-form-field.c-md .mat-form-field-infix{min-height:43.5px;padding:2px 0}:host ::ng-deep mat-form-field.c-md .mat-standard-chip{min-height:26px;padding:7px 10px}:host ::ng-deep mat-form-field.c-md .mat-standard-chip.mat-chip-with-trailing-icon{padding:7px 7px 7px 10px}"]
|
|
299
|
+
styles: [":host{display:block;padding-top:5px}:host ::ng-deep mat-form-field.c-md .mat-form-field-infix{min-height:43.5px;padding:2px 0}:host ::ng-deep mat-form-field.c-md .mat-standard-chip{min-height:26px;padding:7px 10px}:host ::ng-deep mat-form-field.c-md .mat-standard-chip.mat-chip-with-trailing-icon{padding:7px 7px 7px 10px}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}"]
|
|
300
300
|
},] }
|
|
301
301
|
];
|
|
302
302
|
SdChip.ctorParameters = () => [
|
|
@@ -11,6 +11,7 @@ import { SdButtonModule } from '@sd-angular/core/button';
|
|
|
11
11
|
import { SdInputModule } from '@sd-angular/core/input';
|
|
12
12
|
import { SdUtilityModule } from '@sd-angular/core/utility';
|
|
13
13
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
14
|
+
import { SdEditorModule } from '@sd-angular/core/editor';
|
|
14
15
|
|
|
15
16
|
var _items, _send, _load;
|
|
16
17
|
class SdComment {
|
|
@@ -18,11 +19,11 @@ class SdComment {
|
|
|
18
19
|
_items.set(this, new BehaviorSubject([]));
|
|
19
20
|
_send.set(this, new BehaviorSubject(''));
|
|
20
21
|
this.onSend = () => {
|
|
21
|
-
var _a, _b;
|
|
22
|
+
var _a, _b, _c;
|
|
22
23
|
if (this.message) {
|
|
23
24
|
(_b = (_a = this.commentOption) === null || _a === void 0 ? void 0 : _a.event) === null || _b === void 0 ? void 0 : _b.onSend(this.message);
|
|
24
25
|
this.message = null;
|
|
25
|
-
this.textarea.focus();
|
|
26
|
+
(_c = this.textarea) === null || _c === void 0 ? void 0 : _c.focus();
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
_load.set(this, () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -60,9 +61,9 @@ _items = new WeakMap(), _send = new WeakMap(), _load = new WeakMap();
|
|
|
60
61
|
SdComment.decorators = [
|
|
61
62
|
{ type: Component, args: [{
|
|
62
63
|
selector: 'sd-comment',
|
|
63
|
-
template: "<div class=\"c-container\">\r\n <div class=\"c-header\">\r\n <div class=\"c-title\">{{'Comments' | sdTranslate}} <a href=\"javascript:;\">({{count | async}})</a></div>\r\n </div>\r\n <div class=\"c-body\">\r\n <ng-container *ngFor=\"let item of items | async\">\r\n <div class=\"d-flex my-8\">\r\n <div class=\"c-avatar mr-12\">\r\n <img height=\"32\" width=\"32px\" [src]=\"item.picture\">\r\n </div>\r\n <div class=\"c-comment\">\r\n <div class=\"c-info mb-4\">\r\n {{'By' | sdTranslate}}\r\n <span class=\"c-creator ml-2\">\r\n {{item.creator}}\r\n </span>\r\n <ng-container *ngIf=\"item.createdDate\">\r\n <span class=\"mx-4\">\u2022</span>\r\n <span
|
|
64
|
+
template: "<div class=\"c-container\">\r\n <div class=\"c-header\">\r\n <div class=\"c-title\">{{'Comments' | sdTranslate}} <a href=\"javascript:;\">({{count | async}})</a></div>\r\n </div>\r\n <div class=\"c-body\">\r\n <ng-container *ngFor=\"let item of items | async\">\r\n <div class=\"d-flex my-8\">\r\n <div class=\"c-avatar mr-12\">\r\n <img height=\"32\" width=\"32px\" [src]=\"item.picture\">\r\n </div>\r\n <div class=\"c-comment\">\r\n <div class=\"c-info mb-4\">\r\n {{'By' | sdTranslate}}\r\n <span class=\"c-creator ml-2\">\r\n {{item.creator}}\r\n </span>\r\n <ng-container *ngIf=\"item.createdDate\">\r\n <span class=\"mx-4\">\u2022</span>\r\n <span\r\n [matTooltip]=\"item.createdDate | date:'dd/MM/yyyy HH:mm'\">{{item.createdDate | sdTimeDifferent:'dd/MM/yyyy HH:mm':'hour' | async}}</span>\r\n </ng-container>\r\n </div>\r\n <div class=\"c-content\" [innerHtml]=\"item.content\">\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"c-footer p-16\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <ng-container *ngIf=\"commentOption?.editor?.enabled else noUseEditor\">\r\n <div class=\"mb-8\">\r\n <sd-editor [(model)]=\"message\" [styles]=\"commentOption?.editor?.styles\"\r\n [toolbar]=\"commentOption?.editor?.toolbar\"\r\n [urlUploadImage]=\"commentOption?.editor?.urlUploadImage\"\r\n [mentionValues]=\"commentOption?.editor?.mentionValues\"></sd-editor>\r\n </div>\r\n </ng-container>\r\n <ng-template #noUseEditor>\r\n <sd-textarea [(model)]=\"message\" rows=\"1\" autoHeight></sd-textarea>\r\n </ng-template>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <sd-button class=\"float-right\" title=\"G\u1EEDi\" (action)=\"onSend()\" [disabled]=\"!message\" color=\"primary\" type=\"fill\"\r\n size=\"sm\">\r\n </sd-button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n",
|
|
64
65
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
65
|
-
styles: [".c-container{display:flex;flex-direction:column;height:100%}.c-container .c-header{align-items:center;background-color:#fff;display:flex;height:40px;padding:0 16px}.c-container .c-header .c-title{font-weight:500}.c-container .c-body{background:#f8f9fa;flex:1;overflow-y:hidden;padding:16px}.c-container .c-body:hover{overflow-y:auto}.c-container .c-body .c-comment{background:#fff;border:1px solid #f2f2f2;border-radius:4px;padding:12px 16px}.c-container .c-body .c-comment .c-info{color:#757575}.c-container .c-body .c-comment .c-info .c-creator{color:#000;font-weight:500}.c-container .c-footer{background:#fff;min-height:120px}"]
|
|
66
|
+
styles: [".c-container{display:flex;flex-direction:column;height:100%}.c-container .c-header{align-items:center;background-color:#fff;display:flex;height:40px;padding:0 16px}.c-container .c-header .c-title{font-weight:500}.c-container .c-body{background:#f8f9fa;flex:1;overflow-y:hidden;padding:16px}.c-container .c-body:hover{overflow-y:auto}.c-container .c-body .c-comment{background:#fff;border:1px solid #f2f2f2;border-radius:4px;flex:1;overflow-wrap:break-word;padding:12px 16px;white-space:pre-wrap;word-break:break-all}.c-container .c-body .c-comment .c-info{color:#757575}.c-container .c-body .c-comment .c-info .c-creator{color:#000;font-weight:500}.c-container .c-footer{background:#fff;min-height:120px}"]
|
|
66
67
|
},] }
|
|
67
68
|
];
|
|
68
69
|
SdComment.ctorParameters = () => [];
|
|
@@ -84,6 +85,7 @@ SdCommentModule.decorators = [
|
|
|
84
85
|
SdButtonModule,
|
|
85
86
|
SdInputModule,
|
|
86
87
|
SdTextareaModule,
|
|
88
|
+
SdEditorModule,
|
|
87
89
|
SdUtilityModule,
|
|
88
90
|
SdTranslateModule
|
|
89
91
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-comment.js","sources":["../../../../projects/sd-core/comment/src/lib/comment.component.ts","../../../../projects/sd-core/comment/src/lib/comment.module.ts","../../../../projects/sd-core/comment/src/public-api.ts","../../../../projects/sd-core/comment/sd-angular-core-comment.ts"],"sourcesContent":["import {\r\n Component,\r\n AfterViewInit,\r\n OnInit,\r\n OnDestroy,\r\n Input,\r\n ChangeDetectionStrategy,\r\n ViewChild\r\n} from '@angular/core';\r\nimport { SdTextarea } from '@sd-angular/core/textarea';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\nimport { map, switchMap } from 'rxjs/operators';\r\nimport { Comment, SdCommentOption } from './comment.model';\r\n@Component({\r\n selector: 'sd-comment',\r\n templateUrl: './comment.component.html',\r\n styleUrls: ['./comment.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdComment implements OnInit, AfterViewInit, OnDestroy {\r\n @ViewChild(SdTextarea) textarea: SdTextarea;\r\n #items = new BehaviorSubject<Comment[]>([]);\r\n #send = new BehaviorSubject<string>('');\r\n commentOption: SdCommentOption;\r\n @Input() set option(option: SdCommentOption) {\r\n this.commentOption = option;\r\n this.reload();\r\n };\r\n\r\n items: Observable<Comment[]>;\r\n count: Observable<number>;\r\n message: string;\r\n constructor() {\r\n }\r\n ngOnInit(): void {\r\n this.items = this.#items.pipe(map(items => {\r\n return items.map(e => ({\r\n ...e,\r\n picture: e.picture ?? `https://ui-avatars.com/api/?size=32&rounded=true&background=random&name=${e.creator}`\r\n }))\r\n }));\r\n this.count = this.items.pipe(map(items => items.length));\r\n }\r\n ngOnDestroy(): void {\r\n }\r\n ngAfterViewInit(): void {\r\n }\r\n\r\n onSend = () => {\r\n if (this.message) {\r\n this.commentOption?.event?.onSend(this.message);\r\n this.message = null;\r\n this.textarea
|
|
1
|
+
{"version":3,"file":"sd-angular-core-comment.js","sources":["../../../../projects/sd-core/comment/src/lib/comment.component.ts","../../../../projects/sd-core/comment/src/lib/comment.module.ts","../../../../projects/sd-core/comment/src/public-api.ts","../../../../projects/sd-core/comment/sd-angular-core-comment.ts"],"sourcesContent":["import {\r\n Component,\r\n AfterViewInit,\r\n OnInit,\r\n OnDestroy,\r\n Input,\r\n ChangeDetectionStrategy,\r\n ViewChild\r\n} from '@angular/core';\r\nimport { SdTextarea } from '@sd-angular/core/textarea';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\nimport { map, switchMap } from 'rxjs/operators';\r\nimport { Comment, SdCommentOption } from './comment.model';\r\n\r\n@Component({\r\n selector: 'sd-comment',\r\n templateUrl: './comment.component.html',\r\n styleUrls: ['./comment.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdComment implements OnInit, AfterViewInit, OnDestroy {\r\n @ViewChild(SdTextarea) textarea: SdTextarea;\r\n #items = new BehaviorSubject<Comment[]>([]);\r\n #send = new BehaviorSubject<string>('');\r\n commentOption: SdCommentOption;\r\n @Input() set option(option: SdCommentOption) {\r\n this.commentOption = option;\r\n this.reload();\r\n };\r\n\r\n items: Observable<Comment[]>;\r\n count: Observable<number>;\r\n message: string;\r\n constructor() {\r\n }\r\n ngOnInit(): void {\r\n this.items = this.#items.pipe(map(items => {\r\n return items.map(e => ({\r\n ...e,\r\n picture: e.picture ?? `https://ui-avatars.com/api/?size=32&rounded=true&background=random&name=${e.creator}`\r\n }))\r\n }));\r\n this.count = this.items.pipe(map(items => items.length));\r\n }\r\n ngOnDestroy(): void {\r\n }\r\n ngAfterViewInit(): void {\r\n }\r\n\r\n onSend = () => {\r\n if (this.message) {\r\n this.commentOption?.event?.onSend(this.message);\r\n this.message = null;\r\n this.textarea?.focus();\r\n }\r\n }\r\n\r\n #load = async () => {\r\n const { items } = this.commentOption;\r\n const results = items();\r\n if (results instanceof Promise) {\r\n return await results;\r\n }\r\n return results;\r\n }\r\n\r\n reload = async () => {\r\n this.#items.next(await this.#load());\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdComment } from './comment.component';\r\nimport { SdButtonModule } from '@sd-angular/core/button';\r\nimport { SdInputModule } from '@sd-angular/core/input';\r\nimport { SdTextareaModule } from '@sd-angular/core/textarea';\r\nimport { SdUtilityModule } from '@sd-angular/core/utility';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport {SdEditorModule} from '@sd-angular/core/editor';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n MatButtonModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdButtonModule,\r\n SdInputModule,\r\n SdTextareaModule,\r\n SdEditorModule,\r\n SdUtilityModule,\r\n SdTranslateModule\r\n ],\r\n declarations: [\r\n SdComment\r\n ],\r\n exports: [\r\n SdComment\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdCommentModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/comment.module';\r\nexport * from './lib/comment.model';\r\nexport * from './lib/comment.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;MAoBa,SAAS;IAapB;QAXA,iBAAS,IAAI,eAAe,CAAY,EAAE,CAAC,EAAC;QAC5C,gBAAQ,IAAI,eAAe,CAAS,EAAE,CAAC,EAAC;QA0BxC,WAAM,GAAG;;YACP,IAAI,IAAI,CAAC,OAAO,EAAE;gBAChB,YAAA,IAAI,CAAC,aAAa,0CAAE,KAAK,0CAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE;gBAChD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;gBACpB,MAAA,IAAI,CAAC,QA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ACb,gBAAgB;oBAChB,cAAc;oBACd,eAAe;oBACf,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,SAAS;iBACV;gBACD,OAAO,EAAE;oBACP,SAAS;iBACV;gBACD,SAAS,EAAE,EACV;aACF;;;ACnCD;;;;ACAA;;;;;;"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { EventEmitter, Component, ChangeDetectorRef, ViewChild, Input, Output, NgModule } from '@angular/core';
|
|
2
2
|
import { QuillModule } from 'ngx-quill';
|
|
3
3
|
import { FormControl, Validators, NgForm, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import {
|
|
4
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
|
|
5
5
|
import { v4 } from 'uuid';
|
|
6
6
|
import { Subscription } from 'rxjs';
|
|
7
|
+
import { SdApiService, SdApiModule } from '@sd-angular/core/api';
|
|
8
|
+
import 'quill-mention';
|
|
7
9
|
import { CommonModule } from '@angular/common';
|
|
8
10
|
import { SdTranslateModule } from '@sd-angular/core/translate';
|
|
9
11
|
import { SdButtonModule } from '@sd-angular/core/button';
|
|
@@ -114,10 +116,11 @@ const PROMOTION_FORM = {
|
|
|
114
116
|
}
|
|
115
117
|
};
|
|
116
118
|
|
|
117
|
-
var _name, _subscription, _model, _form, _updateValidator;
|
|
119
|
+
var _name, _subscription, _model, _form, _updateValidator, _uploadImage;
|
|
118
120
|
class SdEditor {
|
|
119
|
-
constructor(ref) {
|
|
121
|
+
constructor(ref, sdApiService) {
|
|
120
122
|
this.ref = ref;
|
|
123
|
+
this.sdApiService = sdApiService;
|
|
121
124
|
_name.set(this, `N${v4()}`);
|
|
122
125
|
this.id = `I${v4()}`;
|
|
123
126
|
_subscription.set(this, new Subscription());
|
|
@@ -151,6 +154,35 @@ class SdEditor {
|
|
|
151
154
|
['link', 'image', 'video'] // link and image, video
|
|
152
155
|
]
|
|
153
156
|
},
|
|
157
|
+
mention: {
|
|
158
|
+
allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
|
|
159
|
+
mentionDenotationChars: ['@'],
|
|
160
|
+
source: (searchTerm, renderList, mentionChar) => {
|
|
161
|
+
if (this.mentionValues) {
|
|
162
|
+
let values;
|
|
163
|
+
if (mentionChar === '@') {
|
|
164
|
+
values = this.mentionValues;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
values = [];
|
|
168
|
+
}
|
|
169
|
+
if (searchTerm.length === 0) {
|
|
170
|
+
renderList(values, searchTerm);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
const matches = [];
|
|
174
|
+
// tslint:disable-next-line:prefer-for-of
|
|
175
|
+
for (let i = 0; i < values.length; i++) {
|
|
176
|
+
// tslint:disable-next-line:no-bitwise
|
|
177
|
+
if (~values[i].value.toLowerCase().indexOf(searchTerm.toLowerCase())) {
|
|
178
|
+
matches.push(values[i]);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
renderList(matches, searchTerm);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
},
|
|
154
186
|
keyboard: {
|
|
155
187
|
bindings: {
|
|
156
188
|
enter: {
|
|
@@ -200,6 +232,7 @@ class SdEditor {
|
|
|
200
232
|
// // }
|
|
201
233
|
// // this.formControl.setValue(html);
|
|
202
234
|
// });
|
|
235
|
+
const self = this;
|
|
203
236
|
quill.getModule('toolbar').addHandler('image', function () {
|
|
204
237
|
let fileInput = this.container.querySelector('input.ql-image[type=file]');
|
|
205
238
|
if (fileInput == null) {
|
|
@@ -216,14 +249,15 @@ class SdEditor {
|
|
|
216
249
|
const formData = new FormData();
|
|
217
250
|
formData.append(Constants.FILE, files[0]);
|
|
218
251
|
this.quill.enable(false);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
252
|
+
/*this.apiService.post(this.domain + this.urlUploadImage, formData).subscribe((resp: any) => {
|
|
253
|
+
this.quill.enable(true);
|
|
254
|
+
this.quill.editor.insertEmbed(range.index, 'image', resp.data.imageUrl || resp.data.publish_url || resp.url);
|
|
255
|
+
const content = this.quill.getContents();
|
|
256
|
+
this.quill.setContents(content);
|
|
257
|
+
this.quill.setSelection(range.index + 1, 'silent');
|
|
258
|
+
fileInput.value = '';
|
|
259
|
+
});*/
|
|
260
|
+
__classPrivateFieldGet(self, _uploadImage).call(self, formData, quill, range, fileInput);
|
|
227
261
|
});
|
|
228
262
|
this.container.appendChild(fileInput);
|
|
229
263
|
}
|
|
@@ -237,6 +271,21 @@ class SdEditor {
|
|
|
237
271
|
this.onClickShowHtmlEditor = () => {
|
|
238
272
|
this.showHtmlEditor = !this.showHtmlEditor;
|
|
239
273
|
};
|
|
274
|
+
_uploadImage.set(this, (formData, quill, range, fileInput) => {
|
|
275
|
+
if (!this.urlUploadImage) {
|
|
276
|
+
this.urlUploadImage = '/partner/v2/merchandise/file/uploaduserfile';
|
|
277
|
+
}
|
|
278
|
+
// this.domain = 'https://api-commerce-qc.vinid.dev';
|
|
279
|
+
this.sdApiService.post(this.urlUploadImage, formData).then((resp) => {
|
|
280
|
+
var _a, _b;
|
|
281
|
+
quill.enable(true);
|
|
282
|
+
quill.editor.insertEmbed(range.index, 'image', ((_a = resp === null || resp === void 0 ? void 0 : resp.data) === null || _a === void 0 ? void 0 : _a.imageUrl) || ((_b = resp === null || resp === void 0 ? void 0 : resp.data) === null || _b === void 0 ? void 0 : _b.publish_url) || (resp === null || resp === void 0 ? void 0 : resp.url) || '');
|
|
283
|
+
const content = quill.getContents();
|
|
284
|
+
quill.setContents(content);
|
|
285
|
+
quill.setSelection(range.index + 1, 'silent');
|
|
286
|
+
fileInput.value = '';
|
|
287
|
+
});
|
|
288
|
+
});
|
|
240
289
|
}
|
|
241
290
|
set model(val) {
|
|
242
291
|
__classPrivateFieldSet(this, _model, val);
|
|
@@ -280,6 +329,10 @@ class SdEditor {
|
|
|
280
329
|
ngOnInit() {
|
|
281
330
|
var _a;
|
|
282
331
|
(_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.addControl(__classPrivateFieldGet(this, _name), this.formControl);
|
|
332
|
+
if (this.toolbar) {
|
|
333
|
+
this.quillConfig.toolbar.container = this.toolbar;
|
|
334
|
+
console.log('toolbar', this.quillConfig);
|
|
335
|
+
}
|
|
283
336
|
}
|
|
284
337
|
ngAfterViewInit() {
|
|
285
338
|
__classPrivateFieldGet(this, _subscription).add(this.formControl.valueChanges.subscribe((val) => {
|
|
@@ -293,16 +346,17 @@ class SdEditor {
|
|
|
293
346
|
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
294
347
|
}
|
|
295
348
|
}
|
|
296
|
-
_name = new WeakMap(), _subscription = new WeakMap(), _model = new WeakMap(), _form = new WeakMap(), _updateValidator = new WeakMap();
|
|
349
|
+
_name = new WeakMap(), _subscription = new WeakMap(), _model = new WeakMap(), _form = new WeakMap(), _updateValidator = new WeakMap(), _uploadImage = new WeakMap();
|
|
297
350
|
SdEditor.decorators = [
|
|
298
351
|
{ type: Component, args: [{
|
|
299
352
|
selector: 'sd-editor',
|
|
300
|
-
template: "<label *ngIf=\"label\" class=\"d-block T14M\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n<ng-container *ngIf=\"!formControl.disabled && !showHtmlEditor\">\r\n <quill-editor #editor [styles]=\"styles\" (onEditorCreated)=\"editorInit($event)\" [ngModel]=\"formControl.value\"\r\n (ngModelChange)=\"onModelChange($event)\" [id]=\"id\" [modules]=\"quillConfig\" [placeholder]=\"placeholder\"\r\n [maxLength]=\"maxlength\">\r\n </quill-editor>\r\n <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.required\">\r\n {{'This field is required' | sdTranslate}}\r\n </span>\r\n <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.minlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{minlength}}</strong>\r\n </span>\r\n <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.maxlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </span>\r\n</ng-container>\r\n<ng-container *ngIf=\"formControl.disabled\">\r\n <div [innerHtml]=\"formControl.value\"></div>\r\n</ng-container>\r\n<ng-container *ngIf=\"enableHTMLButton\">\r\n <sd-textarea [(model)]=\"modelHTML\" *ngIf=\"showHtmlEditor\" rows=\"20\"\r\n (modelChange)=\"onModelChange($event)\"></sd-textarea>\r\n <sd-button\r\n title=\"{{showHtmlEditor?'\u1EA8n':'Hi\u1EC7n'}} m\u00E3 HTML\"\r\n class=\"mr-8\"\r\n fontSet=\"material-icons-outlined\"\r\n (action)=\"onClickShowHtmlEditor()\"\r\n type=\"light\"\r\n ></sd-button>\r\n</ng-container>\r\n",
|
|
353
|
+
template: "<label *ngIf=\"label\" class=\"d-block T14M\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n<ng-container *ngIf=\"!formControl.disabled && !showHtmlEditor\">\r\n <quill-editor #editor [styles]=\"styles\" (onEditorCreated)=\"editorInit($event)\" [ngModel]=\"formControl.value\"\r\n (ngModelChange)=\"onModelChange($event)\" [id]=\"id\" [modules]=\"quillConfig\" [placeholder]=\"placeholder\"\r\n [maxLength]=\"maxlength\" >\r\n </quill-editor>\r\n <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.required\">\r\n {{'This field is required' | sdTranslate}}\r\n </span>\r\n <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.minlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{minlength}}</strong>\r\n </span>\r\n <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.maxlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </span>\r\n</ng-container>\r\n<ng-container *ngIf=\"formControl.disabled\">\r\n <div [innerHtml]=\"formControl.value\"></div>\r\n</ng-container>\r\n<ng-container *ngIf=\"enableHTMLButton\">\r\n <sd-textarea [(model)]=\"modelHTML\" *ngIf=\"showHtmlEditor\" rows=\"20\"\r\n (modelChange)=\"onModelChange($event)\"></sd-textarea>\r\n <sd-button\r\n title=\"{{showHtmlEditor?'\u1EA8n':'Hi\u1EC7n'}} m\u00E3 HTML\"\r\n class=\"mr-8\"\r\n fontSet=\"material-icons-outlined\"\r\n (action)=\"onClickShowHtmlEditor()\"\r\n type=\"light\"\r\n ></sd-button>\r\n</ng-container>\r\n",
|
|
301
354
|
styles: [""]
|
|
302
355
|
},] }
|
|
303
356
|
];
|
|
304
357
|
SdEditor.ctorParameters = () => [
|
|
305
|
-
{ type: ChangeDetectorRef }
|
|
358
|
+
{ type: ChangeDetectorRef },
|
|
359
|
+
{ type: SdApiService }
|
|
306
360
|
];
|
|
307
361
|
SdEditor.propDecorators = {
|
|
308
362
|
editor: [{ type: ViewChild, args: ['editor',] }],
|
|
@@ -318,7 +372,9 @@ SdEditor.propDecorators = {
|
|
|
318
372
|
domain: [{ type: Input }],
|
|
319
373
|
urlUploadImage: [{ type: Input }],
|
|
320
374
|
form: [{ type: Input }],
|
|
375
|
+
toolbar: [{ type: Input }],
|
|
321
376
|
enableHTMLButton: [{ type: Input }],
|
|
377
|
+
mentionValues: [{ type: Input }],
|
|
322
378
|
sdChange: [{ type: Output }]
|
|
323
379
|
};
|
|
324
380
|
|
|
@@ -334,7 +390,8 @@ SdEditorModule.decorators = [
|
|
|
334
390
|
QuillModule.forRoot(),
|
|
335
391
|
SdTranslateModule,
|
|
336
392
|
SdButtonModule,
|
|
337
|
-
SdTextareaModule
|
|
393
|
+
SdTextareaModule,
|
|
394
|
+
SdApiModule
|
|
338
395
|
],
|
|
339
396
|
exports: [SdEditor],
|
|
340
397
|
providers: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-editor.js","sources":["../../../../projects/sd-core/editor/src/lib/constant.ts","../../../../projects/sd-core/editor/src/lib/editor.component.ts","../../../../projects/sd-core/editor/src/lib/editor.module.ts","../../../../projects/sd-core/editor/src/public-api.ts","../../../../projects/sd-core/editor/sd-angular-core-editor.ts"],"sourcesContent":["export const Constants = {\r\n ARE_YOU_WANT_TO_DELETE: 'Are you sure you want to delete?',\r\n ACTIVE: 'active',\r\n IN_ACTIVE: 'inactive',\r\n APPROVE: 'approve',\r\n UN_APPROVE: 'unapprove',\r\n ACCEPT_SIZE_IMAGE: 'Logo only accept image with size <= 2MB',\r\n ACCEPT_TYPE_IMAGE:\r\n 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon',\r\n PAGE_TYPE_NEW: 'new',\r\n PAGE_TYPE_EDIT: 'edit',\r\n SAVE: 'saveOb',\r\n SAVE_AND_CONTINUE: 'saveAndContOb',\r\n IMAGE_SIZE: 2048000,\r\n SUCCESS: 'Success',\r\n IMPORT_SUCCESSFULLY: 'Import successfully!',\r\n ERROR: 'Error',\r\n FAILED: 'fail',\r\n FILE: 'file',\r\n NONE: 'none',\r\n NOT_EXIST_ID_OR_LINK: 'This ID/Link is not existing',\r\n FEATURE_IS_PENDING: 'This feature is pending',\r\n NOT_SUPPORT_FILE_IMAGE: 'File upload is not supported.',\r\n NOT_SUPPORT_FILE_IMPORT: 'File import is not supported.',\r\n NETWORK_ERROR: 'Network Error',\r\n SORT_BY: [\r\n {\r\n value: 0,\r\n name: 'Created Date'\r\n },\r\n {\r\n value: 1,\r\n name: 'Title'\r\n }\r\n ],\r\n DESC: [\r\n {\r\n value: true,\r\n name: 'Descending'\r\n },\r\n {\r\n value: false,\r\n name: 'Ascending'\r\n }\r\n ],\r\n FORM_ERRORS: {\r\n Id: '',\r\n textSearch: '',\r\n ImportLogId: '',\r\n SortBy: '',\r\n Reverse: '',\r\n },\r\n VALIDATION_MESSAGES: {}\r\n};\r\n\r\nexport const PROMOTION_PERMISSIONS = ['ListPromotion', 'AddNewPromotion', 'EditPromotion',\r\n 'ActiveOrInactivePromotion', 'RemovePromotion', 'ImportPromotion', 'ExportPromotion'];\r\n\r\nexport const ValidateMessageConstants = {\r\n TITLE_REQUIRED: 'Title is required',\r\n TITLE_MAXLENGTH: 'Title is not more than 55 characters',\r\n TITLE_PATTERN: 'Title is required',\r\n\r\n CREATED_AT_REQUIRED: 'Created At is required',\r\n\r\n SHOW_ON_HOME_REQUIRED: 'Show On Home is required',\r\n\r\n DISPLAY_NUMBER_REQUIRED: 'Display Number is required',\r\n\r\n CONTENT_TYPE_REQUIRED: 'Content Type is required',\r\n\r\n DISCOUNT_PERCENT_REQUIRED: 'Discount percent is required',\r\n DISCOUNT_PERCENT_MAX: 'Max discount percent is 100, cannot input greater',\r\n DISCOUNT_PERCENT_MIN: 'Min discount percent is 0, cannot input lower'\r\n};\r\n\r\nexport const PROMOTION_FORM = {\r\n FORM_ERRORS: {\r\n title: '',\r\n createdAt: '',\r\n displayNumber: '',\r\n showOnHome: '',\r\n discountPercent: '',\r\n isActive: '',\r\n ctaLabelName: '',\r\n ctaDeepLink: '',\r\n tags: ''\r\n },\r\n VALIDATION_MESSAGES: {\r\n title: {\r\n required: ValidateMessageConstants.TITLE_REQUIRED,\r\n maxlength: ValidateMessageConstants.TITLE_MAXLENGTH,\r\n pattern: ValidateMessageConstants.TITLE_PATTERN\r\n },\r\n createdAt: {\r\n required: ValidateMessageConstants.CREATED_AT_REQUIRED\r\n },\r\n showOnHome: {\r\n required: ValidateMessageConstants.SHOW_ON_HOME_REQUIRED\r\n },\r\n displayNumber: {\r\n required: ValidateMessageConstants.DISPLAY_NUMBER_REQUIRED\r\n },\r\n discountPercent: {\r\n required: ValidateMessageConstants.DISCOUNT_PERCENT_REQUIRED,\r\n max: ValidateMessageConstants.DISCOUNT_PERCENT_MAX,\r\n min: ValidateMessageConstants.DISCOUNT_PERCENT_MIN\r\n },\r\n tags: {\r\n required: ValidateMessageConstants.CONTENT_TYPE_REQUIRED\r\n }\r\n }\r\n};\r\n","import {Component, ViewChild, Input, OnInit, Output, EventEmitter, ChangeDetectorRef} from '@angular/core';\r\nimport {QuillEditorComponent} from 'ngx-quill';\r\nimport * as uuid from 'uuid';\r\nimport {FormControl, FormGroup, NgForm, ValidatorFn, Validators} from '@angular/forms';\r\nimport {Constants} from './constant';\r\nimport {Subscription} from 'rxjs';\r\n\r\n@Component({\r\n selector: 'sd-editor',\r\n templateUrl: './editor.component.html',\r\n styleUrls: ['./editor.component.scss'],\r\n})\r\nexport class SdEditor implements OnInit {\r\n #name = `N${uuid.v4()}`;\r\n id: string = `I${uuid.v4()}`;\r\n #subscription = new Subscription();\r\n @ViewChild('editor') editor: QuillEditorComponent;\r\n @Input() label: string;\r\n #model: string;\r\n @Input() set model(val: string) {\r\n this.#model = val;\r\n this.modelHTML = val;\r\n this.formControl.setValue(this.#model, {\r\n emitEvent: false\r\n });\r\n this.ref.detectChanges();\r\n }\r\n\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n\r\n required = false;\r\n\r\n @Input() set pRequired(val: boolean | '') {\r\n this.required = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n minlength: number;\r\n\r\n @Input('minlength') set _minlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n\r\n maxlength: number;\r\n\r\n @Input('maxlength') set _maxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n\r\n @Output() modelChange = new EventEmitter<string>();\r\n\r\n @Input() placeholder: string = '';\r\n\r\n @Input() styles: any = {height: '250px'};\r\n\r\n formControl = new FormControl();\r\n\r\n @Input() domain = '';\r\n @Input() urlUploadImage: string;\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n\r\n @Input() enableHTMLButton = false;\r\n showHtmlEditor = false;\r\n modelHTML: string;\r\n\r\n quillEvent: any;\r\n\r\n quillConfig = {\r\n // toolbar: '.toolbar',\r\n toolbar: {\r\n container: [\r\n ['bold', 'italic', 'underline', 'strike'], // toggled buttons\r\n ['blockquote', 'code-block'],\r\n\r\n [{'header': 1}, {'header': 2}], // custom button values\r\n [{'list': 'ordered'}, {'list': 'bullet'}],\r\n [{'script': 'sub'}, {'script': 'super'}], // superscript/subscript\r\n [{'indent': '-1'}, {'indent': '+1'}], // outdent/indent\r\n [{'direction': 'rtl'}], // text direction\r\n\r\n [{'size': ['small', false, 'large', 'huge']}], // custom dropdown\r\n [{'header': [1, 2, 3, 4, 5, 6, false]}],\r\n\r\n [{'color': []}, {'background': []}], // dropdown with defaults from theme\r\n [{'font': []}],\r\n [{'align': []}],\r\n\r\n ['clean'], // remove formatting button\r\n\r\n ['link', 'image', 'video'] // link and image, video\r\n ]\r\n },\r\n keyboard: {\r\n bindings: {\r\n enter: {\r\n key: 13,\r\n handler: (range, context) => {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n textLength: number = 0;\r\n @Output() sdChange = new EventEmitter<string>();\r\n\r\n constructor(private ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe((val) => {\r\n this.modelChange.emit(val);\r\n this.sdChange.emit(val);\r\n }));\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n if (this.required) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n editorInit = (quill) => {\r\n this.quillEvent = quill;\r\n // const txtArea = document.createElement('textarea');\r\n // txtArea.style.cssText =\r\n // 'width: 100%;margin: 0px;background: rgb(29, 29, 29);' +\r\n // 'box-sizing: border-box;color: rgb(204, 204, 204);' +\r\n // 'font-size: 15px;outline: none;padding: 20px;' +\r\n // 'line-height: 24px;font-family: Consolas, Menlo, Monaco, "Courier New", monospace;' +\r\n // 'position: absolute;top: 0;bottom: 0;border: none;display:none';\r\n\r\n // const htmlEditor = quill.addContainer('ql-custom');\r\n // htmlEditor.appendChild(txtArea);\r\n\r\n // const myEditor = quill.container;\r\n // quill.on('text-change', (delta, oldDelta, source) => {\r\n // const html = myEditor.children[0].innerHTML;\r\n // txtArea.value = html;\r\n // // if (quill.getLength() > this.maxlength) {\r\n // // quill.deleteText(this.maxlength, quill.getLength());\r\n // // }\r\n // // this.formControl.setValue(html);\r\n // });\r\n\r\n quill.getModule('toolbar').addHandler('image', function () {\r\n let fileInput = this.container.querySelector('input.ql-image[type=file]');\r\n\r\n if (fileInput == null) {\r\n fileInput = document.createElement('input');\r\n fileInput.setAttribute('type', Constants.FILE);\r\n fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');\r\n fileInput.classList.add('ql-image');\r\n fileInput.addEventListener('change', () => {\r\n const files = fileInput.files;\r\n const range = this.quill.getSelection(true);\r\n if (!files || !files.length) {\r\n return;\r\n }\r\n\r\n const formData = new FormData();\r\n formData.append(Constants.FILE, files[0]);\r\n\r\n this.quill.enable(false);\r\n // self.apiService.post(self.domain, self.urlUploadImage, formData).subscribe((resp: any) => {\r\n // this.quill.enable(true);\r\n // this.quill.editor.insertEmbed(range.index, 'image', resp.data.imageUrl || resp.data.publish_url);\r\n // const content = this.quill.getContents();\r\n // this.quill.setContents(content);\r\n // this.quill.setSelection(range.index + 1, (Quill as any).sources.SILENT);\r\n // fileInput.value = '';\r\n // });\r\n });\r\n this.container.appendChild(fileInput);\r\n }\r\n fileInput.click();\r\n });\r\n }\r\n onModelChange = (val: string) => {\r\n this.formControl.setValue(val);\r\n this.modelHTML = val;\r\n }\r\n onClickShowHtmlEditor = () => {\r\n this.showHtmlEditor = !this.showHtmlEditor;\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { QuillModule } from 'ngx-quill';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdEditor } from './editor.component';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport {SdButtonModule} from '@sd-angular/core/button';\r\nimport {SdTextareaModule} from '@sd-angular/core/textarea';\r\n\r\n@NgModule({\r\n declarations: [SdEditor],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n QuillModule.forRoot(),\r\n SdTranslateModule,\r\n SdButtonModule,\r\n SdTextareaModule\r\n ],\r\n exports: [SdEditor],\r\n providers: [],\r\n})\r\nexport class SdEditorModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/editor.module';\r\nexport * from './lib/constant';\r\nexport * from './lib/editor.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;MAAa,SAAS,GAAG;IACrB,sBAAsB,EAAE,kCAAkC;IAC1D,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,UAAU;IACrB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,WAAW;IACvB,iBAAiB,EAAE,yCAAyC;IAC5D,iBAAiB,EACf,2DAA2D;IAC7D,aAAa,EAAE,KAAK;IACpB,cAAc,EAAE,MAAM;IACtB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,eAAe;IAClC,UAAU,EAAE,OAAO;IACnB,OAAO,EAAE,SAAS;IAClB,mBAAmB,EAAE,sBAAsB;IAC3C,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,MAA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EvC;;;YAXkE,iBAAiB;;;qBAgBjF,SAAS,SAAC,QAAQ;oBAClB,KAAK;oBAEL,KAAK;uBASL,KAAK;wBAWL,KAAK;yBAOL,KAAK,SAAC,WAAW;yBAOjB,KAAK,SAAC,WAAW;0BAKjB,MAAM;0BAEN,KAAK;qBAEL,KAAK;qBAIL,KAAK;6BACL,KAAK;mBAEL,KAAK;+BAUL,KAAK;uBA4CL,MAAM;;;MCpGI,cAAc;;;YAd1B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,QAAQ,CAAC;gBACxB,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,WAAW,CAAC,OAAO,EAAE;oBACrB,iBAAiB;oBACjB,cAAc;oBACd,gBAAgB;iBACjB;gBACD,OAAO,EAAE,CAAC,QAAQ,CAAC;gBACnB,SAAS,EAAE,EAAE;aACd;;;ACtBD;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-editor.js","sources":["../../../../projects/sd-core/editor/src/lib/constant.ts","../../../../projects/sd-core/editor/src/lib/editor.component.ts","../../../../projects/sd-core/editor/src/lib/editor.module.ts","../../../../projects/sd-core/editor/src/public-api.ts","../../../../projects/sd-core/editor/sd-angular-core-editor.ts"],"sourcesContent":["export const Constants = {\r\n ARE_YOU_WANT_TO_DELETE: 'Are you sure you want to delete?',\r\n ACTIVE: 'active',\r\n IN_ACTIVE: 'inactive',\r\n APPROVE: 'approve',\r\n UN_APPROVE: 'unapprove',\r\n ACCEPT_SIZE_IMAGE: 'Logo only accept image with size <= 2MB',\r\n ACCEPT_TYPE_IMAGE:\r\n 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon',\r\n PAGE_TYPE_NEW: 'new',\r\n PAGE_TYPE_EDIT: 'edit',\r\n SAVE: 'saveOb',\r\n SAVE_AND_CONTINUE: 'saveAndContOb',\r\n IMAGE_SIZE: 2048000,\r\n SUCCESS: 'Success',\r\n IMPORT_SUCCESSFULLY: 'Import successfully!',\r\n ERROR: 'Error',\r\n FAILED: 'fail',\r\n FILE: 'file',\r\n NONE: 'none',\r\n NOT_EXIST_ID_OR_LINK: 'This ID/Link is not existing',\r\n FEATURE_IS_PENDING: 'This feature is pending',\r\n NOT_SUPPORT_FILE_IMAGE: 'File upload is not supported.',\r\n NOT_SUPPORT_FILE_IMPORT: 'File import is not supported.',\r\n NETWORK_ERROR: 'Network Error',\r\n SORT_BY: [\r\n {\r\n value: 0,\r\n name: 'Created Date'\r\n },\r\n {\r\n value: 1,\r\n name: 'Title'\r\n }\r\n ],\r\n DESC: [\r\n {\r\n value: true,\r\n name: 'Descending'\r\n },\r\n {\r\n value: false,\r\n name: 'Ascending'\r\n }\r\n ],\r\n FORM_ERRORS: {\r\n Id: '',\r\n textSearch: '',\r\n ImportLogId: '',\r\n SortBy: '',\r\n Reverse: '',\r\n },\r\n VALIDATION_MESSAGES: {}\r\n};\r\n\r\nexport const PROMOTION_PERMISSIONS = ['ListPromotion', 'AddNewPromotion', 'EditPromotion',\r\n 'ActiveOrInactivePromotion', 'RemovePromotion', 'ImportPromotion', 'ExportPromotion'];\r\n\r\nexport const ValidateMessageConstants = {\r\n TITLE_REQUIRED: 'Title is required',\r\n TITLE_MAXLENGTH: 'Title is not more than 55 characters',\r\n TITLE_PATTERN: 'Title is required',\r\n\r\n CREATED_AT_REQUIRED: 'Created At is required',\r\n\r\n SHOW_ON_HOME_REQUIRED: 'Show On Home is required',\r\n\r\n DISPLAY_NUMBER_REQUIRED: 'Display Number is required',\r\n\r\n CONTENT_TYPE_REQUIRED: 'Content Type is required',\r\n\r\n DISCOUNT_PERCENT_REQUIRED: 'Discount percent is required',\r\n DISCOUNT_PERCENT_MAX: 'Max discount percent is 100, cannot input greater',\r\n DISCOUNT_PERCENT_MIN: 'Min discount percent is 0, cannot input lower'\r\n};\r\n\r\nexport const PROMOTION_FORM = {\r\n FORM_ERRORS: {\r\n title: '',\r\n createdAt: '',\r\n displayNumber: '',\r\n showOnHome: '',\r\n discountPercent: '',\r\n isActive: '',\r\n ctaLabelName: '',\r\n ctaDeepLink: '',\r\n tags: ''\r\n },\r\n VALIDATION_MESSAGES: {\r\n title: {\r\n required: ValidateMessageConstants.TITLE_REQUIRED,\r\n maxlength: ValidateMessageConstants.TITLE_MAXLENGTH,\r\n pattern: ValidateMessageConstants.TITLE_PATTERN\r\n },\r\n createdAt: {\r\n required: ValidateMessageConstants.CREATED_AT_REQUIRED\r\n },\r\n showOnHome: {\r\n required: ValidateMessageConstants.SHOW_ON_HOME_REQUIRED\r\n },\r\n displayNumber: {\r\n required: ValidateMessageConstants.DISPLAY_NUMBER_REQUIRED\r\n },\r\n discountPercent: {\r\n required: ValidateMessageConstants.DISCOUNT_PERCENT_REQUIRED,\r\n max: ValidateMessageConstants.DISCOUNT_PERCENT_MAX,\r\n min: ValidateMessageConstants.DISCOUNT_PERCENT_MIN\r\n },\r\n tags: {\r\n required: ValidateMessageConstants.CONTENT_TYPE_REQUIRED\r\n }\r\n }\r\n};\r\n","import {\r\n Component,\r\n ViewChild,\r\n Input,\r\n OnInit,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n AfterViewInit, OnDestroy\r\n} from '@angular/core';\r\nimport {QuillEditorComponent} from 'ngx-quill';\r\nimport * as uuid from 'uuid';\r\nimport {FormControl, FormGroup, NgForm, ValidatorFn, Validators} from '@angular/forms';\r\nimport {Constants} from './constant';\r\nimport {Subscription} from 'rxjs';\r\nimport {SdApiService} from '@sd-angular/core/api';\r\nimport 'quill-mention';\r\n\r\n@Component({\r\n selector: 'sd-editor',\r\n templateUrl: './editor.component.html',\r\n styleUrls: ['./editor.component.scss'],\r\n})\r\nexport class SdEditor implements OnInit, AfterViewInit, OnDestroy {\r\n #name = `N${uuid.v4()}`;\r\n id: string = `I${uuid.v4()}`;\r\n #subscription = new Subscription();\r\n @ViewChild('editor') editor: QuillEditorComponent;\r\n @Input() label: string;\r\n #model: string;\r\n @Input() set model(val: string) {\r\n this.#model = val;\r\n this.modelHTML = val;\r\n this.formControl.setValue(this.#model, {\r\n emitEvent: false\r\n });\r\n this.ref.detectChanges();\r\n }\r\n\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n\r\n required = false;\r\n\r\n @Input() set pRequired(val: boolean | '') {\r\n this.required = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n minlength: number;\r\n\r\n @Input('minlength') set _minlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n\r\n maxlength: number;\r\n\r\n @Input('maxlength') set _maxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n\r\n @Output() modelChange = new EventEmitter<string>();\r\n\r\n @Input() placeholder: string = '';\r\n\r\n @Input() styles: any = {height: '250px'};\r\n\r\n formControl = new FormControl();\r\n\r\n @Input() domain = '';\r\n @Input() urlUploadImage: string;\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n\r\n @Input() toolbar: any;\r\n @Input() enableHTMLButton = false;\r\n showHtmlEditor = false;\r\n modelHTML: string;\r\n\r\n quillEvent: any;\r\n @Input() mentionValues: { id: string, value: string, link?: string }[];\r\n\r\n quillConfig = {\r\n // toolbar: '.toolbar',\r\n toolbar: {\r\n container: [\r\n ['bold', 'italic', 'underline', 'strike'], // toggled buttons\r\n ['blockquote', 'code-block'],\r\n\r\n [{'header': 1}, {'header': 2}], // custom button values\r\n [{'list': 'ordered'}, {'list': 'bullet'}],\r\n [{'script': 'sub'}, {'script': 'super'}], // superscript/subscript\r\n [{'indent': '-1'}, {'indent': '+1'}], // outdent/indent\r\n [{'direction': 'rtl'}], // text direction\r\n\r\n [{'size': ['small', false, 'large', 'huge']}], // custom dropdown\r\n [{'header': [1, 2, 3, 4, 5, 6, false]}],\r\n\r\n [{'color': []}, {'background': []}], // dropdown with defaults from theme\r\n [{'font': []}],\r\n [{'align': []}],\r\n\r\n ['clean'], // remove formatting button\r\n\r\n ['link', 'image', 'video'] // link and image, video\r\n ]\r\n },\r\n mention: {\r\n allowedChars: /^[A-Za-z\\sÅÄÖåäö]*$/,\r\n mentionDenotationChars: ['@'],\r\n source: (searchTerm, renderList, mentionChar) => {\r\n if (this.mentionValues) {\r\n let values;\r\n if (mentionChar === '@') {\r\n values = this.mentionValues;\r\n } else {\r\n values = [];\r\n }\r\n\r\n if (searchTerm.length === 0) {\r\n renderList(values, searchTerm);\r\n } else {\r\n const matches = [];\r\n // tslint:disable-next-line:prefer-for-of\r\n for (let i = 0; i < values.length; i++) {\r\n // tslint:disable-next-line:no-bitwise\r\n if (~values[i].value.toLowerCase().indexOf(searchTerm.toLowerCase())) {\r\n matches.push(values[i]);\r\n }\r\n }\r\n renderList(matches, searchTerm);\r\n }\r\n }\r\n },\r\n },\r\n keyboard: {\r\n bindings: {\r\n enter: {\r\n key: 13,\r\n handler: (range, context) => {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n textLength: number = 0;\r\n @Output() sdChange = new EventEmitter<string>();\r\n\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n private sdApiService: SdApiService\r\n ) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#form?.addControl(this.#name, this.formControl);\r\n if (this.toolbar) {\r\n this.quillConfig.toolbar.container = this.toolbar;\r\n console.log('toolbar', this.quillConfig);\r\n }\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe((val) => {\r\n this.modelChange.emit(val);\r\n this.sdChange.emit(val);\r\n }));\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n if (this.required) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n editorInit = (quill) => {\r\n this.quillEvent = quill;\r\n // const txtArea = document.createElement('textarea');\r\n // txtArea.style.cssText =\r\n // 'width: 100%;margin: 0px;background: rgb(29, 29, 29);' +\r\n // 'box-sizing: border-box;color: rgb(204, 204, 204);' +\r\n // 'font-size: 15px;outline: none;padding: 20px;' +\r\n // 'line-height: 24px;font-family: Consolas, Menlo, Monaco, "Courier New", monospace;' +\r\n // 'position: absolute;top: 0;bottom: 0;border: none;display:none';\r\n\r\n // const htmlEditor = quill.addContainer('ql-custom');\r\n // htmlEditor.appendChild(txtArea);\r\n\r\n // const myEditor = quill.container;\r\n // quill.on('text-change', (delta, oldDelta, source) => {\r\n // const html = myEditor.children[0].innerHTML;\r\n // txtArea.value = html;\r\n // // if (quill.getLength() > this.maxlength) {\r\n // // quill.deleteText(this.maxlength, quill.getLength());\r\n // // }\r\n // // this.formControl.setValue(html);\r\n // });\r\n\r\n const self = this;\r\n quill.getModule('toolbar').addHandler('image', function () {\r\n let fileInput = this.container.querySelector('input.ql-image[type=file]');\r\n\r\n if (fileInput == null) {\r\n fileInput = document.createElement('input');\r\n fileInput.setAttribute('type', Constants.FILE);\r\n fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');\r\n fileInput.classList.add('ql-image');\r\n fileInput.addEventListener('change', () => {\r\n const files = fileInput.files;\r\n const range = this.quill.getSelection(true);\r\n if (!files || !files.length) {\r\n return;\r\n }\r\n\r\n const formData = new FormData();\r\n formData.append(Constants.FILE, files[0]);\r\n\r\n this.quill.enable(false);\r\n /*this.apiService.post(this.domain + this.urlUploadImage, formData).subscribe((resp: any) => {\r\n this.quill.enable(true);\r\n this.quill.editor.insertEmbed(range.index, 'image', resp.data.imageUrl || resp.data.publish_url || resp.url);\r\n const content = this.quill.getContents();\r\n this.quill.setContents(content);\r\n this.quill.setSelection(range.index + 1, 'silent');\r\n fileInput.value = '';\r\n });*/\r\n self.#uploadImage(formData, quill, range, fileInput);\r\n });\r\n this.container.appendChild(fileInput);\r\n }\r\n fileInput.click();\r\n });\r\n }\r\n\r\n onModelChange = (val: string) => {\r\n this.formControl.setValue(val);\r\n this.modelHTML = val;\r\n }\r\n\r\n onClickShowHtmlEditor = () => {\r\n this.showHtmlEditor = !this.showHtmlEditor;\r\n }\r\n\r\n #uploadImage = (formData, quill, range, fileInput) => {\r\n if (!this.urlUploadImage) {\r\n this.urlUploadImage = '/partner/v2/merchandise/file/uploaduserfile';\r\n }\r\n // this.domain = 'https://api-commerce-qc.vinid.dev';\r\n this.sdApiService.post(this.urlUploadImage, formData).then((resp: any) => {\r\n quill.enable(true);\r\n quill.editor.insertEmbed(range.index, 'image', resp?.data?.imageUrl || resp?.data?.publish_url || resp?.url || '');\r\n const content = quill.getContents();\r\n quill.setContents(content);\r\n quill.setSelection(range.index + 1, 'silent');\r\n fileInput.value = '';\r\n });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { QuillModule } from 'ngx-quill';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdEditor } from './editor.component';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport {SdButtonModule} from '@sd-angular/core/button';\r\nimport {SdTextareaModule} from '@sd-angular/core/textarea';\r\nimport {SdApiModule, SdApiService} from '@sd-angular/core/api';\r\n\r\n@NgModule({\r\n declarations: [SdEditor],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n QuillModule.forRoot(),\r\n SdTranslateModule,\r\n SdButtonModule,\r\n SdTextareaModule,\r\n SdApiModule\r\n ],\r\n exports: [SdEditor],\r\n providers: [],\r\n})\r\nexport class SdEditorModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/editor.module';\r\nexport * from './lib/constant';\r\nexport * from './lib/editor.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;MAAa,SAAS,GAAG;IACrB,sBAAsB,EAAE,kCAAkC;IAC1D,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,UAAU;IACrB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,WAAW;IACvB,iBAAiB,EAAE,yCAAyC;IAC5D,iBAAiB,EACf,2DAA2D;IAC7D,aAAa,EAAE,KAAK;IACpB,cAAc,EAAE,MAAM;IACtB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,eAAe;IAClC,UAAU,EAAE,OAAO;IACnB,OAAO,EAAE,SAAS;IAClB,mBAAmB,EAAE,sBAAsB;IAC3C,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,oBAAoB,EAAE,8BAA8B;IACpD,kBAAkB,EAAE,yBAAyB;IAC7C,sBAAsB,EAAE,+BAA+B;IACvD,uBAAuB,EAAE,+BAA+B;IACxD,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE;QACP;YACE,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,cAAc;SACrB;QACD;YACE,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,OAAO;SACd;KACF;IACD,IAAI,EAAE;QACJ;YACE,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,YAAY;SACnB;QACD;YACE,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,WAAW;SAClB;KACF;IACD,WAAW,EAAE;QACT,EAAE,EAAE,EAAE;QACN,UAAU,EAAE,EAAE;QACd,WAAW,EAAE,EAAE;QACf,MA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AC,CAAC,GAAG;YACjE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACzB,CAAC,CAAC,CAAC;KACL;IAED,WAAW;;QACT,mFAAY,aAAa,sCAAa;QACtC,4CAAmB,WAAW,EAAE,CAAC;KAClC;;;;YA5KF,SAAS,SAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,okDAAsC;;aAEvC;;;YAfC,iBAAiB;YAQX,YAAY;;;qBAYjB,SAAS,SAAC,QAAQ;oBAClB,KAAK;oBAEL,KAAK;uBASL,KAAK;wBAWL,KAAK;yBAOL,KAAK,SAAC,WAAW;yBAOjB,KAAK,SAAC,WAAW;0BAKjB,MAAM;0BAEN,KAAK;qBAEL,KAAK;qBAIL,KAAK;6BACL,KAAK;mBAEL,KAAK;sBAUL,KAAK;+BACL,KAAK;4BAKL,KAAK;uBAoEL,MAAM;;;MC3II,cAAc;;;YAf1B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,QAAQ,CAAC;gBACxB,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,WAAW,CAAC,OAAO,EAAE;oBACrB,iBAAiB;oBACjB,cAAc;oBACd,gBAAgB;oBAChB,WAAW;iBACZ;gBACD,OAAO,EAAE,CAAC,QAAQ,CAAC;gBACnB,SAAS,EAAE,EAAE;aACd;;;ACxBD;;;;ACAA;;;;;;"}
|
|
@@ -23,6 +23,7 @@ import { SdTimeModule } from '@sd-angular/core/time';
|
|
|
23
23
|
import { SdSideDrawerModule } from '@sd-angular/core/side-drawer';
|
|
24
24
|
import { SdQuickActionModule } from '@sd-angular/core/quick-action';
|
|
25
25
|
import { SdBadgeModule } from '@sd-angular/core/badge';
|
|
26
|
+
import { SdModalResizableModule } from '@sd-angular/core/modal-resizable';
|
|
26
27
|
|
|
27
28
|
class SdFormModule {
|
|
28
29
|
}
|
|
@@ -53,6 +54,7 @@ SdFormModule.decorators = [
|
|
|
53
54
|
SdUtilityModule,
|
|
54
55
|
SdQuickActionModule,
|
|
55
56
|
SdBadgeModule,
|
|
57
|
+
SdModalResizableModule
|
|
56
58
|
],
|
|
57
59
|
declarations: [],
|
|
58
60
|
providers: [],
|
|
@@ -81,6 +83,7 @@ SdFormModule.decorators = [
|
|
|
81
83
|
SdUtilityModule,
|
|
82
84
|
SdQuickActionModule,
|
|
83
85
|
SdBadgeModule,
|
|
86
|
+
SdModalResizableModule
|
|
84
87
|
]
|
|
85
88
|
},] }
|
|
86
89
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-form.js","sources":["../../../../projects/sd-core/form/src/lib/form.module.ts","../../../../projects/sd-core/form/sd-angular-core-form.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdAutocompleteModule } from '@sd-angular/core/autocomplete';\r\nimport { SdButtonModule } from '@sd-angular/core/button';\r\nimport { SdDateRangeModule } from '@sd-angular/core/date-range';\r\nimport { SdDateTimeModule } from '@sd-angular/core/date-time';\r\nimport { SdEditorModule } from '@sd-angular/core/editor';\r\nimport { SdInputModule } from '@sd-angular/core/input';\r\nimport { SdInputCurrencyModule } from '@sd-angular/core/input-currency';\r\nimport { SdModalModule } from '@sd-angular/core/modal';\r\nimport { SdRadioModule } from '@sd-angular/core/radio';\r\nimport { SdSelectModule } from '@sd-angular/core/select';\r\nimport { SdSelectEditorModule } from '@sd-angular/core/select-editor';\r\nimport { SdSwitchModule } from '@sd-angular/core/switch';\r\nimport { SdUploadFileModule } from '@sd-angular/core/upload-file';\r\nimport { SdChipModule } from '@sd-angular/core/chip';\r\nimport { SdTextareaModule } from '@sd-angular/core/textarea';\r\nimport { SdUtilityModule } from '@sd-angular/core/utility';\r\nimport { SdCheckboxModule } from '@sd-angular/core/checkbox';\r\nimport { SdLabelModule } from '@sd-angular/core/label';\r\nimport { SdTimeModule } from '@sd-angular/core/time';\r\nimport { SdSideDrawerModule } from '@sd-angular/core/side-drawer';\r\nimport { SdQuickActionModule } from '@sd-angular/core/quick-action';\r\nimport { SdBadgeModule } from '@sd-angular/core/badge';\r\n\r\n@NgModule({\r\n imports: [\r\n FormsModule,\r\n ReactiveFormsModule,\r\n SdModalModule,\r\n SdSideDrawerModule,\r\n SdLabelModule,\r\n SdUploadFileModule,\r\n SdDateRangeModule,\r\n SdDateTimeModule,\r\n SdTimeModule,\r\n SdButtonModule,\r\n SdAutocompleteModule,\r\n SdInputModule,\r\n SdInputCurrencyModule,\r\n SdSelectModule,\r\n SdSelectEditorModule,\r\n SdEditorModule,\r\n SdSwitchModule,\r\n SdRadioModule,\r\n SdChipModule,\r\n SdTextareaModule,\r\n SdCheckboxModule,\r\n SdUtilityModule,\r\n SdQuickActionModule,\r\n SdBadgeModule,\r\n ],\r\n declarations: [\r\n ],\r\n providers: [\r\n ],\r\n exports: [\r\n FormsModule,\r\n ReactiveFormsModule,\r\n SdModalModule,\r\n SdSideDrawerModule,\r\n SdLabelModule,\r\n SdUploadFileModule,\r\n SdDateRangeModule,\r\n SdDateTimeModule,\r\n SdTimeModule,\r\n SdButtonModule,\r\n SdAutocompleteModule,\r\n SdInputModule,\r\n SdInputCurrencyModule,\r\n SdSelectModule,\r\n SdSelectEditorModule,\r\n SdEditorModule,\r\n SdSwitchModule,\r\n SdRadioModule,\r\n SdChipModule,\r\n SdTextareaModule,\r\n SdCheckboxModule,\r\n SdUtilityModule,\r\n SdQuickActionModule,\r\n SdBadgeModule,\r\n ]\r\n})\r\nexport class SdFormModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sd-angular-core-form.js","sources":["../../../../projects/sd-core/form/src/lib/form.module.ts","../../../../projects/sd-core/form/sd-angular-core-form.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdAutocompleteModule } from '@sd-angular/core/autocomplete';\r\nimport { SdButtonModule } from '@sd-angular/core/button';\r\nimport { SdDateRangeModule } from '@sd-angular/core/date-range';\r\nimport { SdDateTimeModule } from '@sd-angular/core/date-time';\r\nimport { SdEditorModule } from '@sd-angular/core/editor';\r\nimport { SdInputModule } from '@sd-angular/core/input';\r\nimport { SdInputCurrencyModule } from '@sd-angular/core/input-currency';\r\nimport { SdModalModule } from '@sd-angular/core/modal';\r\nimport { SdRadioModule } from '@sd-angular/core/radio';\r\nimport { SdSelectModule } from '@sd-angular/core/select';\r\nimport { SdSelectEditorModule } from '@sd-angular/core/select-editor';\r\nimport { SdSwitchModule } from '@sd-angular/core/switch';\r\nimport { SdUploadFileModule } from '@sd-angular/core/upload-file';\r\nimport { SdChipModule } from '@sd-angular/core/chip';\r\nimport { SdTextareaModule } from '@sd-angular/core/textarea';\r\nimport { SdUtilityModule } from '@sd-angular/core/utility';\r\nimport { SdCheckboxModule } from '@sd-angular/core/checkbox';\r\nimport { SdLabelModule } from '@sd-angular/core/label';\r\nimport { SdTimeModule } from '@sd-angular/core/time';\r\nimport { SdSideDrawerModule } from '@sd-angular/core/side-drawer';\r\nimport { SdQuickActionModule } from '@sd-angular/core/quick-action';\r\nimport { SdBadgeModule } from '@sd-angular/core/badge';\r\nimport { SdModalResizableModule } from '@sd-angular/core/modal-resizable';\r\n\r\n@NgModule({\r\n imports: [\r\n FormsModule,\r\n ReactiveFormsModule,\r\n SdModalModule,\r\n SdSideDrawerModule,\r\n SdLabelModule,\r\n SdUploadFileModule,\r\n SdDateRangeModule,\r\n SdDateTimeModule,\r\n SdTimeModule,\r\n SdButtonModule,\r\n SdAutocompleteModule,\r\n SdInputModule,\r\n SdInputCurrencyModule,\r\n SdSelectModule,\r\n SdSelectEditorModule,\r\n SdEditorModule,\r\n SdSwitchModule,\r\n SdRadioModule,\r\n SdChipModule,\r\n SdTextareaModule,\r\n SdCheckboxModule,\r\n SdUtilityModule,\r\n SdQuickActionModule,\r\n SdBadgeModule,\r\n SdModalResizableModule\r\n ],\r\n declarations: [\r\n ],\r\n providers: [\r\n ],\r\n exports: [\r\n FormsModule,\r\n ReactiveFormsModule,\r\n SdModalModule,\r\n SdSideDrawerModule,\r\n SdLabelModule,\r\n SdUploadFileModule,\r\n SdDateRangeModule,\r\n SdDateTimeModule,\r\n SdTimeModule,\r\n SdButtonModule,\r\n SdAutocompleteModule,\r\n SdInputModule,\r\n SdInputCurrencyModule,\r\n SdSelectModule,\r\n SdSelectEditorModule,\r\n SdEditorModule,\r\n SdSwitchModule,\r\n SdRadioModule,\r\n SdChipModule,\r\n SdTextareaModule,\r\n SdCheckboxModule,\r\n SdUtilityModule,\r\n SdQuickActionModule,\r\n SdBadgeModule,\r\n SdModalResizableModule\r\n ]\r\n})\r\nexport class SdFormModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;MAsFa,YAAY;;;YA5DxB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,WAAW;oBACX,mBAAmB;oBACnB,aAAa;oBACb,kBAAkB;oBAClB,aAAa;oBACb,kBAAkB;oBAClB,iBAAiB;oBACjB,gBAAgB;oBAChB,YAAY;oBACZ,cAAc;oBACd,oBAAoB;oBACpB,aAAa;oBACb,qBAAqB;oBACrB,cAAc;oBACd,oBAAoB;oBACpB,cAAc;oBACd,cAAc;oBACd,aAAa;oBACb,YAAY;oBACZ,gBAAgB;oBAChB,gBAAgB;oBAChB,eAAe;oBACf,mBAAmB;oBACnB,aAAa;oBACb,sBAAsB;iBACvB;gBACD,YAAY,EAAE,EACb;gBACD,SAAS,EAAE,EACV;gBACD,OAAO,EAAE;oBACP,WAAW;oBACX,mBAAmB;oBACnB,aAAa;oBACb,kBAAkB;oBAClB,aAAa;oBACb,kBAAkB;oBAClB,iBAAiB;oBACjB,gBAAgB;oBAChB,YAAY;oBACZ,cAAc;oBACd,oBAAoB;oBACpB,aAAa;oBACb,qBAAqB;oBACrB,cAAc;oBACd,oBAAoB;oBACpB,cAAc;oBACd,cAAc;oBACd,aAAa;oBACb,YAAY;oBACZ,gBAAgB;oBAChB,gBAAgB;oBAChB,eAAe;oBACf,mBAAmB;oBACnB,aAAa;oBACb,sBAAsB;iBACvB;aACF;;;ACrFD;;;;;;"}
|