@qwickapps/react-framework 1.5.12 → 1.6.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/README.md +23 -0
- package/dist/components/blocks/ImageGallery.d.ts +30 -0
- package/dist/components/blocks/ImageGallery.d.ts.map +1 -0
- package/dist/components/blocks/OptionSelector.d.ts +45 -0
- package/dist/components/blocks/OptionSelector.d.ts.map +1 -0
- package/dist/components/blocks/index.d.ts +4 -0
- package/dist/components/blocks/index.d.ts.map +1 -1
- package/dist/components/forms/Captcha.d.ts +33 -28
- package/dist/components/forms/Captcha.d.ts.map +1 -1
- package/dist/components/forms/FormCheckbox.d.ts +15 -12
- package/dist/components/forms/FormCheckbox.d.ts.map +1 -1
- package/dist/components/forms/FormField.d.ts +20 -23
- package/dist/components/forms/FormField.d.ts.map +1 -1
- package/dist/components/forms/FormSelect.d.ts +16 -15
- package/dist/components/forms/FormSelect.d.ts.map +1 -1
- package/dist/hooks/useBaseProps.d.ts +27 -1172
- package/dist/hooks/useBaseProps.d.ts.map +1 -1
- package/dist/index.esm.js +1674 -554
- package/dist/index.js +1676 -552
- package/dist/palettes/manifest.json +19 -19
- package/dist/schemas/CaptchaSchema.d.ts +16 -0
- package/dist/schemas/CaptchaSchema.d.ts.map +1 -0
- package/dist/schemas/FormCheckboxSchema.d.ts +16 -0
- package/dist/schemas/FormCheckboxSchema.d.ts.map +1 -0
- package/dist/schemas/FormFieldSchema.d.ts +23 -0
- package/dist/schemas/FormFieldSchema.d.ts.map +1 -0
- package/dist/schemas/FormSelectSchema.d.ts +20 -0
- package/dist/schemas/FormSelectSchema.d.ts.map +1 -0
- package/dist/schemas/ImageGallerySchema.d.ts +27 -0
- package/dist/schemas/ImageGallerySchema.d.ts.map +1 -0
- package/dist/schemas/OptionSelectorSchema.d.ts +34 -0
- package/dist/schemas/OptionSelectorSchema.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +6 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/blocks/Article.tsx +1 -1
- package/src/components/blocks/ImageGallery.tsx +464 -0
- package/src/components/blocks/OptionSelector.tsx +459 -0
- package/src/components/blocks/index.ts +4 -0
- package/src/components/forms/Captcha.tsx +57 -63
- package/src/components/forms/FormCheckbox.tsx +35 -43
- package/src/components/forms/FormField.tsx +50 -66
- package/src/components/forms/FormSelect.tsx +41 -49
- package/src/hooks/useBaseProps.ts +34 -1
- package/src/schemas/CaptchaSchema.ts +65 -0
- package/src/schemas/FormCheckboxSchema.ts +65 -0
- package/src/schemas/FormFieldSchema.ts +140 -0
- package/src/schemas/FormSelectSchema.ts +108 -0
- package/src/schemas/ImageGallerySchema.ts +148 -0
- package/src/schemas/OptionSelectorSchema.ts +216 -0
- package/src/schemas/index.ts +6 -0
- package/src/stories/ImageGallery.stories.tsx +497 -0
- package/src/stories/OptionSelector.stories.tsx +506 -0
- /package/dist/palettes/{palette-autumn.1.5.12.css → palette-autumn.1.6.0.css} +0 -0
- /package/dist/palettes/{palette-autumn.1.5.12.min.css → palette-autumn.1.6.0.min.css} +0 -0
- /package/dist/palettes/{palette-cosmic.1.5.12.css → palette-cosmic.1.6.0.css} +0 -0
- /package/dist/palettes/{palette-cosmic.1.5.12.min.css → palette-cosmic.1.6.0.min.css} +0 -0
- /package/dist/palettes/{palette-default.1.5.12.css → palette-default.1.6.0.css} +0 -0
- /package/dist/palettes/{palette-default.1.5.12.min.css → palette-default.1.6.0.min.css} +0 -0
- /package/dist/palettes/{palette-ocean.1.5.12.css → palette-ocean.1.6.0.css} +0 -0
- /package/dist/palettes/{palette-ocean.1.5.12.min.css → palette-ocean.1.6.0.min.css} +0 -0
- /package/dist/palettes/{palette-spring.1.5.12.css → palette-spring.1.6.0.css} +0 -0
- /package/dist/palettes/{palette-spring.1.5.12.min.css → palette-spring.1.6.0.min.css} +0 -0
- /package/dist/palettes/{palette-winter.1.5.12.css → palette-winter.1.6.0.css} +0 -0
- /package/dist/palettes/{palette-winter.1.5.12.min.css → palette-winter.1.6.0.min.css} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for FormField component - Themed text/number input field
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { IsBoolean, IsIn, IsInt, IsOptional, IsString, Min } from 'class-validator';
|
|
8
|
+
import 'reflect-metadata';
|
|
9
|
+
import { Editor, Field, Schema, FieldType } from '@qwickapps/schema';
|
|
10
|
+
import ViewSchema from './ViewSchema';
|
|
11
|
+
|
|
12
|
+
@Schema('FormField', '1.0.0')
|
|
13
|
+
export class FormFieldModel extends ViewSchema {
|
|
14
|
+
@Field()
|
|
15
|
+
@Editor({
|
|
16
|
+
field_type: FieldType.TEXT,
|
|
17
|
+
label: 'Label',
|
|
18
|
+
description: 'Label text for the input field',
|
|
19
|
+
placeholder: 'Enter label...'
|
|
20
|
+
})
|
|
21
|
+
@IsString()
|
|
22
|
+
label!: string;
|
|
23
|
+
|
|
24
|
+
@Field()
|
|
25
|
+
@Editor({
|
|
26
|
+
field_type: FieldType.TEXT,
|
|
27
|
+
label: 'Value',
|
|
28
|
+
description: 'Current input value',
|
|
29
|
+
placeholder: ''
|
|
30
|
+
})
|
|
31
|
+
@IsString()
|
|
32
|
+
value!: string | number;
|
|
33
|
+
|
|
34
|
+
@Field({ defaultValue: 'text' })
|
|
35
|
+
@Editor({
|
|
36
|
+
field_type: FieldType.SELECT,
|
|
37
|
+
label: 'Input Type',
|
|
38
|
+
description: 'Type of input field'
|
|
39
|
+
})
|
|
40
|
+
@IsOptional()
|
|
41
|
+
@IsIn(['text', 'number', 'password', 'email', 'tel'])
|
|
42
|
+
type?: 'text' | 'number' | 'password' | 'email' | 'tel';
|
|
43
|
+
|
|
44
|
+
@Field()
|
|
45
|
+
@Editor({
|
|
46
|
+
field_type: FieldType.TEXT,
|
|
47
|
+
label: 'Helper Text',
|
|
48
|
+
description: 'Helper text displayed below the input',
|
|
49
|
+
placeholder: 'Enter helper text...'
|
|
50
|
+
})
|
|
51
|
+
@IsOptional()
|
|
52
|
+
@IsString()
|
|
53
|
+
helperText?: string;
|
|
54
|
+
|
|
55
|
+
@Field({ defaultValue: false })
|
|
56
|
+
@Editor({
|
|
57
|
+
field_type: FieldType.BOOLEAN,
|
|
58
|
+
label: 'Required',
|
|
59
|
+
description: 'Mark field as required'
|
|
60
|
+
})
|
|
61
|
+
@IsOptional()
|
|
62
|
+
@IsBoolean()
|
|
63
|
+
required?: boolean;
|
|
64
|
+
|
|
65
|
+
@Field({ defaultValue: false })
|
|
66
|
+
@Editor({
|
|
67
|
+
field_type: FieldType.BOOLEAN,
|
|
68
|
+
label: 'Read Only',
|
|
69
|
+
description: 'Make field read-only'
|
|
70
|
+
})
|
|
71
|
+
@IsOptional()
|
|
72
|
+
@IsBoolean()
|
|
73
|
+
readOnly?: boolean;
|
|
74
|
+
|
|
75
|
+
@Field({ defaultValue: false })
|
|
76
|
+
@Editor({
|
|
77
|
+
field_type: FieldType.BOOLEAN,
|
|
78
|
+
label: 'Disabled',
|
|
79
|
+
description: 'Disable the input field'
|
|
80
|
+
})
|
|
81
|
+
@IsOptional()
|
|
82
|
+
@IsBoolean()
|
|
83
|
+
disabled?: boolean;
|
|
84
|
+
|
|
85
|
+
@Field()
|
|
86
|
+
@Editor({
|
|
87
|
+
field_type: FieldType.TEXT,
|
|
88
|
+
label: 'Disabled Color',
|
|
89
|
+
description: 'Custom color for disabled state (CSS color value)',
|
|
90
|
+
placeholder: 'var(--theme-text-disabled)'
|
|
91
|
+
})
|
|
92
|
+
@IsOptional()
|
|
93
|
+
@IsString()
|
|
94
|
+
disabledColor?: string;
|
|
95
|
+
|
|
96
|
+
@Field({ defaultValue: true })
|
|
97
|
+
@Editor({
|
|
98
|
+
field_type: FieldType.BOOLEAN,
|
|
99
|
+
label: 'Full Width',
|
|
100
|
+
description: 'Make input take full width of container'
|
|
101
|
+
})
|
|
102
|
+
@IsOptional()
|
|
103
|
+
@IsBoolean()
|
|
104
|
+
fullWidth?: boolean;
|
|
105
|
+
|
|
106
|
+
@Field({ defaultValue: false })
|
|
107
|
+
@Editor({
|
|
108
|
+
field_type: FieldType.BOOLEAN,
|
|
109
|
+
label: 'Multiline',
|
|
110
|
+
description: 'Enable multiline textarea mode'
|
|
111
|
+
})
|
|
112
|
+
@IsOptional()
|
|
113
|
+
@IsBoolean()
|
|
114
|
+
multiline?: boolean;
|
|
115
|
+
|
|
116
|
+
@Field()
|
|
117
|
+
@Editor({
|
|
118
|
+
field_type: FieldType.TEXT,
|
|
119
|
+
label: 'Rows',
|
|
120
|
+
description: 'Number of rows for multiline textarea',
|
|
121
|
+
placeholder: '4'
|
|
122
|
+
})
|
|
123
|
+
@IsOptional()
|
|
124
|
+
@IsInt()
|
|
125
|
+
@Min(1)
|
|
126
|
+
rows?: number;
|
|
127
|
+
|
|
128
|
+
@Field()
|
|
129
|
+
@Editor({
|
|
130
|
+
field_type: FieldType.TEXT,
|
|
131
|
+
label: 'Placeholder',
|
|
132
|
+
description: 'Placeholder text',
|
|
133
|
+
placeholder: 'Enter text...'
|
|
134
|
+
})
|
|
135
|
+
@IsOptional()
|
|
136
|
+
@IsString()
|
|
137
|
+
placeholder?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export default FormFieldModel;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for FormSelect component - Themed dropdown select input
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { IsBoolean, IsIn, IsOptional, IsString } from 'class-validator';
|
|
8
|
+
import 'reflect-metadata';
|
|
9
|
+
import { Editor, Field, Schema, FieldType } from '@qwickapps/schema';
|
|
10
|
+
import ViewSchema from './ViewSchema';
|
|
11
|
+
|
|
12
|
+
@Schema('FormSelect', '1.0.0')
|
|
13
|
+
export class FormSelectModel extends ViewSchema {
|
|
14
|
+
@Field()
|
|
15
|
+
@Editor({
|
|
16
|
+
field_type: FieldType.TEXT,
|
|
17
|
+
label: 'Label',
|
|
18
|
+
description: 'Label text for the select field',
|
|
19
|
+
placeholder: 'Enter label...'
|
|
20
|
+
})
|
|
21
|
+
@IsOptional()
|
|
22
|
+
@IsString()
|
|
23
|
+
label?: string;
|
|
24
|
+
|
|
25
|
+
@Field()
|
|
26
|
+
@Editor({
|
|
27
|
+
field_type: FieldType.TEXT,
|
|
28
|
+
label: 'Value',
|
|
29
|
+
description: 'Current selected value',
|
|
30
|
+
placeholder: ''
|
|
31
|
+
})
|
|
32
|
+
@IsString()
|
|
33
|
+
value!: string | number;
|
|
34
|
+
|
|
35
|
+
@Field()
|
|
36
|
+
@Editor({
|
|
37
|
+
field_type: FieldType.TEXTAREA,
|
|
38
|
+
label: 'Options',
|
|
39
|
+
description: 'Select options as JSON array: [{"value": "1", "label": "Option 1"}]',
|
|
40
|
+
placeholder: '[{"value": "1", "label": "Option 1"}]'
|
|
41
|
+
})
|
|
42
|
+
@IsString()
|
|
43
|
+
options!: string; // JSON string of FormSelectOption[]
|
|
44
|
+
|
|
45
|
+
@Field()
|
|
46
|
+
@Editor({
|
|
47
|
+
field_type: FieldType.TEXT,
|
|
48
|
+
label: 'Helper Text',
|
|
49
|
+
description: 'Helper text displayed below the select',
|
|
50
|
+
placeholder: 'Enter helper text...'
|
|
51
|
+
})
|
|
52
|
+
@IsOptional()
|
|
53
|
+
@IsString()
|
|
54
|
+
helperText?: string;
|
|
55
|
+
|
|
56
|
+
@Field({ defaultValue: false })
|
|
57
|
+
@Editor({
|
|
58
|
+
field_type: FieldType.BOOLEAN,
|
|
59
|
+
label: 'Required',
|
|
60
|
+
description: 'Mark field as required'
|
|
61
|
+
})
|
|
62
|
+
@IsOptional()
|
|
63
|
+
@IsBoolean()
|
|
64
|
+
required?: boolean;
|
|
65
|
+
|
|
66
|
+
@Field({ defaultValue: false })
|
|
67
|
+
@Editor({
|
|
68
|
+
field_type: FieldType.BOOLEAN,
|
|
69
|
+
label: 'Disabled',
|
|
70
|
+
description: 'Disable the select field'
|
|
71
|
+
})
|
|
72
|
+
@IsOptional()
|
|
73
|
+
@IsBoolean()
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
|
|
76
|
+
@Field({ defaultValue: true })
|
|
77
|
+
@Editor({
|
|
78
|
+
field_type: FieldType.BOOLEAN,
|
|
79
|
+
label: 'Full Width',
|
|
80
|
+
description: 'Make select take full width of container'
|
|
81
|
+
})
|
|
82
|
+
@IsOptional()
|
|
83
|
+
@IsBoolean()
|
|
84
|
+
fullWidth?: boolean;
|
|
85
|
+
|
|
86
|
+
@Field({ defaultValue: 'small' })
|
|
87
|
+
@Editor({
|
|
88
|
+
field_type: FieldType.SELECT,
|
|
89
|
+
label: 'Size',
|
|
90
|
+
description: 'Size variant of the select field'
|
|
91
|
+
})
|
|
92
|
+
@IsOptional()
|
|
93
|
+
@IsIn(['small', 'medium'])
|
|
94
|
+
size?: 'small' | 'medium';
|
|
95
|
+
|
|
96
|
+
@Field()
|
|
97
|
+
@Editor({
|
|
98
|
+
field_type: FieldType.TEXT,
|
|
99
|
+
label: 'Placeholder',
|
|
100
|
+
description: 'Placeholder text when no value is selected',
|
|
101
|
+
placeholder: 'Select an option...'
|
|
102
|
+
})
|
|
103
|
+
@IsOptional()
|
|
104
|
+
@IsString()
|
|
105
|
+
placeholder?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default FormSelectModel;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for ImageGallery component - Image gallery with multiple view variants
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { IsBoolean, IsOptional, IsString, IsNumber, IsIn, IsArray, ValidateNested } from 'class-validator';
|
|
8
|
+
import { Type } from 'class-transformer';
|
|
9
|
+
import 'reflect-metadata';
|
|
10
|
+
import { Editor, Field, Schema, FieldType, DataType } from '@qwickapps/schema';
|
|
11
|
+
import { ViewSchema } from './ViewSchema';
|
|
12
|
+
|
|
13
|
+
// Product image interface
|
|
14
|
+
export class GalleryImageModel {
|
|
15
|
+
@Field({ dataType: DataType.STRING })
|
|
16
|
+
@IsString()
|
|
17
|
+
url!: string;
|
|
18
|
+
|
|
19
|
+
@Field({ dataType: DataType.STRING })
|
|
20
|
+
@IsString()
|
|
21
|
+
alt!: string;
|
|
22
|
+
|
|
23
|
+
@Field({ dataType: DataType.STRING })
|
|
24
|
+
@IsOptional()
|
|
25
|
+
@IsString()
|
|
26
|
+
thumbnail?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Gallery variants
|
|
30
|
+
export type GalleryVariant = 'thumbnails' | 'carousel' | 'grid';
|
|
31
|
+
|
|
32
|
+
// Thumbnail positions
|
|
33
|
+
export type ThumbnailPosition = 'left' | 'bottom' | 'right';
|
|
34
|
+
|
|
35
|
+
@Schema('ImageGallery', '1.0.0')
|
|
36
|
+
export class ImageGalleryModel extends ViewSchema {
|
|
37
|
+
@Field({ dataType: DataType.ARRAY })
|
|
38
|
+
@Editor({
|
|
39
|
+
field_type: FieldType.ARRAY,
|
|
40
|
+
label: 'Product Images',
|
|
41
|
+
description: 'Array of product images to display in the gallery',
|
|
42
|
+
})
|
|
43
|
+
@IsArray()
|
|
44
|
+
@ValidateNested({ each: true })
|
|
45
|
+
@Type(() => GalleryImageModel)
|
|
46
|
+
images!: GalleryImageModel[];
|
|
47
|
+
|
|
48
|
+
@Field({ dataType: DataType.STRING })
|
|
49
|
+
@Editor({
|
|
50
|
+
field_type: FieldType.TEXT,
|
|
51
|
+
label: 'Product Name',
|
|
52
|
+
description: 'Product name for accessibility',
|
|
53
|
+
placeholder: 'Premium Cotton T-Shirt'
|
|
54
|
+
})
|
|
55
|
+
@IsString()
|
|
56
|
+
productName!: string;
|
|
57
|
+
|
|
58
|
+
@Field({ defaultValue: 'thumbnails', dataType: DataType.STRING })
|
|
59
|
+
@Editor({
|
|
60
|
+
field_type: FieldType.SELECT,
|
|
61
|
+
label: 'Gallery Variant',
|
|
62
|
+
description: 'Display variant for the gallery',
|
|
63
|
+
validation: {
|
|
64
|
+
options: [
|
|
65
|
+
{ label: 'Thumbnails', value: 'thumbnails' },
|
|
66
|
+
{ label: 'Carousel', value: 'carousel' },
|
|
67
|
+
{ label: 'Grid', value: 'grid' }
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
@IsOptional()
|
|
72
|
+
@IsString()
|
|
73
|
+
@IsIn(['thumbnails', 'carousel', 'grid'])
|
|
74
|
+
variant?: GalleryVariant;
|
|
75
|
+
|
|
76
|
+
@Field({ defaultValue: 'left', dataType: DataType.STRING })
|
|
77
|
+
@Editor({
|
|
78
|
+
field_type: FieldType.SELECT,
|
|
79
|
+
label: 'Thumbnail Position',
|
|
80
|
+
description: 'Position of thumbnails (only for thumbnails variant)',
|
|
81
|
+
validation: {
|
|
82
|
+
options: [
|
|
83
|
+
{ label: 'Left', value: 'left' },
|
|
84
|
+
{ label: 'Bottom', value: 'bottom' },
|
|
85
|
+
{ label: 'Right', value: 'right' }
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
@IsOptional()
|
|
90
|
+
@IsString()
|
|
91
|
+
@IsIn(['left', 'bottom', 'right'])
|
|
92
|
+
thumbnailPosition?: ThumbnailPosition;
|
|
93
|
+
|
|
94
|
+
@Field({ defaultValue: '1', dataType: DataType.STRING })
|
|
95
|
+
@Editor({
|
|
96
|
+
field_type: FieldType.TEXT,
|
|
97
|
+
label: 'Aspect Ratio',
|
|
98
|
+
description: 'Aspect ratio for main image (e.g., "1", "4/3", "16/9")',
|
|
99
|
+
placeholder: '1'
|
|
100
|
+
})
|
|
101
|
+
@IsOptional()
|
|
102
|
+
@IsString()
|
|
103
|
+
aspectRatio?: string;
|
|
104
|
+
|
|
105
|
+
@Field({ defaultValue: true, dataType: DataType.BOOLEAN })
|
|
106
|
+
@Editor({
|
|
107
|
+
field_type: FieldType.BOOLEAN,
|
|
108
|
+
label: 'Show Zoom',
|
|
109
|
+
description: 'Enable zoom functionality for images'
|
|
110
|
+
})
|
|
111
|
+
@IsOptional()
|
|
112
|
+
@IsBoolean()
|
|
113
|
+
showZoom?: boolean;
|
|
114
|
+
|
|
115
|
+
@Field({ dataType: DataType.NUMBER })
|
|
116
|
+
@Editor({
|
|
117
|
+
field_type: FieldType.NUMBER,
|
|
118
|
+
label: 'Max Images',
|
|
119
|
+
description: 'Maximum number of images to display (leave empty for all)',
|
|
120
|
+
placeholder: '8'
|
|
121
|
+
})
|
|
122
|
+
@IsOptional()
|
|
123
|
+
@IsNumber()
|
|
124
|
+
maxImages?: number;
|
|
125
|
+
|
|
126
|
+
@Field({ dataType: DataType.STRING })
|
|
127
|
+
@Editor({
|
|
128
|
+
field_type: FieldType.TEXT,
|
|
129
|
+
label: 'Data Source',
|
|
130
|
+
description: 'Data source for dynamic image loading',
|
|
131
|
+
placeholder: 'product-images'
|
|
132
|
+
})
|
|
133
|
+
@IsOptional()
|
|
134
|
+
@IsString()
|
|
135
|
+
dataSource?: string;
|
|
136
|
+
|
|
137
|
+
@Field({ dataType: DataType.OBJECT })
|
|
138
|
+
@Editor({
|
|
139
|
+
field_type: FieldType.TEXTAREA,
|
|
140
|
+
label: 'Binding Options',
|
|
141
|
+
description: 'Data binding configuration (JSON format)',
|
|
142
|
+
placeholder: '{ "filter": {}, "sort": {} }'
|
|
143
|
+
})
|
|
144
|
+
@IsOptional()
|
|
145
|
+
bindingOptions?: Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export default ImageGalleryModel;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for OptionSelector component - Universal option selection with visual modes
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { IsBoolean, IsOptional, IsString, IsNumber, IsIn, IsArray, ValidateNested } from 'class-validator';
|
|
8
|
+
import { Type } from 'class-transformer';
|
|
9
|
+
import 'reflect-metadata';
|
|
10
|
+
import { Editor, Field, Schema, FieldType, DataType } from '@qwickapps/schema';
|
|
11
|
+
import { ViewSchema } from './ViewSchema';
|
|
12
|
+
|
|
13
|
+
// Select option model
|
|
14
|
+
export class SelectOptionModel {
|
|
15
|
+
@Field({ dataType: DataType.STRING })
|
|
16
|
+
@IsString()
|
|
17
|
+
id!: string;
|
|
18
|
+
|
|
19
|
+
@Field({ dataType: DataType.STRING })
|
|
20
|
+
@IsString()
|
|
21
|
+
label!: string;
|
|
22
|
+
|
|
23
|
+
@Field({ dataType: DataType.BOOLEAN })
|
|
24
|
+
@IsBoolean()
|
|
25
|
+
available!: boolean;
|
|
26
|
+
|
|
27
|
+
@Field({ dataType: DataType.NUMBER })
|
|
28
|
+
@IsOptional()
|
|
29
|
+
@IsNumber()
|
|
30
|
+
price?: number;
|
|
31
|
+
|
|
32
|
+
@Field({ dataType: DataType.STRING })
|
|
33
|
+
@Editor({
|
|
34
|
+
field_type: FieldType.TEXT,
|
|
35
|
+
label: 'Hex Color Value',
|
|
36
|
+
description: 'Hex color code for color swatches (e.g., #FF0000)',
|
|
37
|
+
placeholder: '#FF0000'
|
|
38
|
+
})
|
|
39
|
+
@IsOptional()
|
|
40
|
+
@IsString()
|
|
41
|
+
hexValue?: string;
|
|
42
|
+
|
|
43
|
+
@Field({ dataType: DataType.STRING })
|
|
44
|
+
@Editor({
|
|
45
|
+
field_type: FieldType.TEXT,
|
|
46
|
+
label: 'Image URL',
|
|
47
|
+
description: 'Image URL for image/pattern display mode',
|
|
48
|
+
placeholder: '/patterns/stripes.jpg'
|
|
49
|
+
})
|
|
50
|
+
@IsOptional()
|
|
51
|
+
@IsString()
|
|
52
|
+
imageUrl?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Display modes
|
|
56
|
+
export type DisplayMode = 'text' | 'color' | 'image';
|
|
57
|
+
|
|
58
|
+
// Display variants
|
|
59
|
+
export type OptionVariant = 'buttons' | 'dropdown' | 'grid';
|
|
60
|
+
|
|
61
|
+
// Layout options
|
|
62
|
+
export type OptionLayout = 'horizontal' | 'vertical' | 'wrap';
|
|
63
|
+
|
|
64
|
+
// Visual sizes
|
|
65
|
+
export type VisualSize = 'small' | 'medium' | 'large';
|
|
66
|
+
|
|
67
|
+
@Schema('OptionSelector', '1.0.0')
|
|
68
|
+
export class OptionSelectorModel extends ViewSchema {
|
|
69
|
+
@Field({ dataType: DataType.ARRAY })
|
|
70
|
+
@Editor({
|
|
71
|
+
field_type: FieldType.ARRAY,
|
|
72
|
+
label: 'Available Options',
|
|
73
|
+
description: 'Array of options to display',
|
|
74
|
+
})
|
|
75
|
+
@IsArray()
|
|
76
|
+
@ValidateNested({ each: true })
|
|
77
|
+
@Type(() => SelectOptionModel)
|
|
78
|
+
options!: SelectOptionModel[];
|
|
79
|
+
|
|
80
|
+
@Field({ dataType: DataType.STRING })
|
|
81
|
+
@Editor({
|
|
82
|
+
field_type: FieldType.TEXT,
|
|
83
|
+
label: 'Selected Option',
|
|
84
|
+
description: 'Currently selected option ID',
|
|
85
|
+
placeholder: 'm'
|
|
86
|
+
})
|
|
87
|
+
@IsOptional()
|
|
88
|
+
@IsString()
|
|
89
|
+
selectedOption?: string;
|
|
90
|
+
|
|
91
|
+
@Field({ defaultValue: 'text', dataType: DataType.STRING })
|
|
92
|
+
@Editor({
|
|
93
|
+
field_type: FieldType.SELECT,
|
|
94
|
+
label: 'Display Mode',
|
|
95
|
+
description: 'Visual display mode for options',
|
|
96
|
+
validation: {
|
|
97
|
+
options: [
|
|
98
|
+
{ label: 'Text (buttons with labels)', value: 'text' },
|
|
99
|
+
{ label: 'Color (swatches)', value: 'color' },
|
|
100
|
+
{ label: 'Image (patterns/textures)', value: 'image' }
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
@IsOptional()
|
|
105
|
+
@IsString()
|
|
106
|
+
@IsIn(['text', 'color', 'image'])
|
|
107
|
+
displayMode?: DisplayMode;
|
|
108
|
+
|
|
109
|
+
@Field({ defaultValue: 'grid', dataType: DataType.STRING })
|
|
110
|
+
@Editor({
|
|
111
|
+
field_type: FieldType.SELECT,
|
|
112
|
+
label: 'Display Variant',
|
|
113
|
+
description: 'How to display the selector',
|
|
114
|
+
validation: {
|
|
115
|
+
options: [
|
|
116
|
+
{ label: 'Buttons', value: 'buttons' },
|
|
117
|
+
{ label: 'Dropdown', value: 'dropdown' },
|
|
118
|
+
{ label: 'Grid', value: 'grid' }
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
@IsOptional()
|
|
123
|
+
@IsString()
|
|
124
|
+
@IsIn(['buttons', 'dropdown', 'grid'])
|
|
125
|
+
variant?: OptionVariant;
|
|
126
|
+
|
|
127
|
+
@Field({ defaultValue: 'wrap', dataType: DataType.STRING })
|
|
128
|
+
@Editor({
|
|
129
|
+
field_type: FieldType.SELECT,
|
|
130
|
+
label: 'Layout Direction',
|
|
131
|
+
description: 'Layout direction for buttons/grid variant',
|
|
132
|
+
validation: {
|
|
133
|
+
options: [
|
|
134
|
+
{ label: 'Horizontal', value: 'horizontal' },
|
|
135
|
+
{ label: 'Vertical', value: 'vertical' },
|
|
136
|
+
{ label: 'Wrap', value: 'wrap' }
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
@IsOptional()
|
|
141
|
+
@IsString()
|
|
142
|
+
@IsIn(['horizontal', 'vertical', 'wrap'])
|
|
143
|
+
layout?: OptionLayout;
|
|
144
|
+
|
|
145
|
+
@Field({ defaultValue: 'medium', dataType: DataType.STRING })
|
|
146
|
+
@Editor({
|
|
147
|
+
field_type: FieldType.SELECT,
|
|
148
|
+
label: 'Visual Size',
|
|
149
|
+
description: 'Size for color/image display modes',
|
|
150
|
+
validation: {
|
|
151
|
+
options: [
|
|
152
|
+
{ label: 'Small (32px)', value: 'small' },
|
|
153
|
+
{ label: 'Medium (44px)', value: 'medium' },
|
|
154
|
+
{ label: 'Large (56px)', value: 'large' }
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
@IsOptional()
|
|
159
|
+
@IsString()
|
|
160
|
+
@IsIn(['small', 'medium', 'large'])
|
|
161
|
+
visualSize?: VisualSize;
|
|
162
|
+
|
|
163
|
+
@Field({ defaultValue: false, dataType: DataType.BOOLEAN })
|
|
164
|
+
@Editor({
|
|
165
|
+
field_type: FieldType.BOOLEAN,
|
|
166
|
+
label: 'Show Label',
|
|
167
|
+
description: 'Show label below visual (for color/image modes)'
|
|
168
|
+
})
|
|
169
|
+
@IsOptional()
|
|
170
|
+
@IsBoolean()
|
|
171
|
+
showLabel?: boolean;
|
|
172
|
+
|
|
173
|
+
@Field({ defaultValue: false, dataType: DataType.BOOLEAN })
|
|
174
|
+
@Editor({
|
|
175
|
+
field_type: FieldType.BOOLEAN,
|
|
176
|
+
label: 'Disabled',
|
|
177
|
+
description: 'Disable all option selections'
|
|
178
|
+
})
|
|
179
|
+
@IsOptional()
|
|
180
|
+
@IsBoolean()
|
|
181
|
+
disabled?: boolean;
|
|
182
|
+
|
|
183
|
+
@Field({ defaultValue: 'Select Option', dataType: DataType.STRING })
|
|
184
|
+
@Editor({
|
|
185
|
+
field_type: FieldType.TEXT,
|
|
186
|
+
label: 'Label',
|
|
187
|
+
description: 'Label text for the selector',
|
|
188
|
+
placeholder: 'Select Option'
|
|
189
|
+
})
|
|
190
|
+
@IsOptional()
|
|
191
|
+
@IsString()
|
|
192
|
+
label?: string;
|
|
193
|
+
|
|
194
|
+
@Field({ dataType: DataType.STRING })
|
|
195
|
+
@Editor({
|
|
196
|
+
field_type: FieldType.TEXT,
|
|
197
|
+
label: 'Data Source',
|
|
198
|
+
description: 'Data source for dynamic option loading',
|
|
199
|
+
placeholder: 'product-options'
|
|
200
|
+
})
|
|
201
|
+
@IsOptional()
|
|
202
|
+
@IsString()
|
|
203
|
+
dataSource?: string;
|
|
204
|
+
|
|
205
|
+
@Field({ dataType: DataType.OBJECT })
|
|
206
|
+
@Editor({
|
|
207
|
+
field_type: FieldType.TEXTAREA,
|
|
208
|
+
label: 'Binding Options',
|
|
209
|
+
description: 'Data binding configuration (JSON format)',
|
|
210
|
+
placeholder: '{ "filter": {}, "sort": {} }'
|
|
211
|
+
})
|
|
212
|
+
@IsOptional()
|
|
213
|
+
bindingOptions?: Record<string, unknown>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export default OptionSelectorModel;
|
package/src/schemas/index.ts
CHANGED
|
@@ -28,6 +28,10 @@ export * from './FeatureGridSchema';
|
|
|
28
28
|
export * from './FeatureItemSchema';
|
|
29
29
|
export * from './FooterItemSchema';
|
|
30
30
|
export * from './FormBlockSchema';
|
|
31
|
+
export * from './FormSelectSchema';
|
|
32
|
+
export * from './FormFieldSchema';
|
|
33
|
+
export * from './FormCheckboxSchema';
|
|
34
|
+
export * from './CaptchaSchema';
|
|
31
35
|
export * from './FooterSchema';
|
|
32
36
|
export * from './FooterSectionSchema';
|
|
33
37
|
export * from './GridCellSchema';
|
|
@@ -41,6 +45,8 @@ export * from './MetadataItemSchema';
|
|
|
41
45
|
export * from './PageBannerHeaderSchema';
|
|
42
46
|
export * from './PaletteSwitcherSchema';
|
|
43
47
|
export * from './ProductCardSchema';
|
|
48
|
+
export * from './ImageGallerySchema';
|
|
49
|
+
export * from './OptionSelectorSchema';
|
|
44
50
|
export * from './SafeSpanSchema';
|
|
45
51
|
export * from './SectionSchema';
|
|
46
52
|
export * from './TextInputFieldSchema';
|