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

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,66 +1,6 @@
1
- import { ClassComponent } from '../ts-helpers';
1
+ import { BadgeProps as BaseBadgeProps } from '../.././components/badge/Badge.vue.d';
2
+ export * from '../.././components/badge/Badge.vue.d';
2
3
 
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'];
4
+ export interface BadgeProps extends Omit<BaseBadgeProps, 'severity'> {
5
+ severity: BaseBadgeProps['severity'] | 'fixed-primary' | 'supply-primary';
11
6
  }
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,40 +1,19 @@
1
- import { Slot } from 'vue';
2
- import { BadgeProps } from 'lib/components/badge/Badge.vue.d';
3
- import { ClassComponent } from '../ts-helpers.d';
1
+ import { BadgeGroupProps as BaseBadgeGroupProps, ObjectBadge as BaseObjectBadge } from '../.././components/badgegroup/BadgeGroup.vue.d';
2
+ export * from '../.././components/badgegroup/BadgeGroup.vue.d';
4
3
 
5
- export interface BadgeGroupProps
6
- extends Omit<BadgeProps, 'label' | 'disabled' | 'removable'> {
7
- labels: string[];
8
- /**
9
- * The text shown on the more button
10
- *
11
- * @default 'more'
12
- */
13
- textMore?: string;
14
- /**
15
- * Maximum number of label to be shown.
16
- */
17
- limit?: number;
18
- /**
19
- * The dialog header shown on more button clicked
20
- */
21
- headerLabel?: string;
22
- /**
23
- * Specify if the badge should be emptyable
24
- * @default false
25
- */
26
- emptyable?: boolean;
27
- }
4
+ export type ObjectBadge = {
5
+ text: string;
6
+ severity: BaseObjectBadge['severity'] | 'fixed-primary' | 'supply-primary';
7
+ };
28
8
 
29
- export interface BadgeGroupSlots {
9
+ export interface BadgeGroupProps
10
+ extends Omit<BaseBadgeGroupProps, 'severity' | 'labels'> {
11
+ severity?:
12
+ | BaseBadgeGroupProps['severity']
13
+ | 'fixed-primary'
14
+ | 'supply-primary';
30
15
  /**
31
- * Slot for custom more dialog content
16
+ * Support data type object to determine severity for specific text
32
17
  */
33
- dialogcontent: Slot<{ labels: string[] }>;
18
+ labels: string[] | ObjectBadge[];
34
19
  }
35
-
36
- export default class Badge extends ClassComponent<
37
- BadgeGroupProps,
38
- BadgeGroupSlots,
39
- unknown
40
- > {}
@@ -1,185 +1,6 @@
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';
1
+ import { ButtonProps as BaseButtonProps } from '../.././components/button/Button.vue.d';
2
+ export * from '../.././components/button/Button.vue.d';
6
3
 
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;
4
+ export interface ButtonProps extends BaseButtonProps {
5
+ severity: BaseButtonProps['severity'] | 'fixed-primary' | 'supply-primary';
119
6
  }
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,153 +1,10 @@
1
- import { Slot } from 'vue';
2
- import { WangsIcons } from '../icon/Icon.vue.d';
3
- import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
1
+ import { DialogConfirmProps as BaseDialogConfirmProps } from '../.././components/dialogconfirm/DialogConfirm.vue.d';
2
+ export * from '../.././components/dialogconfirm/DialogConfirm.vue.d';
4
3
 
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;
4
+ export interface DialogConfirmProps
5
+ extends Omit<BaseDialogConfirmProps, 'confirmButtonSeverity'> {
6
+ confirmButtonSeverity:
7
+ | BaseDialogConfirmProps['confirmButtonSeverity']
8
+ | 'fixed-primary'
9
+ | 'supply-primary';
19
10
  }
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 boolean modelValue to show dialog.
36
- */
37
- visible: boolean;
38
-
39
- /**
40
- * Determines if the dialog should close after confirm.
41
- * @default true
42
- */
43
- closeAfterConfirm?: boolean;
44
- /**
45
- * The label of the close/cancel button.
46
- */
47
- closeLabel?: string;
48
- /**
49
- * To hide/show the confirm button.
50
- *
51
- * Set to 'false' Make the confirm dialog cannot be confirmed.
52
- *
53
- * @default true;
54
- */
55
- actionable?: boolean;
56
- /**
57
- * The label of the confirm button.
58
- */
59
- confirmLabel?: string;
60
- /**
61
- * Custom header icon. Default is 'error' icon for danger severity, and 'checkbox-circle' for success severity.
62
- */
63
- headerIcon?: WangsIcons;
64
- /**
65
- * The lists to be displayed in the dialog.
66
- */
67
- list?: (string | object)[] | Set<string | object>;
68
- /**
69
- * The label of the list if your list item is an object.
70
- * Choose a property from the item to be displayed on the list.
71
- */
72
- listLabel?: string;
73
- /**
74
- * The confirmation message.
75
- */
76
- message?: string;
77
- /**
78
- * Whether show icon header or not.
79
- * @default true;
80
- */
81
- showIcon?: boolean;
82
- /**
83
- * Whether show close button or not (footer button that has label, not close button with icon 'X').
84
- * @default true;
85
- */
86
- showCloseButton?: boolean;
87
-
88
- /**
89
- * Set class for content element.
90
- */
91
- contentClass?: any;
92
- }
93
-
94
- /**
95
- * Slots for DialogConfirm component
96
- */
97
- export interface DialogConfirmSlots {
98
- /**
99
- * The body slot for the dialog. Here is where you can put your dialog body.
100
- */
101
- body?: Slot | string;
102
- /**
103
- * The footer slot for the dialog. Here is where you can put your dialog footer.
104
- * Use this slot if you need to custom the dialog buttons.
105
- */
106
- footer?: Slot | string;
107
- }
108
-
109
- /**
110
- * Emits for DialogConfirm component
111
- */
112
- export type DialogConfirmEmits = {
113
- /**
114
- * Emits when close button clicked.
115
- */
116
- 'close': [];
117
- /**
118
- * Emits when Confirm button clicked.
119
- */
120
- 'confirm': [];
121
- /**
122
- * Emits when dialog closed.
123
- */
124
- 'hide': [];
125
- /**
126
- * Emits when the dialog is closed. Wether from cancel button, close button, or ESC button pressed.
127
- */
128
- 'update:visible': [state: boolean];
129
- };
130
-
131
- /**
132
- * **WangsVue - DialogConfirm**
133
- *
134
- * _DialogConfirm is a component for creating confirmation dialogs._
135
- *
136
- * --- ---
137
- * ![WangsVue](https://www.wangs.id/wp-content/uploads/2023/12/cropped-Logo_Wangsid-removebg-preview-192x192.png)
138
- *
139
- * @group components
140
- */
141
- declare class DialogConfirm extends ClassComponent<
142
- DialogConfirmProps,
143
- DialogConfirmSlots,
144
- DialogConfirmEmits
145
- > {}
146
-
147
- declare module '@vue/runtime-core' {
148
- interface GlobalComponents {
149
- DialogConfirm: GlobalComponentConstructor<DialogConfirm>;
150
- }
151
- }
152
-
153
- export default DialogConfirm;
@@ -32,6 +32,7 @@ export type WangsIcons =
32
32
  | 'assignment'
