@rebilly/revel 6.11.0 → 6.12.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [6.12.0](https://github.com/Rebilly/rebilly/compare/revel-v6.11.0...revel-v6.12.0) (2024-01-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * **revel:** Update badge column on grid component to display different badge types ([#2914](https://github.com/Rebilly/rebilly/issues/2914)) ([c9645cd](https://github.com/Rebilly/rebilly/commit/c9645cdf43e0354cde4c1c6cec13c86a26d809f8))
7
+
1
8
  ## [6.11.0](https://github.com/Rebilly/rebilly/compare/revel-v6.10.2...revel-v6.11.0) (2024-01-16)
2
9
 
3
10
 
@@ -1,11 +1,11 @@
1
1
  import type { PropType } from 'vue';
2
- import type { GridColumn } from './types';
2
+ import type { BadgeColumn } from './types';
3
3
  /**
4
4
  * renderOptions:
5
5
  * backgroundColor: a color value for the background-color of the badge
6
6
  * color: a color value for the color of the badge text
7
7
  * styles: an object for additional styles for the badge
8
- * type: type of the badge: default, negative or any other
8
+ * type: type of the badge: default, negative or an object mapping values to types
9
9
  *
10
10
  * If column value is an array, place each item of that array inside a badge,
11
11
  * otherwise add the column value in the badge.
@@ -20,12 +20,12 @@ declare const _default: import("vue").DefineComponent<{
20
20
  required: true;
21
21
  };
22
22
  column: {
23
- type: PropType<GridColumn>;
23
+ type: PropType<BadgeColumn>;
24
24
  required: true;
25
25
  };
26
- }, unknown, unknown, {
27
- badgeType(): string;
28
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
26
+ }, unknown, unknown, {}, {
27
+ getBadgeType(value: string): string;
28
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
29
29
  value: {
30
30
  type: (StringConstructor | BooleanConstructor | ArrayConstructor | NumberConstructor)[];
31
31
  required: true;
@@ -35,7 +35,7 @@ declare const _default: import("vue").DefineComponent<{
35
35
  required: true;
36
36
  };
37
37
  column: {
38
- type: PropType<GridColumn>;
38
+ type: PropType<BadgeColumn>;
39
39
  required: true;
40
40
  };
41
41
  }>>, {}>;
@@ -9,12 +9,12 @@ export declare const ColumnTypes: {
9
9
  required: true;
10
10
  };
11
11
  column: {
12
- type: import("vue").PropType<import("./types").GridColumn>;
12
+ type: import("vue").PropType<import("./types").BadgeColumn>;
13
13
  required: true;
14
14
  };
15
- }, unknown, unknown, {
16
- badgeType(): string;
17
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
+ }, unknown, unknown, {}, {
16
+ getBadgeType(value: string): string;
17
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
18
18
  value: {
19
19
  type: (StringConstructor | BooleanConstructor | ArrayConstructor | NumberConstructor)[];
20
20
  required: true;
@@ -24,7 +24,7 @@ export declare const ColumnTypes: {
24
24
  required: true;
25
25
  };
26
26
  column: {
27
- type: import("vue").PropType<import("./types").GridColumn>;
27
+ type: import("vue").PropType<import("./types").BadgeColumn>;
28
28
  required: true;
29
29
  };
30
30
  }>>, {}>;
@@ -5,6 +5,11 @@ export interface GridColumn {
5
5
  renderAs: ColumnType;
6
6
  renderOptions?: Record<string, unknown>;
7
7
  }
8
+ export interface BadgeColumn extends GridColumn {
9
+ renderOptions?: {
10
+ type?: Record<string, string> | string;
11
+ };
12
+ }
8
13
  export interface NumericColumn extends GridColumn {
9
14
  renderOptions: {
10
15
  approximate: boolean;
@@ -66,16 +66,13 @@ declare const _default: import("vue").DefineComponent<{
66
66
  type: ObjectConstructor;
67
67
  required: true;
68
68
  };
69
- /**
70
- * Specify if the grid has frozen (fixed) left column
71
- */
72
69
  column: {
73
- type: PropType<GridColumn>;
70
+ type: PropType<import("./columnTypes/types").BadgeColumn>;
74
71
  required: true;
75
72
  };
76
- }, unknown, unknown, {
77
- badgeType(): string;
78
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
73
+ }, unknown, unknown, {}, {
74
+ getBadgeType(value: string): string;
75
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
79
76
  value: {
80
77
  type: (StringConstructor | BooleanConstructor | ArrayConstructor | NumberConstructor)[];
81
78
  required: true;
@@ -84,11 +81,8 @@ declare const _default: import("vue").DefineComponent<{
84
81
  type: ObjectConstructor;
85
82
  required: true;
86
83
  };
87
- /**
88
- * Specify if the grid has frozen (fixed) left column
89
- */
90
84
  column: {
91
- type: PropType<GridColumn>;
85
+ type: PropType<import("./columnTypes/types").BadgeColumn>;
92
86
  required: true;
93
87
  };
94
88
  }>>, {}> | import("vue").DefineComponent<{
package/dist/revel.mjs CHANGED
@@ -10881,10 +10881,10 @@ const S3 = /* @__PURE__ */ Z(H7, [["render", Y7]]), U7 = U({
10881
10881
  required: !0
10882
10882
  }
10883
10883
  },
10884
- computed: {
10885
- badgeType() {
10886
- const { type: M = "default" } = this.column.renderOptions || {};
10887
- return M;
10884
+ methods: {
10885
+ getBadgeType(M) {
10886
+ const { type: b = "default" } = this.column.renderOptions || {};
10887
+ return typeof b == "object" ? b[M] : b;
10888
10888
  }
10889
10889
  }
10890
10890
  });
@@ -10892,8 +10892,8 @@ function K7(M, b, z, p, o, O) {
10892
10892
  const e = F("r-badge");
10893
10893
  return r(), d("div", null, [
10894
10894
  Array.isArray(M.value) ? (r(!0), d(R0, { key: 0 }, j0(M.value, (c, t) => (r(), n0(e, {
10895
- key: `badge-${M.badgeType}-${M.value}-${t}`,
10896
- type: M.badgeType,
10895
+ key: `badge-${c}-${t}`,
10896
+ type: M.getBadgeType(c),
10897
10897
  class: "r-mr-2"
10898
10898
  }, {
10899
10899
  default: b0(() => [
@@ -10902,7 +10902,7 @@ function K7(M, b, z, p, o, O) {
10902
10902
  _: 2
10903
10903
  }, 1032, ["type"]))), 128)) : (r(), n0(e, {
10904
10904
  key: 1,
10905
- type: M.badgeType,
10905
+ type: M.getBadgeType(M.value),
10906
10906
  class: "r-mr-2"
10907
10907
  }, {
10908
10908
  default: b0(() => [