@fewangsit/wangsvue-fats 1.0.0-alpha.31 → 1.0.0-alpha.32
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/components/animation/Animation.vue.d.ts +24 -0
- package/components/approverinfo/ApproverInfo.vue.d.ts +51 -0
- package/components/assetinfo/AssetInfo.vue.d.ts +34 -0
- package/components/badge/Badge.vue.d.ts +73 -0
- package/components/badgegroup/BadgeGroup.vue.d.ts +52 -0
- package/components/basecomponent/index.d.ts +28 -0
- package/components/basetree/BaseTree.vue.d.ts +591 -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 +188 -0
- package/components/buttonImportExcel/ButtonImportExcel.vue.d.ts +35 -0
- package/components/buttonbulkaction/ButtonBulkAction.vue.d.ts +104 -0
- package/components/buttoncopy/ButtonCopy.vue.d.ts +26 -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/buttonscan/ButtonScan.vue.d.ts +201 -0
- package/components/buttonsearch/ButtonSearch.vue.d.ts +38 -0
- package/components/buttonselecttree/ButtonSelectTree.vue.d.ts +200 -0
- package/components/buttonsplit/ButtonSplit.vue.d.ts +350 -0
- package/components/buttonsync/ButtonSync.vue.d.ts +22 -0
- package/components/buttontoggle/ButtonToggle.vue.d.ts +18 -0
- package/components/buttonviewlog/ButtonViewLog.vue.d.ts +17 -0
- package/components/calendar/Calendar.vue.d.ts +570 -0
- package/components/card/Card.vue.d.ts +139 -0
- package/components/checkbox/Checkbox.vue.d.ts +329 -0
- package/components/customcolumn/CustomColumn.vue.d.ts +37 -0
- package/components/datatable/DataTable.vue.d.ts +735 -0
- package/components/dialog/Dialog.vue.d.ts +464 -0
- package/components/dialogconfirm/DialogConfirm.vue.d.ts +164 -0
- package/components/dialogform/DialogForm.vue.d.ts +349 -0
- package/components/dialogselecttree/DialogSelectTree.vue.d.ts +136 -0
- package/components/dropdown/Dropdown.vue.d.ts +274 -0
- package/components/editor/Editor.vue.d.ts +191 -0
- package/components/fieldwrapper/FieldWrapper.vue.d.ts +69 -0
- package/components/fileupload/FileUpload.vue.d.ts +169 -0
- package/components/filtercontainer/FilterContainer.vue.d.ts +184 -0
- package/components/form/Form.vue.d.ts +316 -0
- package/components/icon/Icon.vue.d.ts +256 -0
- package/components/image/Image.vue.d.ts +403 -0
- package/components/imagecompressor/ImageCompressor.vue.d.ts +229 -0
- package/components/index.d.ts +58 -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 +8 -0
- package/components/inputemail/InputEmail.vue.d.ts +25 -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/inputrangenumber/InputRangeNumber.vue.d.ts +120 -0
- package/components/inputsearch/InputSearch.vue.d.ts +36 -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 +32 -0
- package/components/languagedropdown/LanguageDropdown.vue.d.ts +32 -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/menuitem/index.d.ts +106 -0
- package/components/multiselect/MultiSelect.vue.d.ts +194 -0
- package/components/overlaypanel/OverlayPanel.vue.d.ts +301 -0
- package/components/passthrough/index.d.ts +16 -0
- package/components/tabmenu/TabMenu.vue.d.ts +288 -0
- package/components/textarea/Textarea.vue.d.ts +170 -0
- package/components/timeline/Timeline.vue.d.ts +121 -0
- package/components/toast/Toast.vue.d.ts +367 -0
- package/components/toggleswitch/ToggleSwitch.vue.d.ts +281 -0
- package/components/tree/Tree.vue.d.ts +148 -0
- package/components/tree/helpers/filterNodeKeys.helper.d.ts +22 -0
- package/components/tree/helpers/flattenTreeNodeChildren.helper.d.ts +8 -0
- package/components/treesearchinput/TreeSearchInput.vue.d.ts +16 -0
- package/components/ts-helpers.d.ts +83 -0
- package/components/username/UserName.vue.d.ts +113 -0
- package/components/userwithicon/UserWithIcon.vue.d.ts +20 -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 +1 -1
- package/event-bus/index.d.ts +51 -51
- package/event-bus/mitt.d.ts +29 -14
- package/main.d.ts +31 -0
- package/package.json +8 -4
- package/plugins/WangsVue.d.ts +249 -199
- package/plugins/formValidation.d.ts +15 -6
- package/plugins/i18n-extension.d.ts +4 -0
- package/plugins/i18n.d.ts +82 -78
- package/utils/date.util.d.ts +59 -30
- package/utils/getSeverityByAssetStatus.util.d.ts +3 -0
- package/utils/index.d.ts +8 -0
- package/utils/listenSidebarChanges.util.d.ts +16 -0
- package/utils/object.util.d.ts +14 -3
- package/utils/role.util.d.ts +68 -0
- package/utils/toast.util.d.ts +78 -78
- package/utils/addAttachment.util.d.ts +0 -43
- package/utils/exportToExcel.util.d.ts +0 -20
- package/utils/filterOptions.util.d.ts +0 -3
- package/utils/genPlaceholder.util.d.ts +0 -8
- package/utils/getAttachmentIcon.util.d.ts +0 -8
- package/utils/mergePropsWithDefaults.util.d.ts +0 -20
- package/utils/textFormatter.util.d.ts +0 -17
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { DefineComponent, Slot } from 'vue';
|
|
2
|
+
import { CalendarProps } from '../calendar/Calendar.vue.d';
|
|
3
|
+
import { QueryParams } from '../datatable/DataTable.vue.d';
|
|
4
|
+
import {
|
|
5
|
+
DropdownProps,
|
|
6
|
+
Option,
|
|
7
|
+
} from '../../components/dropdown/Dropdown.vue.d';
|
|
8
|
+
import { InputRangeNumberProps } from '../inputrangenumber/InputRangeNumber.vue.d';
|
|
9
|
+
import { MultiSelectProps } from '../multiselect/MultiSelect.vue.d';
|
|
10
|
+
import { ButtonSelectTreeProps } from '../buttonselecttree/ButtonSelectTree.vue.d';
|
|
11
|
+
|
|
12
|
+
export type FilterMatchMode =
|
|
13
|
+
| 'CONTAINS'
|
|
14
|
+
| 'EQUALS'
|
|
15
|
+
| 'NOT_EQUALS'
|
|
16
|
+
| 'IN'
|
|
17
|
+
| 'LESS_THAN'
|
|
18
|
+
| 'LESS_THAN_OR_EQUAL_TO'
|
|
19
|
+
| 'GREATER_THAN'
|
|
20
|
+
| 'GREATER_THAN_OR_EQUAL_TO'
|
|
21
|
+
| 'BETWEEN'
|
|
22
|
+
| 'DATE_BETWEEN';
|
|
23
|
+
|
|
24
|
+
// More specific filter field types
|
|
25
|
+
export interface MultiSelectFilterField extends MultiSelectProps {
|
|
26
|
+
type: 'multiselect';
|
|
27
|
+
/**
|
|
28
|
+
* The name of the field this filter applies to.
|
|
29
|
+
*
|
|
30
|
+
* When using a static filter, it also specifies the field in the data to be used for generating unique options.
|
|
31
|
+
* For example, if filtering by a user's full name, the field could be 'user.fullName', which will extract
|
|
32
|
+
* unique full names from the table data and use them as filter options.
|
|
33
|
+
*/
|
|
34
|
+
field: string;
|
|
35
|
+
optionField?: string; // @example - actionOptions
|
|
36
|
+
params?: QueryParams; // Additional QueryParams for the fetchOptionFn
|
|
37
|
+
fetchOptionFn?:
|
|
38
|
+
| ((args?: any) => Option[] | undefined) // Sync function to fetch options
|
|
39
|
+
| ((args?: any) => Promise<Option[] | undefined>); // Async function
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface DropdownFilterField extends DropdownProps {
|
|
43
|
+
type: 'dropdown';
|
|
44
|
+
/**
|
|
45
|
+
* The name of the field this filter applies to.
|
|
46
|
+
*
|
|
47
|
+
* When using a static filter, it also specifies the field in the data to be used for generating unique options.
|
|
48
|
+
* For example, if filtering by a user's full name, the field could be 'user.fullName', which will extract
|
|
49
|
+
* unique full names from the table data and use them as filter options.
|
|
50
|
+
*/
|
|
51
|
+
field: string;
|
|
52
|
+
optionField?: string; // @example - actionOptions
|
|
53
|
+
params?: QueryParams; // Additional QueryParams for the fetchOptionFn
|
|
54
|
+
fetchOptionFn?:
|
|
55
|
+
| ((args?: any) => Option[] | undefined) // Sync function to fetch options
|
|
56
|
+
| ((args?: any) => Promise<Option[]> | undefined); // Async function
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface RangeNumberFilterField extends InputRangeNumberProps {
|
|
60
|
+
type: 'rangenumber';
|
|
61
|
+
/**
|
|
62
|
+
* Specify min and max field
|
|
63
|
+
*
|
|
64
|
+
* @example ['minAge', 'maxAge']
|
|
65
|
+
*/
|
|
66
|
+
fields?: string[];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Specify single field for both min and max input.
|
|
70
|
+
* The value will be a number array.
|
|
71
|
+
*
|
|
72
|
+
* Prever use this property when you are working with Static Filtering
|
|
73
|
+
*
|
|
74
|
+
* @example value: [1000,5000] or equal to 'value.0': 1000 & 'value.1': 5000
|
|
75
|
+
*/
|
|
76
|
+
field?: string;
|
|
77
|
+
tooltip?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ButtonSelectTreeFilterField
|
|
81
|
+
extends Omit<ButtonSelectTreeProps, 'type' | 'label' | 'fieldLabel'> {
|
|
82
|
+
type: 'group' | 'category';
|
|
83
|
+
field: string; // The name of the field this filter applies to
|
|
84
|
+
/**
|
|
85
|
+
* The field label.
|
|
86
|
+
*/
|
|
87
|
+
label?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The button label.
|
|
90
|
+
* @default to Select Group|Category
|
|
91
|
+
*/
|
|
92
|
+
buttonLabel?: string;
|
|
93
|
+
params?: QueryParams; // Override QueryParams for the fetchTree
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface CalendarFilterField extends CalendarProps {
|
|
97
|
+
type: 'calendar';
|
|
98
|
+
field: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type AdditionalFilterField = ButtonSelectTreeFilterField;
|
|
102
|
+
|
|
103
|
+
export type FilterField =
|
|
104
|
+
| AdditionalFilterField
|
|
105
|
+
| MultiSelectFilterField
|
|
106
|
+
| DropdownFilterField
|
|
107
|
+
| RangeNumberFilterField
|
|
108
|
+
| CalendarFilterField;
|
|
109
|
+
|
|
110
|
+
export type FilterOptions<Opt = Record<string, boolean>> = Record<
|
|
111
|
+
keyof Opt,
|
|
112
|
+
Option[]
|
|
113
|
+
>;
|
|
114
|
+
|
|
115
|
+
export type LoadingFilters = Record<string, boolean>;
|
|
116
|
+
|
|
117
|
+
export type FetchOptionResponse<Opt = Record<string, boolean>> = {
|
|
118
|
+
message: string;
|
|
119
|
+
data: FilterOptions<Opt>;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export interface FilterContainerLocaleConfig {
|
|
123
|
+
clearFieldText?: string;
|
|
124
|
+
applyText?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface FilterContainerProps {
|
|
128
|
+
/**
|
|
129
|
+
* Specify the table name integrated with this filter.
|
|
130
|
+
*
|
|
131
|
+
* @default datatable - the default table name
|
|
132
|
+
*/
|
|
133
|
+
tableName?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Set the fields count in a row
|
|
136
|
+
*
|
|
137
|
+
* @default 4 grid columns
|
|
138
|
+
*/
|
|
139
|
+
fieldsPerRow?: number;
|
|
140
|
+
fields: FilterField[];
|
|
141
|
+
/**
|
|
142
|
+
* Enable static filtering
|
|
143
|
+
*/
|
|
144
|
+
static?: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Slots for FilterContainer component
|
|
149
|
+
*/
|
|
150
|
+
export type FilterContainerSlots = {
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated Please use props.fields instead
|
|
153
|
+
*/
|
|
154
|
+
default: Slot;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Additional template for field.
|
|
158
|
+
*/
|
|
159
|
+
field: Slot<{ field: AdditionalFilterField; fieldName: string }>;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export type FilterContainerEmits = {
|
|
163
|
+
apply: [filter: QueryParams];
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* **WangsVue - FilterContainer**
|
|
168
|
+
*
|
|
169
|
+
* _FilterContainer is a component for generating a dynamic grid-based layout for any count of filter fields.
|
|
170
|
+
* It calculates the number of children in the container and sets their grid area style dynamically.
|
|
171
|
+
*
|
|
172
|
+
* The grid layout is determined by the row and column position, which are incremented based on the child count.
|
|
173
|
+
* If the child count is odd and the child is the last one (which is Buttons Action),
|
|
174
|
+
* it is placed in the 4th column._
|
|
175
|
+
*
|
|
176
|
+
* @group components
|
|
177
|
+
*/
|
|
178
|
+
declare const FilterContainer: DefineComponent<
|
|
179
|
+
FilterContainerProps,
|
|
180
|
+
FilterContainerEmits,
|
|
181
|
+
FilterContainerSlots
|
|
182
|
+
>;
|
|
183
|
+
|
|
184
|
+
export default FilterContainer;
|
|
@@ -0,0 +1,316 @@
|
|
|
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
|
+
* Callback invoked on Button Save clicked
|
|
274
|
+
*/
|
|
275
|
+
onSaveClicked: () => void;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Exposed function to set the outer fields wrapper height.
|
|
279
|
+
*/
|
|
280
|
+
setOuterFieldsWrapperHeight: () => void;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Set the form values.
|
|
284
|
+
*/
|
|
285
|
+
setValues: (values: GenericObject) => void;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Set value for specific field.
|
|
289
|
+
*/
|
|
290
|
+
setFieldValue<T extends string>(
|
|
291
|
+
field: T,
|
|
292
|
+
value: GenericObject[T],
|
|
293
|
+
shouldValidate?: boolean,
|
|
294
|
+
): void;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Set errors fields
|
|
298
|
+
* @param fields - {
|
|
299
|
+
* name: 'This name already exists'
|
|
300
|
+
* }
|
|
301
|
+
*/
|
|
302
|
+
setErrors(fields: GenericObject): void;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The form values
|
|
306
|
+
*/
|
|
307
|
+
values: GenericObject;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
declare module '@vue/runtime-core' {
|
|
311
|
+
interface GlobalComponents {
|
|
312
|
+
Form: GlobalComponentConstructor<Form>;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export default Form;
|