33
33
  | 'attachment-2'
34
34
  | 'audit'
35
+ | 'barcode'
35
36
  | 'barricade-line'
36
37
  | 'bell'
37
38
  | 'bell-alert'
@@ -51,6 +52,7 @@ export type WangsIcons =
51
52
  | 'checkbox-circle'
52
53
  | 'checkbox-circle-fill'
53
54
  | 'checkbox-blank-circle'
55
+ | 'checkbox-blank-circle-fill'
54
56
  | 'checkbox-multiple'
55
57
  | 'close'
56
58
  | 'close-circle'
@@ -143,6 +145,7 @@ export type WangsIcons =
143
145
  | 'profile'
144
146
  | 'qr'
145
147
  | 'qr-scan'
148
+ | 'reception'
146
149
  | 'refresh'
147
150
  | 'replace-tag'
148
151
  | 'report-tag'
@@ -162,6 +165,7 @@ export type WangsIcons =
162
165
  | 'sort-asc'
163
166
  | 'sort-desc'
164
167
  | 'supplier-return'
168
+ | 'internal-return'
165
169
  | 'spinner'
166
170
  | 'stack'
167
171
  | 'star'
@@ -14,7 +14,7 @@ export type ImageCompressorPayload = {
14
14
  fileName: string;
15
15
  file: File;
16
16
  size: string;
17
- type: 'image/webp';
17
+ type: 'image/webp' | 'image/jpeg' | 'image/jpg';
18
18
  };
19
19
  message?: string;
20
20
  };
@@ -130,6 +130,12 @@ export interface ImageCompressorProps {
130
130
  * @default true
131
131
  */
132
132
  showValidatorMessage?: boolean;
133
+ /**
134
+ * Specify the file type for the uploaded image result.
135
+ *
136
+ * @default 'webp'
137
+ */
138
+ fileType?: 'webp' | 'jpeg' | 'jpg';
133
139
  }
134
140
 
