@expcat/tigercat-vue 0.3.70 → 0.4.2

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.
Files changed (43) hide show
  1. package/dist/{chunk-ZTJTIQZY.mjs → chunk-DEFEAEYE.mjs} +126 -6
  2. package/dist/{chunk-KUJ75OHX.js → chunk-ESALMEHU.js} +10 -9
  3. package/dist/{chunk-KVZLGW45.js → chunk-ETTYERGO.js} +14 -5
  4. package/dist/chunk-HFBRO2IF.mjs +440 -0
  5. package/dist/chunk-HK2TAPQX.js +334 -0
  6. package/dist/{chunk-YZK2HXRT.js → chunk-LGRUMMOG.js} +2 -2
  7. package/dist/chunk-LW3LFCRZ.mjs +331 -0
  8. package/dist/{chunk-ND4XDRYR.mjs → chunk-TCJBN2DA.mjs} +1 -1
  9. package/dist/{chunk-7FCHU5KV.mjs → chunk-TTDBR2B4.mjs} +11 -10
  10. package/dist/{chunk-RKPYLBPU.mjs → chunk-WM4ESIHG.mjs} +15 -6
  11. package/dist/{chunk-3PQIZBT5.js → chunk-WV3Y45YK.js} +125 -5
  12. package/dist/chunk-YQGKXFV5.js +443 -0
  13. package/dist/components/ActivityFeed.js +4 -4
  14. package/dist/components/ActivityFeed.mjs +2 -2
  15. package/dist/components/Collapse.d.mts +1 -1
  16. package/dist/components/Collapse.d.ts +1 -1
  17. package/dist/components/DataTableWithToolbar.js +4 -4
  18. package/dist/components/DataTableWithToolbar.mjs +2 -2
  19. package/dist/components/InputNumber.d.mts +170 -0
  20. package/dist/components/InputNumber.d.ts +170 -0
  21. package/dist/components/InputNumber.js +17 -0
  22. package/dist/components/InputNumber.mjs +2 -0
  23. package/dist/components/Sidebar.d.mts +20 -0
  24. package/dist/components/Sidebar.d.ts +20 -0
  25. package/dist/components/Sidebar.js +3 -3
  26. package/dist/components/Sidebar.mjs +1 -1
  27. package/dist/components/SubMenu.js +3 -3
  28. package/dist/components/SubMenu.mjs +1 -1
  29. package/dist/components/Table.d.mts +16 -2
  30. package/dist/components/Table.d.ts +16 -2
  31. package/dist/components/Table.js +3 -3
  32. package/dist/components/Table.mjs +1 -1
  33. package/dist/components/TaskBoard.d.mts +129 -0
  34. package/dist/components/TaskBoard.d.ts +129 -0
  35. package/dist/components/TaskBoard.js +18 -0
  36. package/dist/components/TaskBoard.mjs +3 -0
  37. package/dist/index.d.mts +2 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.js +50 -40
  40. package/dist/index.mjs +13 -11
  41. package/package.json +2 -2
  42. package/dist/{chunk-NGW5UMAN.js → chunk-EBTLMVDJ.js} +1 -1
  43. package/dist/{chunk-D7VMY6WX.mjs → chunk-RVEEEDJQ.mjs} +1 -1
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, ref, watch, h } from 'vue';
2
- import { getSpinnerSVG, getFixedColumnOffsets, filterData, sortData, paginateData, getRowKey, calculatePagination, getTableWrapperClasses, classNames, tableBaseClasses, tableLoadingOverlayClasses, getSimplePaginationContainerClasses, getSimplePaginationTotalClasses, getSimplePaginationControlsClasses, getSimplePaginationSelectClasses, getSimplePaginationButtonsWrapperClasses, getSimplePaginationButtonClasses, getSimplePaginationPageIndicatorClasses, getCheckboxCellClasses, getTableHeaderCellClasses, getTableHeaderClasses, tableEmptyStateClasses, getTableCellClasses, getTableRowClasses, getLoadingOverlaySpinnerClasses, normalizeSvgAttrs, icon24ViewBox, lockClosedIcon24PathD, lockOpenIcon24PathD, icon16ViewBox, getSortIconClasses, sortAscIcon16PathD, sortDescIcon16PathD, sortBothIcon16PathD } from '@expcat/tigercat-core';
2
+ import { getSpinnerSVG, getFixedColumnOffsets, filterData, sortData, paginateData, getRowKey, calculatePagination, getTableWrapperClasses, classNames, tableBaseClasses, tableLoadingOverlayClasses, getSimplePaginationContainerClasses, getSimplePaginationTotalClasses, getSimplePaginationControlsClasses, getSimplePaginationSelectClasses, getSimplePaginationButtonsWrapperClasses, getSimplePaginationButtonClasses, getSimplePaginationPageIndicatorClasses, getExpandCellClasses, getCheckboxCellClasses, getTableHeaderCellClasses, getTableHeaderClasses, tableEmptyStateClasses, expandIconButtonClasses, getExpandIconRotationClasses, normalizeSvgAttrs, icon16ViewBox, getTableCellClasses, getTableRowClasses, expandedRowContentClasses, getLoadingOverlaySpinnerClasses, icon24ViewBox, lockClosedIcon24PathD, lockOpenIcon24PathD, getSortIconClasses, sortAscIcon16PathD, sortDescIcon16PathD, sortBothIcon16PathD } from '@expcat/tigercat-core';
3
3
 
