ketekny-ui-kit 1.0.28 → 1.0.30

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ketekny-ui-kit",
3
3
  "type": "module",
4
- "version": "1.0.28",
4
+ "version": "1.0.30",
5
5
  "description": "A Vue 3 UI component library with Tailwind CSS styling",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -5,6 +5,7 @@
5
5
  :headers="headers"
6
6
  :items="items"
7
7
  :search="search"
8
+ :theme-color="themeColor"
8
9
  :show-select="effectiveSelectionMode !== 'none'"
9
10
  :single-select="effectiveSelectionMode === 'single'"
10
11
  v-if="effectiveSelectionMode !== 'none'"
@@ -23,7 +24,7 @@
23
24
  </EasyDataTable>
24
25
 
25
26
  <!-- Render separate table without v-model when no selection -->
26
- <EasyDataTable v-else v-bind="$attrs" :headers="headers" :items="items" :search="search" :show-select="false" :body-row-class-name="composeBodyRowClassName" alternating buttons-pagination table-class-name="customize-table">
27
+ <EasyDataTable v-else v-bind="$attrs" :headers="headers" :items="items" :search="search" :theme-color="themeColor" :show-select="false" :body-row-class-name="composeBodyRowClassName" alternating buttons-pagination table-class-name="customize-table">
27
28
  <template v-for="(_, name) in $slots" :key="name" v-slot:[name]="slotProps">
28
29
  <slot :name="name" v-bind="slotProps" />
29
30
  </template>
@@ -44,6 +45,7 @@ export default {
44
45
  headers: { type: Array, required: true },
45
46
  items: { type: Array, required: true },
46
47
  search: { type: String, default: "" },
48
+ themeColor: { type: String, default: "#2563eb" },
47
49
 
48
50
  selectionMode: {
49
51
  type: String,
@@ -128,9 +130,12 @@ export default {
128
130
  const checkbox = event.target.closest(".easy-checkbox");
129
131
  if (!checkbox) return;
130
132
 
131
- // Ignore the header "select all" checkbox.
132
133
  const row = checkbox.closest("tbody tr");
133
- if (!row) return;
134
+ if (!row) {
135
+ // Clear pending row interaction so bulk select doesn't reuse stale row state.
136
+ this.pendingSelectionInteraction = null;
137
+ return;
138
+ }
134
139
 
135
140
  const rowNumber = this.resolveClickedRowNumber(row);
136
141
  if (!rowNumber) return;
@@ -191,12 +196,15 @@ export default {
191
196
  this.pendingSelectionInteraction = null;
192
197
 
193
198
  const toggledItemFromInteraction = interaction?.rowNumber ? this.currentPageRowsCache[interaction.rowNumber - 1] : null;
194
- const toggledItem = toggledItemFromInteraction ?? this.getToggledItem(oldSelection, newSelection);
199
+ const hasInteractionToggle = toggledItemFromInteraction
200
+ ? this.didItemSelectionChange(toggledItemFromInteraction, oldSelection, newSelection)
201
+ : false;
202
+ const toggledItem = hasInteractionToggle ? toggledItemFromInteraction : this.getToggledItem(oldSelection, newSelection);
195
203
  if (!toggledItem) return newSelection;
196
204
 
197
- if (!interaction?.shiftKey || !this.lastSelectionAnchor) {
205
+ if (!interaction?.shiftKey || !hasInteractionToggle || !this.lastSelectionAnchor) {
198
206
  this.lastSelectionAnchor = toggledItem;
199
- this.lastSelectionAnchorRowNumber = interaction?.rowNumber ?? null;
207
+ this.lastSelectionAnchorRowNumber = hasInteractionToggle ? interaction?.rowNumber ?? null : null;
200
208
  return newSelection;
201
209
  }
202
210
 
@@ -250,12 +258,35 @@ export default {
250
258
  delete normalized.index;
251
259
  return normalized;
252
260
  },
261
+ extractStableKey(item) {
262
+ const normalized = this.normalizeItem(item);
263
+ if (!normalized || typeof normalized !== "object") return null;
264
+ if (normalized.id != null) return `id:${normalized.id}`;
265
+ if (normalized.uuid != null) return `uuid:${normalized.uuid}`;
266
+ if (normalized.hospIncNumber != null) return `hospIncNumber:${normalized.hospIncNumber}`;
267
+ return null;
268
+ },
253
269
  areItemsEqual(left, right) {
254
- return JSON.stringify(this.normalizeItem(left)) === JSON.stringify(this.normalizeItem(right));
270
+ const leftKey = this.extractStableKey(left);
271
+ const rightKey = this.extractStableKey(right);
272
+ if (leftKey != null || rightKey != null) {
273
+ return leftKey != null && leftKey === rightKey;
274
+ }
275
+
276
+ const normalizedLeft = this.normalizeItem(left);
277
+ const normalizedRight = this.normalizeItem(right);
278
+ try {
279
+ return JSON.stringify(normalizedLeft) === JSON.stringify(normalizedRight);
280
+ } catch {
281
+ return normalizedLeft === normalizedRight;
282
+ }
255
283
  },
256
284
  containsItem(collection, item) {
257
285
  return collection.some((current) => this.areItemsEqual(current, item));
258
286
  },
287
+ didItemSelectionChange(item, previousSelection, nextSelection) {
288
+ return this.containsItem(previousSelection, item) !== this.containsItem(nextSelection, item);
289
+ },
259
290
  getToggledItem(previousSelection, nextSelection) {
260
291
  const added = nextSelection.filter((item) => !this.containsItem(previousSelection, item));
261
292
  if (added.length === 1) return this.normalizeItem(added[0]);
@@ -310,7 +341,7 @@ export default {
310
341
  --easy-table-body-row-height: 3.2rem;
311
342
  --easy-table-body-row-font-size: 12px;
312
343
  --easy-table-body-row-hover-font-color: #1f2937;
313
- --easy-table-body-row-hover-background-color: #ecfdf3;
344
+ --easy-table-body-row-hover-background-color: #eff6ff;
314
345
  --easy-table-body-item-padding: 0.5rem 0.75rem;
315
346
 
316
347
  --easy-table-footer-background-color: transparent;
@@ -327,7 +358,7 @@ export default {
327
358
 
328
359
  --easy-table-scrollbar-track-color: transparent;
329
360
  --easy-table-scrollbar-color: transparent;
330
- --easy-table-scrollbar-thumb-color: #86efac;
361
+ --easy-table-scrollbar-thumb-color: #93c5fd;
331
362
  --easy-table-scrollbar-corner-color: transparent;
332
363
 
333
364
  --easy-table-loading-mask-background-color: rgba(255, 255, 255, 0.6);
@@ -338,7 +369,7 @@ export default {
338
369
  background-color: #fff; /* white dropdown background */
339
370
  color: #1f2937; /* gray-800 text */
340
371
  padding: 0.25rem 0.5rem; /* small padding */
341
- border: 1px solid #bbf7d0;
372
+ border: 1px solid #bfdbfe;
342
373
  border-radius: 0.25rem;
343
374
  }
344
375