@fewangsit/wangsvue-gsts 1.0.0-alpha.9 → 2.0.0-alpha.10
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/animation/index.d.ts +44 -0
- package/{components/approverinfo/ApproverInfo.vue.d.ts → approverinfo/index.d.ts} +4 -0
- package/assets/scanner.worker-Bk2e5hSA.js.map +1 -0
- package/{components/badge/Badge.vue.d.ts → badge/index.d.ts} +10 -2
- package/{components/badgegroup/BadgeGroup.vue.d.ts → badgegroup/index.d.ts} +19 -9
- package/{components/badgegrouptree/BadgeGroupTree.vue.d.ts → badgegrouptree/index.d.ts} +2 -3
- package/{components/basecomponent → basecomponent}/index.d.ts +0 -1
- package/{components/basetree/BaseTree.vue.d.ts → basetree/index.d.ts} +37 -4
- package/breadcrumb/index.d.ts +42 -0
- package/breadcrumb/store/index.d.ts +8 -0
- package/{components/button/Button.vue.d.ts → button/index.d.ts} +18 -7
- package/{components/buttonbulkaction/ButtonBulkAction.vue.d.ts → buttonbulkaction/index.d.ts} +11 -4
- package/buttoncopy/index.d.ts +26 -0
- package/{components/buttondownload/ButtonDownload.vue.d.ts → buttondownload/index.d.ts} +37 -3
- package/buttonfilter/index.d.ts +23 -0
- package/{components/buttonradio/ButtonRadio.vue.d.ts → buttonradio/index.d.ts} +3 -2
- package/buttonscan/index.d.ts +215 -0
- package/{components/buttonsearch/ButtonSearch.vue.d.ts → buttonsearch/index.d.ts} +6 -5
- package/buttonsearchbyscan/index.d.ts +51 -0
- package/{components/buttonselecttree/ButtonSelectTree.vue.d.ts → buttonselecttree/index.d.ts} +33 -14
- package/buttonsync/index.d.ts +22 -0
- package/buttontoggle/index.d.ts +27 -0
- package/{components/calendar/Calendar.vue.d.ts → calendar/index.d.ts} +44 -7
- package/{components/card/Card.vue.d.ts → card/index.d.ts} +3 -3
- package/carousel/index.d.ts +28 -0
- package/{components/changelog/Changelog.vue.d.ts → changelog/index.d.ts} +8 -4
- package/{components/changelogpage/ChangelogPage.vue.d.ts → changelogpage/index.d.ts} +9 -4
- package/{components/checkbox/Checkbox.vue.d.ts → checkbox/index.d.ts} +3 -2
- package/components.d.ts +66 -0
- package/config/defaultProps.d.ts +1 -1
- package/config/index.d.ts +1 -1
- package/config/locale.d.ts +1 -1
- package/{components/customcolumn/CustomColumn.vue.d.ts → customcolumn/index.d.ts} +18 -2
- package/datatable/index.d.ts +913 -0
- package/dial-codes-DGcGIlbX.js +5 -0
- package/dial-codes-DGcGIlbX.js.map +1 -0
- package/{components/dialog/Dialog.vue.d.ts → dialog/index.d.ts} +6 -6
- package/{components/dialogconfirm/DialogConfirm.vue.d.ts → dialogconfirm/index.d.ts} +9 -4
- package/{components/dialogform/DialogForm.vue.d.ts → dialogform/index.d.ts} +16 -36
- package/{components/dialogselecttree/DialogSelectTree.vue.d.ts → dialogselecttree/index.d.ts} +55 -14
- package/directives/focus.d.ts +1 -1
- package/directives/index.d.ts +1 -0
- package/directives/tooltip.d.ts +1 -0
- package/{components/dropdown/Dropdown.vue.d.ts → dropdown/index.d.ts} +44 -7
- package/{components/editor/Editor.vue.d.ts → editor/index.d.ts} +9 -1
- package/event-bus/index.d.ts +59 -48
- package/event-bus/mitt.d.ts +29 -14
- package/{components/fieldwrapper/FieldWrapper.vue.d.ts → fieldwrapper/index.d.ts} +32 -2
- package/{components/fileupload/FileUpload.vue.d.ts → fileupload/index.d.ts} +25 -8
- package/filtercontainer/index.d.ts +233 -0
- package/{components/form/Form.vue.d.ts → form/index.d.ts} +16 -3
- package/{components/icon/Icon.vue.d.ts → icon/index.d.ts} +76 -56
- package/{components/image/Image.vue.d.ts → image/index.d.ts} +35 -9
- package/{components/imagecompressor/ImageCompressor.vue.d.ts → imagecompressor/index.d.ts} +43 -3
- package/{components/inlinemessage/InlineMessage.vue.d.ts → inlinemessage/index.d.ts} +4 -1
- package/{components/inputbadge/InputBadge.vue.d.ts → inputbadge/index.d.ts} +37 -4
- package/inputcurrency/helpers/index.d.ts +8 -0
- package/{components/inputcurrency/InputCurrency.vue.d.ts → inputcurrency/index.d.ts} +5 -35
- package/inputemail/index.d.ts +30 -0
- package/{components/inputnumber/InputNumber.vue.d.ts → inputnumber/index.d.ts} +12 -10
- package/inputotp/index.d.ts +3 -0
- package/inputpassword/index.d.ts +73 -0
- package/{components/inputphonenumber/InputPhoneNumber.vue.d.ts → inputphonenumber/index.d.ts} +14 -9
- package/{components/inputrangenumber/InputRangeNumber.vue.d.ts → inputrangenumber/index.d.ts} +26 -11
- package/{components/inputtext/InputText.vue.d.ts → inputtext/index.d.ts} +9 -7
- package/inputurl/index.d.ts +38 -0
- package/invisiblefield/index.d.ts +39 -0
- package/languageswitcher/index.d.ts +15 -0
- package/{components/litedropdown/LiteDropdown.vue.d.ts → litedropdown/index.d.ts} +6 -4
- package/{components/loading/Loading.vue.d.ts → loading/index.d.ts} +3 -3
- package/{components/loading/store/loading.store.d.ts → loading/store/index.d.ts} +3 -3
- package/loading-page-CoC9UhfC.js +1 -0
- package/loading-page-CoC9UhfC.js.map +1 -0
- package/loading-page-CoXtqoc9.js +1 -0
- package/loading-page-CoXtqoc9.js.map +1 -0
- package/loading-page-dark-e0SrRAHc.js +5 -0
- package/loading-page-dark-e0SrRAHc.js.map +1 -0
- package/loading-page-f8D03l3G.js +1 -0
- package/loading-page-f8D03l3G.js.map +1 -0
- package/loading-plane-CoXtqoc9.js +1 -0
- package/loading-plane-CoXtqoc9.js.map +1 -0
- package/loading-table-ByUoWqUo.js +1 -0
- package/loading-table-ByUoWqUo.js.map +1 -0
- package/loading-table-BygEMzFM.js +1 -0
- package/loading-table-BygEMzFM.js.map +1 -0
- package/loading-table-D9bw9OcI.js +5 -0
- package/loading-table-D9bw9OcI.js.map +1 -0
- package/loading-table-dark-BGh0tAPM.js +5 -0
- package/loading-table-dark-BGh0tAPM.js.map +1 -0
- package/mcp/components.json +4767 -0
- package/mcp/components.summary.txt +24 -0
- package/mcp/main.js +16996 -0
- package/mcp/package.json +28 -0
- package/mcp/skills/api-service-generator/SKILL.md +93 -0
- package/mcp/skills/committing-changes/SKILL.md +38 -0
- package/mcp/skills/figma-datatable-generator/SKILL.md +93 -0
- package/mcp/skills/figma-to-code/SKILL.md +117 -0
- package/mcp/skills/import-validator/SKILL.md +54 -0
- package/mcp/skills/wangsvue-code-review/SKILL.md +70 -0
- package/mcp/skills/wangsvue-workflow/SKILL.md +91 -0
- package/{components/menu/Menu.vue.d.ts → menu/index.d.ts} +5 -4
- package/menuitem/index.d.ts +34 -0
- package/{components/multiselect/MultiSelect.vue.d.ts → multiselect/index.d.ts} +36 -6
- package/no-data-CTKux8RI.js +1 -0
- package/no-data-CTKux8RI.js.map +1 -0
- package/no-data-DLHO1L_u.js +1 -0
- package/no-data-DLHO1L_u.js.map +1 -0
- package/no-data-dark-nK4e4RAM.js +5 -0
- package/no-data-dark-nK4e4RAM.js.map +1 -0
- package/no-data-g0dJCy2p.js +1 -0
- package/no-data-g0dJCy2p.js.map +1 -0
- package/{components/overlaypanel/OverlayPanel.vue.d.ts → overlaypanel/index.d.ts} +4 -23
- package/package.json +27 -9
- package/paginator/index.d.ts +291 -0
- package/{components/passthrough → passthrough}/index.d.ts +0 -1
- package/plugins/WangsVue.d.ts +275 -98
- package/plugins/basei18n.d.ts +103 -0
- package/plugins/formValidation.d.ts +16 -6
- package/scan-qr-C6V4afHJ.js +5 -0
- package/scan-qr-C6V4afHJ.js.map +1 -0
- package/stats.html +4949 -0
- package/style.css +1 -1
- package/tabmenu/index.d.ts +104 -0
- package/tagtype/index.d.ts +33 -0
- package/{components/textarea/Textarea.vue.d.ts → textarea/index.d.ts} +16 -9
- package/{components/timeline/Timeline.vue.d.ts → timeline/index.d.ts} +42 -7
- package/{components/toast/Toast.vue.d.ts → toast/index.d.ts} +72 -71
- package/toast/service/index.d.ts +1 -0
- package/{components/toggleswitch/ToggleSwitch.vue.d.ts → toggleswitch/index.d.ts} +3 -2
- package/{components/tree → tree}/helpers/filterNodeKeys.helper.d.ts +8 -2
- package/tree/helpers/flattenTreeNodeChildren.helper.d.ts +8 -0
- package/{components/tree/Tree.vue.d.ts → tree/index.d.ts} +20 -12
- package/{components/ts-helpers.d.ts → ts-helpers.d.ts} +8 -1
- package/{components/username/UserName.vue.d.ts → username/index.d.ts} +14 -10
- package/utils/baseToast.util.d.ts +57 -0
- package/utils/cookie.util.d.ts +18 -0
- package/utils/date.util.d.ts +86 -23
- package/utils/exportToExcel.util.d.ts +19 -16
- package/utils/getStatusSeverity.util.d.ts +10 -3
- package/utils/index.d.ts +20 -17
- package/utils/object.util.d.ts +27 -2
- package/utils/role.util.d.ts +5 -1
- package/utils/textFormatter.util.d.ts +15 -3
- package/utils/toast.util.d.ts +2 -2
- package/utils/xlsx.util.d.ts +24 -0
- package/validatormessage/index.d.ts +23 -0
- package/wangsvue-gsts.d.ts +31 -0
- package/wangsvue-gsts.es.js +55418 -125996
- package/wangsvue-gsts.es.js.map +1 -0
- package/wangsvue-gsts.system.js +20 -422
- package/wangsvue-gsts.system.js.map +1 -0
- package/assets/json/currencies.json.d.ts +0 -1068
- package/assets/json/languages.json.d.ts +0 -180
- package/build-entry.d.ts +0 -14
- package/components/animation/Animation.vue.d.ts +0 -24
- package/components/basetree/TreeNode.vue.d.ts +0 -35
- package/components/breadcrumb/Breadcrumb.vue.d.ts +0 -26
- package/components/buttonImportExcel/ButtonImportExcel.vue.d.ts +0 -26
- package/components/buttonfilter/ButtonFilter.vue.d.ts +0 -12
- package/components/buttonsplit/ButtonSplit.d.ts +0 -350
- package/components/buttonsplit/ButtonSplit.vue.d.ts +0 -34
- package/components/buttontoggle/ButtonToggle.vue.d.ts +0 -18
- package/components/calendar/BaseCalendar.vue.d.ts +0 -83
- package/components/changelogpage/ChangelogFilter.vue.d.ts +0 -16
- package/components/codesnippet/CodeSnippet.vue.d.ts +0 -14
- package/components/datatable/DataTable.vue.d.ts +0 -704
- package/components/datatable/MultiRow.vue.d.ts +0 -16
- package/components/datatable/helpers/adjustMenuPosition.helper.d.ts +0 -1
- package/components/datatable/helpers/filter.helper.d.ts +0 -28
- package/components/datatable/helpers/index.d.ts +0 -3
- package/components/datatable/helpers/readConfig.helper.d.ts +0 -2
- package/components/datatable/store/dataTable.store.d.ts +0 -22
- package/components/editor/CodeSnippetAdapter.vue.d.ts +0 -92
- package/components/editor/EditorButton.vue.d.ts +0 -15
- package/components/editor/MentionList.vue.d.ts +0 -35
- package/components/editor/MentionSection.vue.d.ts +0 -92
- package/components/editor/codeSnippetExtension.d.ts +0 -3
- package/components/editor/mentionSectionExtension.d.ts +0 -3
- package/components/editor/suggestion.d.ts +0 -2
- package/components/filtercontainer/FilterContainer.vue.d.ts +0 -141
- package/components/filtercontainer/helpers/applyFilter.helper.d.ts +0 -3
- package/components/filtercontainer/helpers/formatDateTimeRange.helper.d.ts +0 -7
- package/components/filtercontainer/helpers/getOption.helper.d.ts +0 -3
- package/components/gallerypreview/GalleryPreview.vue.d.ts +0 -31
- package/components/helpers/convertToArrayClass.helper.d.ts +0 -2
- package/components/helpers/index.d.ts +0 -2
- package/components/helpers/label.d.ts +0 -15
- package/components/imagecompressor/BackgroundImageCropper.vue.d.ts +0 -36
- package/components/imagecompressor/ImageInputInfo.vue.d.ts +0 -30
- package/components/index.d.ts +0 -66
- package/components/inputcurrency/helpers/currency.helper.d.ts +0 -4
- package/components/inputemail/InputEmail.vue.d.ts +0 -25
- package/components/inputgroup/InputGroup.vue.d.ts +0 -141
- package/components/inputpassword/InputPassword.vue.d.ts +0 -32
- package/components/inputphonenumber/helpers/getUserLocation.helper.d.ts +0 -8
- package/components/inputurl/InputURL.vue.d.ts +0 -39
- package/components/invisiblefield/InvisibleField.vue.d.ts +0 -36
- package/components/languagedropdown/LanguageDropdown.vue.d.ts +0 -58
- package/components/languagedropdown/LanguageDropdownOption.vue.d.ts +0 -18
- package/components/menu/helpers/filterMenu.helper.d.ts +0 -12
- package/components/menu/helpers/index.d.ts +0 -1
- package/components/menuitem/MenuItem.vue.d.ts +0 -19
- package/components/menuitem/index.d.ts +0 -104
- package/components/progressbar/ProgressBar.vue.d.ts +0 -72
- package/components/quickfilter/QuickFilter.vue.d.ts +0 -25
- package/components/tabmenu/TabMenu.vue.d.ts +0 -288
- package/components/tagtype/TagType.vue.d.ts +0 -22
- package/components/timeline/TimelineContentByType.vue.d.ts +0 -16
- package/components/tooltipspan/TooltipSpan.vue.d.ts +0 -20
- package/components/tree/helpers/flattenTreeNodeChildren.helper.d.ts +0 -6
- package/components/tree/helpers/index.d.ts +0 -3
- package/components/treesearchinput/TreeSearchInput.vue.d.ts +0 -16
- package/components/usergroup/UserGroup.vue.d.ts +0 -57
- package/components/validatormessage/ValidatorMessage.vue.d.ts +0 -12
- package/loading-page-BrQattYE.js +0 -1
- package/loading-page-CgfbWppy.js +0 -1
- package/loading-page-DbLuqCHa.js +0 -1
- package/loading-plane-CgfbWppy.js +0 -1
- package/loading-table-Bb2MtjdD.js +0 -4
- package/loading-table-Br25QIny.js +0 -1
- package/loading-table-BzrSQlA0.js +0 -1
- package/loading-table-chOgXi94.js +0 -1
- package/main.d.ts +0 -2
- package/no-data-Cgze_Rvp.js +0 -1
- package/no-data-Dep79CBh.js +0 -1
- package/no-data-y1X5WtcQ.js +0 -1
- package/plugins/translation.d.ts +0 -37
- package/types/options.type.d.ts +0 -16
- 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
|
@@ -0,0 +1,913 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AllowedComponentProps,
|
|
3
|
+
Component,
|
|
4
|
+
ComponentCustomProps,
|
|
5
|
+
VNode,
|
|
6
|
+
VNodeProps,
|
|
7
|
+
} from 'vue';
|
|
8
|
+
|
|
9
|
+
import { DialogConfirmProps } from '../dialogconfirm';
|
|
10
|
+
import { MenuItem } from '../menuitem';
|
|
11
|
+
import { DateOptions } from '../utils/date.util';
|
|
12
|
+
|
|
13
|
+
import { WangsIconseverities } from '../icon';
|
|
14
|
+
import { EmitFn, HintedString } from '../ts-helpers.d';
|
|
15
|
+
|
|
16
|
+
export interface DataTableLocaleConfig {
|
|
17
|
+
/**
|
|
18
|
+
* Message to display on loading ovevrlay while downloading
|
|
19
|
+
*/
|
|
20
|
+
downloadingMessage?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Text when booleanValue is true
|
|
24
|
+
*/
|
|
25
|
+
trueText?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Text when booleanValue is false
|
|
29
|
+
*/
|
|
30
|
+
falseText?: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Text on paginator when data exist
|
|
34
|
+
*/
|
|
35
|
+
paginationReportFound?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Text on paginator when data doesn't exist
|
|
39
|
+
*/
|
|
40
|
+
paginationReportNotFound?: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Specify the error message download excel
|
|
44
|
+
*
|
|
45
|
+
* @example 'Error, failed to download {fileName}' - fileName will be replaced
|
|
46
|
+
*/
|
|
47
|
+
excelToastErrorMessage?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Custom message when data table is empty
|
|
50
|
+
*
|
|
51
|
+
* Will be shown bellow no-data animation
|
|
52
|
+
*/
|
|
53
|
+
emptyTableMessage?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type ChildGroup<T extends Data = Data> = {
|
|
57
|
+
groupHeader: string;
|
|
58
|
+
groupItems: T[];
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type Data<T = Record<string, any>> = T & {
|
|
62
|
+
children?: ChildGroup<T>[];
|
|
63
|
+
hasChildren?: boolean;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type QueryParams = Partial<Record<string, any>>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Custom sort event.
|
|
70
|
+
* @see {@link BaseDataTableEmits.sort}
|
|
71
|
+
*/
|
|
72
|
+
export interface DataTableSortEvent {
|
|
73
|
+
/**
|
|
74
|
+
* Browser event.
|
|
75
|
+
*/
|
|
76
|
+
originalEvent: Event;
|
|
77
|
+
/**
|
|
78
|
+
* Number of rows to display in new page
|
|
79
|
+
*/
|
|
80
|
+
rows: number;
|
|
81
|
+
/**
|
|
82
|
+
* Field to sort against
|
|
83
|
+
*/
|
|
84
|
+
sortField: string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Sort order as integer
|
|
87
|
+
*/
|
|
88
|
+
sortOrder: 1 | 0 | -1 | undefined | null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Custom pagination event.
|
|
93
|
+
* @see {@link BaseDataTableEmits.page}
|
|
94
|
+
* @extends DataTableSortEvent
|
|
95
|
+
*/
|
|
96
|
+
export interface DataTablePageEvent extends DataTableSortEvent {
|
|
97
|
+
/**
|
|
98
|
+
* New page number
|
|
99
|
+
*/
|
|
100
|
+
page: number;
|
|
101
|
+
/**
|
|
102
|
+
* Total page count
|
|
103
|
+
*/
|
|
104
|
+
pageCount: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Custom datatable operator filter metadata.
|
|
109
|
+
*/
|
|
110
|
+
export interface DataTableOperatorFilterMetaData {
|
|
111
|
+
/**
|
|
112
|
+
* Filter operator
|
|
113
|
+
*/
|
|
114
|
+
operator: string;
|
|
115
|
+
/**
|
|
116
|
+
* Array of filter meta data.
|
|
117
|
+
*/
|
|
118
|
+
constraints: DataTableFilterMetaData[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Custom datatable filter metadata.
|
|
123
|
+
*/
|
|
124
|
+
export interface DataTableFilterMetaData {
|
|
125
|
+
/**
|
|
126
|
+
* Filter value
|
|
127
|
+
*/
|
|
128
|
+
value: any;
|
|
129
|
+
/**
|
|
130
|
+
* Filter match mode
|
|
131
|
+
*/
|
|
132
|
+
matchMode:
|
|
133
|
+
| HintedString<
|
|
134
|
+
| 'startsWith'
|
|
135
|
+
| 'contains'
|
|
136
|
+
| 'notContains'
|
|
137
|
+
| 'endsWith'
|
|
138
|
+
| 'equals'
|
|
139
|
+
| 'notEquals'
|
|
140
|
+
| 'in'
|
|
141
|
+
| 'lt'
|
|
142
|
+
| 'lte'
|
|
143
|
+
| 'gt'
|
|
144
|
+
| 'gte'
|
|
145
|
+
| 'between'
|
|
146
|
+
| 'dateIs'
|
|
147
|
+
| 'dateIsNot'
|
|
148
|
+
| 'dateBefore'
|
|
149
|
+
| 'dateAfter'
|
|
150
|
+
>
|
|
151
|
+
| undefined;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Custom datatable filter metadata.
|
|
156
|
+
*/
|
|
157
|
+
export interface DataTableFilterMeta {
|
|
158
|
+
/**
|
|
159
|
+
* Extra options
|
|
160
|
+
*/
|
|
161
|
+
[key: string]:
|
|
162
|
+
| string
|
|
163
|
+
| DataTableFilterMetaData
|
|
164
|
+
| DataTableOperatorFilterMetaData;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type FetchListResponse<T extends Data = Data> = {
|
|
168
|
+
message: string;
|
|
169
|
+
data: {
|
|
170
|
+
data: T[];
|
|
171
|
+
totalRecords: number;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type ShortFetchListResponse<T = Data> = {
|
|
176
|
+
status: number;
|
|
177
|
+
message: string;
|
|
178
|
+
data: T[];
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type TableCellComponent<T extends Data = Data> = {
|
|
182
|
+
component: Component;
|
|
183
|
+
/**
|
|
184
|
+
* Props to pass to the component
|
|
185
|
+
*/
|
|
186
|
+
props?: object;
|
|
187
|
+
/**
|
|
188
|
+
* Events or emits to pass to the component
|
|
189
|
+
*/
|
|
190
|
+
events?: any;
|
|
191
|
+
/**
|
|
192
|
+
* Model to pass to the component
|
|
193
|
+
* @deprecated use `props` instead
|
|
194
|
+
*/
|
|
195
|
+
model?: any;
|
|
196
|
+
/**
|
|
197
|
+
* Callback when component model changed
|
|
198
|
+
* @param itemData The row data object.
|
|
199
|
+
* @returns The new value of the component.
|
|
200
|
+
* @deprecated use `events` instead
|
|
201
|
+
*/
|
|
202
|
+
onChange?: (itemData: T) => void;
|
|
203
|
+
disabled?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* To tell DataTable component whether this component should stop propagation or not
|
|
206
|
+
*
|
|
207
|
+
* @default true - since old logic was automatically stop event click from bodyComponent
|
|
208
|
+
*/
|
|
209
|
+
stop?: boolean;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export type TogglePresetConfirmDialogProps<T extends Data = Data> = Omit<
|
|
213
|
+
DialogConfirmProps,
|
|
214
|
+
'visible' | 'list' | 'onConfirm'
|
|
215
|
+
> & {
|
|
216
|
+
/**
|
|
217
|
+
* When the dialog should be shown?
|
|
218
|
+
* Pass a boolean returning function to show dialog when it returns true.
|
|
219
|
+
*
|
|
220
|
+
* @default both - leave this as undefined to show on both states
|
|
221
|
+
*/
|
|
222
|
+
showWhen?:
|
|
223
|
+
| 'active'
|
|
224
|
+
| 'inactive'
|
|
225
|
+
| ((data: T, state: boolean) => boolean)
|
|
226
|
+
| ((data: T, state: boolean) => Promise<boolean>);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
interface ColumnConfirmActionPresetBase<T extends Data = Data> {
|
|
230
|
+
/**
|
|
231
|
+
* Use dialog confirmation
|
|
232
|
+
*/
|
|
233
|
+
confirmDialogProps?:
|
|
234
|
+
| TogglePresetConfirmDialogProps<T>
|
|
235
|
+
| ((state: boolean, data: T) => TogglePresetConfirmDialogProps<T>);
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Callback for confirmation
|
|
239
|
+
*/
|
|
240
|
+
onConfirm?: (state: boolean, data: T, revertFunction: () => void) => void;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface ColumnTogglePreset<T extends Data = Data>
|
|
244
|
+
extends ColumnConfirmActionPresetBase<T> {
|
|
245
|
+
type: 'toggle';
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Callback function when toggle state changes
|
|
249
|
+
*
|
|
250
|
+
* IMPORTANT: This callback is ALWAYS called regardless of whether confirmation dialog is shown
|
|
251
|
+
* The 'state' parameter represents the NEW state that user sees on screen
|
|
252
|
+
*
|
|
253
|
+
* Usage Pattern:
|
|
254
|
+
* 1. Check if confirmation dialog will be shown using your business logic
|
|
255
|
+
* 2. If confirmation needed: Don't call API here, wait for onConfirm callback
|
|
256
|
+
* 3. If no confirmation needed: Call API immediately to persist state
|
|
257
|
+
* 4. If API fails: Call revertFunction() to restore previous state
|
|
258
|
+
*
|
|
259
|
+
* @param state boolean - NEW toggle state (what user sees on screen)
|
|
260
|
+
* @param data T - The row data object
|
|
261
|
+
* @param revertFunction - Function to revert state when API call fails or user cancels
|
|
262
|
+
* @returns void
|
|
263
|
+
*/
|
|
264
|
+
onToggle?: (state: boolean, data: T, revertFunction: () => void) => void;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Add conditional disabling for each row
|
|
268
|
+
*/
|
|
269
|
+
disabled?: boolean | ((data: T) => boolean);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface ColumnCheckboxPreset<T extends Data = Data>
|
|
273
|
+
extends ColumnConfirmActionPresetBase<T> {
|
|
274
|
+
type: 'checkbox';
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Callback function when checkbox state changes
|
|
278
|
+
*
|
|
279
|
+
* IMPORTANT: This callback is ALWAYS called regardless of whether confirmation dialog is shown
|
|
280
|
+
* The 'state' parameter represents the NEW state that user sees on screen
|
|
281
|
+
*
|
|
282
|
+
* Usage Pattern:
|
|
283
|
+
* 1. Check if confirmation dialog will be shown using your business logic
|
|
284
|
+
* 2. If confirmation needed: Don't call API here, wait for onConfirm callback
|
|
285
|
+
* 3. If no confirmation needed: Call API immediately to persist state
|
|
286
|
+
* 4. If API fails: Call revertFunction() to restore previous state
|
|
287
|
+
*
|
|
288
|
+
* @param state boolean - NEW checkbox state (what user sees on screen)
|
|
289
|
+
* @param data T - The row data object
|
|
290
|
+
* @param revertFunction - Function to revert state when API call fails or user cancels
|
|
291
|
+
* @returns void
|
|
292
|
+
*/
|
|
293
|
+
onCheck?: (state: boolean, data: T, revertFunction: () => void) => void;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Add conditional disabling for each row
|
|
297
|
+
*/
|
|
298
|
+
disabled?: boolean | ((data: T) => boolean);
|
|
299
|
+
}
|
|
300
|
+
export interface ColumnMultiRowPreset<T extends Data = Data> {
|
|
301
|
+
type: 'multirow';
|
|
302
|
+
fieldAttributes?: (data: T) => MultiRowAttribute[];
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface MultiRowAttribute<T extends Data = Data> {
|
|
306
|
+
class?: string | string[];
|
|
307
|
+
value?: string;
|
|
308
|
+
bodyComponent?: TableCellComponent<T>;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export type ColumnPreset<T extends Data = Data> =
|
|
312
|
+
| ColumnTogglePreset<T>
|
|
313
|
+
| ColumnMultiRowPreset<T>
|
|
314
|
+
| ColumnCheckboxPreset<T>;
|
|
315
|
+
|
|
316
|
+
export interface CombinedHeaders<T extends Data = Data> {
|
|
317
|
+
parent: TableParentHeader<T>[];
|
|
318
|
+
child: TreeTableColumns<T>[];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface TableParentHeader<T extends Data = Data>
|
|
322
|
+
extends Pick<
|
|
323
|
+
TableColumn<T>,
|
|
324
|
+
'header' | 'info' | 'infoSeverity' | 'headerClass' | 'sortable'
|
|
325
|
+
> {
|
|
326
|
+
/**
|
|
327
|
+
* Field is used as the header's key, parent headers with
|
|
328
|
+
* the same field will be grouped into one cell
|
|
329
|
+
*/
|
|
330
|
+
field: string;
|
|
331
|
+
/**
|
|
332
|
+
* Note: colspan is calculated automatically
|
|
333
|
+
* @ignore
|
|
334
|
+
*/
|
|
335
|
+
colspan?: number;
|
|
336
|
+
/**
|
|
337
|
+
* Note: rowspan is calculated automatically
|
|
338
|
+
* @ignore
|
|
339
|
+
*/
|
|
340
|
+
rowspan?: number;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface TableColumn<T extends Data> {
|
|
344
|
+
/**
|
|
345
|
+
* The text rendered on th on each column
|
|
346
|
+
*/
|
|
347
|
+
header?: string;
|
|
348
|
+
/**
|
|
349
|
+
* The headers placed above certain child headers. If there are
|
|
350
|
+
* multiple child headers with the same parent header, the parent
|
|
351
|
+
* will have its colspan extended. The parent header will be shown
|
|
352
|
+
* when at least one of its child headers is visible.
|
|
353
|
+
*/
|
|
354
|
+
parentHeader?: TableParentHeader<T>;
|
|
355
|
+
/**
|
|
356
|
+
* The field name of the column.
|
|
357
|
+
* Field is representing field on the row object to be displayed on the column.
|
|
358
|
+
* The field is crucial for sorting and filtering the data.
|
|
359
|
+
*/
|
|
360
|
+
field: string;
|
|
361
|
+
fieldType?: 'string' | 'number' | 'boolean' | 'array';
|
|
362
|
+
/**
|
|
363
|
+
* Display information icon on the column header and show tooltip information about the column.
|
|
364
|
+
*/
|
|
365
|
+
info?: string;
|
|
366
|
+
/**
|
|
367
|
+
* The severity of the information icon.
|
|
368
|
+
*/
|
|
369
|
+
infoSeverity?: WangsIconseverities;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Whether the column is editable.
|
|
373
|
+
* Editable column will set contenteditable to true on the cell.
|
|
374
|
+
*/
|
|
375
|
+
editable?: boolean;
|
|
376
|
+
/**
|
|
377
|
+
* If the column is editable, only allow number inputs.
|
|
378
|
+
*/
|
|
379
|
+
numberInputOnly?: boolean;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Whether the column is sortable.
|
|
383
|
+
* Sortable column will add sort icon on the column header. It will produce query `sortBy` and `sortOrder`. The value for sortBy determined by column 'field'.
|
|
384
|
+
*/
|
|
385
|
+
sortable?: boolean;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Controls whether column appears in column visibility menu for reordering
|
|
389
|
+
* @default true
|
|
390
|
+
* @example
|
|
391
|
+
* // Column appears in menu and can be reordered
|
|
392
|
+
* { field: 'name', reorderable: true }
|
|
393
|
+
*
|
|
394
|
+
* // Column does NOT appear in menu (but still visible in table)
|
|
395
|
+
* { field: 'id', reorderable: false }
|
|
396
|
+
*/
|
|
397
|
+
reorderable?: boolean;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Controls whether column can be dragged to reorder position in column visibility menu
|
|
401
|
+
* @default true
|
|
402
|
+
* @example
|
|
403
|
+
* // Column can be reordered by dragging
|
|
404
|
+
* { field: 'category', dragable: true }
|
|
405
|
+
*
|
|
406
|
+
* // Column cannot be dragged (but may still appear in menu)
|
|
407
|
+
* { field: 'code', dragable: false }
|
|
408
|
+
*/
|
|
409
|
+
dragable?: boolean;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Makes column completely fixed - no visibility changes allowed
|
|
413
|
+
* @default false
|
|
414
|
+
* @example
|
|
415
|
+
* // Fixed column - never appears in visibility menu AND cannot be hidden
|
|
416
|
+
* { field: 'id', fixed: true }
|
|
417
|
+
*
|
|
418
|
+
* // Normal behavior - can be hidden/shown as needed
|
|
419
|
+
* { field: 'name', fixed: false }
|
|
420
|
+
*/
|
|
421
|
+
fixed?: boolean;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Controls initial visibility state of column
|
|
425
|
+
* @default true
|
|
426
|
+
* @example
|
|
427
|
+
* // Column starts visible
|
|
428
|
+
* { field: 'name', visible: true }
|
|
429
|
+
*
|
|
430
|
+
* // Column starts hidden
|
|
431
|
+
* { field: 'internalId', visible: false }
|
|
432
|
+
*/
|
|
433
|
+
visible?: boolean;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Use commonly used component as preset, simplify the common use-cases of bodyComponent with DataTable component.
|
|
437
|
+
*/
|
|
438
|
+
preset?: ColumnPreset<T>;
|
|
439
|
+
/**
|
|
440
|
+
* Whether the column is checked by default, only for Custom Report Table
|
|
441
|
+
* @default true
|
|
442
|
+
*/
|
|
443
|
+
checkedByDefault?: boolean;
|
|
444
|
+
/**
|
|
445
|
+
* The column width in pixel.
|
|
446
|
+
*/
|
|
447
|
+
width?: number | string;
|
|
448
|
+
/**
|
|
449
|
+
* Exclude column from download/export excel.
|
|
450
|
+
*/
|
|
451
|
+
excluded?: boolean;
|
|
452
|
+
/**
|
|
453
|
+
* Set the field for Export Excel, when you need to export different field of column field.
|
|
454
|
+
*
|
|
455
|
+
* @default undefined - the export field using column 'field'
|
|
456
|
+
*/
|
|
457
|
+
exportField?: string;
|
|
458
|
+
/**
|
|
459
|
+
* Specify the header when exported
|
|
460
|
+
*/
|
|
461
|
+
exportHeader?: string;
|
|
462
|
+
/**
|
|
463
|
+
* Specify the property or field which value in the array should be used for exporting to Excel.
|
|
464
|
+
*
|
|
465
|
+
* @example 'field.name.fullName'
|
|
466
|
+
*/
|
|
467
|
+
arrayValueField?: string;
|
|
468
|
+
/**
|
|
469
|
+
* Download Excel Config
|
|
470
|
+
*
|
|
471
|
+
* When needs to export only the property has Truthy value, set this to true,
|
|
472
|
+
* The Excel result will only get the property object which the value is truthy.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* Example Object:
|
|
476
|
+
* "roles": {
|
|
477
|
+
* roleA: true,
|
|
478
|
+
* roleB: true,
|
|
479
|
+
* roleC: false,
|
|
480
|
+
* roleD: null, // falsy
|
|
481
|
+
* roleE: '', // falsy
|
|
482
|
+
* roleF: 'role', // truthy
|
|
483
|
+
* }
|
|
484
|
+
*
|
|
485
|
+
* The result will be: "roleA, roleB, roleF" - Only the properties with truthy values will be included.
|
|
486
|
+
*/
|
|
487
|
+
includeTruthyProperties?: boolean;
|
|
488
|
+
/**
|
|
489
|
+
* Convert boolean into text Yes/No
|
|
490
|
+
*/
|
|
491
|
+
booleanValue?: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* The text to display in the Excel cell when the value is true. (should be used with booleanValue)
|
|
494
|
+
*/
|
|
495
|
+
trueText?: string;
|
|
496
|
+
/**
|
|
497
|
+
* The text to display in the Excel cell when the value is false. (should be used with booleanValue)
|
|
498
|
+
*/
|
|
499
|
+
falseText?: string;
|
|
500
|
+
/**
|
|
501
|
+
* Specify the options for formatting date values using the formatDate utility.
|
|
502
|
+
*
|
|
503
|
+
* The date format primarily uses the general settings configurations.
|
|
504
|
+
* Within this property, you only need to set the `showTime` or `showDate` options.
|
|
505
|
+
*/
|
|
506
|
+
dateFormatOptions?: DateOptions;
|
|
507
|
+
/**
|
|
508
|
+
* Set the fallback text when the cell value is empty. Used in export excel.
|
|
509
|
+
*
|
|
510
|
+
* @example 'N/A'
|
|
511
|
+
*/
|
|
512
|
+
emptyText?: string;
|
|
513
|
+
/**
|
|
514
|
+
* Customize the cell content rendered in the table body. Use this when the value of `field` specified needs custom formatting.
|
|
515
|
+
*
|
|
516
|
+
* @param data The row data object.
|
|
517
|
+
* @param index The index of the row.
|
|
518
|
+
* @returns The custom cell content as a string or undefined.
|
|
519
|
+
*/
|
|
520
|
+
bodyTemplate?: (data: T, index: number) => string | undefined;
|
|
521
|
+
/**
|
|
522
|
+
* Customize the cell component rendered in the table body. Use this when the value of `field` specified needs custom component rendering.
|
|
523
|
+
*
|
|
524
|
+
* @param data The row data object.
|
|
525
|
+
* @param index The index of the row.
|
|
526
|
+
* @returns The custom cell component as a TableCellComponent or undefined.
|
|
527
|
+
*/
|
|
528
|
+
bodyComponent?: (data: T, index: number) => TableCellComponent<T>;
|
|
529
|
+
/**
|
|
530
|
+
* Inline style of header, body and footer cells.
|
|
531
|
+
*/
|
|
532
|
+
style?: string | (() => string);
|
|
533
|
+
/**
|
|
534
|
+
* Style class of header, body and footer cells.
|
|
535
|
+
*/
|
|
536
|
+
class?: string | string[] | (() => string | string[]);
|
|
537
|
+
/**
|
|
538
|
+
* Inline style of the column header.
|
|
539
|
+
*/
|
|
540
|
+
headerStyle?: string | (() => string);
|
|
541
|
+
/**
|
|
542
|
+
* Style class of the column header.
|
|
543
|
+
*/
|
|
544
|
+
headerClass?: string | string[] | (() => string | string[]);
|
|
545
|
+
/**
|
|
546
|
+
* Inline style of the column body.
|
|
547
|
+
*/
|
|
548
|
+
bodyStyle?: string | (() => string);
|
|
549
|
+
/**
|
|
550
|
+
* Style class of the column body.
|
|
551
|
+
*/
|
|
552
|
+
bodyClass?: string | string[] | ((data: T) => string | string[]);
|
|
553
|
+
/**
|
|
554
|
+
* Style class of the column body if the row is selected (useful for dark classes).
|
|
555
|
+
*/
|
|
556
|
+
bodySelectedClass?: string | ((data: T) => string);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Extending the base table column, tree table column will only available when props.treeTable is sets to be `true`
|
|
561
|
+
*/
|
|
562
|
+
export interface TreeTableColumns<T extends Data> extends TableColumn<T> {
|
|
563
|
+
/**
|
|
564
|
+
* How much the column spanning
|
|
565
|
+
*/
|
|
566
|
+
colspan?: number;
|
|
567
|
+
/**
|
|
568
|
+
* The list of parents columns fields
|
|
569
|
+
* The colspan will be counted from it lengths
|
|
570
|
+
* This column will be shown when at least one of parent columns is visible
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* This column spans from parent column A to C,
|
|
574
|
+
* this property value should be ['a', 'b', 'c'],
|
|
575
|
+
* which each value in array is a 'column.field' of the parent columns
|
|
576
|
+
*
|
|
577
|
+
* The counted colspan will be 3
|
|
578
|
+
*/
|
|
579
|
+
parentColumnsFields?: string[];
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Emit payload for `cellEdited`
|
|
584
|
+
*/
|
|
585
|
+
export interface DataTableCellEditedEvent<T extends Data = Data> {
|
|
586
|
+
/**
|
|
587
|
+
* The row item were edited
|
|
588
|
+
*/
|
|
589
|
+
item: T;
|
|
590
|
+
/**
|
|
591
|
+
* The column field were edited
|
|
592
|
+
*/
|
|
593
|
+
field: string;
|
|
594
|
+
/**
|
|
595
|
+
* The index of row item
|
|
596
|
+
*/
|
|
597
|
+
index: number;
|
|
598
|
+
/**
|
|
599
|
+
* The text content of editable field
|
|
600
|
+
*/
|
|
601
|
+
value?: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Emit payload for `rowReorder`
|
|
606
|
+
*/
|
|
607
|
+
export interface DataTableRowReorderEvent<T extends Data = Data> {
|
|
608
|
+
item: T;
|
|
609
|
+
fromIndex?: number;
|
|
610
|
+
toIndex?: number;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Custom row click event.
|
|
615
|
+
* @see {@link DataTableEmits['row-click']}
|
|
616
|
+
*/
|
|
617
|
+
export interface DataTableRowClickEvent<T extends Data = Data> {
|
|
618
|
+
/**
|
|
619
|
+
* Browser event.
|
|
620
|
+
*/
|
|
621
|
+
originalEvent: Event;
|
|
622
|
+
/**
|
|
623
|
+
* Selected row data.
|
|
624
|
+
*/
|
|
625
|
+
data: T;
|
|
626
|
+
/**
|
|
627
|
+
* Row index.
|
|
628
|
+
*/
|
|
629
|
+
index: number;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export type ChildTableProps<T = Data> = Partial<
|
|
633
|
+
Omit<TreeTableProps<T>, 'fetchFunction'>
|
|
634
|
+
> & {
|
|
635
|
+
/**
|
|
636
|
+
* Use the header of each column in child table
|
|
637
|
+
*
|
|
638
|
+
* @default false
|
|
639
|
+
*/
|
|
640
|
+
useColumnsHeader?: boolean;
|
|
641
|
+
/**
|
|
642
|
+
* The function to fetch data on row expand
|
|
643
|
+
*/
|
|
644
|
+
fetchFunction?: (
|
|
645
|
+
parentData: T,
|
|
646
|
+
) => Promise<ShortFetchListResponse<ChildGroup<T>> | undefined>;
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
export interface DataTableBaseProps<T extends Data = Data> {
|
|
650
|
+
/**
|
|
651
|
+
* Optional unique table name for ID generation and integration with components like FilterContainer, ButtonSearch, ButtonBulkAction.
|
|
652
|
+
* Must be unique to avoid collisions.
|
|
653
|
+
*
|
|
654
|
+
* @optional
|
|
655
|
+
*/
|
|
656
|
+
tableName?: string;
|
|
657
|
+
/**
|
|
658
|
+
* Optional property to set a unique table title for export into excel.
|
|
659
|
+
*
|
|
660
|
+
* @optional
|
|
661
|
+
*/
|
|
662
|
+
tableTitle?: string;
|
|
663
|
+
/**
|
|
664
|
+
* Whether show single action option.
|
|
665
|
+
* @default true;
|
|
666
|
+
*/
|
|
667
|
+
useOption?: boolean;
|
|
668
|
+
/**
|
|
669
|
+
* An array of objects to display in the table.
|
|
670
|
+
* Mainly used for static table. For dynamic table that need to fetch data on demand, use fetchFunction instead.
|
|
671
|
+
*/
|
|
672
|
+
data?: T[];
|
|
673
|
+
/**
|
|
674
|
+
* The key of the data object to use as a unique identifier.
|
|
675
|
+
* Each row data must have a unique value for this key. Otherwise, the behavior of the table may be unpredictable.
|
|
676
|
+
*
|
|
677
|
+
* @default '_id' - You can specify a custom key if your data object uses a different unique identifier.
|
|
678
|
+
*/
|
|
679
|
+
dataKey?: string;
|
|
680
|
+
/**
|
|
681
|
+
* Style class of the row body.
|
|
682
|
+
*/
|
|
683
|
+
rowClass?: string | string[] | ((data?: any) => string | string[]);
|
|
684
|
+
/**
|
|
685
|
+
* The key of the data object to determine whether the row data should be disabled.
|
|
686
|
+
* If the value of this key is truthy, the row will be disabled.
|
|
687
|
+
*/
|
|
688
|
+
disableKey?: string;
|
|
689
|
+
/**
|
|
690
|
+
* Determine whether disabled rows should be included in the check all process or not
|
|
691
|
+
*/
|
|
692
|
+
includeCheckDisabledRows?: boolean;
|
|
693
|
+
/**
|
|
694
|
+
* The key of data object to determine whether the row data has context highlighted or not
|
|
695
|
+
* If the value of this key is truthy, the row will be highlighted.
|
|
696
|
+
*/
|
|
697
|
+
highlightKey?: string;
|
|
698
|
+
/**
|
|
699
|
+
* Boolean to specify whether all rows should be disabled.
|
|
700
|
+
*/
|
|
701
|
+
disableAllRows?: boolean;
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Determine the type of DataTable.
|
|
705
|
+
*
|
|
706
|
+
* Sets to lazy if you need to dynamically shows data.
|
|
707
|
+
*/
|
|
708
|
+
lazy?: boolean;
|
|
709
|
+
/**
|
|
710
|
+
* The default query params that must be included every fetch request.
|
|
711
|
+
* Will be merged with query params from fetchFunction.
|
|
712
|
+
*/
|
|
713
|
+
defaultQueryParams?: Readonly<Record<string, any>>;
|
|
714
|
+
/**
|
|
715
|
+
* The function to fetch data on DataTable mounted and on queryParams dependencies updated.
|
|
716
|
+
*
|
|
717
|
+
* @param params this is required
|
|
718
|
+
*/
|
|
719
|
+
fetchFunction?: (
|
|
720
|
+
params: QueryParams,
|
|
721
|
+
) => Promise<FetchListResponse<T> | undefined>;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* The number of rows to display per page.
|
|
725
|
+
* @defaultValue 10
|
|
726
|
+
*/
|
|
727
|
+
rows?: number;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Sets loading animation for DataTable that's not lazy.
|
|
731
|
+
*/
|
|
732
|
+
loading?: boolean;
|
|
733
|
+
/**
|
|
734
|
+
* Whether to enable 'checkbox' | 'single' selection.
|
|
735
|
+
*
|
|
736
|
+
* @default 'checkbox'
|
|
737
|
+
*/
|
|
738
|
+
selectionType?: 'single' | 'checkbox' | 'none';
|
|
739
|
+
/**
|
|
740
|
+
* An array of selected objects from `data`.
|
|
741
|
+
*/
|
|
742
|
+
selectedData?: T[];
|
|
743
|
+
/**
|
|
744
|
+
* An array of selected objects from `data`.
|
|
745
|
+
*/
|
|
746
|
+
expandedRows?: { [key: string]: boolean };
|
|
747
|
+
/**
|
|
748
|
+
* Whether display pagination under the table or not.
|
|
749
|
+
*/
|
|
750
|
+
usePaginator?: boolean;
|
|
751
|
+
/**
|
|
752
|
+
* The options that will be visible for each row data.
|
|
753
|
+
* To use this, set 'useOption' to true.
|
|
754
|
+
* The options menu will be displayed on the right side of the table row.
|
|
755
|
+
*/
|
|
756
|
+
options?: MenuItem[];
|
|
757
|
+
/**
|
|
758
|
+
* Whether the column is customizable or not.
|
|
759
|
+
*
|
|
760
|
+
* @default true - the table is able to reorder and toggle visibility column;
|
|
761
|
+
*/
|
|
762
|
+
customColumn?: boolean;
|
|
763
|
+
/**
|
|
764
|
+
* Props to set scroll height, this will make table content scrollable
|
|
765
|
+
* @example '50vh' or '300px'
|
|
766
|
+
*/
|
|
767
|
+
scrollHeight?: string;
|
|
768
|
+
/**
|
|
769
|
+
* When the row height sets to fixed, it will have 35px height
|
|
770
|
+
*
|
|
771
|
+
* @defaultValue 'fixed'
|
|
772
|
+
*/
|
|
773
|
+
rowHeight?: 'fixed' | 'auto';
|
|
774
|
+
/**
|
|
775
|
+
* To determine if row table is reorder-able
|
|
776
|
+
*/
|
|
777
|
+
reorderable?: boolean;
|
|
778
|
+
/**
|
|
779
|
+
* Total disabled rows in table (used for synchronizing with bulk action button)
|
|
780
|
+
*/
|
|
781
|
+
totalDisabledRows?: number;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
export interface DataTableProps<T extends Data> extends DataTableBaseProps<T> {
|
|
785
|
+
/**
|
|
786
|
+
* Disable tree table mode
|
|
787
|
+
*/
|
|
788
|
+
treeTable?: false;
|
|
789
|
+
childTableProps?: undefined;
|
|
790
|
+
/**
|
|
791
|
+
* An array of table columns to display.
|
|
792
|
+
*/
|
|
793
|
+
columns: TableColumn<T>[];
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
export interface TreeTableProps<T extends Data> extends DataTableBaseProps<T> {
|
|
797
|
+
/**
|
|
798
|
+
* Activate tree table mode
|
|
799
|
+
*/
|
|
800
|
+
treeTable: true;
|
|
801
|
+
/**
|
|
802
|
+
* V-model single selection. Works with selectionType 'single'
|
|
803
|
+
*/
|
|
804
|
+
singleSelection?: T;
|
|
805
|
+
/**
|
|
806
|
+
* An array of table columns to display.
|
|
807
|
+
*/
|
|
808
|
+
columns: TreeTableColumns<T>[];
|
|
809
|
+
/**
|
|
810
|
+
* Properties to be passed into sub table
|
|
811
|
+
*/
|
|
812
|
+
childTableProps?: ChildTableProps<T>;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
export interface BaseDataTableEmits<T extends Data> {
|
|
816
|
+
/**
|
|
817
|
+
* Emits when option menu button clicked.
|
|
818
|
+
*/
|
|
819
|
+
'toggleOption': [data: T];
|
|
820
|
+
/**
|
|
821
|
+
* Emits when an item is double clicked.
|
|
822
|
+
*/
|
|
823
|
+
'doubleClick': [data: T];
|
|
824
|
+
'rowSelect': [data: DataTableRowClickEvent<T>];
|
|
825
|
+
/**
|
|
826
|
+
* Event emitted when the page changes in the data table.
|
|
827
|
+
*
|
|
828
|
+
* @event page
|
|
829
|
+
* @param {DataTablePageEvent} data - The event data containing information about the new page.
|
|
830
|
+
*
|
|
831
|
+
* @example
|
|
832
|
+
* <DataTable @page="handlePageChange" />
|
|
833
|
+
*
|
|
834
|
+
* This will call the `handlePageChange` method whenever the page changes in the data table.
|
|
835
|
+
*/
|
|
836
|
+
'page': [data: DataTablePageEvent];
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Event emitted when the sort order changes in the data table.
|
|
840
|
+
*
|
|
841
|
+
* @event sort
|
|
842
|
+
* @param {DataTableSortEvent} data - The event data containing information about the new sort order.
|
|
843
|
+
*
|
|
844
|
+
* @example
|
|
845
|
+
* <DataTable @sort="handleSortChange" />
|
|
846
|
+
*
|
|
847
|
+
* This will call the `handleSortChange` method whenever the sort order changes in the data table.
|
|
848
|
+
*/
|
|
849
|
+
'sort': [data: DataTableSortEvent];
|
|
850
|
+
/**
|
|
851
|
+
* Event emitted when the `selectedData` property is updated.
|
|
852
|
+
*
|
|
853
|
+
* @event update:selectedData
|
|
854
|
+
* @param {Data[]} datas - The updated array of selected data objects.
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* <DataTable v-model:selected-data="selectedData" />
|
|
858
|
+
*
|
|
859
|
+
* This will update the `selectedData` value whenever a row is selected or deselected.
|
|
860
|
+
*/
|
|
861
|
+
'update:selectedData': [datas: T[]];
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
export interface TreeTableEmits<T extends Data> extends BaseDataTableEmits<T> {
|
|
865
|
+
/**
|
|
866
|
+
* Emitted when a row is clicked/selected. Only available on `single` selectionType
|
|
867
|
+
*/
|
|
868
|
+
'update:singleSelection': [data: T];
|
|
869
|
+
/**
|
|
870
|
+
* Emitted when cell has lost focus.
|
|
871
|
+
*/
|
|
872
|
+
'cellEdited': [payload: DataTableCellEditedEvent<T>];
|
|
873
|
+
/**
|
|
874
|
+
* Emitted on Drop Event occurred after dragging a row.
|
|
875
|
+
* Only available on
|
|
876
|
+
*
|
|
877
|
+
*/
|
|
878
|
+
'rowReorder': [payload?: DataTableRowReorderEvent<T>];
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
export interface DataTableEmits<T extends Data> extends TreeTableEmits<T> {}
|
|
882
|
+
|
|
883
|
+
export interface DataTableSlots<T extends Data> {
|
|
884
|
+
/**
|
|
885
|
+
* Slot for rendering sub content below a table row.
|
|
886
|
+
*/
|
|
887
|
+
'row-subcontent': (props: { item: T }) => VNode[];
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* **WangsVue - DataTable**
|
|
892
|
+
*
|
|
893
|
+
* * _DataTable displays data in tabular format._
|
|
894
|
+
*
|
|
895
|
+
* [Live Demo](https://fewangsit.github.io/wangsvue/table)
|
|
896
|
+
* --- ---
|
|
897
|
+
* 
|
|
898
|
+
*
|
|
899
|
+
* @group Component
|
|
900
|
+
*/
|
|
901
|
+
declare const DataTable: <T extends Data = Data>(
|
|
902
|
+
props: (DataTableProps<T> | TreeTableProps<T>) &
|
|
903
|
+
VNodeProps &
|
|
904
|
+
AllowedComponentProps &
|
|
905
|
+
ComponentCustomProps,
|
|
906
|
+
context?: {
|
|
907
|
+
slots: DataTableSlots<T>;
|
|
908
|
+
emit: EmitFn<DataTableEmits<T>>;
|
|
909
|
+
attrs: Record<string, any>;
|
|
910
|
+
},
|
|
911
|
+
) => VNode & { __ctx?: { props: typeof props; slots: typeof context.slots } };
|
|
912
|
+
|
|
913
|
+
export default DataTable;
|