4
4
  // src/components/Table.ts
5
5
  var spinnerSvg = getSpinnerSVG("spinner");
@@ -158,6 +158,12 @@ var Table = defineComponent({
158
158
  rowSelection: {
159
159
  type: Object
160
160
  },
161
+ /**
162
+ * Row expansion configuration
163
+ */
164
+ expandable: {
165
+ type: Object
166
+ },
161
167
  /**
162
168
  * Function to get row key
163
169
  */
@@ -192,7 +198,15 @@ var Table = defineComponent({
192
198
  default: "auto"
193
199
  }
194
200
  },
195
- emits: ["change", "row-click", "selection-change", "sort-change", "filter-change", "page-change"],
201
+ emits: [
202
+ "change",
203
+ "row-click",
204
+ "selection-change",
205
+ "sort-change",
206
+ "filter-change",
207
+ "page-change",
208
+ "expanded-rows-change"
209
+ ],
196
210
  setup(props, { emit, slots }) {
197
211
  const paginationConfig = computed(() => {
198
212
  return props.pagination !== false && typeof props.pagination === "object" ? props.pagination : null;
@@ -202,6 +216,7 @@ var Table = defineComponent({
202
216
  computed(() => paginationConfig.value?.current !== void 0);
203
217
  computed(() => paginationConfig.value?.pageSize !== void 0);
204
218
  const isSelectionControlled = computed(() => props.rowSelection?.selectedRowKeys !== void 0);
219
+ const isExpandControlled = computed(() => props.expandable?.expandedRowKeys !== void 0);
205
220
  const uncontrolledSortState = ref(props.defaultSort);
206
221
  const uncontrolledFilterState = ref(props.defaultFilters);
207
222
  const uncontrolledCurrentPage = ref(
@@ -213,6 +228,9 @@ var Table = defineComponent({
213
228
  const uncontrolledSelectedRowKeys = ref(
214
229
  props.rowSelection?.defaultSelectedRowKeys ?? props.rowSelection?.selectedRowKeys ?? []
215
230
  );
231
+ const uncontrolledExpandedRowKeys = ref(
232
+ props.expandable?.defaultExpandedRowKeys ?? props.expandable?.expandedRowKeys ?? []
233
+ );
216
234
  const sortState = computed(() => props.sort ?? uncontrolledSortState.value);
217
235
  const filterState = computed(() => props.filters ?? uncontrolledFilterState.value);
218
236
  const currentPage = computed(() => {
@@ -224,6 +242,10 @@ var Table = defineComponent({
224
242
  const selectedRowKeys = computed(() => {
225
243
  return props.rowSelection?.selectedRowKeys ?? uncontrolledSelectedRowKeys.value;
226
244
  });
245
+ const expandedRowKeys = computed(() => {
246
+ return props.expandable?.expandedRowKeys ?? uncontrolledExpandedRowKeys.value;
247
+ });
248
+ const expandedRowKeySet = computed(() => new Set(expandedRowKeys.value));
227
249
  watch(
228
250
  () => props.sort,
229
251
  (next) => {
@@ -435,8 +457,25 @@ var Table = defineComponent({
435
457
  const someSelected = computed(() => {
436
458
  return selectedRowKeys.value.length > 0 && !allSelected.value;
437
459
  });
460
+ function handleToggleExpand(key) {
461
+ const isExp = expandedRowKeySet.value.has(key);
462
+ const next = isExp ? expandedRowKeys.value.filter((k) => k !== key) : [...expandedRowKeys.value, key];
463
+ if (!isExpandControlled.value) {
464
+ uncontrolledExpandedRowKeys.value = next;
465
+ }
466
+ emit("expanded-rows-change", next);
467
+ }
468
+ const totalColumnCount = computed(() => {
469
+ let count = displayColumns.value.length;
470
+ if (props.rowSelection && props.rowSelection.showCheckbox !== false) count++;
471
+ if (props.expandable) count++;
472
+ return count;
473
+ });
438
474
  function renderTableHeader() {
439
475
  const headerCells = [];
476
+ if (props.expandable && props.expandable.expandIconPosition !== "end") {
477
+ headerCells.push(h("th", { class: getExpandCellClasses(props.size) }));
478
+ }
440
479
  if (props.rowSelection && props.rowSelection.showCheckbox !== false && props.rowSelection.type !== "radio") {
441
480
  headerCells.push(
442
481
  h(
@@ -556,6 +595,9 @@ var Table = defineComponent({
556
595
  )
557
596
  );
558
597
  });
598
+ if (props.expandable && props.expandable.expandIconPosition === "end") {
599
+ headerCells.push(h("th", { class: getExpandCellClasses(props.size) }));
600
+ }
559
601
  return h("thead", { class: getTableHeaderClasses(props.stickyHeader) }, [
560
602
  h("tr", headerCells)
561
603
  ]);
@@ -570,7 +612,7 @@ var Table = defineComponent({
570
612
  h(
571
613
  "td",
572
614
  {
573
- colspan: displayColumns.value.length + (props.rowSelection ? 1 : 0),
615
+ colspan: totalColumnCount.value,
574
616
  class: tableEmptyStateClasses
575
617
  },
576
618
  [
@@ -587,11 +629,45 @@ var Table = defineComponent({
587
629
  ])
588
630
  ]);
589
631
  }
590
- const rows = paginatedData.value.map((record, index) => {
632
+ const rows = paginatedData.value.flatMap((record, index) => {
591
633
  const key = paginatedRowKeys.value[index];
592
634
  const isSelected = selectedRowKeySet.value.has(key);
635
+ const isExpanded = expandedRowKeySet.value.has(key);
636
+ const isExpandable = props.expandable ? props.expandable.rowExpandable?.(record) ?? true : false;
593
637
  const rowClass = typeof props.rowClassName === "function" ? props.rowClassName(record, index) : props.rowClassName;
594
638
  const cells = [];
639
+ if (props.expandable && props.expandable.expandIconPosition !== "end") {
640
+ cells.push(
641
+ h("td", { class: getExpandCellClasses(props.size) }, [
642
+ isExpandable ? h(
643
+ "button",
644
+ {
645
+ class: classNames(
646
+ expandIconButtonClasses,
647
+ getExpandIconRotationClasses(isExpanded)
648
+ ),
649
+ "aria-label": isExpanded ? "Collapse row" : "Expand row",
650
+ onClick: (e) => {
651
+ e.stopPropagation();
652
+ handleToggleExpand(key);
653
+ }
654
+ },
655
+ [
656
+ h(
657
+ "svg",
658
+ normalizeSvgAttrs({
659
+ xmlns: "http://www.w3.org/2000/svg",
660
+ viewBox: icon16ViewBox,
661
+ fill: "currentColor",
662
+ class: "w-4 h-4"
663
+ }),
664
+ [h("path", { d: "M6 3l6 5-6 5V3z" })]
665
+ )
666
+ ]
667
+ ) : null
668
+ ])
669
+ );
670
+ }
595
671
  if (props.rowSelection && props.rowSelection.showCheckbox !== false) {
596
672
  const checkboxProps = props.rowSelection?.getCheckboxProps?.(record) || {};
597
673
  cells.push(
@@ -606,6 +682,7 @@ var Table = defineComponent({
606
682
  class: props.rowSelection?.type === "radio" ? "border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]" : "rounded border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]",
607
683
  checked: isSelected,
608
684
  disabled: checkboxProps.disabled,
685
+ onClick: (e) => e.stopPropagation(),
609
686
  onChange: (e) => handleSelectRow(key, e.target.checked)
610
687
  })
611
688
  ]
@@ -647,12 +724,44 @@ var Table = defineComponent({
647
724
  style
648
725
  },
649
726
  [
650
- column.render ? slots[`cell-${column.key}`]?.({ record, index }) || column.render(record, index) : cellValue
727
+ slots[`cell-${column.key}`]?.({ record, index }) ?? (column.render ? column.render(record, index) : cellValue)
651
728
  ]
652
729
  )
653
730
  );
654
731
  });
655
- return h(
732
+ if (props.expandable && props.expandable.expandIconPosition === "end") {
733
+ cells.push(
734
+ h("td", { class: getExpandCellClasses(props.size) }, [
735
+ isExpandable ? h(
736
+ "button",
737
+ {
738
+ class: classNames(
739
+ expandIconButtonClasses,
740
+ getExpandIconRotationClasses(isExpanded)
741
+ ),
742
+ "aria-label": isExpanded ? "Collapse row" : "Expand row",
743
+ onClick: (e) => {
744
+ e.stopPropagation();
745
+ handleToggleExpand(key);
746
+ }
747
+ },
748
+ [
749
+ h(
750
+ "svg",
751
+ normalizeSvgAttrs({
752
+ xmlns: "http://www.w3.org/2000/svg",
753
+ viewBox: icon16ViewBox,
754
+ fill: "currentColor",
755
+ class: "w-4 h-4"
756
+ }),
757
+ [h("path", { d: "M6 3l6 5-6 5V3z" })]
758
+ )
759
+ ]
760
+ ) : null
761
+ ])
762
+ );
763
+ }
764
+ const row = h(
656
765
  "tr",
657
766
  {
658
767
  key,
@@ -664,6 +773,17 @@ var Table = defineComponent({
664
773
  },
665
774
  cells
666
775
  );
776
+ const result = [row];
777
+ if (props.expandable && isExpanded && isExpandable) {
778
+ result.push(
779
+ h("tr", { key: `${key}-expanded`, class: expandedRowContentClasses }, [
780
+ h("td", { colspan: totalColumnCount.value }, [
781
+ props.expandable.expandedRowRender(record, index)
782
+ ])
783
+ ])
784
+ );
785
+ }
786
+ return result;
667
787
  });
668
788
  return h("tbody", rows);
669
789
  }
@@ -87,7 +87,9 @@ var SubMenu = vue.defineComponent({
87
87
  return props.collapsed ?? (menuContext ? menuContext.collapsed.value : false);
88
88
  });
89
89
  const isPopup = vue.computed(() => {
90
- return !!menuContext && menuContext.mode.value === "vertical" && effectiveCollapsed.value;
90
+ if (!menuContext) return false;
91
+ if (menuContext.mode.value === "horizontal") return true;
92
+ return menuContext.mode.value === "vertical" && effectiveCollapsed.value;
91
93
  });
92
94
  const isExpanded = vue.computed(() => {
93
95
  if (menuContext?.mode.value === "horizontal" || isPopup.value) {
@@ -111,12 +113,13 @@ var SubMenu = vue.defineComponent({
111
113
  const contentClasses = vue.computed(() => {
112
114
  if (!menuContext) return "";
113
115
  if (menuContext.mode.value === "horizontal") {
114
- return tigercatCore.submenuContentHorizontalClasses;
116
+ return props.level === 0 ? tigercatCore.submenuContentHorizontalClasses : tigercatCore.submenuContentHorizontalNestedClasses;
115
117
  }
116
118
  if (isPopup.value) return tigercatCore.submenuContentPopupClasses;
117
119
  if (menuContext.mode.value === "inline") return tigercatCore.submenuContentInlineClasses;
118
120
  return tigercatCore.submenuContentVerticalClasses;
119
121
  });
122
+ const popupZIndex = vue.computed(() => isPopup.value ? tigercatCore.getSubmenuPopupZIndex(props.level) : {});
120
123
  const handleTitleClick = () => {
121
124
  if (!menuContext || props.disabled) return;
122
125
  if (menuContext.mode.value === "horizontal") return;
@@ -208,7 +211,7 @@ var SubMenu = vue.defineComponent({
208
211
  }
209
212
  };
210
213
  const indentStyle = vue.computed(() => {
211
- if (!menuContext || menuContext.mode.value !== "inline" || props.level === 0) {
214
+ if (!menuContext || menuContext.mode.value === "horizontal" || props.level === 0) {
212
215
  return {};
213
216
  }
214
217
  return tigercatCore.getMenuItemIndent(props.level, menuContext.inlineIndent.value);
@@ -226,9 +229,6 @@ var SubMenu = vue.defineComponent({
226
229
  const nextProps = {
227
230
  level: existingProps.level ?? nextLevel
228
231
  };
229
- if (isPopup.value) {
230
- nextProps.collapsed = false;
231
- }
232
232
  return vue.cloneVNode(node, nextProps);
233
233
  });
234
234
  };
@@ -276,12 +276,13 @@ var SubMenu = vue.defineComponent({
276
276
  },
277
277
  titleChildren
278
278
  );
279
- const contentNode = menuContext.mode.value === "horizontal" || isPopup.value ? vue.h(
279
+ const contentNode = isPopup.value ? vue.h(
280
280
  "ul",
281
281
  {
282
282
  class: contentClasses.value,
283
283
  style: {
284
- display: isExpanded.value ? "block" : "none"
284
+ display: isExpanded.value ? "block" : "none",
285
+ ...popupZIndex.value
285
286
  },
286
287
  role: "menu",
287
288
  "aria-hidden": isExpanded.value ? void 0 : "true"
@@ -326,7 +327,7 @@ var SubMenu = vue.defineComponent({
326
327
  return vue.h(
327
328
  "li",
328
329
  {
329
- class: menuContext.mode.value === "horizontal" || isPopup.value ? "relative" : "",
330
+ class: isPopup.value ? "relative" : "",
330
331
  onMouseenter: handleMouseEnter,
331
332
  onMouseleave: handleMouseLeave,
332
333
  role: "none"
@@ -23,6 +23,15 @@ var Sidebar = vue.defineComponent({
23
23
  type: String,
24
24
  default: "256px"
25
25
  },
26
+ /**
27
+ * Width when collapsed (mini mode).
28
+ * Set to '0px' to fully hide the sidebar when collapsed.
29
+ * @default '64px'
30
+ */
31
+ collapsedWidth: {
32
+ type: String,
33
+ default: "64px"
34
+ },
26
35
  /**
27
36
  * Whether the sidebar is collapsed
28
37
  * @default false
@@ -43,14 +52,14 @@ var Sidebar = vue.defineComponent({
43
52
  const sidebarClasses = vue.computed(
44
53
  () => tigercatCore.classNames(
45
54
  tigercatCore.layoutSidebarClasses,
55
+ props.collapsed && tigercatCore.layoutSidebarCollapsedClasses,
46
56
  props.className,
47
57
  tigercatCore.coerceClassValue(attrs.class)
48
58
  )
49
59
  );
50
- const sidebarStyle = vue.computed(() => ({
51
- width: props.collapsed ? "0px" : props.width,
52
- minWidth: props.collapsed ? "0px" : props.width
53
- }));
60
+ const sidebarStyle = vue.computed(
61
+ () => tigercatCore.getSidebarStyle(props.collapsed, props.width, props.collapsedWidth)
62
+ );
54
63
  return () => vue.h(
55
64
  "aside",
56
65
  {
@@ -58,7 +67,7 @@ var Sidebar = vue.defineComponent({
58
67
  class: sidebarClasses.value,
59
68
  style: tigercatCore.mergeStyleValues(props.style, sidebarStyle.value)
60
69
  },
61
- !props.collapsed && slots.default?.()
70
+ slots.default?.()
62
71
  );
63
72
  }
64
73
  });