@kws3/ui 1.8.2 → 1.8.3

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.mdx CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.8.3
2
+ - Allow `clickableRows` and `bulk_actions` to work at the same time on `GridView`
3
+ - Various bugfixes on `GridRow`
4
+ - New `visualActivationOnClick` prop for `GridView` and `TileView`
5
+ - Change the way click activation works on `GridView` and `TileView` rows. Now only one row can be activated at a time
6
+
1
7
  ## 1.8.2
2
8
  - Usability fixes for `NumberInput`
3
9
  - New `input_only`, `force_integer`, `style` and `class` props for `NumberInput`
@@ -4,7 +4,8 @@
4
4
 
5
5
  @param {number} [row_index=0] - Row index value, Default: `0`
6
6
  @param {object} [row={}] - Contains all the column values in a row, Default: `{}`
7
- @param {boolean} [rowActive=false] - Determines whether the row is selected or not, Default: `false`
7
+ @param {boolean} [visualActivationOnClick=true] - Determines whether clickable rows activate visually on click, Default: `true`
8
+ @param {object} [activatedId=null] - Unique id of row that is activated, Default: `null`
8
9
  @param {object} [isVisible={}] - Determines whether column is visible or not, Default: `{}`
9
10
  @param {boolean} [clickableRows=false] - Determines whether the row is clickable or not, Default: `false`
10
11
  @param {object} [transforms={}] - Contains all custom values for each columns, Default: `{}`
@@ -29,10 +30,14 @@
29
30
  <tr
30
31
  in:fly={{ x: 20, delay: 25 * row_index }}
31
32
  on:click|stopPropagation={rowClick}
32
- class:is-selected={rowActive}
33
+ class:is-selected={activated && visualActivationOnClick}
33
34
  class:is-checked={checked}>
