@fewangsit/wangsvue-fats 1.0.0-alpha.2 → 1.0.0-alpha.21

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.
Files changed (34) hide show
  1. package/build-entry.d.ts +2 -2
  2. package/components/assetinfo/AssetInfo.vue.d.ts +32 -0
  3. package/components/button/Button.vue.d.ts +5 -2
  4. package/components/buttonscan/ButtonScan.vue.d.ts +201 -0
  5. package/components/buttonscan/helpers/getErrorCode.helper.d.ts +3 -0
  6. package/components/buttonscan/helpers/index.d.ts +1 -0
  7. package/components/buttonscan/workers/scanner.worker.d.ts +1 -0
  8. package/components/buttonselecttree/ButtonSelectTree.vue.d.ts +3 -1
  9. package/components/buttonsync/ButtonSync.vue.d.ts +10 -0
  10. package/components/buttonviewlog/ButtonViewLog.vue.d.ts +17 -0
  11. package/components/filtercontainer/FilterContainer.vue.d.ts +1 -0
  12. package/components/hardwaresync/store/device.store.d.ts +36 -0
  13. package/components/imagecompressor/ImageCompressor.vue.d.ts +6 -0
  14. package/components/imagecompressor/ImageInputInfo.vue.d.ts +2 -0
  15. package/components/index.d.ts +6 -0
  16. package/components/inputsearch/InputSearch.vue.d.ts +32 -0
  17. package/components/languagedropdown/LanguageDropdown.vue.d.ts +1 -4
  18. package/components/tagtype/TagType.vue.d.ts +21 -0
  19. package/components/timeline/Timeline.vue.d.ts +7 -1
  20. package/components/timeline/TimelineContentByType.vue.d.ts +3 -3
  21. package/components/userwithicon/UserWithIcon.vue.d.ts +21 -0
  22. package/event-bus/index.d.ts +3 -1
  23. package/package.json +1 -1
  24. package/plugins/i18n-extension.d.ts +4 -0
  25. package/plugins/i18n.d.ts +80 -0
  26. package/style.css +1 -1
  27. package/utils/getSeverityByAssetStatus.util.d.ts +3 -0
  28. package/utils/index.d.ts +2 -1
  29. package/utils/listenSidebarChanges.util.d.ts +11 -0
  30. package/utils/role.util.d.ts +32 -1
  31. package/wangsvue-fats.es.js +20331 -19772
  32. package/wangsvue-fats.system.js +126 -126
  33. package/assets/json/supported-official-langs.json.d.ts +0 -530
  34. package/plugins/translation.d.ts +0 -84
package/build-entry.d.ts CHANGED
@@ -8,7 +8,7 @@ export { default as Tooltip } from 'primevue/tooltip';
8
8
  export { Focus } from './directives';
9
9
  export { useForm, useField } from './plugins/formValidation';
10
10
  export type { FormContext } from './plugins/formValidation';
11
- export * from './plugins/translation';
12
- export { default as i18n } from './plugins/translation';
11
+ export * from './plugins/i18n';
12
+ export { default as i18n } from './plugins/i18n-extension';
13
13
  export * from './components';
14
14
  export { default as WangsVue } from './config';
@@ -0,0 +1,32 @@
1
+ import { ClassComponent, GlobalComponentConstructor } from '../.././components/ts-helpers.d';
2
+
3
+
4
+ type Field = 'brand' | 'model' | 'group' | 'status';
5
+
6
+ export interface AssetInfoProps {
7
+ id: string;
8
+ /**
9
+ * Specifys the field/information to be fisplayed
10
+ */
11
+ fields?: Field[];
12
+ /**
13
+ * The Transaction Detail contains the asset infomation.
14
+ *
15
+ * It will prevent dynamic fetch of asset information.
16
+ */
17
+ transactionDetail?: Record<string, unknown>;
18
+ }
19
+
20
+ declare class AssetInfo extends ClassComponent<
21
+ AssetInfoProps,
22
+ unknown,
23
+ unknown
24
+ > {}
25
+
26
+ declare module 'vue' {
27
+ export interface GlobalComponents {
28
+ AssetInfo: GlobalComponentConstructor<AssetInfo>;
29
+ }
30
+ }
31
+
32
+ export default AssetInfo;
@@ -1,8 +1,11 @@
1
1
  import { ButtonHTMLAttributes, VNode } from 'vue';
