@antglobal/copilot-cards-web 0.0.20260806095059-dev.1 → 0.0.20260811080429-dev.1
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/index.d.ts +2 -2
- package/dist/index.js +30 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1295,7 +1295,7 @@ interface ChoiceListProps {
|
|
|
1295
1295
|
indicatorStyle?: Record<string, any>;
|
|
1296
1296
|
/** Style merged into selected indicators */
|
|
1297
1297
|
selectedIndicatorStyle?: Record<string, any>;
|
|
1298
|
-
/**
|
|
1298
|
+
/** Selected mark override; single mode keeps its radio dot when omitted, while multiple mode defaults to `check_bold` */
|
|
1299
1299
|
checkedIcon?: ChoiceIndicatorIcon;
|
|
1300
1300
|
}
|
|
1301
1301
|
interface ChoiceIndicatorIcon {
|
|
@@ -1323,7 +1323,7 @@ interface ChoiceItemProps {
|
|
|
1323
1323
|
indicatorStyle?: Record<string, any>;
|
|
1324
1324
|
/** Per-item selected indicator style */
|
|
1325
1325
|
selectedIndicatorStyle?: Record<string, any>;
|
|
1326
|
-
/** Per-item
|
|
1326
|
+
/** Per-item selected mark override; also replaces the single-select radio dot */
|
|
1327
1327
|
checkedIcon?: ChoiceIndicatorIcon;
|
|
1328
1328
|
}
|
|
1329
1329
|
interface PasscodeInputProps {
|
package/dist/index.js
CHANGED
|
@@ -706,6 +706,7 @@ function buildHeatmapOption(config) {
|
|
|
706
706
|
*/
|
|
707
707
|
// ─── Slot Layout Constants ──────────────────────────────────────
|
|
708
708
|
const SLOT_LAYOUT = {
|
|
709
|
+
FLEX: 'flex',
|
|
709
710
|
COLUMNS: 'columns',
|
|
710
711
|
GRID: 'grid',
|
|
711
712
|
HORIZONTAL_SCROLL: 'horizontalScroll',
|
|
@@ -716,6 +717,30 @@ const SLOT_LAYOUT = {
|
|
|
716
717
|
TABLE: 'table',
|
|
717
718
|
CHART: 'chart',
|
|
718
719
|
};
|
|
720
|
+
// ─── Dispatcher ─────────────────────────────────────────────────
|
|
721
|
+
/**
|
|
722
|
+
* Apply host-level layout styles based on the slot key.
|
|
723
|
+
* Called from renderDefault BEFORE props.style so explicit styles can override.
|
|
724
|
+
* Layouts that require wrapper DOM continue to render in renderSlotLayout.
|
|
725
|
+
*/
|
|
726
|
+
function applySlotBaseStyle(container, props) {
|
|
727
|
+
const flex = props.slots?.[SLOT_LAYOUT.FLEX];
|
|
728
|
+
if (!flex || typeof flex !== 'object')
|
|
729
|
+
return;
|
|
730
|
+
const config = flex.config && typeof flex.config === 'object' ? flex.config : {};
|
|
731
|
+
container.style.display = 'flex';
|
|
732
|
+
container.style.flexDirection = config.direction ?? 'column';
|
|
733
|
+
container.style.alignItems = config.align ?? 'flex-start';
|
|
734
|
+
container.style.justifyContent = config.justify ?? 'flex-start';
|
|
735
|
+
container.style.flexWrap = config.wrap ?? 'nowrap';
|
|
736
|
+
container.style.gap = resolveFlexGap(config.gap);
|
|
737
|
+
}
|
|
738
|
+
function resolveFlexGap(value) {
|
|
739
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
740
|
+
return `${value}px`;
|
|
741
|
+
}
|
|
742
|
+
return typeof value === 'string' && value.length > 0 ? value : '0px';
|
|
743
|
+
}
|
|
719
744
|
/**
|
|
720
745
|
* Render children into a container using the slot layout strategy.
|
|
721
746
|
* Returns true if a special layout was applied (children already appended).
|
|
@@ -7013,11 +7038,12 @@ class CardChoiceItem extends BaseElement {
|
|
|
7013
7038
|
...(selected ? selectedIndicatorStyle || {} : {}),
|
|
7014
7039
|
}, isExpressionResultStyle);
|
|
7015
7040
|
const indicatorRole = selectionMode === 'single' ? 'radio' : 'checkbox';
|
|
7016
|
-
const
|
|
7041
|
+
const configuredCheckedIcon = checkedIcon ?? listCheckedIcon;
|
|
7042
|
+
const resolvedCheckedIcon = configuredCheckedIcon ?? {
|
|
7017
7043
|
name: 'check_bold',
|
|
7018
7044
|
size: 12,
|
|
7019
7045
|
};
|
|
7020
|
-
const checkedMark = selectionMode === 'multiple'
|
|
7046
|
+
const checkedMark = selectionMode === 'multiple' || configuredCheckedIcon
|
|
7021
7047
|
? `<span class="choice-icon" aria-hidden="true">${renderIconContent(resolvedCheckedIcon)}</span>`
|
|
7022
7048
|
: '<span class="radio-dot" aria-hidden="true"></span>';
|
|
7023
7049
|
this.setAttribute('data-selected', String(selected));
|
|
@@ -7656,6 +7682,8 @@ function renderDefault(node, props, isMobile, responsive) {
|
|
|
7656
7682
|
div.className = `card-element card-${node.type.toLowerCase()} ${isMobile ? 'card-mobile' : 'card-desktop'}`;
|
|
7657
7683
|
div.setAttribute('data-card-id', node.id);
|
|
7658
7684
|
div.setAttribute('data-card-type', node.type);
|
|
7685
|
+
// Apply slot base styles FIRST (so props.style can override)
|
|
7686
|
+
applySlotBaseStyle(div, props);
|
|
7659
7687
|
if (props.style && typeof props.style === 'object') {
|
|
7660
7688
|
const resolvedStyle = buildStyleString(props.isExpressionResultStyle
|
|
7661
7689
|
? props.style
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antglobal/copilot-cards-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20260811080429-dev.1",
|
|
4
4
|
"description": "Web Component renderer for copilot bot card SDK — PC + Mobile + WebView unified rendering via Custom Elements",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@antglobal/copilot-cards-core": "0.0.
|
|
31
|
+
"@antglobal/copilot-cards-core": "0.0.20260811080429-dev.1",
|
|
32
32
|
"echarts": "^5.6.0",
|
|
33
33
|
"marked": "^18.0.5",
|
|
34
34
|
"tslib": "^2.8.1",
|