@fewangsit/wangsvue 1.5.205-alpha.1 → 1.5.206-alpha.0

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,9 +1,19 @@
1
1
  import { ClassComponent } from '../ts-helpers';
2
2
 
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'];
11
+ }
12
+
3
13
  /**
4
14
  * Props for Badge component
5
15
  */
6
- export interface BadgeProps {
16
+ export interface BadgeProps extends BadgeComponentConfigs {
7
17
  /**
8
18
  * The text to be displayed.
9
19
  */
@@ -13,9 +23,9 @@ export interface BadgeProps {
13
23
  */
14
24
  editable?: boolean;
15
25
  /**
16
- * Sets the severity level for styling purposes.
26
+ * Sets the severity level for styling purposes. This prop might be omitted if getSeverity is provided.
17
27
  */
18
- severity?: 'success' | 'danger' | 'warning' | 'dark' | 'primary';
28
+ severity?: 'success' | 'info' | 'danger' | 'warning' | 'dark' | 'primary';
19
29
  /**
20
30
  * Specifies the format for text truncation rules based on the usage context.
21
31
  */
@@ -1,9 +1,26 @@
1
+ import { Slot } from 'vue';
1
2
  import { BadgeProps } from 'lib/components/badge/Badge.vue.d';
2
- import { ClassComponent } from '../ts-helpers.d';
3
+ import { ClassComponent, HintedString } from '../ts-helpers.d';
4
+
5
+ export type ObjectBadge = {
6
+ text: string;
7
+ severity: 'success' | 'danger' | 'warning' | 'dark' | 'primary';
8
+ };
3
9
 
4
10
  export interface BadgeGroupProps
5
11
  extends Omit<BadgeProps, 'label' | 'disabled' | 'removable'> {
6
- labels: string[];
12
+ /**
13
+ * Support data type object to determine severity for specific text
14
+ */
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
+ >;
7
24
  /**
8
25
  * The text shown on the more button
9
26
  *
@@ -25,8 +42,15 @@ export interface BadgeGroupProps
25
42
  emptyable?: boolean;
26
43
  }
27
44
 
45
+ export interface BadgeGroupSlots {
46
+ /**
47
+ * Slot for custom more dialog content
48
+ */
49
+ dialogcontent: Slot<{ labels: string[] }>;
50
+ }
51
+
28
52
  export default class Badge extends ClassComponent<
29
53
  BadgeGroupProps,
30
- unknown,
54
+ BadgeGroupSlots,
31
55
  unknown
32
56
  > {}
@@ -300,6 +300,8 @@ export interface TreeContext {
300
300
  */
301
301
  export interface BaseTreeProps {
302
302
  disableKeys?: number[];
303
+ disableNodeAll?: boolean;
304
+ exactDisableKeys?: number[];
303
305
  level?: number;
304
306
  /**
305
307
  * List of labels that has no menu option
@@ -1,6 +1,25 @@
1
1
  import { DefineComponent } from 'vue';
2
2
  import { MenuItem } from '../menuitem';
3
3
 
4
+ export interface ButtonBulkActionLocaleConfig {
5
+ /**
6
+ * @example `{length} data selected`
7
+ */
8
+ currentSelectionMessage?: string;
9
+
10
+ /**
11
+ * @description Label for when all records have been selected.
12
+ * @example 'Select all ({totalRecords} data)' - totalRecords - The total number of records available to select.
13
+ */
14
+ allRecordSelected?: string;
15
+
16
+ /**
17
+ * @description Label for the "Select All" option in a bulk action button.
18
+ * @example `Select all ({totalRecords} items)` - totalRecords - The total number of records available to select.
19
+ */
20
+ selectAllRecords?: string;
21
+ }
22
+
4
23
  export interface ButtonBulkActionProps {
5
24
  /**
6
25
  * Disable the button.
@@ -80,7 +80,14 @@ export interface ButtonSelectTreeProps {
80
80
  * @default false
81
81
  */
82
82
  autoSelectAll?: boolean;
83
+ /**
84
+ * A list of node keys that should be disabled along with their children.
85
+ */
83
86
  disableKeys?: number[];
87
+ /**
88
+ * A list of node keys that should be disabled, affecting only the specified nodes and not their children.
89
+ */
90
+ exactDisableKeys?: number[];
84
91
  /**
85
92
  * Disable the Select button
86
93
  */
@@ -2,6 +2,7 @@ import { DialogConfirmProps } from 'lib/components/dialogconfirm/DialogConfirm.v
2
2
  import { MenuItem } from 'lib/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
6
 
6
7
  export type ChildGroup = {
7
8
  groupHeader: string;
@@ -13,9 +14,7 @@ export type Data = Record<string, any> & {
13
14
  hasChildren?: boolean;
14
15
  };
15
16
 
16
- export type QueryParams = {
17
- [key: string]: any;
18
- };
17
+ export type QueryParams = Partial<Record<string, any>>;
19
18
 
20
19
  /**
21
20
  * Custom sort event.
@@ -298,6 +297,13 @@ export interface TableColumn {
298
297
  * Convert boolean into text Yes/No
299
298
  */
300
299
  booleanValue?: boolean;
300
+ /**
301
+ * Specify the options for formatting date values using the formatDate utility.
302
+ *
303
+ * The date format primarily uses the general settings configurations.
304
+ * Within this property, you only need to set the `showTime` or `showDate` options.
305
+ */
306
+ dateFormatOptions?: DateOptions;
301
307
  bodyTemplate?: (data: any, index: number) => string | undefined;
302
308
  bodyComponent?: (data: any, index: number) => TableCellComponent;
303
309
  headerTemplate?: () => string;
@@ -521,6 +527,7 @@ export interface BaseDataTableProps {
521
527
  * Sets to lazy if you need to dynamically shows data.
522
528
  */
523
529
  lazy?: boolean;
530
+ // Sets loading animation for DataTable that's not lazy.
524
531
  loading?: boolean;
525
532
  /**
526
533
  * Whether to enable 'checkbox' | 'single' selection.
@@ -41,8 +41,18 @@ export interface DialogSelectTreeProps {
41
41
  * Disable node 'All' selection
42
42
  */
43
43
  disableNodeAll?: boolean;
44
- disableKeys?: number[];
44
+ /**
45
+ * @deprecated
46
+ */
45
47
  exactDisableKey?: number;
48
+ /**
49
+ * A list of node keys that should be disabled along with their children.
50
+ */
51
+ disableKeys?: number[];
52
+ /**
53
+ * A list of node keys that should be disabled, affecting only the specified nodes and not their children.
54
+ */
55
+ exactDisableKeys?: number[];
46
56
  /**
47
57
  * Defines the tree is readonly and disabled.
48
58
  */
@@ -11,7 +11,8 @@ import { ButtonSelectTreeProps } from '../buttonselecttree/ButtonSelectTree.vue.
11
11
  export interface MultiSelectFilterField extends MultiSelectProps {
12
12
  type: 'multiselect';
13
13
  field: string; // The name of the field this filter applies to
14
- optionField: string; // @example - actionOptions
14
+ optionField?: string; // @example - actionOptions
15
+ params?: QueryParams; // Additional QueryParams for the fetchOptionFn
15
16
  fetchOptionFn?:
16
17
  | ((args?: any) => MultiSelectOption[]) // Sync function to fetch options
17
18
  | ((args?: any) => Promise<MultiSelectOption[]>); // Async function
@@ -21,6 +22,7 @@ export interface DropdownFilterField extends DropdownProps {
21
22
  type: 'dropdown';
22
23
  field: string; // The name of the field this filter applies to
23
24
  optionField?: string; // @example - actionOptions
25
+ params?: QueryParams; // Additional QueryParams for the fetchOptionFn
24
26
  fetchOptionFn?:
25
27
  | ((args?: any) => MultiSelectOption[]) // Sync function to fetch options
26
28
  | ((args?: any) => Promise<MultiSelectOption[]>); // Async function
@@ -41,6 +41,7 @@ export type FieldValidation<T = FieldValue | undefined> =
41
41
  setErrors?: (errors?: string | string[]) => void;
42
42
  handleReset?: () => void;
43
43
  validate?: () => void;
44
+ setValue?: (value: any, shouldValidate?: boolean) => void;
44
45
  }
45
46
  | (Omit<FieldContext, 'value'> & {
46
47
  value: T;
@@ -263,6 +264,11 @@ declare class Form extends ClassComponent<FormProps, FormSlots, FormEmits> {
263
264
  */
264
265
  submit: (e?: Event | undefined) => Promise<void | undefined>;
265
266
 
267
+ /**
268
+ * Callback invoked on Button Submit clicked
269
+ */
270
+ onSubmitClicked: () => void;
271
+
266
272
  /**
267
273
  * Exposed function to set the outer fields wrapper height.
268
274
  */
@@ -1,3 +1,5 @@
1
+ import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2
+
1
3
  export type WangsIconseverities =
2
4
  | 'danger'
3
5
  | 'info'
@@ -44,6 +46,7 @@ export type WangsIcons =
44
46
  | 'chat-check'
45
47
  | 'change-tag'
46
48
  | 'check'
49
+ | 'checkout'
47
50
  | 'check-double-fill'
48
51
  | 'checkbox-circle'
49
52
  | 'checkbox-circle-fill'
@@ -158,6 +161,7 @@ export type WangsIcons =
158
161
  | 'smartphone'
159
162
  | 'sort-asc'
160
163
  | 'sort-desc'
164
+ | 'supplier-return'
161
165
  | 'spinner'
162
166
  | 'stack'
163
167
  | 'star'
@@ -226,3 +230,16 @@ export interface IconProps {
226
230
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
227
231
  class?: any;
228
232
  }
233
+
234
+ /**
235
+ * Display icon with svg backrgounds
236
+ */
237
+ declare class Icon extends ClassComponent<IconProps, unknown, unknown> {}
238
+
239
+ declare module '@vue/runtime-core' {
240
+ interface GlobalComponents {
241
+ Icon: GlobalComponentConstructor<Icon>;
242
+ }
243
+ }
244
+
245
+ export default Icon;
@@ -69,6 +69,11 @@ export interface MenuItem {
69
69
  * @defaultValue true
70
70
  */
71
71
  visible?: boolean | ((...args: any) => boolean) | undefined;
72
+ /**
73
+ * A boolean or to specify if the item has danger severity.
74
+ * @defaultValue false
75
+ */
76
+ danger?: boolean | undefined;
72
77
  /**
73
78
  * Defines the item as a separator.
74
79
  * @defaultValue false
@@ -1,16 +1,25 @@
1
1
  import { DefineComponent } from 'vue';
2
2
  import { FilterField } from '../filtercontainer/FilterContainer.vue.d';
3
+ import { QueryParams } from '../datatable/DataTable.vue.d';
3
4
 
4
5
  export interface QuickFilterProps {
5
6
  fields: FilterField[];
6
7
  tableName?: string;
7
8
  }
8
9
 
10
+ export type QuickFilterEmits = {
11
+ apply: [filter: QueryParams];
12
+ };
13
+
9
14
  /**
10
15
  * **WangsVue - QuickFilter**
11
16
  *
12
17
  * @group components
13
18
  */
14
- declare const QuickFilter: DefineComponent<QuickFilterProps, unknown, unknown>;
19
+ declare const QuickFilter: DefineComponent<
20
+ QuickFilterProps,
21
+ QuickFilterEmits,
22
+ unknown
23
+ >;
15
24
 
16
25
  export default QuickFilter;
@@ -44,8 +44,14 @@ export interface TreeProps extends BaseTreeProps {
44
44
  * @default false - (-1) is excluded
45
45
  */
46
46
  includeNodeAllKey?: boolean;
47
+ /**
48
+ * A list of node keys that should be disabled along with their children.
49
+ */
47
50
  disableKeys?: number[];
48
- exactDisableKey?: number;
51
+ /**
52
+ * A list of node keys that should be disabled, affecting only the specified nodes and not their children.
53
+ */
54
+ exactDisableKeys?: number[];
49
55
  /**
50
56
  * Defines the tree is readonly and disabled.
51
57
  */
@@ -62,6 +68,12 @@ export interface TreeProps extends BaseTreeProps {
62
68
  * Defines the group tree to disable excluded keys
63
69
  */
64
70
  excludedKeys?: number[];
71
+ /**
72
+ * Will emit update selection when value is `true`
73
+ *
74
+ * @default false - to prevent auto emit in every possible unhandled way
75
+ */
76
+ shouldEmitEventOnChange?: boolean;
65
77
  }
66
78
 
67
79
  export type TreeEmits = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue",
3
- "version": "1.5.205-alpha.1",
3
+ "version": "1.5.206-alpha.0",
4
4
  "author": "fewangsit",
5
5
  "description": "Wangsit VueJS Component Library",
6
6
  "module": "./wangsvue.es.js",
@@ -21,10 +21,11 @@ import { InputURLProps } from '../components/inputurl/InputURL.vue.d';
21
21
  import { InputEmailProps } from '../components/inputemail/InputEmail.vue.d';
22
22
  import { ImageProps } from '../components/image/Image.vue.d';
23
23
  import { MenuLocaleConfig } from '../components/menu/Menu.vue.d';
24
- import { ButtonBulkActionProps } from '../components/buttonbulkaction/ButtonBulkAction.vue.d';
24
+ import { ButtonBulkActionLocaleConfig, ButtonBulkActionProps } from '../components/buttonbulkaction/ButtonBulkAction.vue.d';
25
25
  import { AnimationDefaultConfig } from '../components/animation/Animation.vue.d';
26
26
  import { LoadingPresetOptions } from '../components/loading/Loading.vue.d';
27
27
  import { DataTableProps } from '../components/datatable/DataTable.vue.d';
28
+ import { BadgeComponentConfigs } from '../components/badge/Badge.vue.d';
28
29
  /**
29
30
  * A Record of component names with theirs props interface
30
31
  */
@@ -38,6 +39,7 @@ export interface ComponentDefaultPropsConfig {
38
39
  ButtonBulkAction?: Omit<ButtonBulkActionProps, 'selectedData' | 'options'>;
39
40
  Animation?: AnimationDefaultConfig;
40
41
  DataTable?: Partial<DataTableProps>;
42
+ Badge?: Partial<BadgeComponentConfigs>;
41
43
  }
42
44
  interface ComponentLocaleConfig {
43
45
  FieldWrapper?: FieldWrapperLocaleConfig;
@@ -56,6 +58,7 @@ interface ComponentLocaleConfig {
56
58
  InputNumber?: InputNumberLocaleConfig;
57
59
  Calendar?: CalendarLocaleConfig;
58
60
  Menu?: MenuLocaleConfig;
61
+ ButtonBulkAction?: ButtonBulkActionLocaleConfig;
59
62
  }
60
63
  export interface LocaleConfig {
61
64
  global: Partial<PrimeVueLocaleOptions>;