2
2
  import { WangsIcons } from '../icon/Icon.vue.d';
3
3
  import { TooltipOptions } from 'primevue/tooltip';
4
- import { GlobalComponentConstructor } from '../ts-helpers.d';
5
- import { ClassComponent, HintedString } from '../ts-helpers';
4
+ import {
5
+ GlobalComponentConstructor,
6
+ ClassComponent,
7
+ HintedString,
8
+ } from '../ts-helpers';
6
9
 
7
10
  /**
8
11
  * Defines valid properties in Button component.
@@ -0,0 +1,201 @@
1
+ import { ClassComponent, HintedString } from 'lib/components/ts-helpers.d';
2
+ import { ButtonProps } from 'lib/components/button/Button.vue.d';
3
+ import { WangsIcons } from '../icon/Icon.vue.d';
4
+
5
+ export type ScannerErrorCode =
6
+ | 'DRIVER_NOT_FOUND'
7
+ | 'DEVICE_NOT_CONNECTED'
8
+ | 'DEVICE_DISCONNECTED'
9
+ | 'NOT_SUPPORTED_SYSTEM'
10
+ | 'HARDWARE_NOT_SYNCHRONIZED';
11
+
12
+ export type ScannerErrorMessage = {
13
+ title: string;
14
+ detail: string;
15
+ };
16
+
17
+ export type ScannerOption = Partial<Device> & {
18
+ label: string;
19
+ device: Device | undefined;
20
+ };
21
+
22
+ export type Device = {
23
+ jenisDevice: string;
24
+ serialNumber: string;
25
+ API: string;
26
+ rfidScan: boolean;
27
+ qrScan: boolean;
28
+ name: string;
29
+ };
30
+
31
+ export type RegisteredDevice = {
32
+ _id: string;
33
+ imageSmall: string;
34
+ imageBig: string;
35
+ serialNumber: string;
36
+ status: string;
37
+ lastReportDate: string;
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ group: null;
41
+ name: string;
42
+ };
43
+
44
+ export type DeviceList = Device[];
45
+
46
+ export interface ButtonScanProps extends Omit<ButtonProps, 'type'> {
47
+ /**
48
+ * Set custom button label.
49
+ *
50
+ * @default Scan Type
51
+ */
52
+ label?: string;
53
+ /**
54
+ * Set custom button icon.
55
+ *
56
+ * @default 'qr' | 'rfid'
57
+ */
58
+ icon?: WangsIcons;
59
+ /**
60
+ * Scpecify the scan type
61
+ */
62
+ type?: 'RFID' | 'QR';
63
+ /**
64
+ * Automatically switch between RFID and QR scan types during the scanning process.
65
+ * This allows the scan type to change dynamically based on the validation of the scanned code.
66
+ *
67
+ * The scan type will alternate between RFID and QR based on the validation result:
68
+ * - If the current scan is valid, it proceeds with the next scan type.
69
+ * - If the scan is invalid, it will re-scan using the previous scan type.
70
+ *
71
+ * This behavior continues in a loop until a stop condition is met, typically triggered by the parent component.
72
+ *
73
+ * Note: Only work with single Scan
74
+ *
75
+ * @default false
76
+ * @type {boolean}
77
+ *
78
+ * @example
79
+ * // Example usage in a component:
80
+ * <Button :auto-switch="true" />
81
+ *
82
+ * In this case, scanning will automatically switch between RFID and QR based on the validation results.
83
+ */
84
+ autoSwitch?: boolean;
85
+
86
+ /**
87
+ * Do validation when a tag is scanned, if valid, it will emits scan, otherwise re-scanning.
88
+ * when need to show toast on validation failed, set the toast group to `scan-error-validation`
89
+ *
90
+ * @param type
91
+ * @param code
92
+ * @param serialNumber
93
+ * @returns
94
+ */
95
+ scanValidation?: (
96
+ type: 'RFID' | 'QR',
97
+ code: string,
98
+ serialNumber: string,
99
+ ) => Promise<boolean>;
100
+
101
+ /**
102
+ * The value of the input (tag).
103
+ *
104
+ * @deprecated use `onScan` instead.
105
+ */
106
+ modelValue?: string;
107
+ /**
108
+ * Whether the scanner is in bulk mode.
109
+ *
110
+ * @toto add support bulk scan
111
+ */
112
+ bulk?: boolean;
113
+ /**
114
+ * The id of the button element.
115
+ */
116
+ id?: string;
117
+ /**
118
+ * Wether the button should be disabled.
119
+ */
120
+ disabled?: boolean;
121
+ /**
122
+ * Whether the scanner is a powerbank.
123
+ *
124
+ * @deprecated
125
+ */
126
+ powerbank?: boolean;
127
+ /**
128
+ * Display the label only (wihout icon).
129
+ *
130
+ * @default false
131
+ */
132
+ labelOnly?: boolean;
133
+ /**
134
+ * Add a border class without a background initially.
135
+ * @default false
136
+ */
137
+ outlined?: boolean | undefined;
138
+ /**
139
+ * Defines the style of the button.
140
+ */
141
+ severity?:
142
+ | HintedString<
143
+ | 'secondary'
144
+ | 'success'
145
+ | 'info'
146
+ | 'warning'
147
+ | 'help'
148
+ | 'danger'
149
+ | 'contrast'
150
+ >
151
+ | undefined;
152
+ /**
153
+ * Defines the size of the button.
154
+ */
155
+ size: 'small' | 'large';
156
+ }
157
+
158
+ export type ButtonScanEmits = {
159
+ 'update:modelValue': [tag: string];
160
+ 'connect': [];
161
+ 'connected': [device?: Device];
162
+ 'scan': [tag: string, deviceSerialNumber: string];
163
+ 'stop': [];
164
+ 'error': [error: unknown | Event];
165
+ 'beforeStartScan': [];
166
+ };
167
+
168
+ export interface ButtonScanExposes {
169
+ onBeforeStartScan: () => void;
170
+ startScan: () => void;
171
+ /**
172
+ * Method to stop the scan process.
173
+ */
174
+ stopScan: (afterScan?: boolean) => void;
175
+ }
176
+
177
+ /**
178
+ * **TSVue v2 - ButtonScan**
179
+ *
180
+ * _ButtonScan is component for scanning RFID or QR Tag._
181
+ *
182
+ * --- ---
183
+ * ![TSVue](https://ik.imagekit.io/kurniadev/TS-HEAD-BLACK.png)
184
+ *
185
+ * @group Component
186
+ */
187
+ declare class ButtonScan
188
+ extends ClassComponent<ButtonScanProps, ButtonScanEmits, unknown>
189
+ implements ButtonScanExposes
190
+ {
191
+ onBeforeStartScan: () => void;
192
+ startScan: () => void;
193
+ stopScan: (afterScan?: boolean) => void;
194
+ }
195
+
196
+ interface Window {
197
+ scannerWorker: Worker;
198
+ toastGroups: string[] | undefined;
199
+ }
200
+
201
+ export default ButtonScan;
@@ -0,0 +1,3 @@
1
+ import { ScannerErrorCode } from '../ButtonScan.vue.d';
2
+ declare const getErrorCode: (error: unknown) => ScannerErrorCode | undefined;
3
+ export default getErrorCode;
@@ -0,0 +1 @@
1
+ export { default as getErrorCode } from './getErrorCode.helper';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { Slot } from 'vue';
2
2
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
3
3
  import { TreeNode } from '../basetree/BaseTree.vue.d';
