vueless 0.0.541 → 0.0.543

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,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.541",
3
+ "version": "0.0.543",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -91,6 +91,8 @@ const footerRowRef = useTemplateRef<HTMLTableRowElement>("footer-row");
91
91
  const tableWrapperRef = useTemplateRef<HTMLDivElement>("table-wrapper");
92
92
  const stickyFooterRowRef = useTemplateRef<HTMLTableRowElement>("sticky-footer-row");
93
93
  const stickyHeaderRowRef = useTemplateRef<HTMLDivElement>("sticky-header-row");
94
+ const stickyActionHeaderRowRef = useTemplateRef<HTMLDivElement>("sticky-action-header-row");
95
+ const actionHeaderRowRef = useTemplateRef<HTMLDivElement>("action-header-row");
94
96
 
95
97
  const i18nGlobal = tm(UTable);
96
98
  const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
@@ -326,10 +328,21 @@ function setFooterCellWidth(zero?: null) {
326
328
  }
327
329
 
328
330
  function setHeaderCellWidth() {
329
- if (selectedRows.value.length || !footerRowRef.value || !stickyFooterRowRef.value) return;
331
+ if (
332
+ !headerRowRef.value ||
333
+ !stickyHeaderRowRef.value ||
334
+ !stickyActionHeaderRowRef.value ||
335
+ !actionHeaderRowRef.value
336
+ ) {
337
+ return;
338
+ }
330
339
 
331
- const mainHeaderItems = [...(headerRowRef.value?.children || [])] as HTMLElement[];
332
- const stickyHeaderItems = [...(stickyHeaderRowRef.value?.children || [])] as HTMLDivElement[];
340
+ const mainHeaderItems = [...headerRowRef.value.children] as HTMLElement[];
341
+ const stickyHeaderItems = [
342
+ ...stickyHeaderRowRef.value.children,
343
+ ...stickyActionHeaderRowRef.value.children,
344
+ ...actionHeaderRowRef.value.children,
345
+ ] as HTMLElement[];
333
346
 
334
347
  stickyHeaderItems.forEach((item, index) => {
335
348
  item.style.width = `${mainHeaderItems[index]?.offsetWidth / PX_IN_REM}rem`;
@@ -486,7 +499,7 @@ defineExpose({
486
499
 
487
500
  <div
488
501
  v-show="isShownActionsHeader && isHeaderSticky"
489
- ref="sticky-header-row"
502
+ ref="sticky-action-header-row"
490
503
  :style="tableRowWidthStyle"
491
504
  v-bind="stickyHeaderAttrs"
492
505
  >
@@ -518,7 +531,7 @@ defineExpose({
518
531
 
519
532
  <div
520
533
  v-show="isShownActionsHeader && !isHeaderSticky"
521
- ref="sticky-header-row"
534
+ ref="action-header-row"
522
535
  :style="tableRowWidthStyle"
523
536
  v-bind="stickyHeaderAttrs"
524
537
  class="absolute"
@@ -80,7 +80,7 @@ const addOptionKeyCombination = computed(() => {
80
80
  return isMac ? "(⌘ + Enter)" : "(Ctrl + Enter)";
81
81
  });
82
82
 
83
- const wrapperHeight = computed(() => {
83
+ const wrapperMaxHeight = computed(() => {
84
84
  if (!optionsRef.value?.length) return "auto";
85
85
 
86
86
  const maxHeight = optionsRef.value
@@ -88,7 +88,7 @@ const wrapperHeight = computed(() => {
88
88
  .map((el) => el.getBoundingClientRect().height)
89
89
  .reduce((acc, cur) => acc + cur, 0);
90
90
 
91
- return props.visibleOptions === undefined ? "auto" : `${maxHeight + 10}px`;
91
+ return !props.visibleOptions ? "auto" : `${maxHeight + 10}px`;
92
92
  });
93
93
 
94
94
  function onClickAddOption() {
@@ -202,7 +202,7 @@ defineExpose({
202
202
  <div
203
203
  ref="wrapper"
204
204
  tabindex="1"
205
- :style="{ maxHeight: wrapperHeight }"
205
+ :style="{ maxHeight: wrapperMaxHeight }"
206
206
  v-bind="wrapperAttrs"
207
207
  @keydown.self.down.prevent="pointerForward"
208
208
  @keydown.self.up.prevent="pointerBackward"
@@ -267,21 +267,30 @@ defineExpose({
267
267
  </template>
268
268
  </li>
269
269
 
270
- <div v-if="!options.length" v-bind="optionAttrs">
270
+ <li
271
+ v-if="!options.length"
272
+ ref="option"
273
+ v-bind="optionAttrs"
274
+ @mouseenter.self="pointerSet(options.length + 1)"
275
+ >
271
276
  <!-- @slot Use it to add something instead of empty state. -->
272
277
  <slot name="empty">
273
278
  <span v-bind="optionContentAttrs" v-text="currentLocale.noDataToShow" />
274
279
  </slot>
275
- </div>
280
+ </li>
276
281
 
277
282
  <!-- Add button -->
278
283
  <template v-if="addOption">
279
- <div v-bind="addOptionLabelWrapperAttrs" @click="onClickAddOption">
280
- <div v-bind="addOptionLabelAttrs">
284
+ <li
285
+ v-bind="addOptionLabelWrapperAttrs"
286
+ @click="onClickAddOption"
287
+ @mouseenter.self="pointerSet(options.length + 1)"
288
+ >
289
+ <span v-bind="addOptionLabelAttrs">
281
290
  {{ currentLocale.add }}
282
291
  <span v-bind="addOptionLabelHotkeyAttrs" v-text="addOptionKeyCombination" />
283
- </div>
284
- </div>
292
+ </span>
293
+ </li>
285
294
 
286
295
  <UButton round square v-bind="addOptionButtonAttrs" @click="onClickAddOption">
287
296
  <UIcon
@@ -49,13 +49,10 @@ export default /*tw*/ {
49
49
  },
50
50
  },
51
51
  },
52
- addOptionLabelWrapper: `
53
- flex items-center justify-between cursor-pointer p-3 hover:bg-brand-50
54
- active:bg-brand-100 active:font-medium -mb-6
55
- `,
56
- addOptionLabel: "text-sm font-medium text-gray-900",
52
+ addOptionLabelWrapper: "-mb-[1.375rem] active:bg-brand-100",
53
+ addOptionLabel: "text-sm leading-none font-medium text-gray-900",
57
54
  addOptionLabelHotkey: "text-gray-500",
58
- addOptionButton: "{UButton} sticky left-[calc(100%-2.3rem)] bottom-2.5 p-1",
55
+ addOptionButton: "{UButton} !leading-none sticky left-[calc(100%-2.15rem)] bottom-2 p-1",
59
56
  addOptionIcon: "{UIcon} bg-transparent",
60
57
  i18n: {
61
58
  noDataToShow: "No data to show.",
@@ -65,7 +62,6 @@ export default /*tw*/ {
65
62
  size: "md",
66
63
  labelKey: "label",
67
64
  valueKey: "id",
68
- optionHeight: 40,
69
65
  visibleOptions: undefined,
70
66
  disabled: false,
71
67
  addOption: false,
@@ -16,6 +16,9 @@ export default function useAttrs(props: UDropdownListProps): UseAttrs<Config> {
16
16
  const extendingKeysClasses = getExtendingKeysClasses(extendingKeys);
17
17
 
18
18
  const keysAttrs = getKeysAttrs({}, [], {
19
+ addOptionLabelWrapper: {
20
+ base: computed(() => [extendingKeysClasses.option.value]),
21
+ },
19
22
  group: {
20
23
  base: computed(() => [extendingKeysClasses.option.value]),
21
24
  },
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.541",
4
+ "version": "0.0.543",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",