@fewangsit/wangsvue-gsts 1.0.0-alpha.11 → 1.0.0-alpha.13

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.
@@ -1,4 +1,4 @@
1
- import { ClassComponent } from 'lib/components/ts-helpers.d';
1
+ import { ClassComponent } from '../../components/ts-helpers.d';
2
2
 
3
3
  export interface AnimationDefaultConfig {
4
4
  libPath: 'supplyasset' | 'workspace' | 'admin';
@@ -1,6 +1,66 @@
1
- import { BadgeProps as BaseBadgeProps } from '../.././components/badge/Badge.vue.d';
2
- export * from '../.././components/badge/Badge.vue.d';
1
+ import { ClassComponent } from '../ts-helpers';
3
2
 
4
- export interface BadgeProps extends Omit<BaseBadgeProps, 'severity'> {
5
- severity: BaseBadgeProps['severity'] | 'fixed-primary' | 'supply-primary';
3
+ export interface BadgeComponentConfigs {
4
+ /**
5
+ * The component configurasion to set the severity based on given label. If provided, props.severity might be omitted.
6
+ *
7
+ * @param label The badge label
8
+ * @returns The matched severity of given label
9
+ */
10
+ getSeverity?: (label?: string) => BadgeProps['severity'];
6
11
  }
12
+
13
+ /**
14
+ * Props for Badge component
15
+ */
16
+ export interface BadgeProps extends BadgeComponentConfigs {
17
+ /**
18
+ * The text to be displayed.
19
+ */
20
+ label: string;
21
+ /**
22
+ * Whether the badge text is editable.
23
+ */
24
+ editable?: boolean;
25
+ /**
26
+ * Sets the severity level for styling purposes. This prop might be omitted if getSeverity is provided.
27
+ */
28
+ severity?: 'success' | 'info' | 'danger' | 'warning' | 'dark' | 'primary';
29
+ /**
30
+ * Specifies the format for text truncation rules based on the usage context.
31
+ */
32
+ format?: 'username' | 'nowrap';
33
+ /**
34
+ * Whether to show the remove icon or not. Clicking the remove icon will emit 'remove' event.
35
+ */
36
+ removable?: boolean;
37
+ /**
38
+ * Whether to set badge become disabled.
39
+ */
40
+ disabled?: boolean;
41
+ }
42
+
43
+ /**
44
+ * Emits for Badge component
45
+ */
46
+ export type BadgeEmits = {
47
+ 'remove': [];
48
+ /**
49
+ * Emits when the text is edited.
50
+ * Only available when props.editable=true
51
+ */
52
+ 'update:label': [label: string | null];
53
+ };
54
+
55
+ /**
56
+ * **WangsVue - Badge**
57
+ *
58
+ * _Badge is a component for displaying a text with optional remove functionality._
59
+ *
60
+ * @group components
61
+ */
62
+ export default class Badge extends ClassComponent<
63
+ BadgeProps,
64
+ unknown,
65
+ BadgeEmits
66
+ > {}
@@ -1,19 +1,56 @@
1
- import { BadgeGroupProps as BaseBadgeGroupProps, ObjectBadge as BaseObjectBadge } from '../.././components/badgegroup/BadgeGroup.vue.d';
2
- export * from '../.././components/badgegroup/BadgeGroup.vue.d';
1
+ import { Slot } from 'vue';
2
+ import { BadgeProps } from '../../components/badge/Badge.vue.d';
3
+ import { ClassComponent, HintedString } from '../ts-helpers.d';
3
4
 
4
5
  export type ObjectBadge = {
5
6
  text: string;
6
- severity: BaseObjectBadge['severity'] | 'fixed-primary' | 'supply-primary';
7
+ severity: 'success' | 'danger' | 'warning' | 'dark' | 'primary';
7
8
  };
8
9
 
9
10
  export interface BadgeGroupProps
10
- extends Omit<BaseBadgeGroupProps, 'severity' | 'labels'> {
11
- severity?:
12
- | BaseBadgeGroupProps['severity']
13
- | 'fixed-primary'
14
- | 'supply-primary';
11
+ extends Omit<BadgeProps, 'label' | 'disabled' | 'removable'> {
15
12
  /**
16
13
  * Support data type object to determine severity for specific text
17
14
  */
18
15
  labels: string[] | ObjectBadge[];
16
+ /**
17
+ * Determine whether severity of text "more" is customizable
18
+ *
19
+ * @default undefined
20
+ */
21
+ textMoreSeverity?: HintedString<
22
+ 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'contrast'
23
+ >;
24
+ /**
25
+ * The text shown on the more button
26
+ *
27
+ * @default 'more'
28
+ */
29
+ textMore?: string;
30
+ /**
31
+ * Maximum number of label to be shown.
32
+ */
33
+ limit?: number;
34
+ /**
35
+ * The dialog header shown on more button clicked
36
+ */
37
+ headerLabel?: string;
38
+ /**
39
+ * Specify if the badge should be emptyable
40
+ * @default false
41
+ */
42
+ emptyable?: boolean;
19
43
  }
44
+
45
+ export interface BadgeGroupSlots {
46
+ /**
47
+ * Slot for custom more dialog content
48
+ */
49
+ dialogcontent: Slot<{ labels: string[] }>;
50
+ }
51
+
52
+ export default class Badge extends ClassComponent<
53
+ BadgeGroupProps,
54
+ BadgeGroupSlots,
55
+ unknown
56
+ > {}
@@ -1,6 +1,185 @@
1
- import { ButtonProps as BaseButtonProps } from '../.././components/button/Button.vue.d';
2
- export * from '../.././components/button/Button.vue.d';
1
+ import { ButtonHTMLAttributes, VNode } from 'vue';
2
+ import { WangsIcons } from '../icon/Icon.vue.d';
3
+ import { TooltipOptions } from 'primevue/tooltip';
4
+ import { GlobalComponentConstructor } from '../ts-helpers.d';
5
+ import { ClassComponent, HintedString } from '../ts-helpers';
3
6
 
4
- export interface ButtonProps extends BaseButtonProps {
5
- severity: BaseButtonProps['severity'] | 'fixed-primary' | 'supply-primary';
7
+ /**
8
+ * Defines valid properties in Button component.
9
+ */
10
+ export interface ButtonProps extends /* @vue-ignore */ ButtonHTMLAttributes {
11
+ /**
12
+ * Inline style of the button.
13
+ */
14
+ style?: any;
15
+ /**
16
+ * Style class of the button.
17
+ */
18
+ class?: any;
19
+ /**
20
+ * Text of the button.
21
+ */
22
+ label?: string | undefined;
23
+ /**
24
+ * Name of the icon.
25
+ */
26
+ icon?: WangsIcons | undefined;
27
+ /**
28
+ * Position of the icon.
29
+ * @defaultValue left
30
+ */
31
+ iconPos?: 'left' | 'right' | 'top' | 'bottom' | undefined;
32
+ /**
33
+ * Style class of the icon.
34
+ */
35
+ iconClass?: string | undefined;
36
+ /**
37
+ * Tooltip/information to show on button hover.
38
+ */
39
+ tooltip?: string | TooltipOptions;
40
+ /**
41
+ * Set the position of tooltip.
42
+ * @default bottom
43
+ */
44
+ tooltipPos?: 'top' | 'right' | 'bottom' | 'left';
45
+ /**
46
+ * Value of the badge.
47
+ */
48
+ badge?: string | undefined;
49
+ /**
50
+ * Style class of the badge.
51
+ */
52
+ badgeClass?: string | undefined;
53
+ /**
54
+ * Severity type of the badge.
55
+ */
56
+ badgeSeverity?:
57
+ | HintedString<
58
+ 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'contrast'
59
+ >
60
+ | null
61
+ | undefined;
62
+ /**
63
+ * Whether the button is in loading state.
64
+ * @defaultValue false
65
+ */
66
+ loading?: boolean | undefined;
67
+ /**
68
+ * Icon to display in loading state.
69
+ */
70
+ loadingIcon?: string | undefined;
71
+ /**
72
+ * Add a link style to the button.
73
+ * @defaultValue false
74
+ */
75
+ link?: boolean | undefined;
76
+ /**
77
+ * Defines the style of the button.
78
+ */
79
+ severity?:
80
+ | HintedString<
81
+ | 'secondary'
82
+ | 'success'
83
+ | 'info'
84
+ | 'warning'
85
+ | 'help'
86
+ | 'danger'
87
+ | 'contrast'
88
+ >
89
+ | undefined;
90
+ /**
91
+ * Add a shadow to indicate elevation.
92
+ * @defaultValue false
93
+ */
94
+ raised?: boolean | undefined;
95
+ /**
96
+ * Add a circular border radius to the button.
97
+ * @defaultValue false
98
+ */
99
+ rounded?: boolean | undefined;
100
+ /**
101
+ * Add a textual class to the button without a background initially.
102
+ * @defaultValue false
103
+ */
104
+ text?: boolean | undefined;
105
+ /**
106
+ * Add a border class without a background initially.
107
+ * @defaultValue false
108
+ */
109
+ outlined?: boolean | undefined;
110
+ /**
111
+ * Defines the size of the button.
112
+ */
113
+ size?: 'small' | 'large' | undefined;
114
+ /**
115
+ * Add a plain textual class to the button without a background initially.
116
+ * @defaultValue false
117
+ */
118
+ plain?: boolean | undefined;
6
119
  }
120
+
121
+ /**
122
+ * Defines current options in Button component.
123
+ */
124
+ export interface ButtonContext {
125
+ /**
126
+ * Current disabled state of the element as a boolean.
127
+ * @defaultValue false
128
+ */
129
+ disabled: boolean;
130
+ }
131
+
132
+ /**
133
+ * Defines valid slots in Button component.
134
+ */
135
+ export interface ButtonSlots {
136
+ /**
137
+ * Custom content such as icons, images and text can be placed inside the button via the default slot. Note that when slot is used, label, icon and badge properties are not included.
138
+ */
139
+ default(): VNode[];
140
+ /**
141
+ * Custom icon template.
142
+ * @param {Object} scope - icon slot's params.
143
+ */
144
+ icon(scope: {
145
+ /**
146
+ * Style class of the icon.
147
+ */
148
+ class: string;
149
+ }): VNode[];
150
+ /**
151
+ * Custom loading icon template.
152
+ * @param {Object} scope - loading icon slot's params.
153
+ */
154
+ loadingicon(scope: {
155
+ /**
156
+ * Style class of the loading icon.
157
+ */
158
+ class: string;
159
+ }): VNode[];
160
+ }
161
+
162
+ /**
163
+ * **WangsVue - Button**
164
+ *
165
+ * _Button is an extension to standard button element with icons and theming._
166
+ *
167
+ * [Live Demo](https://fewangsit.github.io/wangsvue/table)
168
+ * --- ---
169
+ * ![WangsVue](https://www.wangs.id/wp-content/uploads/2023/12/cropped-Logo_Wangsid-removebg-preview-192x192.png)
170
+ *
171
+ * @group Component
172
+ */
173
+ declare class Button extends ClassComponent<
174
+ ButtonProps,
175
+ ButtonSlots,
176
+ Record<string, unknown>
177
+ > {}
178
+
179
+ declare module '@vue/runtime-core' {
180
+ interface GlobalComponents {
181
+ Button: GlobalComponentConstructor<Button>;
182
+ }
183
+ }
184
+
185
+ export default Button;
@@ -1,8 +1,8 @@
1
- import { DialogConfirmProps } from 'lib/components/dialogconfirm/DialogConfirm.vue.d';
2
- import { MenuItem } from 'lib/components/menuitem';
1
+ import { DialogConfirmProps } from '../../components/dialogconfirm/DialogConfirm.vue.d';
2
+ import { MenuItem } from '../../components/menuitem';
3
3
  import { ClassComponent, HintedString } from '../ts-helpers.d';
4
4
  import { Component } from 'vue';
5
- import { DateOptions } from 'lib/utils/date.util';
5
+ import { DateOptions } from '../../utils/date.util';
6
6
 
7
7
  export type ChildGroup = {
8
8
  groupHeader: string;
@@ -1,10 +1,160 @@
1
- import { DialogConfirmProps as BaseDialogConfirmProps } from '../.././components/dialogconfirm/DialogConfirm.vue.d';
2
- export * from '../.././components/dialogconfirm/DialogConfirm.vue.d';
1
+ import { Slot } from 'vue';
2
+ import { WangsIcons } from '../icon/Icon.vue.d';
3
+ import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
3
4
 
4
- export interface DialogConfirmProps
5
- extends Omit<BaseDialogConfirmProps, 'confirmButtonSeverity'> {
6
- confirmButtonSeverity:
7
- | BaseDialogConfirmProps['confirmButtonSeverity']
8
- | 'fixed-primary'
9
- | 'supply-primary';
5
+ type ConfirmDialogSeverity = 'success' | 'danger';
6
+
7
+ export interface DialogConfirmLocaleConfig {
8
+ actionableCloseButtonLabel?: string;
9
+ nonActionableCloseButtonLabel?: string;
10
+ /**
11
+ * @example Are you sure?
12
+ */
13
+ defaultConfirmMessage?: string;
14
+
15
+ /**
16
+ * @example Yakin
17
+ */
18
+ defaultConfirmLabel?: string;
10
19
  }
20
+
21
+ /**
22
+ * Props for DialogConfirm component
23
+ */
24
+ export interface DialogConfirmProps {
25
+ /**
26
+ * The header of the dialog.
27
+ */
28
+ header: string;
29
+ /**
30
+ * The severity of the dialog.
31
+ * The severity will determine the dialog icons and color scheme.
32
+ */
33
+ severity: ConfirmDialogSeverity;
34
+ /**
35
+ * The severity of the confirm button.
36
+ * The severity will determine the confirm button color scheme in case button severity is different from header/dialog severity.
37
+ *
38
+ * @default undefined - to fallback to props.severity
39
+ */
40
+ confirmButtonSeverity?: ConfirmDialogSeverity;
41
+ /**
42
+ * The boolean modelValue to show dialog.
43
+ */
44
+ visible: boolean;
45
+
46
+ /**
47
+ * Determines if the dialog should close after confirm.
48
+ * @default true
49
+ */
50
+ closeAfterConfirm?: boolean;
51
+ /**
52
+ * The label of the close/cancel button.
53
+ */
54
+ closeLabel?: string;
55
+ /**
56
+ * To hide/show the confirm button.
57
+ *
58
+ * Set to 'false' Make the confirm dialog cannot be confirmed.
59
+ *
60
+ * @default true;
61
+ */
62
+ actionable?: boolean;
63
+ /**
64
+ * The label of the confirm button.
65
+ */
66
+ confirmLabel?: string;
67
+ /**
68
+ * Custom header icon. Default is 'error' icon for danger severity, and 'checkbox-circle' for success severity.
69
+ */
70
+ headerIcon?: WangsIcons;
71
+ /**
72
+ * The lists to be displayed in the dialog.
73
+ */
74
+ list?: (string | object)[] | Set<string | object>;
75
+ /**
76
+ * The label of the list if your list item is an object.
77
+ * Choose a property from the item to be displayed on the list.
78
+ */
79
+ listLabel?: string;
80
+ /**
81
+ * The confirmation message.
82
+ */
83
+ message?: string;
84
+ /**
85
+ * Whether show icon header or not.
86
+ * @default true;
87
+ */
88
+ showIcon?: boolean;
89
+ /**
90
+ * Whether show close button or not (footer button that has label, not close button with icon 'X').
91
+ * @default true;
92
+ */
93
+ showCloseButton?: boolean;
94
+
95
+ /**
96
+ * Set class for content element.
97
+ */
98
+ contentClass?: any;
99
+ }
100
+
101
+ /**
102
+ * Slots for DialogConfirm component
103
+ */
104
+ export interface DialogConfirmSlots {
105
+ /**
106
+ * The body slot for the dialog. Here is where you can put your dialog body.
107
+ */
108
+ body?: Slot | string;
109
+ /**
110
+ * The footer slot for the dialog. Here is where you can put your dialog footer.
111
+ * Use this slot if you need to custom the dialog buttons.
112
+ */
113
+ footer?: Slot | string;
114
+ }
115
+
116
+ /**
117
+ * Emits for DialogConfirm component
118
+ */
119
+ export type DialogConfirmEmits = {
120
+ /**
121
+ * Emits when close button clicked.
122
+ */
123
+ 'close': [];
124
+ /**
125
+ * Emits when Confirm button clicked.
126
+ */
127
+ 'confirm': [];
128
+ /**
129
+ * Emits when dialog closed.
130
+ */
131
+ 'hide': [];
132
+ /**
133
+ * Emits when the dialog is closed. Wether from cancel button, close button, or ESC button pressed.
134
+ */
135
+ 'update:visible': [state: boolean];
136
+ };
137
+
138
+ /**
139
+ * **WangsVue - DialogConfirm**
140
+ *
141
+ * _DialogConfirm is a component for creating confirmation dialogs._
142
+ *
143
+ * --- ---
144
+ * ![WangsVue](https://www.wangs.id/wp-content/uploads/2023/12/cropped-Logo_Wangsid-removebg-preview-192x192.png)
145
+ *
146
+ * @group components
147
+ */
148
+ declare class DialogConfirm extends ClassComponent<
149
+ DialogConfirmProps,
150
+ DialogConfirmSlots,
151
+ DialogConfirmEmits
152
+ > {}
153
+
154
+ declare module '@vue/runtime-core' {
155
+ interface GlobalComponents {
156
+ DialogConfirm: GlobalComponentConstructor<DialogConfirm>;
157
+ }
158
+ }
159
+
160
+ export default DialogConfirm;
@@ -1,8 +1,8 @@
1
1
  import { Slot } from 'vue';
2
- import { DropdownOption, OptionValue } from 'lib/types/options.type';
2
+ import { DropdownOption, OptionValue } from '../../types/options.type';
3
3
  import { CustomValidation } from '../form/Form.vue.d';
4
4
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
5
- import { BadgeProps } from 'lib/components/badge/Badge.vue.d';
5
+ import { BadgeProps } from '../../components/badge/Badge.vue.d';
6
6
 
7
7
  /**
8
8
  * Configuration interface for localizing dropdown component placeholders and error messages.
@@ -1,4 +1,4 @@
1
- import { MultiSelectOption } from 'lib/types/options.type';
1
+ import { MultiSelectOption } from '../../types/options.type';
2
2
  import { DefineComponent, Slot } from 'vue';
3
3
  import { CalendarProps } from '../calendar/Calendar.vue.d';
4
4
  import { QueryParams } from '../datatable/DataTable.vue.d';
@@ -14,8 +14,8 @@ export interface MultiSelectFilterField extends MultiSelectProps {
14
14
  optionField?: string; // @example - actionOptions
15
15
  params?: QueryParams; // Additional QueryParams for the fetchOptionFn
16
16
  fetchOptionFn?:
17
- | ((args?: any) => MultiSelectOption[]) // Sync function to fetch options
18
- | ((args?: any) => Promise<MultiSelectOption[]>); // Async function
17
+ | ((args?: any) => MultiSelectOption[] | undefined) // Sync function to fetch options
18
+ | ((args?: any) => Promise<MultiSelectOption[] | undefined>); // Async function
19
19
  }
20
20
 
21
21
  export interface DropdownFilterField extends DropdownProps {
@@ -24,8 +24,8 @@ export interface DropdownFilterField extends DropdownProps {
24
24
  optionField?: string; // @example - actionOptions
25
25
  params?: QueryParams; // Additional QueryParams for the fetchOptionFn
26
26
  fetchOptionFn?:
27
- | ((args?: any) => MultiSelectOption[]) // Sync function to fetch options
28
- | ((args?: any) => Promise<MultiSelectOption[]>); // Async function
27
+ | ((args?: any) => MultiSelectOption[] | undefined) // Sync function to fetch options
28
+ | ((args?: any) => Promise<MultiSelectOption[]> | undefined); // Async function
29
29
  }
30
30
 
31
31
  export interface RangeNumberFilterField extends InputRangeNumberProps {
@@ -3,7 +3,7 @@ import { ClassComponent } from '../ts-helpers';
3
3
  import {
4
4
  InputTextEmits,
5
5
  InputTextProps,
6
- } from 'lib/components/inputtext/InputText.vue.d';
6
+ } from '../../components/inputtext/InputText.vue.d';
7
7
 
8
8
  /**
9
9
  * InputURL component props
@@ -1,4 +1,4 @@
1
- import { DropdownOption, OptionValue } from 'lib/types/options.type';
1
+ import { DropdownOption, OptionValue } from '../../types/options.type';
2
2
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
3
3
  import { DropdownChangeEvent } from 'primevue/dropdown';
4
4
 
@@ -2,7 +2,7 @@ import { DropdownLocaleConfig } from '../dropdown/Dropdown.vue.d';
2
2
  import { CustomValidation } from '../form/Form.vue.d';
3
3
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
4
4
 
5
- import { MultiSelectOption, OptionValue } from 'lib/types/options.type';
5
+ import { MultiSelectOption, OptionValue } from '../../types/options.type';
6
6
 
7
7
  export type MultiSelectLocaleConfig = DropdownLocaleConfig & {};
8
8
 
@@ -1,7 +1,7 @@
1
1
  import { Slot } from 'vue';
2
2
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
3
3
  import { TreeSelectionKeys } from 'primevue/tree';
4
- import { MenuItem } from 'lib/components/menuitem';
4
+ import { MenuItem } from '../../components/menuitem';
5
5
  import { BaseTreeProps, TreeNode } from '../basetree/BaseTree.vue.d';
6
6
  import { ShortFetchResponse } from '../datatable/DataTable.vue.d';
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-gsts",
3
- "version": "1.0.0-alpha.11",
3
+ "version": "1.0.0-alpha.13",
4
4
  "author": "Wangsit FE Developer",
5
5
  "description": "Global Settings Tagsamurai VueJS Component Library",
6
6
  "type": "module",