4
- import { ShortFetchResponse } from '../datatable/DataTable.vue.d';
4
+ import { QueryParams, ShortFetchResponse } from '../datatable/DataTable.vue.d';
5
5
 
6
6
  export type KeysModelValue = number[] | undefined;
7
7
  export type NodeModelValue =
@@ -75,7 +75,9 @@ export interface ButtonSelectTreeProps {
75
75
 
76
76
  fetchTree?: (
77
77
  type: 'group' | 'category',
78
+ params?: QueryParams,
78
79
  ) => Promise<ShortFetchResponse<TreeNode> | undefined>;
80
+ params?: QueryParams;
79
81
  /**
80
82
  * Specify wether the all tree node should be auto checked once it rendered.
81
83
  * @default false
@@ -0,0 +1,10 @@
1
+ import { ClassComponent } from '../ts-helpers';
2
+
3
+ export interface ButtonSyncProps {
4
+ /**
5
+ * Defines no scan buttons in hardware sync dialog footer.
6
+ */
7
+ withoutScanBtn?: boolean;
8
+ }
9
+
10
+ declare class ButtonSync extends ClassComponent<ButtonSyncProps> {}
@@ -0,0 +1,17 @@
1
+ import { DefineComponent } from 'vue';
2
+
3
+
4
+ export interface ButtonViewLogProps {
5
+ showLog?: boolean;
6
+ }
7
+
8
+ export type ButtonViewLogEmits = {
9
+ 'update:showLog': [state: boolean];
10
+ };
11
+
12
+ declare const ButtonViewLog: DefineComponent<
13
+ ButtonViewLogProps,
14
+ ButtonViewLogEmits
15
+ >;
16
+
17
+ export default ButtonViewLog;
@@ -88,6 +88,7 @@ export interface ButtonSelectTreeFilterField
88
88
  * @default to Select Group|Category
