@fewangsit/wangsvue-gsts 1.0.0-alpha.1
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/json/currencies.json.d.ts +1068 -0
- package/assets/json/languages.json.d.ts +180 -0
- package/assets/lottie/admin/loading-page.lottie +0 -0
- package/assets/lottie/admin/loading-table.lottie +0 -0
- package/assets/lottie/admin/no-data.lottie +0 -0
- package/assets/lottie/supplyasset/loading-page.lottie +0 -0
- package/assets/lottie/supplyasset/loading-table.lottie +0 -0
- package/assets/lottie/supplyasset/no-data.lottie +0 -0
- package/assets/lottie/workspace/loading-page.lottie +0 -0
- package/assets/lottie/workspace/loading-plane.lottie +0 -0
- package/assets/lottie/workspace/loading-table.lottie +0 -0
- package/assets/lottie/workspace/no-data.lottie +0 -0
- package/build-entry.d.ts +14 -0
- package/components/animation/Animation.vue.d.ts +24 -0
- package/components/approverinfo/ApproverInfo.vue.d.ts +51 -0
- package/components/badge/Badge.vue.d.ts +66 -0
- package/components/badgegroup/BadgeGroup.vue.d.ts +40 -0
- package/components/badgegrouptree/BadgeGroupTree.vue.d.ts +34 -0
- package/components/basecomponent/index.d.ts +28 -0
- package/components/basetree/BaseTree.vue.d.ts +567 -0
- package/components/basetree/TreeNode.vue.d.ts +35 -0
- package/components/breadcrumb/Breadcrumb.vue.d.ts +26 -0
- package/components/button/Button.vue.d.ts +185 -0
- package/components/buttonImportExcel/ButtonImportExcel.vue.d.ts +26 -0
- package/components/buttonbulkaction/ButtonBulkAction.vue.d.ts +97 -0
- package/components/buttondownload/ButtonDownload.vue.d.ts +49 -0
- package/components/buttonfilter/ButtonFilter.vue.d.ts +12 -0
- package/components/buttonradio/ButtonRadio.vue.d.ts +257 -0
- package/components/buttonsearch/ButtonSearch.vue.d.ts +38 -0
- package/components/buttonselecttree/ButtonSelectTree.vue.d.ts +193 -0
- package/components/buttonsplit/ButtonSplit.d.ts +350 -0
- package/components/buttonsplit/ButtonSplit.vue.d.ts +34 -0
- package/components/buttontoggle/ButtonToggle.vue.d.ts +18 -0
- package/components/calendar/BaseCalendar.vue.d.ts +83 -0
- package/components/calendar/Calendar.vue.d.ts +561 -0
- package/components/card/Card.vue.d.ts +139 -0
- package/components/changelog/Changelog.vue.d.ts +158 -0
- package/components/changelogpage/ChangelogFilter.vue.d.ts +16 -0
- package/components/changelogpage/ChangelogPage.vue.d.ts +124 -0
- package/components/checkbox/Checkbox.vue.d.ts +329 -0
- package/components/codesnippet/CodeSnippet.vue.d.ts +14 -0
- package/components/customcolumn/CustomColumn.vue.d.ts +35 -0
- package/components/datatable/DataTable.vue.d.ts +704 -0
- package/components/datatable/MultiRow.vue.d.ts +16 -0
- package/components/datatable/helpers/adjustMenuPosition.helper.d.ts +1 -0
- package/components/datatable/helpers/filter.helper.d.ts +28 -0
- package/components/datatable/helpers/index.d.ts +3 -0
- package/components/datatable/helpers/readConfig.helper.d.ts +2 -0
- package/components/datatable/store/dataTable.store.d.ts +22 -0
- package/components/dialog/Dialog.vue.d.ts +464 -0
- package/components/dialogconfirm/DialogConfirm.vue.d.ts +153 -0
- package/components/dialogform/DialogForm.vue.d.ts +349 -0
- package/components/dialogselecttree/DialogSelectTree.vue.d.ts +111 -0
- package/components/dropdown/Dropdown.vue.d.ts +257 -0
- package/components/editor/CodeSnippetAdapter.vue.d.ts +92 -0
- package/components/editor/Editor.vue.d.ts +191 -0
- package/components/editor/EditorButton.vue.d.ts +15 -0
- package/components/editor/MentionList.vue.d.ts +35 -0
- package/components/editor/MentionSection.vue.d.ts +92 -0
- package/components/editor/codeSnippetExtension.d.ts +3 -0
- package/components/editor/mentionSectionExtension.d.ts +3 -0
- package/components/editor/suggestion.d.ts +2 -0
- package/components/fieldwrapper/FieldWrapper.vue.d.ts +69 -0
- package/components/fileupload/FileUpload.vue.d.ts +153 -0
- package/components/filtercontainer/FilterContainer.vue.d.ts +141 -0
- package/components/filtercontainer/helpers/applyFilter.helper.d.ts +3 -0
- package/components/filtercontainer/helpers/formatDateTimeRange.helper.d.ts +7 -0
- package/components/filtercontainer/helpers/getOption.helper.d.ts +3 -0
- package/components/form/Form.vue.d.ts +306 -0
- package/components/gallerypreview/GalleryPreview.vue.d.ts +31 -0
- package/components/helpers/convertToArrayClass.helper.d.ts +2 -0
- package/components/helpers/index.d.ts +2 -0
- package/components/helpers/label.d.ts +15 -0
- package/components/icon/Icon.vue.d.ts +245 -0
- package/components/image/Image.vue.d.ts +403 -0
- package/components/imagecompressor/BackgroundImageCropper.vue.d.ts +36 -0
- package/components/imagecompressor/ImageCompressor.vue.d.ts +191 -0
- package/components/imagecompressor/ImageInputInfo.vue.d.ts +30 -0
- package/components/index.d.ts +66 -0
- package/components/inlinemessage/InlineMessage.vue.d.ts +167 -0
- package/components/inputbadge/InputBadge.vue.d.ts +122 -0
- package/components/inputcurrency/InputCurrency.vue.d.ts +170 -0
- package/components/inputcurrency/helpers/currency.helper.d.ts +4 -0
- package/components/inputemail/InputEmail.vue.d.ts +25 -0
- package/components/inputgroup/InputGroup.vue.d.ts +141 -0
- package/components/inputnumber/InputNumber.vue.d.ts +282 -0
- package/components/inputpassword/InputPassword.vue.d.ts +32 -0
- package/components/inputphonenumber/InputPhoneNumber.vue.d.ts +99 -0
- package/components/inputphonenumber/helpers/getUserLocation.helper.d.ts +8 -0
- package/components/inputrangenumber/InputRangeNumber.vue.d.ts +120 -0
- package/components/inputtext/InputText.vue.d.ts +352 -0
- package/components/inputurl/InputURL.vue.d.ts +39 -0
- package/components/invisiblefield/InvisibleField.vue.d.ts +36 -0
- package/components/languagedropdown/LanguageDropdown.vue.d.ts +58 -0
- package/components/languagedropdown/LanguageDropdownOption.vue.d.ts +18 -0
- package/components/litedropdown/LiteDropdown.vue.d.ts +96 -0
- package/components/loading/Loading.vue.d.ts +47 -0
- package/components/loading/store/loading.store.d.ts +8 -0
- package/components/menu/Menu.vue.d.ts +390 -0
- package/components/menu/helpers/filterMenu.helper.d.ts +12 -0
- package/components/menu/helpers/index.d.ts +1 -0
- package/components/menuitem/MenuItem.vue.d.ts +19 -0
- package/components/menuitem/index.d.ts +104 -0
- package/components/multiselect/MultiSelect.vue.d.ts +192 -0
- package/components/overlaypanel/OverlayPanel.vue.d.ts +301 -0
- package/components/passthrough/index.d.ts +16 -0
- package/components/progressbar/ProgressBar.vue.d.ts +72 -0
- package/components/quickfilter/QuickFilter.vue.d.ts +25 -0
- package/components/tabmenu/TabMenu.vue.d.ts +288 -0
- package/components/tagtype/TagType.vue.d.ts +22 -0
- package/components/textarea/Textarea.vue.d.ts +170 -0
- package/components/timeline/Timeline.vue.d.ts +115 -0
- package/components/timeline/TimelineContentByType.vue.d.ts +16 -0
- package/components/toast/Toast.vue.d.ts +367 -0
- package/components/toggleswitch/ToggleSwitch.vue.d.ts +281 -0
- package/components/tooltipspan/TooltipSpan.vue.d.ts +20 -0
- package/components/tree/Tree.vue.d.ts +146 -0
- package/components/tree/helpers/filterNodeKeys.helper.d.ts +16 -0
- package/components/tree/helpers/flattenTreeNodeChildren.helper.d.ts +6 -0
- package/components/tree/helpers/index.d.ts +3 -0
- package/components/treesearchinput/TreeSearchInput.vue.d.ts +16 -0
- package/components/ts-helpers.d.ts +63 -0
- package/components/usergroup/UserGroup.vue.d.ts +57 -0
- package/components/username/UserName.vue.d.ts +61 -0
- package/components/validatormessage/ValidatorMessage.vue.d.ts +12 -0
- package/config/defaultProps.d.ts +3 -0
- package/config/index.d.ts +3 -0
- package/config/locale.d.ts +3 -0
- package/directives/focus.d.ts +7 -0
- package/directives/index.d.ts +1 -0
- package/event-bus/index.d.ts +55 -0
- package/event-bus/mitt.d.ts +26 -0
- package/loading-page-BrQattYE.js +1 -0
- package/loading-page-CgfbWppy.js +1 -0
- package/loading-page-CoC9UhfC.js +4 -0
- package/loading-page-CoXtqoc9.js +4 -0
- package/loading-page-DbLuqCHa.js +1 -0
- package/loading-page-f8D03l3G.js +4 -0
- package/loading-plane-CgfbWppy.js +1 -0
- package/loading-plane-CoXtqoc9.js +4 -0
- package/loading-table-Bb2MtjdD.js +4 -0
- package/loading-table-Br25QIny.js +1 -0
- package/loading-table-ByUoWqUo.js +4 -0
- package/loading-table-BygEMzFM.js +4 -0
- package/loading-table-BzrSQlA0.js +1 -0
- package/loading-table-chOgXi94.js +1 -0
- package/main.d.ts +2 -0
- package/no-data-CTKux8RI.js +4 -0
- package/no-data-Cgze_Rvp.js +1 -0
- package/no-data-DLHO1L_u.js +4 -0
- package/no-data-Dep79CBh.js +1 -0
- package/no-data-g0dJCy2p.js +4 -0
- package/no-data-y1X5WtcQ.js +1 -0
- package/package.json +16 -0
- package/plugins/WangsVue.d.ts +121 -0
- package/plugins/formValidation.d.ts +10 -0
- package/plugins/translation.d.ts +37 -0
- package/style.css +1 -0
- package/types/options.type.d.ts +16 -0
- package/utils/date.util.d.ts +37 -0
- package/utils/exportToExcel.util.d.ts +20 -0
- package/utils/filterOptions.util.d.ts +3 -0
- package/utils/genPlaceholder.util.d.ts +8 -0
- package/utils/getAttachmentIcon.util.d.ts +8 -0
- package/utils/getStatusSeverity.util.d.ts +3 -0
- package/utils/index.d.ts +18 -0
- package/utils/mergePropsWithDefaults.util.d.ts +20 -0
- package/utils/object.util.d.ts +9 -0
- package/utils/role.util.d.ts +2 -0
- package/utils/textFormatter.util.d.ts +17 -0
- package/utils/toast.util.d.ts +114 -0
- package/wangsvue-gsts.es.js +133347 -0
- package/wangsvue-gsts.system.js +454 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { MultiSelectOption } from 'lib/types/options.type';
|
|
2
|
+
import { DefineComponent, Slot } from 'vue';
|
|
3
|
+
import { CalendarProps } from '../calendar/Calendar.vue.d';
|
|
4
|
+
import { QueryParams } from '../datatable/DataTable.vue.d';
|
|
5
|
+
import { DropdownProps } from '../dropdown/Dropdown.vue.d';
|
|
6
|
+
import { InputRangeNumberProps } from '../inputrangenumber/InputRangeNumber.vue.d';
|
|
7
|
+
import { MultiSelectProps } from '../multiselect/MultiSelect.vue.d';
|
|
8
|
+
import { ButtonSelectTreeProps } from '../buttonselecttree/ButtonSelectTree.vue.d';
|
|
9
|
+
|
|
10
|
+
// More specific filter field types
|
|
11
|
+
export interface MultiSelectFilterField extends MultiSelectProps {
|
|
12
|
+
type: 'multiselect';
|
|
13
|
+
field: string; // The name of the field this filter applies to
|
|
14
|
+
optionField?: string; // @example - actionOptions
|
|
15
|
+
params?: QueryParams; // Additional QueryParams for the fetchOptionFn
|
|
16
|
+
fetchOptionFn?:
|
|
17
|
+
| ((args?: any) => MultiSelectOption[]) // Sync function to fetch options
|
|
18
|
+
| ((args?: any) => Promise<MultiSelectOption[]>); // Async function
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface DropdownFilterField extends DropdownProps {
|
|
22
|
+
type: 'dropdown';
|
|
23
|
+
field: string; // The name of the field this filter applies to
|
|
24
|
+
optionField?: string; // @example - actionOptions
|
|
25
|
+
params?: QueryParams; // Additional QueryParams for the fetchOptionFn
|
|
26
|
+
fetchOptionFn?:
|
|
27
|
+
| ((args?: any) => MultiSelectOption[]) // Sync function to fetch options
|
|
28
|
+
| ((args?: any) => Promise<MultiSelectOption[]>); // Async function
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface RangeNumberFilterField extends InputRangeNumberProps {
|
|
32
|
+
type: 'rangenumber';
|
|
33
|
+
/**
|
|
34
|
+
* Specify min and max field
|
|
35
|
+
*
|
|
36
|
+
* @example ['minAge', 'maxAge']
|
|
37
|
+
*/
|
|
38
|
+
fields: string[];
|
|
39
|
+
tooltip?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ButtonSelectTreeFilterField
|
|
43
|
+
extends Omit<ButtonSelectTreeProps, 'type' | 'label' | 'fieldLabel'> {
|
|
44
|
+
type: 'group' | 'category';
|
|
45
|
+
field: string; // The name of the field this filter applies to
|
|
46
|
+
/**
|
|
47
|
+
* The field label.
|
|
48
|
+
*/
|
|
49
|
+
label?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The button label.
|
|
52
|
+
* @default to Select Group|Category
|
|
53
|
+
*/
|
|
54
|
+
buttonLabel?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface CalendarFilterField extends CalendarProps {
|
|
58
|
+
type: 'calendar';
|
|
59
|
+
field: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type AdditionalFilterField = ButtonSelectTreeFilterField;
|
|
63
|
+
|
|
64
|
+
export type FilterField =
|
|
65
|
+
| AdditionalFilterField
|
|
66
|
+
| MultiSelectFilterField
|
|
67
|
+
| DropdownFilterField
|
|
68
|
+
| RangeNumberFilterField
|
|
69
|
+
| CalendarFilterField;
|
|
70
|
+
|
|
71
|
+
export type FilterOptions<Opt = Record<string, boolean>> = Record<
|
|
72
|
+
keyof Opt,
|
|
73
|
+
MultiSelectOption[]
|
|
74
|
+
>;
|
|
75
|
+
|
|
76
|
+
export type LoadingFilters = Record<string, boolean>;
|
|
77
|
+
|
|
78
|
+
export type FetchOptionResponse<Opt = Record<string, boolean>> = {
|
|
79
|
+
message: string;
|
|
80
|
+
data: FilterOptions<Opt>;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export interface FilterContainerLocaleConfig {
|
|
84
|
+
clearFieldText?: string;
|
|
85
|
+
applyText?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface FilterContainerProps {
|
|
89
|
+
/**
|
|
90
|
+
* Specify the table name integrated with this filter.
|
|
91
|
+
*
|
|
92
|
+
* @default datatable - the default table name
|
|
93
|
+
*/
|
|
94
|
+
tableName?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Set the fields count in a row
|
|
97
|
+
*
|
|
98
|
+
* @default 4 grid columns
|
|
99
|
+
*/
|
|
100
|
+
fieldsPerRow?: number;
|
|
101
|
+
fields: FilterField[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Slots for FilterContainer component
|
|
106
|
+
*/
|
|
107
|
+
export type FilterContainerSlots = {
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated Please use props.fields instead
|
|
110
|
+
*/
|
|
111
|
+
default: Slot;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Additional template for field.
|
|
115
|
+
*/
|
|
116
|
+
field: Slot<{ field: AdditionalFilterField }>;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export type FilterContainerEmits = {
|
|
120
|
+
apply: [filter: QueryParams];
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* **WangsVue - FilterContainer**
|
|
125
|
+
*
|
|
126
|
+
* _FilterContainer is a component for generating a dynamic grid-based layout for any count of filter fields.
|
|
127
|
+
* It calculates the number of children in the container and sets their grid area style dynamically.
|
|
128
|
+
*
|
|
129
|
+
* The grid layout is determined by the row and column position, which are incremented based on the child count.
|
|
130
|
+
* If the child count is odd and the child is the last one (which is Buttons Action),
|
|
131
|
+
* it is placed in the 4th column._
|
|
132
|
+
*
|
|
133
|
+
* @group components
|
|
134
|
+
*/
|
|
135
|
+
declare const FilterContainer: DefineComponent<
|
|
136
|
+
FilterContainerProps,
|
|
137
|
+
FilterContainerEmits,
|
|
138
|
+
FilterContainerSlots
|
|
139
|
+
>;
|
|
140
|
+
|
|
141
|
+
export default FilterContainer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format the time in range selection when not show time.
|
|
3
|
+
* It will adjust the end range time to 23.59.59 and the start to 00.00.00
|
|
4
|
+
*
|
|
5
|
+
* @returns {number[]} - The formatted date time range in millis. [start, end]
|
|
6
|
+
*/
|
|
7
|
+
export declare const formatDateTimeRange: (e: number[]) => number[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FilterOptions, LoadingFilters, MultiSelectFilterField } from '../FilterContainer.vue.d';
|
|
2
|
+
declare const getOptions: (fn: MultiSelectFilterField["fetchOptionFn"], field: string, filterOption: FilterOptions, loading: LoadingFilters) => Promise<void>;
|
|
3
|
+
export default getOptions;
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FieldContext,
|
|
3
|
+
FieldState,
|
|
4
|
+
GenericObject,
|
|
5
|
+
MaybeArray,
|
|
6
|
+
} from 'vee-validate';
|
|
7
|
+
import { Ref, Slot } from 'vue';
|
|
8
|
+
import {
|
|
9
|
+
ClassComponent,
|
|
10
|
+
GlobalComponentConstructor,
|
|
11
|
+
Nullable,
|
|
12
|
+
HintedString,
|
|
13
|
+
} from '../ts-helpers';
|
|
14
|
+
|
|
15
|
+
export type Condition =
|
|
16
|
+
| 'empty'
|
|
17
|
+
| 'exceed'
|
|
18
|
+
| 'invalidFormat'
|
|
19
|
+
| 'exist'
|
|
20
|
+
| 'mismatch';
|
|
21
|
+
|
|
22
|
+
export type CustomValidation<T extends Partial<Condition> = Condition> =
|
|
23
|
+
Partial<Record<T, string>>;
|
|
24
|
+
|
|
25
|
+
type FieldValue =
|
|
26
|
+
| Nullable<string>
|
|
27
|
+
| Nullable<number>
|
|
28
|
+
| string
|
|
29
|
+
| string[]
|
|
30
|
+
| number
|
|
31
|
+
| number[]
|
|
32
|
+
| boolean
|
|
33
|
+
| undefined
|
|
34
|
+
| null
|
|
35
|
+
| object;
|
|
36
|
+
|
|
37
|
+
export type FieldValidation<T = FieldValue | undefined> =
|
|
38
|
+
| {
|
|
39
|
+
value: T;
|
|
40
|
+
errorMessage?: Ref<string | undefined>;
|
|
41
|
+
setErrors?: (errors?: string | string[]) => void;
|
|
42
|
+
handleReset?: () => void;
|
|
43
|
+
validate?: () => void;
|
|
44
|
+
setValue?: (value: any, shouldValidate?: boolean) => void;
|
|
45
|
+
}
|
|
46
|
+
| (Omit<FieldContext, 'value'> & {
|
|
47
|
+
value: T;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export type FormValue =
|
|
51
|
+
| string
|
|
52
|
+
| boolean
|
|
53
|
+
| number
|
|
54
|
+
| File
|
|
55
|
+
| GenericObject
|
|
56
|
+
| MaybeArray<any>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Generic form payload, able to receive types from outside
|
|
60
|
+
*/
|
|
61
|
+
export type FormPayload<FormValuesType = Record<string, FormValue>> = {
|
|
62
|
+
stayAfterSubmit: boolean;
|
|
63
|
+
formValues: FormValuesType;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Props for Form component
|
|
68
|
+
*/
|
|
69
|
+
export interface FormProps {
|
|
70
|
+
/**
|
|
71
|
+
* The template for form buttons.
|
|
72
|
+
*/
|
|
73
|
+
buttonsTemplate?: ('cancel' | 'clear' | 'save' | 'submit')[];
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Conditionally disable submit button.
|
|
77
|
+
*/
|
|
78
|
+
disableSubmit?: boolean;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Custom button cancel label.
|
|
82
|
+
*/
|
|
83
|
+
cancelBtnLabel?: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Custom button clear label.
|
|
87
|
+
*/
|
|
88
|
+
clearBtnLabel?: string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The number of columns per row.
|
|
92
|
+
* @default 1;
|
|
93
|
+
*/
|
|
94
|
+
columnPerRow?: number;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Determines whether form footer should be hidden or not
|
|
98
|
+
*/
|
|
99
|
+
hideFooter?: boolean;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Determines if the stay checkbox should be hidden.
|
|
103
|
+
*/
|
|
104
|
+
hideStayCheckbox?: boolean;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Invalid form state.
|
|
108
|
+
*/
|
|
109
|
+
invalid?: boolean;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Prevent form resets after submitted. Default behaviour is form resetted after submit.
|
|
113
|
+
*
|
|
114
|
+
* @default true
|
|
115
|
+
*/
|
|
116
|
+
resetAfterSubmit?: boolean;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Custom button save label.
|
|
120
|
+
*/
|
|
121
|
+
saveBtnLabel?: string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Custom button submit label.
|
|
125
|
+
*/
|
|
126
|
+
submitBtnLabel?: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Custom label for stay checkbox.
|
|
130
|
+
*/
|
|
131
|
+
stayCheckboxLabel?: string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Custom submit form validator message.
|
|
135
|
+
*/
|
|
136
|
+
validatorMessage?: string;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Determine whether button template "Save" should also behave like "Submit" (use validations)
|
|
140
|
+
*
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
validateOnSave?: boolean;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Defines the style of the cancel button.
|
|
147
|
+
*/
|
|
148
|
+
cancelBtnSeverity?: HintedString<
|
|
149
|
+
| 'secondary'
|
|
150
|
+
| 'success'
|
|
151
|
+
| 'info'
|
|
152
|
+
| 'warning'
|
|
153
|
+
| 'help'
|
|
154
|
+
| 'danger'
|
|
155
|
+
| 'contrast'
|
|
156
|
+
>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Defines the style of the submit button.
|
|
160
|
+
*/
|
|
161
|
+
saveBtnSeverity?: HintedString<
|
|
162
|
+
| 'secondary'
|
|
163
|
+
| 'success'
|
|
164
|
+
| 'info'
|
|
165
|
+
| 'warning'
|
|
166
|
+
| 'help'
|
|
167
|
+
| 'danger'
|
|
168
|
+
| 'contrast'
|
|
169
|
+
>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Defines the style of the submit button.
|
|
173
|
+
*/
|
|
174
|
+
submitBtnSeverity?: HintedString<
|
|
175
|
+
| 'secondary'
|
|
176
|
+
| 'success'
|
|
177
|
+
| 'info'
|
|
178
|
+
| 'warning'
|
|
179
|
+
| 'help'
|
|
180
|
+
| 'danger'
|
|
181
|
+
| 'contrast'
|
|
182
|
+
>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Slots for Form component
|
|
187
|
+
*/
|
|
188
|
+
export interface FormSlots {
|
|
189
|
+
/**
|
|
190
|
+
* The fields slot for the form. Here is where you can put your form fields.
|
|
191
|
+
*/
|
|
192
|
+
fields: Slot<{ formValues: GenericObject; key?: number }>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Emits for Form component
|
|
197
|
+
*/
|
|
198
|
+
export type FormEmits = {
|
|
199
|
+
/**
|
|
200
|
+
* Emitted when button template `Cancel` clicked (doesn't matter its label)
|
|
201
|
+
*/
|
|
202
|
+
cancel: [];
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Emitted when button template `Clear` clicked (doesn't matter its label)
|
|
206
|
+
*/
|
|
207
|
+
clear: [];
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Emitted when button template `Save` clicked (doesn't matter its label)
|
|
211
|
+
*/
|
|
212
|
+
save: [values: FormPayload];
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Emitted when button template `Submit` clicked (doesn't matter its label)
|
|
216
|
+
*/
|
|
217
|
+
submit: [values: FormPayload];
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* **WangsVue - Form**
|
|
222
|
+
*
|
|
223
|
+
* _Form is a component for creating forms with validation on submit using vee-validate.
|
|
224
|
+
* You need to install vee-validate while using this component._
|
|
225
|
+
*
|
|
226
|
+
* --- ---
|
|
227
|
+
* 
|
|
228
|
+
*
|
|
229
|
+
* @group components
|
|
230
|
+
*/
|
|
231
|
+
declare class Form extends ClassComponent<FormProps, FormSlots, FormEmits> {
|
|
232
|
+
/**
|
|
233
|
+
* Exposed errors of form
|
|
234
|
+
*/
|
|
235
|
+
errors: Partial<Record<string, string>>;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The ref of form element.
|
|
239
|
+
*/
|
|
240
|
+
formElement: HTMLFormElement;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Whether to show validator or not
|
|
244
|
+
*/
|
|
245
|
+
showValidator: boolean;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Whether to keep the dialog remains visible or not after submit.
|
|
249
|
+
*/
|
|
250
|
+
stayAfterSubmit: boolean;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Exposed function to clears the form fields.
|
|
254
|
+
*/
|
|
255
|
+
clearField: () => void;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Exposed function to clears the specific field.
|
|
259
|
+
*/
|
|
260
|
+
resetField: (field: string, state?: Partial<FieldState>) => void;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Exposed function that handle submit inside form component
|
|
264
|
+
*/
|
|
265
|
+
submit: (e?: Event | undefined) => Promise<void | undefined>;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Callback invoked on Button Submit clicked
|
|
269
|
+
*/
|
|
270
|
+
onSubmitClicked: () => void;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Exposed function to set the outer fields wrapper height.
|
|
274
|
+
*/
|
|
275
|
+
setOuterFieldsWrapperHeight: () => void;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Set the form values.
|
|
279
|
+
*/
|
|
280
|
+
setValues: (values: GenericObject) => void;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Set value for specific field.
|
|
284
|
+
*/
|
|
285
|
+
setFieldValue<T extends string>(
|
|
286
|
+
field: T,
|
|
287
|
+
value: GenericObject[T],
|
|
288
|
+
shouldValidate?: boolean,
|
|
289
|
+
): void;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Set errors fields
|
|
293
|
+
* @param fields - {
|
|
294
|
+
* name: 'This name already exists'
|
|
295
|
+
* }
|
|
296
|
+
*/
|
|
297
|
+
setErrors(fields: GenericObject): void;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
declare module '@vue/runtime-core' {
|
|
301
|
+
interface GlobalComponents {
|
|
302
|
+
Form: GlobalComponentConstructor<Form>;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export default Form;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ClassComponent } from '../ts-helpers.d';
|
|
2
|
+
|
|
3
|
+
export type File = {
|
|
4
|
+
_id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
src: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface GalleryPreviewProps {
|
|
12
|
+
files: File[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* **WangsVue - GalleryPreview**
|
|
17
|
+
*
|
|
18
|
+
* --- ---
|
|
19
|
+
* 
|
|
20
|
+
*
|
|
21
|
+
* @group Component
|
|
22
|
+
*
|
|
23
|
+
* @experimental
|
|
24
|
+
*/
|
|
25
|
+
declare class GalleryPreview extends ClassComponent<
|
|
26
|
+
GalleryPreviewProps,
|
|
27
|
+
unknown,
|
|
28
|
+
unknown
|
|
29
|
+
> {}
|
|
30
|
+
|
|
31
|
+
export default GalleryPreview;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SetupContext, VNode } from 'vue';
|
|
2
|
+
interface LabelProps {
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* For input like checkbox, radiobutton, toggleswitch, etc.
|
|
7
|
+
*
|
|
8
|
+
* Conditionally wrap the input with label element when props.label is defined.
|
|
9
|
+
*
|
|
10
|
+
* @param propsData
|
|
11
|
+
* @param setupContext
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
declare const Label: (propsData: LabelProps, setupContext?: SetupContext) => VNode;
|
|
15
|
+
export default Label;
|