@wawjs/ngx-bos 22.0.0
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/AGENTS.md +23 -0
- package/README.md +105 -0
- package/RELEASES.md +21 -0
- package/ai/architecture.md +40 -0
- package/ai/code-style.md +33 -0
- package/ai/decisions/2026-06-02-browser-only-bos-spa.md +16 -0
- package/ai/decisions/2026-06-02-package-boundary.md +22 -0
- package/ai/decisions/2026-06-02-version-start.md +12 -0
- package/ai/decisions/index.md +7 -0
- package/ai/onboarding.md +19 -0
- package/ai/task-execution.md +35 -0
- package/ai/tooling.md +33 -0
- package/fesm2022/wawjs-ngx-bos.mjs +2287 -0
- package/fesm2022/wawjs-ngx-bos.mjs.map +1 -0
- package/package.json +38 -0
- package/src/feature/file/file.component.html +123 -0
- package/src/feature/file/file.component.scss +209 -0
- package/src/feature/file/file.component.ts +220 -0
- package/src/feature/file/file.const.ts +20 -0
- package/src/feature/file/file.interface.ts +12 -0
- package/src/feature/file/file.service.ts +34 -0
- package/src/feature/file/file.util.ts +72 -0
- package/src/feature/file/index.ts +9 -0
- package/src/feature/file/pages/files/files.component.html +12 -0
- package/src/feature/file/pages/files/files.component.ts +117 -0
- package/src/feature/file/pages/files/files.routes.ts +9 -0
- package/src/feature/file/selectors/file/file-selector.component.html +11 -0
- package/src/feature/file/selectors/file/file-selector.component.ts +27 -0
- package/src/feature/user/LICENSE +21 -0
- package/src/feature/user/README.md +1 -0
- package/src/feature/user/components/user-preview/user-preview.component.html +7 -0
- package/src/feature/user/components/user-preview/user-preview.component.scss +27 -0
- package/src/feature/user/components/user-preview/user-preview.component.ts +16 -0
- package/src/feature/user/guards/admins.guard.ts +22 -0
- package/src/feature/user/guards/authenticated.guard.ts +14 -0
- package/src/feature/user/guards/guest.guard.ts +14 -0
- package/src/feature/user/module.json +1 -0
- package/src/feature/user/pages/clients/clients.component.html +8 -0
- package/src/feature/user/pages/clients/clients.component.scss +0 -0
- package/src/feature/user/pages/clients/clients.component.ts +45 -0
- package/src/feature/user/pages/clients/clients.routes.ts +9 -0
- package/src/feature/user/pages/users/users.component.html +18 -0
- package/src/feature/user/pages/users/users.component.ts +57 -0
- package/src/feature/user/pages/users/users.routes.ts +9 -0
- package/src/feature/user/selectors/user/user-selector.component.html +6 -0
- package/src/feature/user/selectors/user/user-selector.component.scss +0 -0
- package/src/feature/user/selectors/user/user-selector.component.ts +17 -0
- package/src/feature/user/user.const.ts +13 -0
- package/src/feature/user/user.form.ts +54 -0
- package/src/feature/user/user.interface.ts +12 -0
- package/src/feature/user/user.service.ts +176 -0
- package/src/form-components/ace/ace.component.html +14 -0
- package/src/form-components/ace/ace.component.scss +22 -0
- package/src/form-components/ace/ace.component.ts +210 -0
- package/src/form-components/ace/ace.form.ts +184 -0
- package/src/form-components/button/button.component.html +15 -0
- package/src/form-components/button/button.component.ts +31 -0
- package/src/form-components/button/button.form.ts +74 -0
- package/src/form-components/file/file.component.html +73 -0
- package/src/form-components/file/file.component.ts +91 -0
- package/src/form-components/file/file.form.ts +112 -0
- package/src/form-components/form-bridge.interface.ts +27 -0
- package/src/form-components/index.ts +85 -0
- package/src/form-components/input/input.component.html +16 -0
- package/src/form-components/input/input.component.ts +31 -0
- package/src/form-components/input/input.form.ts +117 -0
- package/src/form-components/select/select.component.html +24 -0
- package/src/form-components/select/select.component.ts +31 -0
- package/src/form-components/select/select.form.ts +88 -0
- package/src/form-components/tinymce/tinymce.component.html +13 -0
- package/src/form-components/tinymce/tinymce.component.scss +19 -0
- package/src/form-components/tinymce/tinymce.component.ts +221 -0
- package/src/form-components/tinymce/tinymce.form.ts +191 -0
- package/src/icons/spider/LICENSE +21 -0
- package/src/icons/spider/README.md +127 -0
- package/src/icons/spider/index.ts +1 -0
- package/src/icons/spider/module.json +4 -0
- package/src/icons/spider/spider.component.html +115 -0
- package/src/icons/spider/spider.component.scss +20 -0
- package/src/icons/spider/spider.component.ts +20 -0
- package/src/ngx-bos.config.ts +55 -0
- package/src/pages/form/form.component.html +9 -0
- package/src/pages/form/form.component.ts +86 -0
- package/src/pages/form/form.routes.ts +9 -0
- package/src/pages/forms/forms.component.html +9 -0
- package/src/pages/forms/forms.component.ts +77 -0
- package/src/pages/forms/forms.routes.ts +9 -0
- package/src/pipes/phone.pipe.ts +17 -0
- package/src/public-api.ts +36 -0
- package/types/wawjs-ngx-bos.d.ts +332 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export const fileForm = {
|
|
2
|
+
formId: 'file',
|
|
3
|
+
title: 'File',
|
|
4
|
+
components: [
|
|
5
|
+
{
|
|
6
|
+
name: 'Input',
|
|
7
|
+
key: 'label',
|
|
8
|
+
focused: true,
|
|
9
|
+
props: {
|
|
10
|
+
label: 'Label',
|
|
11
|
+
placeholder: 'Enter file field label...',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Input',
|
|
16
|
+
key: 'placeholder',
|
|
17
|
+
props: {
|
|
18
|
+
label: 'Placeholder',
|
|
19
|
+
placeholder: 'Select file',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Select',
|
|
24
|
+
key: 'mode',
|
|
25
|
+
props: {
|
|
26
|
+
label: 'Mode',
|
|
27
|
+
placeholder: 'Select mode...',
|
|
28
|
+
items: [
|
|
29
|
+
'single-image',
|
|
30
|
+
'single-file',
|
|
31
|
+
'multi-image',
|
|
32
|
+
'multi-file',
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Select',
|
|
38
|
+
key: 'view',
|
|
39
|
+
props: {
|
|
40
|
+
label: 'View',
|
|
41
|
+
placeholder: 'Select view...',
|
|
42
|
+
items: ['dropzone', 'list', 'thumb-only'],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Input',
|
|
47
|
+
key: 'accept',
|
|
48
|
+
props: {
|
|
49
|
+
label: 'Accept',
|
|
50
|
+
placeholder: 'Example: image/*, application/pdf',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Input',
|
|
55
|
+
key: 'preview',
|
|
56
|
+
props: {
|
|
57
|
+
label: 'Show image preview',
|
|
58
|
+
type: 'checkbox',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Input',
|
|
63
|
+
key: 'clearable',
|
|
64
|
+
props: {
|
|
65
|
+
label: 'Allow clear',
|
|
66
|
+
type: 'checkbox',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Input',
|
|
71
|
+
key: 'cropWidth',
|
|
72
|
+
props: {
|
|
73
|
+
label: 'Crop width (px)',
|
|
74
|
+
placeholder: 'Example: 1080',
|
|
75
|
+
type: 'number',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'Input',
|
|
80
|
+
key: 'cropHeight',
|
|
81
|
+
props: {
|
|
82
|
+
label: 'Crop height (px)',
|
|
83
|
+
placeholder: 'Example: 1080',
|
|
84
|
+
type: 'number',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'Input',
|
|
89
|
+
key: 'container',
|
|
90
|
+
props: {
|
|
91
|
+
label: 'Backend container',
|
|
92
|
+
placeholder: 'general, avatars, products...',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Input',
|
|
97
|
+
key: 'name',
|
|
98
|
+
props: {
|
|
99
|
+
label: 'File name / prefix',
|
|
100
|
+
placeholder: 'Optional file name prefix...',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Input',
|
|
105
|
+
key: 'disabled',
|
|
106
|
+
props: {
|
|
107
|
+
label: 'Disabled',
|
|
108
|
+
type: 'checkbox',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shape of the dynamic `data` payload handed to template-bridge components by
|
|
3
|
+
* the wform engine. The engine populates a subset of these per field, so every
|
|
4
|
+
* member is optional and consumers must feature-detect before use.
|
|
5
|
+
*/
|
|
6
|
+
export interface FormBridgeFieldState {
|
|
7
|
+
value?: (() => unknown) & { set?: (value: unknown) => void };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type FormBridgeField = (() => FormBridgeFieldState) &
|
|
11
|
+
Record<string, unknown>;
|
|
12
|
+
|
|
13
|
+
export type FormBridgeModel = (() => Record<string, unknown>) & {
|
|
14
|
+
update?: (
|
|
15
|
+
updater: (current: Record<string, unknown>) => Record<string, unknown>,
|
|
16
|
+
) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export interface FormBridgeData {
|
|
20
|
+
key?: string | null;
|
|
21
|
+
field?: FormBridgeField;
|
|
22
|
+
model?: FormBridgeModel;
|
|
23
|
+
submition?: Record<string, unknown>;
|
|
24
|
+
props?: Record<string, unknown>;
|
|
25
|
+
component?: { class?: string; disabled?: boolean };
|
|
26
|
+
wChange?: () => void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
APP_INITIALIZER,
|
|
3
|
+
ApplicationRef,
|
|
4
|
+
EnvironmentInjector,
|
|
5
|
+
Provider,
|
|
6
|
+
Type,
|
|
7
|
+
createComponent,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { FormInterface } from '@wawjs/ngx-form';
|
|
10
|
+
import { AceFormComponent } from './ace/ace.component';
|
|
11
|
+
import { aceForm } from './ace/ace.form';
|
|
12
|
+
import { ButtonFormComponent } from './button/button.component';
|
|
13
|
+
import { buttonForm } from './button/button.form';
|
|
14
|
+
import { FileFormComponent } from './file/file.component';
|
|
15
|
+
import { fileForm } from './file/file.form';
|
|
16
|
+
import { InputFormComponent } from './input/input.component';
|
|
17
|
+
import { inputForm } from './input/input.form';
|
|
18
|
+
import { SelectFormComponent } from './select/select.component';
|
|
19
|
+
import { selectForm } from './select/select.form';
|
|
20
|
+
import { TinymceFormComponent } from './tinymce/tinymce.component';
|
|
21
|
+
import { tinymceForm } from './tinymce/tinymce.form';
|
|
22
|
+
/* components */
|
|
23
|
+
|
|
24
|
+
export const FORM_COMPONENTS = [
|
|
25
|
+
'Input',
|
|
26
|
+
'Select',
|
|
27
|
+
'File',
|
|
28
|
+
'Button',
|
|
29
|
+
'Ace',
|
|
30
|
+
'Tinymce',
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export const FORM_COMPONENT_FORM = (key: string): FormInterface => {
|
|
34
|
+
return {
|
|
35
|
+
Input: inputForm,
|
|
36
|
+
Select: selectForm,
|
|
37
|
+
File: fileForm,
|
|
38
|
+
Button: buttonForm,
|
|
39
|
+
Ace: aceForm,
|
|
40
|
+
Tinymce: tinymceForm,
|
|
41
|
+
}[key] as FormInterface;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Central registry: template name → component class.
|
|
46
|
+
* Names must match `component.name` in form schema (e.g. `{ name: 'Input', ... }`)
|
|
47
|
+
* and what the template component passes into FormService.addTemplateComponent().
|
|
48
|
+
*/
|
|
49
|
+
export const FORM_TEMPLATE_COMPONENTS: Record<string, Type<unknown>> = {
|
|
50
|
+
Input: InputFormComponent,
|
|
51
|
+
Select: SelectFormComponent,
|
|
52
|
+
File: FileFormComponent,
|
|
53
|
+
Button: ButtonFormComponent,
|
|
54
|
+
Ace: AceFormComponent,
|
|
55
|
+
Tinymce: TinymceFormComponent,
|
|
56
|
+
/* addComponents */
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function registerFormTemplatesFactory(
|
|
60
|
+
injector: EnvironmentInjector,
|
|
61
|
+
appRef: ApplicationRef,
|
|
62
|
+
): () => void {
|
|
63
|
+
return () => {
|
|
64
|
+
// Instantiate each template component once so their ngOnInit runs
|
|
65
|
+
// and they call FormService.addTemplateComponent(name, templateRef)
|
|
66
|
+
Object.values(FORM_TEMPLATE_COMPONENTS).forEach((cmp) => {
|
|
67
|
+
const ref = createComponent(cmp, {
|
|
68
|
+
environmentInjector: injector,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
appRef.attachView(ref.hostView);
|
|
72
|
+
(ref.hostView as any).detectChanges?.();
|
|
73
|
+
// no DOM insertion – purely for registration side-effects
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const provideFormComponents = (): Provider => {
|
|
79
|
+
return {
|
|
80
|
+
provide: APP_INITIALIZER,
|
|
81
|
+
multi: true,
|
|
82
|
+
useFactory: registerFormTemplatesFactory,
|
|
83
|
+
deps: [EnvironmentInjector, ApplicationRef],
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<ng-template #templateRef let-data>
|
|
2
|
+
<winput
|
|
3
|
+
[formField]="data.field"
|
|
4
|
+
[label]="data.props.label ?? inputDefaults.label"
|
|
5
|
+
[placeholder]="data.props.placeholder ?? inputDefaults.placeholder"
|
|
6
|
+
[type]="data.props.type ?? inputDefaults.type"
|
|
7
|
+
[name]="data.props.name || data.key || inputDefaults.name"
|
|
8
|
+
[items]="data.props.items ?? inputDefaults.items"
|
|
9
|
+
[disabled]="!!data.props.disabled || !!data.component?.disabled"
|
|
10
|
+
[focused]="data.props.focused ?? inputDefaults.focused"
|
|
11
|
+
[clearable]="data.props.clearable ?? inputDefaults.clearable"
|
|
12
|
+
[wClass]="data.props.wClass ?? inputDefaults.wClass"
|
|
13
|
+
[autocomplete]="data.props.autocomplete ?? inputDefaults.autocomplete"
|
|
14
|
+
[error]="data.props.error ?? inputDefaults.error"
|
|
15
|
+
></winput>
|
|
16
|
+
</ng-template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
OnInit,
|
|
4
|
+
TemplateRef,
|
|
5
|
+
inject,
|
|
6
|
+
viewChild,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import { FormService } from '@wawjs/ngx-form';
|
|
9
|
+
import { InputComponent, inputDefaults } from '@wawjs/ngx-ui';
|
|
10
|
+
|
|
11
|
+
interface Interface {}
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
imports: [InputComponent],
|
|
15
|
+
templateUrl: './input.component.html',
|
|
16
|
+
})
|
|
17
|
+
export class InputFormComponent implements OnInit {
|
|
18
|
+
private readonly _formService = inject(FormService);
|
|
19
|
+
|
|
20
|
+
readonly templateRef =
|
|
21
|
+
viewChild.required<TemplateRef<Interface>>('templateRef');
|
|
22
|
+
|
|
23
|
+
readonly inputDefaults = inputDefaults;
|
|
24
|
+
|
|
25
|
+
ngOnInit(): void {
|
|
26
|
+
this._formService.addTemplateComponent<Interface>(
|
|
27
|
+
'Input',
|
|
28
|
+
this.templateRef(),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export const inputForm = {
|
|
2
|
+
formId: 'form',
|
|
3
|
+
title: 'Form',
|
|
4
|
+
components: [
|
|
5
|
+
{
|
|
6
|
+
name: 'Input',
|
|
7
|
+
key: 'label',
|
|
8
|
+
focused: true,
|
|
9
|
+
props: {
|
|
10
|
+
placeholder: 'Enter component label...',
|
|
11
|
+
label: 'Label',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Input',
|
|
16
|
+
key: 'placeholder',
|
|
17
|
+
props: {
|
|
18
|
+
placeholder: 'Enter component placeholder...',
|
|
19
|
+
label: 'Placeholder',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Select',
|
|
24
|
+
key: 'type',
|
|
25
|
+
props: {
|
|
26
|
+
placeholder: 'Enter component type...',
|
|
27
|
+
label: 'Type',
|
|
28
|
+
items: [
|
|
29
|
+
'text',
|
|
30
|
+
'password',
|
|
31
|
+
'email',
|
|
32
|
+
'radio',
|
|
33
|
+
'checkbox',
|
|
34
|
+
'textarea',
|
|
35
|
+
'search',
|
|
36
|
+
'tel',
|
|
37
|
+
'url',
|
|
38
|
+
'number',
|
|
39
|
+
'range',
|
|
40
|
+
'color',
|
|
41
|
+
'date',
|
|
42
|
+
'month',
|
|
43
|
+
'week',
|
|
44
|
+
'time',
|
|
45
|
+
'datetime',
|
|
46
|
+
'datetime-local',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Input',
|
|
52
|
+
key: 'name',
|
|
53
|
+
props: {
|
|
54
|
+
placeholder: 'Enter HTML name attribute...',
|
|
55
|
+
label: 'Name',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'Input',
|
|
60
|
+
key: 'autocomplete',
|
|
61
|
+
props: {
|
|
62
|
+
placeholder:
|
|
63
|
+
'Enter autocomplete (email, name, current-password, off...)',
|
|
64
|
+
label: 'Autocomplete',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'Input',
|
|
69
|
+
key: 'wClass',
|
|
70
|
+
props: {
|
|
71
|
+
placeholder: 'Enter extra CSS classes...',
|
|
72
|
+
label: 'CSS classes',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'Input',
|
|
77
|
+
key: 'items',
|
|
78
|
+
props: {
|
|
79
|
+
label: 'Items (for radio / checkbox)',
|
|
80
|
+
placeholder: 'Option 1, Option 2, Option 3...',
|
|
81
|
+
type: 'textarea',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'Input',
|
|
86
|
+
key: 'clearable',
|
|
87
|
+
props: {
|
|
88
|
+
label: 'Clearable',
|
|
89
|
+
type: 'checkbox',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'Input',
|
|
94
|
+
key: 'disabled',
|
|
95
|
+
props: {
|
|
96
|
+
label: 'Disabled',
|
|
97
|
+
type: 'checkbox',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'Input',
|
|
102
|
+
key: 'focused',
|
|
103
|
+
props: {
|
|
104
|
+
label: 'Auto focus',
|
|
105
|
+
type: 'checkbox',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'Input',
|
|
110
|
+
key: 'error',
|
|
111
|
+
props: {
|
|
112
|
+
label: 'Custom error (optional)',
|
|
113
|
+
placeholder: 'Static error or i18n key...',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<ng-template #templateRef let-data>
|
|
2
|
+
<wselect
|
|
3
|
+
[formField]="data.formField"
|
|
4
|
+
[items]="data.props.items ?? selectDefaults.items"
|
|
5
|
+
[placeholder]="
|
|
6
|
+
data.props.placeholder ?? selectDefaults.placeholder
|
|
7
|
+
"
|
|
8
|
+
[label]="data.props.label ?? selectDefaults.label"
|
|
9
|
+
[bindLabel]="data.props.bindLabel ?? selectDefaults.bindLabel"
|
|
10
|
+
[bindValue]="data.props.bindValue ?? selectDefaults.bindValue"
|
|
11
|
+
[multiple]="data.props.multiple ?? selectDefaults.multiple"
|
|
12
|
+
[clearable]="data.props.clearable ?? selectDefaults.clearable"
|
|
13
|
+
[searchable]="data.props.searchable ?? selectDefaults.searchable"
|
|
14
|
+
[searchableBy]="
|
|
15
|
+
data.props.searchableBy ?? selectDefaults.searchableBy
|
|
16
|
+
"
|
|
17
|
+
[buttons]="data.props.buttons ?? selectDefaults.buttons"
|
|
18
|
+
[disabled]="
|
|
19
|
+
data.props.disabled === true ||
|
|
20
|
+
data.component.disabled === true
|
|
21
|
+
"
|
|
22
|
+
(wChange)="data.props.onChange?.($event)"
|
|
23
|
+
></wselect>
|
|
24
|
+
</ng-template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
OnInit,
|
|
4
|
+
TemplateRef,
|
|
5
|
+
inject,
|
|
6
|
+
viewChild,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import { FormService } from '@wawjs/ngx-form';
|
|
9
|
+
import { SelectComponent, selectDefaults } from '@wawjs/ngx-ui';
|
|
10
|
+
|
|
11
|
+
interface SelectTemplateContext {}
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
imports: [SelectComponent],
|
|
15
|
+
templateUrl: './select.component.html',
|
|
16
|
+
})
|
|
17
|
+
export class SelectFormComponent implements OnInit {
|
|
18
|
+
private readonly _formService = inject(FormService);
|
|
19
|
+
|
|
20
|
+
readonly templateRef =
|
|
21
|
+
viewChild.required<TemplateRef<SelectTemplateContext>>('templateRef');
|
|
22
|
+
|
|
23
|
+
readonly selectDefaults = selectDefaults;
|
|
24
|
+
|
|
25
|
+
ngOnInit(): void {
|
|
26
|
+
this._formService.addTemplateComponent<SelectTemplateContext>(
|
|
27
|
+
'Select',
|
|
28
|
+
this.templateRef(),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export const selectForm = {
|
|
2
|
+
formId: 'select',
|
|
3
|
+
title: 'Select',
|
|
4
|
+
components: [
|
|
5
|
+
{
|
|
6
|
+
name: 'Input',
|
|
7
|
+
key: 'label',
|
|
8
|
+
focused: true,
|
|
9
|
+
props: {
|
|
10
|
+
placeholder: 'Enter select label...',
|
|
11
|
+
label: 'Label',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Input',
|
|
16
|
+
key: 'placeholder',
|
|
17
|
+
props: {
|
|
18
|
+
placeholder: 'Enter select placeholder...',
|
|
19
|
+
label: 'Placeholder',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Input',
|
|
24
|
+
key: 'bindLabel',
|
|
25
|
+
props: {
|
|
26
|
+
placeholder: 'Enter label field (e.g. name)...',
|
|
27
|
+
label: 'Bind label',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Input',
|
|
32
|
+
key: 'bindValue',
|
|
33
|
+
props: {
|
|
34
|
+
placeholder: 'Enter value field (e.g. _id)...',
|
|
35
|
+
label: 'Bind value',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Input',
|
|
40
|
+
key: 'items',
|
|
41
|
+
props: {
|
|
42
|
+
label: 'Items',
|
|
43
|
+
placeholder: 'Option 1, Option 2, Option 3...',
|
|
44
|
+
type: 'textarea',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Input',
|
|
49
|
+
key: 'searchableBy',
|
|
50
|
+
props: {
|
|
51
|
+
label: 'Searchable by',
|
|
52
|
+
placeholder: 'name email ...',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Input',
|
|
57
|
+
key: 'multiple',
|
|
58
|
+
props: {
|
|
59
|
+
label: 'Multiple select',
|
|
60
|
+
type: 'checkbox',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Input',
|
|
65
|
+
key: 'clearable',
|
|
66
|
+
props: {
|
|
67
|
+
label: 'Clearable',
|
|
68
|
+
type: 'checkbox',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'Input',
|
|
73
|
+
key: 'searchable',
|
|
74
|
+
props: {
|
|
75
|
+
label: 'Searchable',
|
|
76
|
+
type: 'checkbox',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'Input',
|
|
81
|
+
key: 'disabled',
|
|
82
|
+
props: {
|
|
83
|
+
label: 'Disabled',
|
|
84
|
+
type: 'checkbox',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<ng-template #templateRef let-data>
|
|
2
|
+
<div class="w-tiny" [class]="data.component?.class">
|
|
3
|
+
<tinymce
|
|
4
|
+
class="w-tiny__editor"
|
|
5
|
+
[ngModel]="getValue(data)"
|
|
6
|
+
(ngModelChange)="onValueChange(data, $event)"
|
|
7
|
+
[config]="getConfig(data)"
|
|
8
|
+
[disabled]="isDisabled(data)"
|
|
9
|
+
[inline]="isInline(data)"
|
|
10
|
+
[placeholder]="getPlaceholder(data)"
|
|
11
|
+
></tinymce>
|
|
12
|
+
</div>
|
|
13
|
+
</ng-template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.w-tiny {
|
|
2
|
+
width: 100%;
|
|
3
|
+
background: var(--c-bg-secondary);
|
|
4
|
+
color: var(--c-text-primary);
|
|
5
|
+
border: 1px solid var(--c-border);
|
|
6
|
+
border-radius: var(--radius-card);
|
|
7
|
+
box-shadow: var(--shadow-sm);
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
padding: var(--sp-2);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Height is controlled mostly via TinyMCE config (height).
|
|
14
|
+
* Wrapper just makes sure editor stretches horizontally.
|
|
15
|
+
*/
|
|
16
|
+
.w-tiny__editor {
|
|
17
|
+
display: block;
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|