89
89
  */
90
90
  buttonLabel?: string;
91
+ params?: QueryParams; // Override QueryParams for the fetchTree
91
92
  }
92
93
 
93
94
  export interface CalendarFilterField extends CalendarProps {
@@ -0,0 +1,36 @@
1
+ import { Ref } from 'vue';
2
+ import { Device, DeviceList } from '../../buttonscan/ButtonScan.vue.d';
3
+ export interface ScanDevice {
4
+ RFID: Device | undefined;
5
+ QR: Device | undefined;
6
+ }
7
+ export interface DeviceStore {
8
+ /**
9
+ * The device list.
10
+ */
11
+ devices: Ref<DeviceList>;
12
+ /**
13
+ * Save new device list.
14
+ */
15
+ saveDevices: (devices: DeviceList) => void;
16
+ /**
17
+ * The selected device.
18
+ */
19
+ device: Ref<ScanDevice>;
20
+ /**
21
+ * Set new selected Device.
22
+ */
23
+ setDevice: (device: ScanDevice) => void;
24
+ /**
25
+ * Get device options from sessionStorage.
26
+ */
27
+ loadDevices: () => void;
28
+ }
29
+ declare const useDeviceStore: () => DeviceStore;
30
+ export default useDeviceStore;
31
+ declare global {
32
+ interface Window {
33
+ device: ScanDevice;
34
+ devices: DeviceList;
35
+ }
36
+ }
@@ -141,6 +141,12 @@ export interface ImageCompressorProps {
141
141
  * @default true
142
142
  */
143
143
  showInfo?: boolean;
144
+ /**
145
+ * Change the requirements of the photo
146
+ *
147
+ * @default undefined - will use maxSizeRequirement, imageTypeRequirement from LocaleConfig
148
+ */
149
+ customRequirements?: string[];
144
150
  /**
145
151
  * Show dialog confirmation before delete the image.
146
152
  */
@@ -2,11 +2,13 @@ declare function __VLS_template(): {
2
2
  default?(_: {}): any;
3
3
  };
4
4
  declare const __VLS_component: import('vue').DefineComponent<__VLS_TypePropsToOption<{
5
+ customRequirements?: string[];
5
6
  showInfo: boolean;
6
7
  showAddButton?: boolean;
7
8
  }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
9
  addPhoto: () => void;
9
10
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
11
+ customRequirements?: string[];
10
12
  showInfo: boolean;
11
13
  showAddButton?: boolean;
12
14
  }>>> & {
@@ -1,6 +1,7 @@
1
1
  export * from '.././components';
2
2
  export { default as Animation } from './animation/Animation.vue';
3
3
  export { default as ApproverInfo } from './approverinfo/ApproverInfo.vue';
4
+ export { default as AssetInfo } from './assetinfo/AssetInfo.vue';
4
5
  export { default as Badge } from './badge/Badge.vue';
5
6
  export { default as BadgeGroup } from './badgegroup/BadgeGroup.vue';
6
7
  export { default as BaseTree } from '.././components/basetree/BaseTree.vue';
@@ -12,10 +13,13 @@ export { default as ButtonDownload } from './buttondownload/ButtonDownload.vue';
12
13
  export { default as ButtonFilter } from './buttonfilter/ButtonFilter.vue';
13
14
  export { default as ButtonImportExcel } from './buttonImportExcel/ButtonImportExcel.vue';
14
15
  export { default as ButtonRadio } from './buttonradio/ButtonRadio.vue';
16
+ export { default as ButtonScan } from '.././components/buttonscan/ButtonScan.vue';
15
17
  export { default as ButtonSearch } from './buttonsearch/ButtonSearch.vue';
16
18
  export { default as ButtonSelectTree } from '.././components/buttonselecttree/ButtonSelectTree.vue';
17
19
  export { default as ButtonSplit } from './buttonsplit/ButtonSplit.vue';
20
+ export { default as ButtonSync } from '.././components/buttonsync/ButtonSync.vue';
18
21
  export { default as ButtonToggle } from './buttontoggle/ButtonToggle.vue';
22
+ export { default as ButtonViewLog } from './buttonviewlog/ButtonViewLog.vue';
19
23
  export { default as Calendar } from '.././components/calendar/Calendar.vue';
20
24
  export { default as Card } from './card/Card.vue';
21
25
  export { default as Checkbox } from './checkbox/Checkbox.vue';
@@ -41,6 +45,7 @@ export { default as InputNumber } from './inputnumber/InputNumber.vue';
41
45
  export { default as InputPassword } from './inputpassword/InputPassword.vue';
42
46
  export { default as InputPhoneNumber } from './inputphonenumber/InputPhoneNumber.vue';
43
47
  export { default as InputRangeNumber } from './inputrangenumber/InputRangeNumber.vue';
48
+ export { default as InputSearch } from './inputsearch/InputSearch.vue';
44
49
  export { default as InputText } from './inputtext/InputText.vue';
45
50
  export { default as InputURL } from './inputurl/InputURL.vue';
46
51
  export { default as InvisibleField } from './invisiblefield/InvisibleField.vue';
@@ -61,3 +66,4 @@ export { default as TooltipSpan } from './tooltipspan/TooltipSpan.vue';
61
66
  export { default as Tree } from '.././components/tree/Tree.vue';
62
67
  export { default as UserGroup } from './usergroup/UserGroup.vue';
63
68
  export { default as UserName } from './username/UserName.vue';
69
+ export { default as UserWithIcon } from './userwithicon/UserWithIcon.vue';
@@ -0,0 +1,32 @@
1
+ import { ClassComponent, GlobalComponentConstructor } from '../.././components/ts-helpers';
2
+
3
+
4
+ export type InputSearchEmits = {
5
+ /**
6
+ * Emits when the Enter key is pressed.
7
+ */
8
+ search: [payload?: string];
9
+ };
10
+
11
+ /**
12
+ * **WangsVue - InputSearch**
13
+ *
14
+ * _InputSearch is an search input for fixed asset navbar_
15
+ *
16
+ * [Live Demo](https://fewangsit.github.io/wangsvue/inputsearch)
17
+ * --- ---
18
+ * ![WangsVue](https://www.wangs.id/wp-content/uploads/2023/12/cropped-Logo_Wangsid-removebg-preview-192x192.png)
19
+ *
20
+ * @group Component
21
+ */
22
+ declare class InputSearch extends ClassComponent<
23
+ unknown,
24
+ unknown,
25
+ InputSearchEmits
26
+ > {}
27
+
28
+ declare module '@vue/runtime-core' {
29
+ interface GlobalComponents {
30
+ InputSearch: GlobalComponentConstructor<InputSearch>;
31
+ }
32
+ }
@@ -2,13 +2,10 @@ import { DropdownEmits, DropdownProps } from '../dropdown/Dropdown.vue.d';
2
2
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
3
3
 
4
4
  export interface LanguageOption {
5
- /**
6
- * The name of the language, written in English for universal readability.
7
- */
8
5
  /**
9
6
  * ISO 639-1 language code (e.g., "en" for English, "fr" for French).
10
7
  */
11
- language?: string;
8
+ isoCode?: string;
12
9
 
13
10
  /**
14
11
  * The name of the language in English (e.g., "English", "Français").
@@ -0,0 +1,21 @@
1
+ import { ClassComponent } from 'primevue/ts-helpers';
2
+
3
+ export type AssetTagType =
4
+ | 'QR'
5
+ | 'RFID'
6
+ | 'NFC'
7
+ | 'RFID & NFC'
8
+ | 'RFID & QR'
9
+ | 'NFC & QR'
10
+ | 'RFID & NFC & QR'
11
+ | 'Non TAG';
12
+
13
+ export interface TagTypeProps {
14
+ type: AssetTagType;
15
+ }
16
+
17
+ export default class TagType extends ClassComponent<
18
+ TagTypeProps,
19
+ unknown,
20
+ unknown
21
+ > {}
@@ -1,4 +1,5 @@
1
1
  import { JSONContent } from '../editor/Editor.vue.d';
2
+ import { BadgeProps } from '../badge/Badge.vue.d';
2
3
  import { ClassComponent } from '../ts-helpers';
3
4
 
4
5
  export interface AttachmentFile {
@@ -26,6 +27,10 @@ export interface DetailText {
26
27
  value: string;
27
28
  }
28
29
 
30
+ export interface DetailBadge extends BadgeProps {
31
+ type: 'badge';
32
+ }
33
+
29
34
  export interface DetailUserText {
30
35
  type: 'userText';
31
36
  user: {
@@ -62,7 +67,8 @@ export type DetailType =
62
67
  | DetailText
63
68
  | DetailUserText
64
69
  | DetailBullet
65
- | DetailJSONContent;
70
+ | DetailJSONContent
71
+ | DetailBadge;
66
72
 
67
73
  export type KeyValue = Record<string, string | DetailType>;
68
74
 
@@ -1,8 +1,8 @@
1
- import { AttachmentFile, AttachmentLink, DetailBullet, DetailJSONContent, DetailText, DetailUserText, LinkTaskIframeEmbed, LinkTaskURL } from './Timeline.vue.d';
1
+ import { AttachmentFile, AttachmentLink, DetailBullet, DetailJSONContent, DetailText, DetailUserText, LinkTaskIframeEmbed, LinkTaskURL, DetailBadge } from './Timeline.vue.d';
2
2
  declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<{
3
- detail: AttachmentFile | LinkTaskIframeEmbed | LinkTaskURL | AttachmentLink | DetailText | DetailUserText | DetailBullet | DetailJSONContent;
3
+ detail: AttachmentFile | LinkTaskIframeEmbed | LinkTaskURL | AttachmentLink | DetailText | DetailUserText | DetailBullet | DetailJSONContent | DetailBadge;
4
4
  }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
5
- detail: AttachmentFile | LinkTaskIframeEmbed | LinkTaskURL | AttachmentLink | DetailText | DetailUserText | DetailBullet | DetailJSONContent;
5
+ detail: AttachmentFile | LinkTaskIframeEmbed | LinkTaskURL | AttachmentLink | DetailText | DetailUserText | DetailBullet | DetailJSONContent | DetailBadge;
6
6
  }>>>, {}, {}>;
7
7
  export default _default;
8
8
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -0,0 +1,21 @@
1
+ import { UserDetail } from '@tagsamurai/fats-api-services/src/types/user.type';
2
+ import { ClassComponent } from '../.././components/ts-helpers';
3
+
4
+
5
+ export interface UserWithIconProps {
6
+ user: UserDetail;
7
+ }
8
+
9
+ declare class UserWithIcon extends ClassComponent<
10
+ UserWithIconProps,
11
+ unknown,
12
+ unknown
13
+ > {}
14
+
15
+ declare module 'vue' {
16
+ interface GlobalComponents {
17
+ UserWithIcon: typeof UserWithIcon;
18
+ }
19
+ }
20
+
21
+ export default UserWithIcon;
@@ -48,7 +48,9 @@ export type Events<CustomEvents = Record<string, any>> = CustomEvents & {
48
48
  'toast:add': ToastParams;
49
49
  'tree:update-tree-nodes': unknown;
50
50
  'tree:tree-updated': unknown;
51
- 'tree:selection-changed': unknown;
51
+ 'tree:selection-changed': {
52
+ keys: string;
53
+ };
52
54
  'overlay:show': {
53
55
  overlayId: number;
54
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-fats",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.21",
4
4
  "author": "fewangsit",
5
5
  "description": "Admin Console Tagsamurai VueJS Component Library",
6
6
  "type": "module",
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ install: (app: import('vue').App) => void;
3
+ };
4
+ export default _default;
@@ -0,0 +1,80 @@
1
+ import { App, Ref } from 'vue';
2
+ import { AxiosResponse } from 'axios';
3
+ import { LanguageOption } from '../components/languagedropdown/LanguageDropdown.vue.d';
4
+ export type Locale = string;
5
+ export interface I18n {
6
+ /**
7
+ * Locale message translation
8
+ *
9
+ * @param key - The translation key
10
+ * @param params - A values of named interpolation
11
+ * @param args - Positional interpolation values
12
+ *
13
+ * @returns translation message
14
+ * @example `t('Hello {user}!', { user: 'John Doe' })` - returns: 'Hello John Doe!'
15
+ * @example `t('Hello %s! I am %s.', "John Doe", "Peter Smith")` - returns: 'Hello John Doe! I am Peter Smith.'
16
+ */
17
+ t: {
18
+ (key: string, params: Record<string, any>): string;
19
+ (key: string, ...args: (string | number | boolean)[]): string;
20
+ };
21
+ /**
22
+ * Change the locale dynamically
23
+ *
24
+ * @param newLocale - The locale to switch to
25
+ */
26
+ setLocale: (newLocale: Locale) => Promise<void>;
27
+ /**
28
+ * Get the current locale
29
+ *
30
+ * @returns Current locale
31
+ */
32
+ locale: Ref<Locale>;
33
+ /**
34
+ * Service methods handle fetch requests
35
+ */
36
+ service?: I18nService;
37
+ }
38
+ type MessageMap = Record<string, string>;
39
+ export interface I18nService {
40
+ /**
41
+ * Fetch all translation messages for a specific locale.
42
+ * @param locale The locale code (e.g., 'en', 'id').
43
+ * @returns A promise resolving to a key-value record of messages.
44
+ */
45
+ getMessages(locale: string): Promise<AxiosResponse<{
46
+ data: MessageMap;
47
+ }>>;
48
+ /**
49
+ * Fetch all available lang options for LanguageDropdown and LanguageSwitcher
50
+ *
51
+ * @returns Promise Array of options
52
+ */
53
+ getLanguageOptions(): Promise<LanguageOption[]>;
54
+ /**
55
+ * Fetch single lang option meta data
56
+ *
57
+ * @param locale The locale code (e.g., 'en', 'id').
58
+ * @returns Promise LanguageMeta
59
+ */
60
+ getLanguageOptionMeta(locale: string): Promise<LanguageOption>;
61
+ /**
62
+ * Translate a specific text to the target locale.
63
+ * @param key Unique translation key.
64
+ * @param locale Target locale code.
65
+ * @returns A promise resolving to the translated string.
66
+ */
67
+ translateText(key: string, locale: string): Promise<string>;
68
+ }
69
+ export declare const useI18n: () => I18n;
70
+ declare const i18n: {
71
+ install: (app: App) => void;
72
+ };
73
+ export declare const createI18nWithExtension: (service: I18nService) => typeof i18n;
74
+ export default i18n;
75
+ declare module 'vue' {
76
+ interface ComponentCustomProperties {
77
+ $i18n: I18n;
78
+ $t: I18n['t'];
79
+ }
80
+ }