34
35
  {#if bulk_actions}
35
- <td style="vertical-align:middle;">
36
+ <td
37
+ style="vertical-align:middle;"
38
+ on:click={(e) => {
39
+ clickableRows && e.stopImmediatePropagation();
40
+ }}>
36
41
  <Checkbox
37
42
  size={selectCheckboxSize}
38
43
  color={selectCheckboxColor}
@@ -58,7 +63,7 @@
58
63
  {:else}
59
64
  <tr
60
65
  on:click|stopPropagation={rowClick}
61
- class:is-selected={rowActive}
66
+ class:is-selected={activated && visualActivationOnClick}
62
67
  class:is-checked={checked}>
63
68
  {#if bulk_actions}
64
69
  <td style="vertical-align:middle;">
@@ -103,9 +108,13 @@
103
108
  */
104
109
  row = {},
105
110
  /**
106
- * Determines whether the row is selected or not
111
+ * Determines whether clickable rows activate visually on click
112
+ */
113
+ visualActivationOnClick = true,
114
+ /**
115
+ * Unique id of row that is activated
107
116
  */
108
- rowActive = false,
117
+ activatedId = null,
109
118
  /**
110
119
  * Determines whether column is visible or not
111
120
  */
@@ -161,6 +170,7 @@
161
170
  };
162
171
 
163
172
  $: selectedIds, setCheckedValue();
173
+ $: activated = activatedId === row.id;
164
174
 
165
175
  function setCheckedValue() {
166
176
  checked = false;
@@ -175,7 +185,6 @@
175
185
 
176
186
  function rowClick() {
177
187
  if (clickableRows) {
178
- rowActive = true;
179
188
  fire("rowClick", { row });
180
189
  }
181
190
  }
@@ -5,9 +5,11 @@
5
5
  @param {string} [iteration_key="id"] - Iteration key, Default: `"id"`
6
6
  @param {array} [data=[]] - Contains all the results that needs to be displayed, Default: `[]`
7
7
  @param {object} [columns={}] - Table column names. {db_field_name: column_name}, Default: `{}`
8
- @param {boolean} [transition=false] - Determines if a transision effect is used, Default: `false`
8
+ @param {boolean} [transition=false] - Determines if a transition effect is used, Default: `false`
9
9
  @param {boolean} [is_striped=true] - Determines whether to use alternating row shading in the table view, Default: `true`
10
+ @param {boolean} [visualActivationOnClick=true] - Determines whether clickable rows activate visually on click, Default: `true`
10
11
  @param {boolean} [clickableRows=false] - Determines whether rows are clickable or not, Default: `false`
12
+ @param {object} [activatedId=null] - Unique id of row that is activated, Default: `null`
11
13
  @param {boolean} [bulk_actions=false] - Determines if selecting multiple rows and doing multiple actions is allowed, Default: `false`
12
14
  @param {boolean} [selectAll=false] - Determines if all rows are selected, Default: `false`
13
15
  @param {array} [selectedIds=[]] - List of unique IDs of all the selected rows, Default: `[]`
@@ -64,6 +66,7 @@
64
66
  {transition}
65
67
  {column_keys}
66
68
  {clickableRows}
69
+ {visualActivationOnClick}
67
70
  {isVisible}
68
71
  {transforms}
69
72
  {classNames}
@@ -71,6 +74,7 @@
71
74
  {cellComponent}
72
75
  {row}
73
76
  {bulk_actions}
77
+ {activatedId}
74
78
  {selectedIds}
75
79
  {selectCheckboxColor}
76
80
  {selectCheckboxSize}
@@ -100,7 +104,7 @@
100
104
  */
101
105
  columns = {},
102
106
  /**
103
- * Determines if a transision effect is used
107
+ * Determines if a transition effect is used
104
108
  */
105
109
  transition = false,
106
110
  /**
@@ -108,10 +112,18 @@
108
112
  * @link https://bulma.io/documentation/elements/table/#modifiers
109
113
  */
110
114
  is_striped = true,
115
+ /**
116
+ * Determines whether clickable rows activate visually on click
117
+ */
118
+ visualActivationOnClick = true,
111
119
  /**
112
120
  * Determines whether rows are clickable or not
113
121
  */
114
122
  clickableRows = false,
123
+ /**
124
+ * Unique id of row that is activated
125
+ */
126
+ activatedId = null,
115
127
  /**
116
128
  * Determines if selecting multiple rows and doing multiple actions is allowed
117
129
  */
@@ -8,7 +8,9 @@
8
8
  @param {object} [tileItemComponent=null] - Contains a custom component, Default: `null`
9
9
  @param {number} [per_row=3] - Sets how many items to display in a row, Default: `3`
10
10
  @param {object} [columns={}] - Column names for the displayed table {db_field_name: column_name}, Default: `{}`
11
+ @param {boolean} [visualActivationOnClick=true] - Determines whether clickable rows activate visually on click, Default: `true`
11
12
  @param {boolean} [clickableRows=false] - Determines whether rows are clickable or not, Default: `false`
13
+ @param {object} [activatedId=null] - Unique id of row that is activated, Default: `null`
12
14
  @param {object} [valueTransformers={}] - Contains all custom values for each column, Default: `{}`
13
15
  @param {object} [classTransformers={}] - CSS class names for each column, Default: `{}`
14
16
  @param {object} [styleTransformers={}] - CSS styles for each column, Default: `{}`
@@ -31,6 +33,7 @@
31
33
  on:_forwardEvent
32
34
  {row_index}
33
35
  {column_keys}
36
+ {visualActivationOnClick}
34
37
  {clickableRows}
35
38
  {isVisible}
36
39
  {transforms}
@@ -38,6 +41,7 @@
38
41
  {styles}
39
42
  {row}
40
43
  {bulk_actions}
44
+ {activatedId}
41
45
  {selectedIds}
42
46
  {selectCheckboxColor}
43
47
  {selectCheckboxSize}
@@ -75,10 +79,18 @@
75
79
  * Column names for the displayed table {db_field_name: column_name}
76
80
  */
77
81
  columns = {},
82
+ /**
83
+ * Determines whether clickable rows activate visually on click
84
+ */
85
+ visualActivationOnClick = true,
78
86
  /**
79
87
  * Determines whether rows are clickable or not
80
88
  */
81
89
  clickableRows = false,
90
+ /**
91
+ * Unique id of row that is activated
92
+ */
93
+ activatedId = null,
82
94
  /**
83
95
  * Contains all custom values for each column
84
96
  */
@@ -3,7 +3,8 @@
3
3
 
4
4
 
5
5
  @param {object} [row={}] - List of all values in a row, Default: `{}`
6
- @param {boolean} [rowActive=false] - Determines whether the row is selected or not, Default: `false`
6
+ @param {boolean} [visualActivationOnClick=true] - Determines whether clickable rows activate visually on click, Default: `true`
7
+ @param {object} [activatedId=null] - Unique id of row that is activated, Default: `null`
7
8
  @param {boolean} [clickableRows=false] - Determines whether the row is clickable or not, Default: `false`
8
9
  @param {function} [isVisible()] - Returns whether a column can be visible or not
9
10
  @param {function} [transforms()] - Returns column custom value
@@ -16,7 +17,7 @@
16
17
 
17
18
  -->
18
19
  <div
19
- class:is-selected={rowActive}
20
+ class:is-selected={activated && visualActivationOnClick}
20
21
  class="box {clickableRows ? 'is-hoverable' : ''}"
21
22
  on:click|stopPropagation={rowClick}>
22
23
  {#each column_keys as column}
@@ -39,9 +40,13 @@
39
40
  */
40
41
  export let row = {},
41
42
  /**
42
- * Determines whether the row is selected or not
43
+ * Determines whether clickable rows activate visually on click
43
44
  */
44
- rowActive = false,
45
+ visualActivationOnClick = true,
46
+ /**
47
+ * Unique id of row that is activated
48
+ */
49
+ activatedId = null,
45
50
  /**
46
51
  * Determines whether the row is clickable or not
47
52
  */
@@ -67,9 +72,10 @@
67
72
  */
68
73
  column_keys = [];
69
74
 
75
+ $: activated = activatedId === row.id;
76
+
70
77
  function rowClick() {
71
78
  if (clickableRows) {
72
- rowActive = true;
73
79
  /**
74
80
  * Fires an event when a row is clicked
75
81
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kws3/ui",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "UI components for use with Svelte v3 applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,5 +29,5 @@
29
29
  "text-mask-core": "^5.1.2",
30
30
  "tippy.js": "^6.3.1"
31
31
  },
32
- "gitHead": "9fcbe3d34101490398b7bf571334e84e9ee04aee"
32
+ "gitHead": "b211043d95c9b0f3e4184624ccd84b0a99687e50"
33
33
  }
package/styles/Grid.scss CHANGED
@@ -51,6 +51,7 @@ $kws-gridview-checked-row-background: $primary-light !default;
51
51
  background-color: $kws-gridview-checked-row-background !important;
52
52
  td {
53
53
  background-color: $kws-gridview-checked-row-background !important;
54
+ color: findColorInvert($kws-gridview-checked-row-background) !important;
54
55
  }
55
56
  }
56
57
  }