@solidev/data 0.0.1-rc.1 → 0.0.1-rc.2
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/esm2020/lib/dispedit/richedit/richedit.component.mjs +56 -33
- package/esm2020/lib/utils/template.mjs +72 -0
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/solidev-data.mjs +129 -34
- package/fesm2015/solidev-data.mjs.map +1 -1
- package/fesm2020/solidev-data.mjs +128 -33
- package/fesm2020/solidev-data.mjs.map +1 -1
- package/lib/dispedit/richedit/richedit.component.d.ts +13 -11
- package/lib/utils/template.d.ts +1 -0
- package/package.json +2 -2
- package/public-api.d.ts +1 -0
|
@@ -4016,49 +4016,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
|
|
|
4016
4016
|
type: Input
|
|
4017
4017
|
}] } });
|
|
4018
4018
|
|
|
4019
|
+
const RichEditToolbars = {
|
|
4020
|
+
default: [
|
|
4021
|
+
['bold', 'italic'],
|
|
4022
|
+
['underline', 'strike'],
|
|
4023
|
+
['code', 'blockquote'],
|
|
4024
|
+
['ordered_list', 'bullet_list'],
|
|
4025
|
+
[{ heading: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] }],
|
|
4026
|
+
['link'],
|
|
4027
|
+
['text_color', 'background_color'],
|
|
4028
|
+
['align_left', 'align_center', 'align_right', 'align_justify'],
|
|
4029
|
+
],
|
|
4030
|
+
light: [
|
|
4031
|
+
['bold', 'italic', 'underline'],
|
|
4032
|
+
['ordered_list', 'bullet_list'],
|
|
4033
|
+
['text_color'],
|
|
4034
|
+
['align_left', 'align_center', 'align_right', 'align_justify'],
|
|
4035
|
+
],
|
|
4036
|
+
none: [],
|
|
4037
|
+
};
|
|
4019
4038
|
class RicheditComponent {
|
|
4020
4039
|
constructor() {
|
|
4021
4040
|
this.editable = true;
|
|
4022
4041
|
this.edit = true;
|
|
4023
4042
|
this.mode = 'dd';
|
|
4024
|
-
/**
|
|
4025
|
-
* Hide label (for inline forms)
|
|
4026
|
-
*/
|
|
4043
|
+
/** Hide label (for inline forms) */
|
|
4027
4044
|
this.hideLabel = false;
|
|
4028
|
-
/**
|
|
4029
|
-
* Hide button (for changed usage)
|
|
4030
|
-
*/
|
|
4045
|
+
/** Hide button (for changed usage) */
|
|
4031
4046
|
this.hideButton = false;
|
|
4047
|
+
/** Toolbar mode */
|
|
4048
|
+
this.toolbar = 'default';
|
|
4032
4049
|
this.changed = new EventEmitter();
|
|
4033
|
-
this.toolbar = [
|
|
4034
|
-
['bold', 'italic'],
|
|
4035
|
-
['underline', 'strike'],
|
|
4036
|
-
['code', 'blockquote'],
|
|
4037
|
-
['ordered_list', 'bullet_list'],
|
|
4038
|
-
[{ heading: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] }],
|
|
4039
|
-
['link'],
|
|
4040
|
-
['text_color', 'background_color'],
|
|
4041
|
-
['align_left', 'align_center', 'align_right', 'align_justify'],
|
|
4042
|
-
];
|
|
4043
4050
|
this.html = '';
|
|
4044
|
-
this.fc = new FormControl('');
|
|
4045
4051
|
}
|
|
4046
4052
|
ngOnInit() {
|
|
4047
4053
|
this.editor = new Editor();
|
|
4048
|
-
this.
|
|
4049
|
-
|
|
4050
|
-
if (this.model) {
|
|
4051
|
-
this.fc.setValue(this.model[this.field] || '', {
|
|
4052
|
-
emitEvent: false,
|
|
4053
|
-
});
|
|
4054
|
+
if (this.toolbar === 'light' || this.toolbar === 'default') {
|
|
4055
|
+
this.realToolbar = RichEditToolbars[this.toolbar];
|
|
4054
4056
|
}
|
|
4055
|
-
if (this.
|
|
4056
|
-
this.fc.enable();
|
|
4057
|
+
else if (this.toolbar === 'none') {
|
|
4057
4058
|
}
|
|
4058
4059
|
else {
|
|
4059
|
-
this.
|
|
4060
|
+
this.realToolbar = this.toolbar;
|
|
4061
|
+
}
|
|
4062
|
+
if (!this.fc) {
|
|
4063
|
+
this.fc = new FormControl('');
|
|
4064
|
+
if (this.model && this.field) {
|
|
4065
|
+
this.manager = this.model.FM(this.field);
|
|
4066
|
+
this.required = this.manager?.required || false;
|
|
4067
|
+
this.fc.setValue(this.model[this.field] || '', {
|
|
4068
|
+
emitEvent: false,
|
|
4069
|
+
});
|
|
4070
|
+
}
|
|
4071
|
+
if (this.edit) {
|
|
4072
|
+
this.fc.enable();
|
|
4073
|
+
}
|
|
4074
|
+
else {
|
|
4075
|
+
this.fc.disable();
|
|
4076
|
+
}
|
|
4077
|
+
this.fc.valueChanges.subscribe((v) => this.changed.emit(v));
|
|
4060
4078
|
}
|
|
4061
|
-
this.fc.valueChanges.subscribe((v) => this.changed.emit(v));
|
|
4062
4079
|
}
|
|
4063
4080
|
// make sure to destory the editor
|
|
4064
4081
|
ngOnDestroy() {
|
|
@@ -4081,17 +4098,19 @@ class RicheditComponent {
|
|
|
4081
4098
|
}
|
|
4082
4099
|
}
|
|
4083
4100
|
async save() {
|
|
4084
|
-
this.model
|
|
4085
|
-
|
|
4086
|
-
|
|
4101
|
+
if (this.model && this.field) {
|
|
4102
|
+
this.model.setFV(this.field, this.fc.value);
|
|
4103
|
+
if (this.mode === 'dd') {
|
|
4104
|
+
await firstValueFrom(this.model.save({ updateModel: true }));
|
|
4105
|
+
}
|
|
4087
4106
|
}
|
|
4088
4107
|
}
|
|
4089
4108
|
}
|
|
4090
4109
|
RicheditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RicheditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4091
|
-
RicheditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: RicheditComponent, isStandalone: true, selector: "data-richedit", inputs: { model: "model", field: "field", editable: "editable", edit: "edit", mode: "mode", hideLabel: "hideLabel", hideButton: "hideButton" }, outputs: { changed: "changed" }, ngImport: i0, template: "\n<ng-template #editorTemplate>\n <div class=\"NgxEditor__Wrapper\">\n <ngx-editor-menu [editor]=\"editor\" [toolbar]=\"
|
|
4110
|
+
RicheditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: RicheditComponent, isStandalone: true, selector: "data-richedit", inputs: { model: "model", field: "field", editable: "editable", edit: "edit", mode: "mode", hideLabel: "hideLabel", hideButton: "hideButton", fc: "fc", toolbar: "toolbar" }, outputs: { changed: "changed" }, ngImport: i0, template: "\n<ng-template #editorTemplate>\n <div class=\"NgxEditor__Wrapper\">\n <ngx-editor-menu [editor]=\"editor\" [toolbar]=\"realToolbar\" *ngIf=\"edit && toolbar!=='none'\"></ngx-editor-menu>\n <ngx-editor [editor]=\"editor\" [formControl]=\"fc\" [placeholder]=\"''\"></ngx-editor>\n </div>\n <button class=\"btn btn-primary btn-sm w-100 mt-1\" *ngIf=\"edit && !hideButton\" (click)=\"save()\"><i class=\"bi bi-save me-2\"></i>Enregistrer</button>\n</ng-template>\n<ng-template #titleTpl>\n <ng-content></ng-content>\n</ng-template>\n<!-- Dd display-->\n<ng-container *ngIf=\"mode==='dd'\">\n <dt [class.required]=\"required\" *ngIf=\"!hideLabel\"><span class=\"editable\" (click)=\"toggleEdit()\" role=\"button\">\n <ng-container *ngTemplateOutlet=\"titleTpl\"></ng-container></span></dt>\n <dd [class.mb-0]=\"hideLabel\">\n <ng-container *ngTemplateOutlet=\"editorTemplate\"></ng-container>\n </dd>\n</ng-container>\n<!-- Inline display-->\n<ng-container *ngIf=\"mode==='inline'\">\n <ng-container *ngIf=\"!hideLabel\">\n <label [class.required]=\"required\">\n <ng-container *ngTemplateOutlet=\"titleTpl\"></ng-container>\n </label>\n </ng-container>\n <ng-container *ngTemplateOutlet=\"editorTemplate\"></ng-container>\n</ng-container>\n<!-- Form display-->\n<ng-container *ngIf=\"mode==='form'\">\n <ng-container *ngIf=\"!hideLabel\">\n <label [class.required]=\"required\">\n <ng-container *ngTemplateOutlet=\"titleTpl\"></ng-container>\n </label>\n </ng-container>\n <ng-container *ngTemplateOutlet=\"editorTemplate\"></ng-container>\n</ng-container>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: NgxEditorModule }, { kind: "component", type: i2$3.NgxEditorComponent, selector: "ngx-editor", inputs: ["editor", "outputFormat", "placeholder"], outputs: ["focusOut", "focusIn"] }, { kind: "component", type: i2$3.MenuComponent, selector: "ngx-editor-menu", inputs: ["toolbar", "colorPresets", "disabled", "editor", "customMenuRef", "dropdownPlacement"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
4092
4111
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RicheditComponent, decorators: [{
|
|
4093
4112
|
type: Component,
|
|
4094
|
-
args: [{ selector: 'data-richedit', standalone: true, imports: [CommonModule, NgxEditorModule, ReactiveFormsModule], template: "\n<ng-template #editorTemplate>\n <div class=\"NgxEditor__Wrapper\">\n <ngx-editor-menu [editor]=\"editor\" [toolbar]=\"
|
|
4113
|
+
args: [{ selector: 'data-richedit', standalone: true, imports: [CommonModule, NgxEditorModule, ReactiveFormsModule], template: "\n<ng-template #editorTemplate>\n <div class=\"NgxEditor__Wrapper\">\n <ngx-editor-menu [editor]=\"editor\" [toolbar]=\"realToolbar\" *ngIf=\"edit && toolbar!=='none'\"></ngx-editor-menu>\n <ngx-editor [editor]=\"editor\" [formControl]=\"fc\" [placeholder]=\"''\"></ngx-editor>\n </div>\n <button class=\"btn btn-primary btn-sm w-100 mt-1\" *ngIf=\"edit && !hideButton\" (click)=\"save()\"><i class=\"bi bi-save me-2\"></i>Enregistrer</button>\n</ng-template>\n<ng-template #titleTpl>\n <ng-content></ng-content>\n</ng-template>\n<!-- Dd display-->\n<ng-container *ngIf=\"mode==='dd'\">\n <dt [class.required]=\"required\" *ngIf=\"!hideLabel\"><span class=\"editable\" (click)=\"toggleEdit()\" role=\"button\">\n <ng-container *ngTemplateOutlet=\"titleTpl\"></ng-container></span></dt>\n <dd [class.mb-0]=\"hideLabel\">\n <ng-container *ngTemplateOutlet=\"editorTemplate\"></ng-container>\n </dd>\n</ng-container>\n<!-- Inline display-->\n<ng-container *ngIf=\"mode==='inline'\">\n <ng-container *ngIf=\"!hideLabel\">\n <label [class.required]=\"required\">\n <ng-container *ngTemplateOutlet=\"titleTpl\"></ng-container>\n </label>\n </ng-container>\n <ng-container *ngTemplateOutlet=\"editorTemplate\"></ng-container>\n</ng-container>\n<!-- Form display-->\n<ng-container *ngIf=\"mode==='form'\">\n <ng-container *ngIf=\"!hideLabel\">\n <label [class.required]=\"required\">\n <ng-container *ngTemplateOutlet=\"titleTpl\"></ng-container>\n </label>\n </ng-container>\n <ng-container *ngTemplateOutlet=\"editorTemplate\"></ng-container>\n</ng-container>" }]
|
|
4095
4114
|
}], propDecorators: { model: [{
|
|
4096
4115
|
type: Input
|
|
4097
4116
|
}], field: [{
|
|
@@ -4106,6 +4125,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
|
|
|
4106
4125
|
type: Input
|
|
4107
4126
|
}], hideButton: [{
|
|
4108
4127
|
type: Input
|
|
4128
|
+
}], fc: [{
|
|
4129
|
+
type: Input
|
|
4130
|
+
}], toolbar: [{
|
|
4131
|
+
type: Input
|
|
4109
4132
|
}], changed: [{
|
|
4110
4133
|
type: Output
|
|
4111
4134
|
}] } });
|
|
@@ -5617,6 +5640,78 @@ const slugify = (str) => {
|
|
|
5617
5640
|
return str;
|
|
5618
5641
|
};
|
|
5619
5642
|
|
|
5643
|
+
// By default, Underscore uses ERB-style template delimiters, change the
|
|
5644
|
+
// following template settings to use alternative delimiters.
|
|
5645
|
+
const settings = {
|
|
5646
|
+
evaluate: /<%([\s\S]+?)%>/g,
|
|
5647
|
+
interpolate: /<%=([\s\S]+?)%>/g,
|
|
5648
|
+
escape: /<%-([\s\S]+?)%>/g,
|
|
5649
|
+
variable: 'obj',
|
|
5650
|
+
};
|
|
5651
|
+
// When customizing `templateSettings`, if you don't want to define an
|
|
5652
|
+
// interpolation, evaluation or escaping regex, we need one that is
|
|
5653
|
+
// guaranteed not to match.
|
|
5654
|
+
const noMatch = /.^/;
|
|
5655
|
+
// Certain characters need to be escaped so that they can be put into a
|
|
5656
|
+
// string literal.
|
|
5657
|
+
let escapes = {
|
|
5658
|
+
'\\': '\\',
|
|
5659
|
+
"'": "'",
|
|
5660
|
+
r: '\r',
|
|
5661
|
+
n: '\n',
|
|
5662
|
+
t: '\t',
|
|
5663
|
+
u2028: '\u2028',
|
|
5664
|
+
u2029: '\u2029',
|
|
5665
|
+
};
|
|
5666
|
+
for (let p in escapes) {
|
|
5667
|
+
escapes[escapes[p]] = p;
|
|
5668
|
+
}
|
|
5669
|
+
const escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
|
|
5670
|
+
const unescaper = /\\(\\|'|r|n|t|u2028|u2029)/g;
|
|
5671
|
+
const tmpl = (text, data, objectName) => {
|
|
5672
|
+
if (objectName) {
|
|
5673
|
+
settings.variable = objectName;
|
|
5674
|
+
}
|
|
5675
|
+
// Compile the template source, taking care to escape characters that
|
|
5676
|
+
// cannot be included in a string literal and then unescape them in code
|
|
5677
|
+
// blocks.
|
|
5678
|
+
let source = "__p+='" +
|
|
5679
|
+
text
|
|
5680
|
+
.replace(escaper, function (match) {
|
|
5681
|
+
return '\\' + escapes[match];
|
|
5682
|
+
})
|
|
5683
|
+
.replace(settings.escape || noMatch, function (match, code) {
|
|
5684
|
+
return "'+\n_.escape(" + unescape(code) + ")+\n'";
|
|
5685
|
+
})
|
|
5686
|
+
.replace(settings.interpolate || noMatch, function (match, code) {
|
|
5687
|
+
return "'+\n(" + unescape(code) + ")+\n'";
|
|
5688
|
+
})
|
|
5689
|
+
.replace(settings.evaluate || noMatch, function (match, code) {
|
|
5690
|
+
return "';\n" + unescape(code) + "\n;__p+='";
|
|
5691
|
+
}) +
|
|
5692
|
+
"';\n";
|
|
5693
|
+
// If a variable is not specified, place data values in local scope.
|
|
5694
|
+
if (!settings.variable) {
|
|
5695
|
+
source = 'with(obj||{}){\n' + source + '}\n';
|
|
5696
|
+
}
|
|
5697
|
+
source =
|
|
5698
|
+
"var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n" +
|
|
5699
|
+
source +
|
|
5700
|
+
'return __p;\n';
|
|
5701
|
+
var render = new Function(settings.variable || 'obj', source);
|
|
5702
|
+
if (data) {
|
|
5703
|
+
return render(data);
|
|
5704
|
+
}
|
|
5705
|
+
const template = (data) => {
|
|
5706
|
+
return render.call(this, data);
|
|
5707
|
+
};
|
|
5708
|
+
// Provide the compiled function source as a convenience for build time
|
|
5709
|
+
// precompilation.
|
|
5710
|
+
template.source =
|
|
5711
|
+
'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
|
|
5712
|
+
return template;
|
|
5713
|
+
};
|
|
5714
|
+
|
|
5620
5715
|
class UpdateService {
|
|
5621
5716
|
constructor(appRef, swUpdate) {
|
|
5622
5717
|
this.appRef = appRef;
|
|
@@ -5690,6 +5785,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
|
|
|
5690
5785
|
* Generated bundle index. Do not edit.
|
|
5691
5786
|
*/
|
|
5692
5787
|
|
|
5693
|
-
export { AuthInterceptor, AuthServiceBase, BanAdapter, BootstrapDataDisplayConfig, BreadcrumbComponent, ChoicePipe, Collection, CollectionMock, DATA_API_URL, DATA_AUTH_PARAMS, DATA_AUTH_SERVICE, DATA_AUTH_USER_SERVICE, DATA_DISPLAY_CONFIG, DATA_MAX_TRANSFERSTATE_TIME, DATA_MESSAGE_SOUNDS, DEFAULT_TIMEOUTS, DataBackend, DataMessageService, DataModel, DataUploaderService, DispeditComponent, FactorPipe, FactorcPipe, FkselectComponent, FlagsComponent, Jwt, Link, M2mselectComponent, Message, MessageZoneComponent, ModelList, ModelListAutocompleteFilter, ModelListAutocompleteMultiFilter, ModelListDateFilter, ModelListDatetimeFilter, ModelListDatetimerangeFilter, ModelListFieldHeaderComponent, ModelListFieldsSelectorComponent, ModelListFilters, ModelListFiltersComponent, ModelListFiltersSelectComponent, ModelListFlagsFilter, ModelListGeodistanceFilter, ModelListNumberFilter, ModelListNumberOperations, ModelListPaginatorComponent, ModelListSelectFilter, ModelListSelectMultiFilter, ModelListService, ModelListSorterComponent, ModelListTextFilter, ModelListTreeFilter, NavDriver, NgFileDropDirective, NgFileSelectDirective, NgxUploaderModule, PChoicePipe, PFactorPipe, PFactorcPipe, Queryset, RData, RicheditComponent, STATUS, SafeDeleteComponent, TabMemoryService, UpdateComponent, UpdateService, UploadStatus, booleanField, charField, computedField, dateField, datetimeField, decimalField, detailsField, emailField, floatField, foreignKeyField, humanizeBytes, integerField, isValue, manyToManyField, passwordField, primaryField, reverseForeignKeyField, slugify, strToNumber, textField };
|
|
5788
|
+
export { AuthInterceptor, AuthServiceBase, BanAdapter, BootstrapDataDisplayConfig, BreadcrumbComponent, ChoicePipe, Collection, CollectionMock, DATA_API_URL, DATA_AUTH_PARAMS, DATA_AUTH_SERVICE, DATA_AUTH_USER_SERVICE, DATA_DISPLAY_CONFIG, DATA_MAX_TRANSFERSTATE_TIME, DATA_MESSAGE_SOUNDS, DEFAULT_TIMEOUTS, DataBackend, DataMessageService, DataModel, DataUploaderService, DispeditComponent, FactorPipe, FactorcPipe, FkselectComponent, FlagsComponent, Jwt, Link, M2mselectComponent, Message, MessageZoneComponent, ModelList, ModelListAutocompleteFilter, ModelListAutocompleteMultiFilter, ModelListDateFilter, ModelListDatetimeFilter, ModelListDatetimerangeFilter, ModelListFieldHeaderComponent, ModelListFieldsSelectorComponent, ModelListFilters, ModelListFiltersComponent, ModelListFiltersSelectComponent, ModelListFlagsFilter, ModelListGeodistanceFilter, ModelListNumberFilter, ModelListNumberOperations, ModelListPaginatorComponent, ModelListSelectFilter, ModelListSelectMultiFilter, ModelListService, ModelListSorterComponent, ModelListTextFilter, ModelListTreeFilter, NavDriver, NgFileDropDirective, NgFileSelectDirective, NgxUploaderModule, PChoicePipe, PFactorPipe, PFactorcPipe, Queryset, RData, RichEditToolbars, RicheditComponent, STATUS, SafeDeleteComponent, TabMemoryService, UpdateComponent, UpdateService, UploadStatus, booleanField, charField, computedField, dateField, datetimeField, decimalField, detailsField, emailField, floatField, foreignKeyField, humanizeBytes, integerField, isValue, manyToManyField, passwordField, primaryField, reverseForeignKeyField, slugify, strToNumber, textField, tmpl };
|
|
5694
5789
|
//# sourceMappingURL=solidev-data.mjs.map
|
|
5695
5790
|
//# sourceMappingURL=solidev-data.mjs.map
|