@retailcrm/embed-ui-v1-components 0.9.12 → 0.9.13
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/dist/host.cjs +624 -313
- package/dist/host.css +319 -0
- package/dist/host.d.ts +181 -6
- package/dist/host.js +625 -314
- package/dist/remote.cjs +595 -2
- package/dist/remote.d.ts +603 -6
- package/dist/remote.js +596 -3
- package/package.json +5 -3
package/dist/remote.cjs
CHANGED
|
@@ -163,7 +163,7 @@ const _hoisted_5 = {
|
|
|
163
163
|
class: "ui-v1-field__addon"
|
|
164
164
|
};
|
|
165
165
|
const _hoisted_6 = { class: "ui-v1-field__control" };
|
|
166
|
-
const _sfc_main$
|
|
166
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
167
167
|
...{
|
|
168
168
|
inheritAttrs: false
|
|
169
169
|
},
|
|
@@ -415,6 +415,577 @@ const UiSwitch = remote.defineRemoteComponent(
|
|
|
415
415
|
UiSwitchType,
|
|
416
416
|
["click", "focus", "blur"]
|
|
417
417
|
);
|
|
418
|
+
var ALIGN = /* @__PURE__ */ ((ALIGN2) => {
|
|
419
|
+
ALIGN2["LEFT"] = "left";
|
|
420
|
+
ALIGN2["CENTER"] = "center";
|
|
421
|
+
ALIGN2["RIGHT"] = "right";
|
|
422
|
+
return ALIGN2;
|
|
423
|
+
})(ALIGN || {});
|
|
424
|
+
var VALIGN = /* @__PURE__ */ ((VALIGN2) => {
|
|
425
|
+
VALIGN2["TOP"] = "top";
|
|
426
|
+
VALIGN2["MIDDLE"] = "middle";
|
|
427
|
+
VALIGN2["BOTTOM"] = "bottom";
|
|
428
|
+
return VALIGN2;
|
|
429
|
+
})(VALIGN || {});
|
|
430
|
+
var DIRECTION = /* @__PURE__ */ ((DIRECTION2) => {
|
|
431
|
+
DIRECTION2["ASC"] = "asc";
|
|
432
|
+
DIRECTION2["DESC"] = "desc";
|
|
433
|
+
return DIRECTION2;
|
|
434
|
+
})(DIRECTION || {});
|
|
435
|
+
const byRowKey = (key) => {
|
|
436
|
+
return (row) => row[key];
|
|
437
|
+
};
|
|
438
|
+
const asRowClass = (value) => value;
|
|
439
|
+
const asRowAttrs = (value) => value;
|
|
440
|
+
const _sfc_main$5 = vue.defineComponent({
|
|
441
|
+
name: "UiTableColumn",
|
|
442
|
+
props: {
|
|
443
|
+
label: {
|
|
444
|
+
type: String,
|
|
445
|
+
default: ""
|
|
446
|
+
},
|
|
447
|
+
width: {
|
|
448
|
+
type: [String, Number],
|
|
449
|
+
default: void 0
|
|
450
|
+
},
|
|
451
|
+
minWidth: {
|
|
452
|
+
type: [String, Number],
|
|
453
|
+
default: void 0
|
|
454
|
+
},
|
|
455
|
+
maxWidth: {
|
|
456
|
+
type: [String, Number],
|
|
457
|
+
default: void 0
|
|
458
|
+
},
|
|
459
|
+
align: {
|
|
460
|
+
type: String,
|
|
461
|
+
default: ALIGN.LEFT,
|
|
462
|
+
validator: (align) => Object.values(ALIGN).includes(align)
|
|
463
|
+
},
|
|
464
|
+
valign: {
|
|
465
|
+
type: String,
|
|
466
|
+
default: VALIGN.MIDDLE,
|
|
467
|
+
validator: (valign) => Object.values(VALIGN).includes(valign)
|
|
468
|
+
},
|
|
469
|
+
trim: {
|
|
470
|
+
type: Boolean,
|
|
471
|
+
default: false
|
|
472
|
+
},
|
|
473
|
+
colspan: {
|
|
474
|
+
type: Function,
|
|
475
|
+
default: void 0
|
|
476
|
+
},
|
|
477
|
+
rowspan: {
|
|
478
|
+
type: Function,
|
|
479
|
+
default: void 0
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
setup() {
|
|
483
|
+
return () => null;
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
const UiTableRootType = "UiTableRoot";
|
|
487
|
+
const UiTableRoot = remote.defineRemoteComponent(UiTableRootType);
|
|
488
|
+
const UiTableSectionType = "UiTableSection";
|
|
489
|
+
const UiTableSection = remote.defineRemoteComponent(UiTableSectionType);
|
|
490
|
+
const UiTableRowType = "UiTableRow";
|
|
491
|
+
const UiTableRow = remote.defineRemoteComponent(
|
|
492
|
+
UiTableRowType,
|
|
493
|
+
["click"]
|
|
494
|
+
);
|
|
495
|
+
const UiTableColType = "UiTableCol";
|
|
496
|
+
const UiTableCol = remote.defineRemoteComponent(UiTableColType);
|
|
497
|
+
const UiTableFooterSectionType = "UiTableFooterSection";
|
|
498
|
+
const UiTableFooterSection = remote.defineRemoteComponent(UiTableFooterSectionType);
|
|
499
|
+
const UiTableFooterButtonType = "UiTableFooterButton";
|
|
500
|
+
const UiTableFooterButton = remote.defineRemoteComponent(
|
|
501
|
+
UiTableFooterButtonType,
|
|
502
|
+
["click"]
|
|
503
|
+
);
|
|
504
|
+
const UiTableHeadCellType = "UiTableHeadCell";
|
|
505
|
+
const UiTableHeadCell = remote.defineRemoteComponent(UiTableHeadCellType);
|
|
506
|
+
const UiTableBodyCellType = "UiTableBodyCell";
|
|
507
|
+
const UiTableBodyCell = remote.defineRemoteComponent(UiTableBodyCellType);
|
|
508
|
+
const UiTableSorterType = "UiTableSorter";
|
|
509
|
+
const UiTableSorter = remote.defineRemoteComponent(
|
|
510
|
+
UiTableSorterType,
|
|
511
|
+
["click"]
|
|
512
|
+
);
|
|
513
|
+
const isNamedComponent = (node, name) => {
|
|
514
|
+
if (typeof node.type !== "object" || node.type === null) {
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
return "name" in node.type && node.type.name === name;
|
|
518
|
+
};
|
|
519
|
+
const isTableColumnVNode = (node) => {
|
|
520
|
+
return node.type === _sfc_main$5 || isNamedComponent(node, "UiTableColumn");
|
|
521
|
+
};
|
|
522
|
+
const isWhitespaceText = (value) => value.trim().length === 0;
|
|
523
|
+
const normalizeNodes = (children) => {
|
|
524
|
+
const normalized = [];
|
|
525
|
+
children.forEach((child) => {
|
|
526
|
+
if (Array.isArray(child)) {
|
|
527
|
+
normalized.push(...normalizeNodes(child));
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
if (typeof child === "string") {
|
|
531
|
+
if (!isWhitespaceText(child)) {
|
|
532
|
+
normalized.push(child);
|
|
533
|
+
}
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (typeof child === "number") {
|
|
537
|
+
normalized.push(child);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (!vue.isVNode(child)) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
if (child.type === vue.Comment) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (child.type === vue.Text) {
|
|
547
|
+
const text = typeof child.children === "string" ? child.children : "";
|
|
548
|
+
if (!isWhitespaceText(text)) {
|
|
549
|
+
normalized.push(text);
|
|
550
|
+
}
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (child.type === vue.Fragment && Array.isArray(child.children)) {
|
|
554
|
+
normalized.push(...normalizeNodes(child.children));
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
normalized.push(child);
|
|
558
|
+
});
|
|
559
|
+
return normalized;
|
|
560
|
+
};
|
|
561
|
+
const normalizeBoolean = (value) => value === "" || value === true;
|
|
562
|
+
const normalizeString = (value) => typeof value === "string" ? value : "";
|
|
563
|
+
const normalizeAlign = (value) => {
|
|
564
|
+
return Object.values(ALIGN).includes(value) ? value : ALIGN.LEFT;
|
|
565
|
+
};
|
|
566
|
+
const normalizeValign = (value) => {
|
|
567
|
+
return Object.values(VALIGN).includes(value) ? value : VALIGN.MIDDLE;
|
|
568
|
+
};
|
|
569
|
+
const normalizeSlotRecord = (node) => {
|
|
570
|
+
const children = node.children;
|
|
571
|
+
if (!children || Array.isArray(children) || typeof children === "string") {
|
|
572
|
+
return {};
|
|
573
|
+
}
|
|
574
|
+
const slots = children;
|
|
575
|
+
return {
|
|
576
|
+
defaultSlot: slots.default,
|
|
577
|
+
cellSlot: slots.cell,
|
|
578
|
+
labelSlot: slots.label
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
const resolveFunction = (value) => {
|
|
582
|
+
if (typeof value === "function") {
|
|
583
|
+
return value;
|
|
584
|
+
}
|
|
585
|
+
return () => void 0;
|
|
586
|
+
};
|
|
587
|
+
const collectTableColumns = (children) => {
|
|
588
|
+
return normalizeNodes(children).filter((node) => vue.isVNode(node)).filter(isTableColumnVNode).map((node, index) => {
|
|
589
|
+
const props = node.props ?? {};
|
|
590
|
+
const slots = normalizeSlotRecord(node);
|
|
591
|
+
return {
|
|
592
|
+
id: String(node.key ?? `ui-v1-table-column-${index}`),
|
|
593
|
+
label: normalizeString(props.label),
|
|
594
|
+
width: props.width,
|
|
595
|
+
minWidth: props.minWidth ?? props["min-width"],
|
|
596
|
+
maxWidth: props.maxWidth ?? props["max-width"],
|
|
597
|
+
align: normalizeAlign(props.align),
|
|
598
|
+
valign: normalizeValign(props.valign),
|
|
599
|
+
trim: normalizeBoolean(props.trim),
|
|
600
|
+
getColspan: resolveFunction(props.colspan),
|
|
601
|
+
getRowspan: resolveFunction(props.rowspan),
|
|
602
|
+
cellSlot: slots.cellSlot,
|
|
603
|
+
defaultSlot: slots.defaultSlot,
|
|
604
|
+
labelSlot: slots.labelSlot
|
|
605
|
+
};
|
|
606
|
+
});
|
|
607
|
+
};
|
|
608
|
+
const normalizeSpan = (value) => {
|
|
609
|
+
if (typeof value === "undefined") {
|
|
610
|
+
return void 0;
|
|
611
|
+
}
|
|
612
|
+
const normalized = Math.trunc(Number(value));
|
|
613
|
+
if (!Number.isFinite(normalized) || normalized < 1) {
|
|
614
|
+
return void 0;
|
|
615
|
+
}
|
|
616
|
+
return normalized;
|
|
617
|
+
};
|
|
618
|
+
const renderLabel = (column) => column.labelSlot?.({ column }) ?? [column.label];
|
|
619
|
+
const renderCell = (column, props) => column.cellSlot?.(props) ?? column.defaultSlot?.(props) ?? [];
|
|
620
|
+
const buildRenderedRows = (options) => {
|
|
621
|
+
const activeRowspans = Array.from({ length: options.columns.length }, () => 0);
|
|
622
|
+
return options.rows.map((row, index) => {
|
|
623
|
+
const key = options.resolveKey(row, index);
|
|
624
|
+
const expanded = options.expandedKeys.has(key);
|
|
625
|
+
const toggle = () => options.toggle(key);
|
|
626
|
+
const attrs = options.resolveRowAttrs(row, index);
|
|
627
|
+
const cells = [];
|
|
628
|
+
let pendingColspan = 0;
|
|
629
|
+
options.columns.forEach((column, columnIndex) => {
|
|
630
|
+
if (pendingColspan > 0) {
|
|
631
|
+
pendingColspan -= 1;
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
if (activeRowspans[columnIndex] > 0) {
|
|
635
|
+
activeRowspans[columnIndex] -= 1;
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
const slotProps = {
|
|
639
|
+
row,
|
|
640
|
+
index,
|
|
641
|
+
key,
|
|
642
|
+
expanded,
|
|
643
|
+
toggle,
|
|
644
|
+
column
|
|
645
|
+
};
|
|
646
|
+
const colspan = normalizeSpan(column.getColspan(row, index));
|
|
647
|
+
const rowspan = normalizeSpan(column.getRowspan(row, index));
|
|
648
|
+
const resolvedColspan = colspan && colspan > 1 ? colspan : void 0;
|
|
649
|
+
const resolvedRowspan = rowspan && rowspan > 1 ? rowspan : void 0;
|
|
650
|
+
if (resolvedColspan) {
|
|
651
|
+
pendingColspan = resolvedColspan - 1;
|
|
652
|
+
}
|
|
653
|
+
if (resolvedRowspan) {
|
|
654
|
+
for (let spanIndex = 0; spanIndex < (resolvedColspan ?? 1); spanIndex++) {
|
|
655
|
+
activeRowspans[columnIndex + spanIndex] = Math.max(
|
|
656
|
+
activeRowspans[columnIndex + spanIndex] ?? 0,
|
|
657
|
+
resolvedRowspan - 1
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
cells.push({
|
|
662
|
+
column,
|
|
663
|
+
colspan: resolvedColspan,
|
|
664
|
+
rowspan: resolvedRowspan,
|
|
665
|
+
slotProps
|
|
666
|
+
});
|
|
667
|
+
});
|
|
668
|
+
return {
|
|
669
|
+
row,
|
|
670
|
+
index,
|
|
671
|
+
key,
|
|
672
|
+
attrs,
|
|
673
|
+
expanded,
|
|
674
|
+
toggle,
|
|
675
|
+
cells,
|
|
676
|
+
className: [
|
|
677
|
+
options.resolveRowClass(row, index),
|
|
678
|
+
attrs.class,
|
|
679
|
+
options.extraClass
|
|
680
|
+
]
|
|
681
|
+
};
|
|
682
|
+
});
|
|
683
|
+
};
|
|
684
|
+
const isCellVNode = (node) => {
|
|
685
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
return node.type === UiTableBodyCell || node.type === UiTableHeadCell || isNamedComponent(node, "UiTableBodyCell") || isNamedComponent(node, "UiTableHeadCell") || node.type === "td" || node.type === "th";
|
|
689
|
+
};
|
|
690
|
+
const slotNeedsBodyCellWrapper = (children) => {
|
|
691
|
+
const nodes = normalizeNodes(children);
|
|
692
|
+
if (nodes.length === 0) {
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
|
+
return !nodes.every(isCellVNode);
|
|
696
|
+
};
|
|
697
|
+
const renderGroupHead = (slot, props) => {
|
|
698
|
+
return slot?.(props) ?? [String(props.group.key)];
|
|
699
|
+
};
|
|
700
|
+
const renderExpand = (slot, props) => slot?.(props) ?? [];
|
|
701
|
+
const getRowClass = (rowClass, row, index) => {
|
|
702
|
+
if (typeof rowClass === "function") {
|
|
703
|
+
return rowClass(row, index);
|
|
704
|
+
}
|
|
705
|
+
return rowClass;
|
|
706
|
+
};
|
|
707
|
+
const getRowAttrs = (rowAttrs, row, index) => rowAttrs?.(row, index) ?? {};
|
|
708
|
+
const resolveRowKey = (rowKey, row, index) => {
|
|
709
|
+
if (typeof rowKey === "function") {
|
|
710
|
+
return rowKey(row, index);
|
|
711
|
+
}
|
|
712
|
+
if (typeof rowKey !== "undefined" && typeof row === "object" && row !== null && rowKey in row) {
|
|
713
|
+
const value = row[rowKey];
|
|
714
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
715
|
+
return value;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return index;
|
|
719
|
+
};
|
|
720
|
+
const withoutClass = (attrs) => {
|
|
721
|
+
const next = { ...attrs };
|
|
722
|
+
delete next.class;
|
|
723
|
+
return next;
|
|
724
|
+
};
|
|
725
|
+
const _sfc_main$4 = vue.defineComponent({
|
|
726
|
+
name: "UiTable",
|
|
727
|
+
inheritAttrs: false,
|
|
728
|
+
props: {
|
|
729
|
+
rows: {
|
|
730
|
+
type: Array,
|
|
731
|
+
default: () => []
|
|
732
|
+
},
|
|
733
|
+
rowKey: {
|
|
734
|
+
type: [String, Number, Function],
|
|
735
|
+
default: void 0
|
|
736
|
+
},
|
|
737
|
+
headless: {
|
|
738
|
+
type: Boolean,
|
|
739
|
+
default: false
|
|
740
|
+
},
|
|
741
|
+
bordered: {
|
|
742
|
+
type: Boolean,
|
|
743
|
+
default: false
|
|
744
|
+
},
|
|
745
|
+
fixed: {
|
|
746
|
+
type: Boolean,
|
|
747
|
+
default: false
|
|
748
|
+
},
|
|
749
|
+
rowClass: {
|
|
750
|
+
type: [String, Array, Object, Function],
|
|
751
|
+
default: void 0
|
|
752
|
+
},
|
|
753
|
+
rowAttrs: {
|
|
754
|
+
type: Function,
|
|
755
|
+
default: void 0
|
|
756
|
+
},
|
|
757
|
+
groupBy: {
|
|
758
|
+
type: Function,
|
|
759
|
+
default: void 0
|
|
760
|
+
},
|
|
761
|
+
groupHeadClass: {
|
|
762
|
+
type: [String, Array, Object],
|
|
763
|
+
default: void 0
|
|
764
|
+
},
|
|
765
|
+
groupBodyClass: {
|
|
766
|
+
type: [String, Array, Object],
|
|
767
|
+
default: void 0
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
emits: {
|
|
771
|
+
"row:click": (payload, event) => {
|
|
772
|
+
return true;
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
setup(props, { attrs, emit, expose, slots }) {
|
|
776
|
+
const instance = vue.getCurrentInstance();
|
|
777
|
+
const expandedKeys = vue.ref([]);
|
|
778
|
+
const isInteractive = vue.computed(() => Boolean(
|
|
779
|
+
instance?.vnode.props?.onRowClick || instance?.vnode.props?.["onRow:click"]
|
|
780
|
+
));
|
|
781
|
+
const toggleExpanded = (key) => {
|
|
782
|
+
expandedKeys.value = expandedKeys.value.includes(key) ? expandedKeys.value.filter((item) => item !== key) : [...expandedKeys.value, key];
|
|
783
|
+
};
|
|
784
|
+
const resetExpanded = () => {
|
|
785
|
+
expandedKeys.value = [];
|
|
786
|
+
};
|
|
787
|
+
const expand = (key) => {
|
|
788
|
+
if (!expandedKeys.value.includes(key)) {
|
|
789
|
+
expandedKeys.value = [...expandedKeys.value, key];
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
const collapse = (key) => {
|
|
793
|
+
expandedKeys.value = expandedKeys.value.filter((item) => item !== key);
|
|
794
|
+
};
|
|
795
|
+
expose({
|
|
796
|
+
resetExpanded,
|
|
797
|
+
expand,
|
|
798
|
+
collapse,
|
|
799
|
+
toggle: toggleExpanded
|
|
800
|
+
});
|
|
801
|
+
vue.watch([() => props.rows, () => props.rowKey], () => {
|
|
802
|
+
const availableKeys = new Set(
|
|
803
|
+
props.rows.map((row, index) => resolveRowKey(props.rowKey, row, index))
|
|
804
|
+
);
|
|
805
|
+
const next = expandedKeys.value.filter((key) => availableKeys.has(key));
|
|
806
|
+
if (next.length !== expandedKeys.value.length) {
|
|
807
|
+
expandedKeys.value = next;
|
|
808
|
+
}
|
|
809
|
+
}, { deep: false });
|
|
810
|
+
const resolveColumns = () => collectTableColumns(slots.default?.() ?? []);
|
|
811
|
+
const resolveGroups = () => {
|
|
812
|
+
return props.groupBy ? props.groupBy(props.rows) : [];
|
|
813
|
+
};
|
|
814
|
+
const resolveFooterData = (currentColumns, currentGroups) => ({
|
|
815
|
+
columnsCount: currentColumns.length,
|
|
816
|
+
rowsCount: props.rows.length,
|
|
817
|
+
groupsCount: currentGroups.length,
|
|
818
|
+
groups: currentGroups
|
|
819
|
+
});
|
|
820
|
+
const hasStructuredFooter = () => {
|
|
821
|
+
return [
|
|
822
|
+
"footer-summary",
|
|
823
|
+
"footer-page-size",
|
|
824
|
+
"footer-export",
|
|
825
|
+
"footer-pagination"
|
|
826
|
+
].some((name) => Boolean(slots[name]));
|
|
827
|
+
};
|
|
828
|
+
const hasFooter = () => Boolean(slots.footer) || hasStructuredFooter();
|
|
829
|
+
const resolveColumnsCount = (currentColumns) => {
|
|
830
|
+
return Math.max(currentColumns.length, 1);
|
|
831
|
+
};
|
|
832
|
+
const buildPlainRows = (currentColumns) => buildRenderedRows({
|
|
833
|
+
columns: currentColumns,
|
|
834
|
+
rows: props.rows,
|
|
835
|
+
expandedKeys: new Set(expandedKeys.value),
|
|
836
|
+
resolveKey: (row, index) => resolveRowKey(props.rowKey, row, index),
|
|
837
|
+
resolveRowAttrs: (row, index) => getRowAttrs(props.rowAttrs, row, index),
|
|
838
|
+
resolveRowClass: (row, index) => getRowClass(props.rowClass, row, index),
|
|
839
|
+
toggle: toggleExpanded
|
|
840
|
+
});
|
|
841
|
+
const buildGroupedRows = (currentColumns, currentGroups) => currentGroups.map((group) => ({
|
|
842
|
+
group,
|
|
843
|
+
rows: buildRenderedRows({
|
|
844
|
+
columns: currentColumns,
|
|
845
|
+
rows: group.rows,
|
|
846
|
+
expandedKeys: new Set(expandedKeys.value),
|
|
847
|
+
extraClass: props.groupBodyClass,
|
|
848
|
+
resolveKey: (row, index) => resolveRowKey(props.rowKey, row, index),
|
|
849
|
+
resolveRowAttrs: (row, index) => getRowAttrs(props.rowAttrs, row, index),
|
|
850
|
+
resolveRowClass: (row, index) => getRowClass(props.rowClass, row, index),
|
|
851
|
+
toggle: toggleExpanded
|
|
852
|
+
})
|
|
853
|
+
}));
|
|
854
|
+
const emitRowClick = (payload, event) => {
|
|
855
|
+
emit("row:click", payload, event);
|
|
856
|
+
};
|
|
857
|
+
const renderBodyRow = (row, columnsCount, suffix = "row") => {
|
|
858
|
+
const rowKey = `${String(row.key)}:${suffix}`;
|
|
859
|
+
return [
|
|
860
|
+
vue.h(UiTableRow, {
|
|
861
|
+
key: rowKey,
|
|
862
|
+
interactive: isInteractive.value,
|
|
863
|
+
expanded: row.expanded,
|
|
864
|
+
...withoutClass(row.attrs),
|
|
865
|
+
class: row.className,
|
|
866
|
+
onClick: (event) => emitRowClick({
|
|
867
|
+
row: row.row,
|
|
868
|
+
index: row.index,
|
|
869
|
+
key: row.key,
|
|
870
|
+
expanded: row.expanded,
|
|
871
|
+
toggle: row.toggle
|
|
872
|
+
}, event)
|
|
873
|
+
}, () => row.cells.map((cell, cellIndex) => vue.h(UiTableBodyCell, {
|
|
874
|
+
key: `${rowKey}:cell:${cell.column.id}:${cellIndex}`,
|
|
875
|
+
align: cell.column.align,
|
|
876
|
+
valign: cell.column.valign,
|
|
877
|
+
colspan: cell.colspan,
|
|
878
|
+
rowspan: cell.rowspan,
|
|
879
|
+
trim: cell.column.trim
|
|
880
|
+
}, () => renderCell(cell.column, cell.slotProps)))),
|
|
881
|
+
slots.expand && row.expanded ? vue.h(UiTableRow, {
|
|
882
|
+
key: `${rowKey}:expand`,
|
|
883
|
+
expanded: true
|
|
884
|
+
}, () => vue.h(UiTableBodyCell, {
|
|
885
|
+
colspan: columnsCount
|
|
886
|
+
}, () => renderExpand(slots.expand, {
|
|
887
|
+
row: row.row,
|
|
888
|
+
index: row.index,
|
|
889
|
+
key: row.key
|
|
890
|
+
}))) : null
|
|
891
|
+
];
|
|
892
|
+
};
|
|
893
|
+
const renderGroupHeadRow = (group, index, columnsCount) => {
|
|
894
|
+
const content = renderGroupHead(slots["group-head"], {
|
|
895
|
+
group,
|
|
896
|
+
index
|
|
897
|
+
});
|
|
898
|
+
return vue.h(UiTableRow, {
|
|
899
|
+
key: `${String(group.key)}:group-head`,
|
|
900
|
+
class: props.groupHeadClass
|
|
901
|
+
}, () => {
|
|
902
|
+
if (slotNeedsBodyCellWrapper(content)) {
|
|
903
|
+
return vue.h(UiTableBodyCell, {
|
|
904
|
+
colspan: columnsCount,
|
|
905
|
+
theme: "group"
|
|
906
|
+
}, () => vue.h("div", { class: "ui-v1-table__group-head" }, content));
|
|
907
|
+
}
|
|
908
|
+
return content;
|
|
909
|
+
});
|
|
910
|
+
};
|
|
911
|
+
const renderEmptyRow = (columnsCount) => vue.h(UiTableRow, { key: "empty" }, () => vue.h(UiTableBodyCell, {
|
|
912
|
+
colspan: columnsCount
|
|
913
|
+
}, () => vue.h("div", { class: "ui-v1-table__empty" }, slots.empty?.() ?? [])));
|
|
914
|
+
const renderFooter = (footerData, columnsCount) => {
|
|
915
|
+
if (!hasFooter()) {
|
|
916
|
+
return null;
|
|
917
|
+
}
|
|
918
|
+
if (hasStructuredFooter()) {
|
|
919
|
+
const summary = slots["footer-summary"]?.(footerData);
|
|
920
|
+
const pageSize = slots["footer-page-size"]?.(footerData);
|
|
921
|
+
const exportControl = slots["footer-export"]?.(footerData);
|
|
922
|
+
const pagination = slots["footer-pagination"]?.(footerData);
|
|
923
|
+
return vue.h(UiTableSection, { kind: "foot", key: "footer" }, () => vue.h(UiTableRow, () => vue.h(UiTableBodyCell, {
|
|
924
|
+
colspan: columnsCount,
|
|
925
|
+
class: "ui-v1-table__footer-cell"
|
|
926
|
+
}, () => vue.h("div", { class: "ui-v1-table__footer" }, [
|
|
927
|
+
summary ? vue.h("div", { class: "ui-v1-table__footer-meta" }, [summary]) : null,
|
|
928
|
+
pageSize || exportControl || pagination ? vue.h("div", { class: "ui-v1-table__footer-controls" }, [
|
|
929
|
+
pageSize || exportControl ? vue.h("div", { class: "ui-v1-table__footer-main" }, [
|
|
930
|
+
pageSize,
|
|
931
|
+
exportControl
|
|
932
|
+
]) : null,
|
|
933
|
+
pagination ? vue.h("div", { class: "ui-v1-table__footer-side" }, [pagination]) : null
|
|
934
|
+
]) : null
|
|
935
|
+
]))));
|
|
936
|
+
}
|
|
937
|
+
const content = slots.footer?.(footerData) ?? [];
|
|
938
|
+
return vue.h(UiTableSection, { kind: "foot", key: "footer" }, () => vue.h(UiTableRow, () => {
|
|
939
|
+
if (slotNeedsBodyCellWrapper(content)) {
|
|
940
|
+
return vue.h(UiTableBodyCell, {
|
|
941
|
+
colspan: columnsCount
|
|
942
|
+
}, () => content);
|
|
943
|
+
}
|
|
944
|
+
return content;
|
|
945
|
+
}));
|
|
946
|
+
};
|
|
947
|
+
return () => vue.h(UiTableRoot, {
|
|
948
|
+
...attrs,
|
|
949
|
+
bordered: props.bordered,
|
|
950
|
+
fixed: props.fixed
|
|
951
|
+
}, () => [
|
|
952
|
+
(() => {
|
|
953
|
+
const currentColumns = resolveColumns();
|
|
954
|
+
const currentColumnsCount = resolveColumnsCount(currentColumns);
|
|
955
|
+
const currentGroups = resolveGroups();
|
|
956
|
+
const currentFooterData = resolveFooterData(currentColumns, currentGroups);
|
|
957
|
+
const currentPlainRows = buildPlainRows(currentColumns);
|
|
958
|
+
const currentGroupedRows = buildGroupedRows(currentColumns, currentGroups);
|
|
959
|
+
return [
|
|
960
|
+
currentColumns.length > 0 ? vue.h("colgroup", { key: "colgroup" }, currentColumns.map((column) => vue.h(UiTableCol, {
|
|
961
|
+
key: `col:${column.id}`,
|
|
962
|
+
width: column.width,
|
|
963
|
+
minWidth: column.minWidth,
|
|
964
|
+
maxWidth: column.maxWidth
|
|
965
|
+
}))) : null,
|
|
966
|
+
!props.headless && currentColumns.length > 0 ? vue.h(UiTableSection, { key: "head", kind: "head" }, () => vue.h(UiTableRow, () => currentColumns.map((column) => vue.h(UiTableHeadCell, {
|
|
967
|
+
key: `head:${column.id}`,
|
|
968
|
+
align: column.align,
|
|
969
|
+
trim: column.trim
|
|
970
|
+
}, () => renderLabel(column))))) : null,
|
|
971
|
+
vue.h(UiTableSection, { key: "body", kind: "body" }, () => {
|
|
972
|
+
if (props.rows.length === 0) {
|
|
973
|
+
return renderEmptyRow(currentColumnsCount);
|
|
974
|
+
}
|
|
975
|
+
if (props.groupBy) {
|
|
976
|
+
return currentGroupedRows.flatMap(({ group, rows }, index) => [
|
|
977
|
+
renderGroupHeadRow(group, index, currentColumnsCount),
|
|
978
|
+
...rows.flatMap((row) => renderBodyRow(row, currentColumnsCount, `${String(group.key)}:row`))
|
|
979
|
+
]);
|
|
980
|
+
}
|
|
981
|
+
return currentPlainRows.flatMap((row) => renderBodyRow(row, currentColumnsCount));
|
|
982
|
+
}),
|
|
983
|
+
renderFooter(currentFooterData, currentColumnsCount)
|
|
984
|
+
];
|
|
985
|
+
})()
|
|
986
|
+
]);
|
|
987
|
+
}
|
|
988
|
+
});
|
|
418
989
|
const UiTagType = "UiTag";
|
|
419
990
|
const UiTag = remote.defineRemoteComponent(
|
|
420
991
|
UiTagType,
|
|
@@ -1538,6 +2109,15 @@ const createEndpointRoot = async (channel) => {
|
|
|
1538
2109
|
"UiSwitch",
|
|
1539
2110
|
"UiSelectPopper",
|
|
1540
2111
|
"UiSelectTrigger",
|
|
2112
|
+
"UiTableBodyCell",
|
|
2113
|
+
"UiTableCol",
|
|
2114
|
+
"UiTableFooterButton",
|
|
2115
|
+
"UiTableFooterSection",
|
|
2116
|
+
"UiTableHeadCell",
|
|
2117
|
+
"UiTableRoot",
|
|
2118
|
+
"UiTableRow",
|
|
2119
|
+
"UiTableSection",
|
|
2120
|
+
"UiTableSorter",
|
|
1541
2121
|
"UiTag",
|
|
1542
2122
|
"UiTextbox",
|
|
1543
2123
|
"UiTimePicker",
|
|
@@ -1600,6 +2180,8 @@ function detectLocale() {
|
|
|
1600
2180
|
}
|
|
1601
2181
|
return "en-GB";
|
|
1602
2182
|
}
|
|
2183
|
+
exports.ALIGN = ALIGN;
|
|
2184
|
+
exports.DIRECTION = DIRECTION;
|
|
1603
2185
|
exports.ImageWorkersKey = ImageWorkersKey;
|
|
1604
2186
|
exports.UiAddButton = UiAddButton;
|
|
1605
2187
|
exports.UiAddButtonType = UiAddButtonType;
|
|
@@ -1629,7 +2211,7 @@ exports.UiDatePickerType = UiDatePickerType;
|
|
|
1629
2211
|
exports.UiDateType = UiDateType;
|
|
1630
2212
|
exports.UiError = UiError;
|
|
1631
2213
|
exports.UiErrorType = UiErrorType;
|
|
1632
|
-
exports.UiField = _sfc_main$
|
|
2214
|
+
exports.UiField = _sfc_main$6;
|
|
1633
2215
|
exports.UiInfobox = UiInfobox;
|
|
1634
2216
|
exports.UiInfoboxType = UiInfoboxType;
|
|
1635
2217
|
exports.UiLink = UiLink;
|
|
@@ -1665,6 +2247,13 @@ exports.UiSlider = UiSlider;
|
|
|
1665
2247
|
exports.UiSliderType = UiSliderType;
|
|
1666
2248
|
exports.UiSwitch = UiSwitch;
|
|
1667
2249
|
exports.UiSwitchType = UiSwitchType;
|
|
2250
|
+
exports.UiTable = _sfc_main$4;
|
|
2251
|
+
exports.UiTableBodyCell = UiTableBodyCell;
|
|
2252
|
+
exports.UiTableColumn = _sfc_main$5;
|
|
2253
|
+
exports.UiTableFooterButton = UiTableFooterButton;
|
|
2254
|
+
exports.UiTableFooterSection = UiTableFooterSection;
|
|
2255
|
+
exports.UiTableHeadCell = UiTableHeadCell;
|
|
2256
|
+
exports.UiTableSorter = UiTableSorter;
|
|
1668
2257
|
exports.UiTag = UiTag;
|
|
1669
2258
|
exports.UiTagType = UiTagType;
|
|
1670
2259
|
exports.UiTextbox = UiTextbox;
|
|
@@ -1681,6 +2270,10 @@ exports.UiTransition = UiTransition;
|
|
|
1681
2270
|
exports.UiTransitionType = UiTransitionType;
|
|
1682
2271
|
exports.UiYandexMap = UiYandexMap;
|
|
1683
2272
|
exports.UiYandexMapType = UiYandexMapType;
|
|
2273
|
+
exports.VALIGN = VALIGN;
|
|
2274
|
+
exports.asRowAttrs = asRowAttrs;
|
|
2275
|
+
exports.asRowClass = asRowClass;
|
|
2276
|
+
exports.byRowKey = byRowKey;
|
|
1684
2277
|
exports.createEndpointRoot = createEndpointRoot;
|
|
1685
2278
|
exports.formatDate = formatDate;
|
|
1686
2279
|
exports.formatDateTime = formatDateTime;
|