135
141
  export interface ImageCompressorSlots {
@@ -30,7 +30,7 @@ export { default as DialogSelectTree } from '.././components/dialogselecttree/Di
30
30
  export { default as Dropdown } from './dropdown/Dropdown.vue';
31
31
  export { default as Editor } from './editor/Editor.vue';
32
32
  export { default as FileUpload } from './fileupload/FileUpload.vue';
33
- export { default as FilterContainer } from '../../admin-tagsamurai/components/filtercontainer/FilterContainer.vue';
33
+ export { default as FilterContainer } from './filtercontainer/FilterContainer.vue';
34
34
  export { default as Form } from './form/Form.vue';
35
35
  export { default as Icon } from './icon/Icon.vue';
36
36
  export { default as Image } from './image/Image.vue';
@@ -61,3 +61,23 @@ export declare type DefaultPassThrough<T = void> =
61
61
  | undefined;
62
62
 
63
63
  export declare type HintedString<T extends string> = (string & {}) | T;
64
+
65
+ export declare type PresetAttributes = {
66
+ class?: any;
67
+ style?: any;
68
+ [key: string]: any;
69
+ };
70
+
71
+ export declare type PresetMethodOptions = {
72
+ instance: any;
73
+ props: any;
74
+ state: any;
75
+ context: any;
76
+ attrs: any;
77
+ parent: any;
78
+ global: object | undefined;
79
+ };
80
+
81
+ export declare type PresetOptionMethodType<Opt = PresetMethodOptions> = (
82
+ options: Partial<Opt>,
83
+ ) => PresetAttributes;
@@ -1,39 +1,97 @@
1
- import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
1
+ import {
2
+ ClassComponent,
3
+ GlobalComponentConstructor,
4
+ PresetAttributes,
5
+ PresetOptionMethodType,
6
+ } from '../ts-helpers';
2
7
 
3
- /**
4
- * Defines valid properties in UserName component.
5
- */
6
- export interface UserNameProps {
8
+ export interface UserNamePresetOptions {
9
+ root: PresetAttributes;
10
+ displayname: PresetOptionMethodType;
11
+ panel: {
12
+ background: PresetAttributes;
13
+ username: PresetAttributes;
14
+ useremail: PresetAttributes;
15
+ positiondivision: PresetAttributes;
16
+ userdetaillink: PresetAttributes;
17
+ contentwrapper: PresetAttributes;
18
+ detailwrapper: PresetAttributes;
19
+ };
20
+ }
21
+
22
+ export interface UserNameLocaleConfig {
7
23
  /**
8
- * @default 'picture' - Show user profile picture instead of user icon
24
+ * The anchor text for user detail link on user panel
9
25
  */
10
- type?: 'icon' | 'picture';
26
+ detailUserAnchorText?: string;
27
+ }
28
+
29
+ export interface UserNameComponentConfigs {
11
30
  /**
12
- * The full user Object
31
+ * @example `/tim-member/member/{userId}/detail-member`
32
+ */
33
+ detailUserPath: string;
34
+
35
+ /**
36
+ * @default 'picture' - Show user profile picture instead of user icon
13
37
  */
14
- user?: Record<string, any>;
38
+ type?: 'icon' | 'picture';
39
+
15
40
  /**
16
41
  * Specify the field of user to be used as display name
17
42
  *
18
43
  * @example 'name.fullName'
19
- *
20
- * @default 'nickName'
21
44
  */
22
45
  userNameField?: string;
23
46
  /**
24
47
  * Specify the field of user to be used as display picture
25
48
  *
26
49
  * @example 'image.profile'
27
- *
28
- * @default 'profilePicture'
29
50
  */
30
51
  profilePictureField?: string;
52
+
53
+ /**
54
+ * Function to get user detail on panel shown
55
+ * @param userId The user id
56
+ * @returns Full user detail object
57
+ */
58
+ getUserDetail: (
59
+ userId: string,
60
+ ) => UserNameProps['user'] | Promise<UserNameProps['user']>;
61
+ }
62
+
63
+ export interface GeneralUser {
64
+ _id: string;
65
+ profilePicture?: string;
66
+ firstName?: string;
67
+ lastName?: string;
68
+ fullName?: string;
69
+ email?: string;
70
+ nickName?: string;
71
+ position?: string;
72
+ division?: string;
73
+ [key: string]: any;
74
+ }
75
+
76
+ /**
77
+ * Defines valid properties in UserName component.
78
+ */
79
+ export interface UserNameProps extends Partial<UserNameComponentConfigs> {
80
+ /**
81
+ * The full user Object
82
+ */
83
+ user?: GeneralUser;
31
84
  /**
32
85
  * Specify if the component can be emptyable
33
86
  *
34
87
  * @default false
35
88
  */
36
89
  emptyable?: boolean;
90
+
91
+ /**
92
+ * When it sets to false, the props.user will be used
93
+ */
94
+ fetchDetailOnPanelShow?: boolean;
37
95
  }
38
96
 
39
97
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-gsts",
3
- "version": "1.0.0-alpha.1",
4
- "author": "fewangsit",
3
+ "version": "1.0.0-alpha.11",
4
+ "author": "Wangsit FE Developer",
5
5
  "description": "Global Settings Tagsamurai VueJS Component Library",
6
6
  "type": "module",
7
7
  "module": "./wangsvue-gsts.es.js",