@pilotiq/pilotiq 0.4.0 → 0.6.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +11 -1
- package/dist/Column.d.ts +36 -0
- package/dist/Column.d.ts.map +1 -1
- package/dist/Column.js +24 -0
- package/dist/Column.js.map +1 -1
- package/dist/RenderHook.d.ts +2 -2
- package/dist/RenderHook.d.ts.map +1 -1
- package/dist/RenderHook.js +8 -0
- package/dist/RenderHook.js.map +1 -1
- package/dist/applyPageHooks.d.ts.map +1 -1
- package/dist/applyPageHooks.js +76 -0
- package/dist/applyPageHooks.js.map +1 -1
- package/dist/elements/dispatchForm.d.ts +14 -6
- package/dist/elements/dispatchForm.d.ts.map +1 -1
- package/dist/elements/dispatchForm.js +28 -8
- package/dist/elements/dispatchForm.js.map +1 -1
- package/dist/fields/TextField.d.ts +10 -0
- package/dist/fields/TextField.d.ts.map +1 -1
- package/dist/fields/TextField.js +11 -0
- package/dist/fields/TextField.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/pageData.d.ts.map +1 -1
- package/dist/pageData.js +32 -4
- package/dist/pageData.js.map +1 -1
- package/dist/react/SchemaRenderer.d.ts.map +1 -1
- package/dist/react/SchemaRenderer.js +25 -4
- package/dist/react/SchemaRenderer.js.map +1 -1
- package/dist/react/cells/EditableCell.d.ts.map +1 -1
- package/dist/react/cells/EditableCell.js +6 -1
- package/dist/react/cells/EditableCell.js.map +1 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +35 -0
- package/dist/routes.js.map +1 -1
- package/dist/schema/SlotComponent.d.ts +49 -0
- package/dist/schema/SlotComponent.d.ts.map +1 -0
- package/dist/schema/SlotComponent.js +65 -0
- package/dist/schema/SlotComponent.js.map +1 -0
- package/dist/schema/Wizard.d.ts +37 -0
- package/dist/schema/Wizard.d.ts.map +1 -1
- package/dist/schema/Wizard.js +21 -0
- package/dist/schema/Wizard.js.map +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +1 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/slot-components/index.d.ts +2 -0
- package/dist/slot-components/index.d.ts.map +1 -0
- package/dist/slot-components/index.js +6 -0
- package/dist/slot-components/index.js.map +1 -0
- package/dist/slot-components/registry.d.ts +41 -0
- package/dist/slot-components/registry.d.ts.map +1 -0
- package/dist/slot-components/registry.js +17 -0
- package/dist/slot-components/registry.js.map +1 -0
- package/package.json +5 -1
- package/src/Column.test.ts +23 -0
- package/src/Column.ts +44 -0
- package/src/RenderHook.ts +16 -0
- package/src/applyPageHooks.test.ts +167 -2
- package/src/applyPageHooks.ts +88 -0
- package/src/elements/dispatchForm.test.ts +23 -1
- package/src/elements/dispatchForm.ts +33 -9
- package/src/fields/TextField.test.ts +45 -0
- package/src/fields/TextField.ts +13 -0
- package/src/index.ts +1 -0
- package/src/pageData.test.ts +83 -0
- package/src/pageData.ts +37 -4
- package/src/react/SchemaRenderer.tsx +43 -4
- package/src/react/cells/EditableCell.tsx +5 -1
- package/src/routes.test.ts +141 -0
- package/src/routes.ts +32 -0
- package/src/schema/SlotComponent.test.ts +77 -0
- package/src/schema/SlotComponent.ts +71 -0
- package/src/schema/Wizard.ts +45 -0
- package/src/schema/containers.test.ts +28 -0
- package/src/schema/index.ts +1 -0
- package/src/slot-components/index.ts +10 -0
- package/src/slot-components/registry.ts +56 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaRenderer.d.ts","sourceRoot":"","sources":["../../src/react/SchemaRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"SchemaRenderer.d.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;IACvB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB,kDAW3E"}
|
|
@@ -47,6 +47,7 @@ import { StatsOverviewRenderer } from './widgets/StatsOverviewRenderer.js';
|
|
|
47
47
|
import { TableWidgetRenderer } from './widgets/TableWidgetRenderer.js';
|
|
48
48
|
import { ViewRenderer } from './widgets/ViewRenderer.js';
|
|
49
49
|
import { getEntryComponent } from '../entries/registry.js';
|
|
50
|
+
import { getSlotComponent } from '../slot-components/registry.js';
|
|
50
51
|
import { getWidgetRenderer } from './widgetRegistry.js';
|
|
51
52
|
function resolveIcon(name) {
|
|
52
53
|
if (!name)
|
|
@@ -634,6 +635,14 @@ function HandlerActionButton({ url, ids, className, name, ariaLabel, tooltip, in
|
|
|
634
635
|
* Used by callsites that accept both (table header / bulk toolbars,
|
|
635
636
|
* heading actions, container schemas). */
|
|
636
637
|
function renderActionLike(el, index, opts = {}) {
|
|
638
|
+
if (el.type === 'slotComponent') {
|
|
639
|
+
// Plugin-contributed React mount — render through the main element
|
|
640
|
+
// dispatcher, which looks up the registered component and forwards
|
|
641
|
+
// its serialised props bag. Keeps every action-row slot (heading
|
|
642
|
+
// children, alert footer, empty-state footer, table-toolbar bulk
|
|
643
|
+
// strip) usable as a plugin extension point.
|
|
644
|
+
return renderElement(el, index);
|
|
645
|
+
}
|
|
637
646
|
if (el.type === 'actionGroup') {
|
|
638
647
|
return _jsx(ActionGroupTrigger, { el: el, ids: opts.ids ?? [] }, index);
|
|
639
648
|
}
|
|
@@ -1612,7 +1621,7 @@ function renderElement(el, index) {
|
|
|
1612
1621
|
const level = el['level'] ?? 1;
|
|
1613
1622
|
const content = String(el['content'] ?? '');
|
|
1614
1623
|
const description = el['description'] ? String(el['description']) : undefined;
|
|
1615
|
-
const headerActions = (el.children ?? []).filter(c => c.type === 'action' || c.type === 'actionGroup');
|
|
1624
|
+
const headerActions = (el.children ?? []).filter(c => c.type === 'action' || c.type === 'actionGroup' || c.type === 'slotComponent');
|
|
1616
1625
|
const Tag = level === 1 ? 'h1' : level === 2 ? 'h2' : 'h3';
|
|
1617
1626
|
const sizes = { 1: 'text-2xl', 2: 'text-xl', 3: 'text-lg' };
|
|
1618
1627
|
const titleBlock = (_jsxs("div", { children: [_jsx(Tag, { className: `${sizes[level]} font-bold tracking-tight`, children: content }), description && (_jsx("p", { className: "text-sm text-muted-foreground mt-1", children: description }))] }));
|
|
@@ -1622,7 +1631,7 @@ function renderElement(el, index) {
|
|
|
1622
1631
|
return (_jsxs("div", { className: "flex items-start justify-between gap-4", children: [titleBlock, _jsx("div", { className: "flex items-center gap-2 shrink-0", children: headerActions.map((a, i) => renderActionLike(a, i)) })] }, index));
|
|
1623
1632
|
}
|
|
1624
1633
|
case 'alert': {
|
|
1625
|
-
const footer = (el.children ?? []).filter(c => c.type === 'action' || c.type === 'actionGroup');
|
|
1634
|
+
const footer = (el.children ?? []).filter(c => c.type === 'action' || c.type === 'actionGroup' || c.type === 'slotComponent');
|
|
1626
1635
|
return (_jsx(AlertRenderer, { alertType: String(el['alertType'] ?? 'info'), content: String(el['content'] ?? ''), ...(el['title'] !== undefined ? { title: String(el['title']) } : {}), ...(el['dismissible'] ? { dismissible: Boolean(el['dismissible']) } : {}), ...(el['persistDismissal'] !== undefined ? { persistDismissal: String(el['persistDismissal']) } : {}), ...(el['iconColor'] !== undefined ? { iconColor: String(el['iconColor']) } : {}), ...(el['actionsAlignment'] !== undefined ? { actionsAlignment: String(el['actionsAlignment']) } : {}), footer: footer.map((a, i) => renderActionLike(a, i)) }, index));
|
|
1627
1636
|
}
|
|
1628
1637
|
case 'emptyState': {
|
|
@@ -1631,7 +1640,7 @@ function renderElement(el, index) {
|
|
|
1631
1640
|
const iconName = el['icon'] ? String(el['icon']) : undefined;
|
|
1632
1641
|
const contained = el['contained'] !== false;
|
|
1633
1642
|
const Icon = iconName ? resolveIcon(iconName) : undefined;
|
|
1634
|
-
const footer = (el.children ?? []).filter(c => c.type === 'action' || c.type === 'actionGroup');
|
|
1643
|
+
const footer = (el.children ?? []).filter(c => c.type === 'action' || c.type === 'actionGroup' || c.type === 'slotComponent');
|
|
1635
1644
|
const wrapper = contained
|
|
1636
1645
|
? 'rounded-lg border border-border bg-card text-card-foreground py-12 px-6'
|
|
1637
1646
|
: 'py-8';
|
|
@@ -1744,6 +1753,18 @@ function renderElement(el, index) {
|
|
|
1744
1753
|
return _jsx(TableWidgetRenderer, { meta: el }, index);
|
|
1745
1754
|
case 'view':
|
|
1746
1755
|
return _jsx(ViewRenderer, { meta: el }, index);
|
|
1756
|
+
case 'slotComponent': {
|
|
1757
|
+
const componentName = String(el['component'] ?? '');
|
|
1758
|
+
if (!componentName) {
|
|
1759
|
+
return (_jsxs("div", { className: "rounded-md border border-amber-500/40 bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-950/30 dark:text-amber-200", role: "alert", children: ["SlotComponent without a registered ", _jsx("code", { className: "font-mono", children: "component" }), " name."] }, index));
|
|
1760
|
+
}
|
|
1761
|
+
const Component = getSlotComponent(componentName);
|
|
1762
|
+
if (!Component) {
|
|
1763
|
+
return (_jsxs("div", { className: "rounded-md border border-amber-500/40 bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-950/30 dark:text-amber-200", role: "alert", children: ["No slot component registered for ", _jsx("code", { className: "font-mono", children: componentName }), ". Call ", _jsxs("code", { className: "font-mono", children: ["registerSlotComponents(", '{ ', componentName, ' }', ")"] }), " at app boot."] }, index));
|
|
1764
|
+
}
|
|
1765
|
+
const props = (el['props'] ?? {});
|
|
1766
|
+
return _jsx(Component, { ...props }, index);
|
|
1767
|
+
}
|
|
1747
1768
|
default: {
|
|
1748
1769
|
// Plan #15 Phase C — server-data widget elements registered by
|
|
1749
1770
|
// adapter packages (`@pilotiq/recharts` for `'chart'`, future
|
|
@@ -2984,7 +3005,7 @@ function TableRendererBody({ el }) {
|
|
|
2984
3005
|
const columns = children.filter(c => c.type === 'column');
|
|
2985
3006
|
// Actions and ActionGroups share placement — both show up in the
|
|
2986
3007
|
// header/bulk/row toolbars depending on their `placement` field.
|
|
2987
|
-
const actionLike = children.filter(c => c.type === 'action' || c.type === 'actionGroup');
|
|
3008
|
+
const actionLike = children.filter(c => c.type === 'action' || c.type === 'actionGroup' || c.type === 'slotComponent');
|
|
2988
3009
|
const filters = children.filter(c => c.type === 'filter');
|
|
2989
3010
|
const hasRecordUrl = Boolean(el['recordUrl']);
|
|
2990
3011
|
const hasRecordClasses = Boolean(el['recordClasses']);
|