@pilotiq/pilotiq 0.5.0 → 0.6.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +19 -0
- 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/RightSidebarContext.d.ts.map +1 -1
- package/dist/react/RightSidebarContext.js +35 -15
- package/dist/react/RightSidebarContext.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 +41 -2
- 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/RightSidebarContext.tsx +34 -11
- 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 +38 -2
- 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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Element } from './Element.js';
|
|
2
|
+
/**
|
|
3
|
+
* Escape-hatch schema element that hands rendering off to a user-supplied
|
|
4
|
+
* React component registered via `registerSlotComponents()`. Distinct from
|
|
5
|
+
* `ComponentEntry` (which is record-bound and label-shelled for infolists)
|
|
6
|
+
* and from `View` (which is widget-shaped with `getData`/polling). Use for
|
|
7
|
+
* plugin-contributed UI that needs to mount inline at any schema position
|
|
8
|
+
* — toolbars, header chips, sidebar contributions, anywhere `Action` /
|
|
9
|
+
* `ActionGroup` would otherwise live.
|
|
10
|
+
*
|
|
11
|
+
* Wire shape ships only the registered name + a serialisable `props` bag.
|
|
12
|
+
* The `_components.ts` build-time manifest doesn't see runtime-registered
|
|
13
|
+
* components (they live in plugin packages, not `cfg.resources / globals
|
|
14
|
+
* / pages` statics), so the lookup happens at render via the runtime
|
|
15
|
+
* registry — same model as `registerEntryComponents` and
|
|
16
|
+
* `registerWidgetComponents`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // bootstrap/providers.ts
|
|
20
|
+
* registerSlotComponents({ BookmarkButton })
|
|
21
|
+
*
|
|
22
|
+
* // A plugin / app contributes the chip into the resource-edit header:
|
|
23
|
+
* panel.renderHook(
|
|
24
|
+
* 'panels::resource.pages.edit-record.header.actions.before',
|
|
25
|
+
* (ctx) => [
|
|
26
|
+
* SlotComponent.make('BookmarkButton').props({
|
|
27
|
+
* basePath: ctx.basePath,
|
|
28
|
+
* resourceSlug: ctx.resource?.getSlug(),
|
|
29
|
+
* recordId: ctx.recordId,
|
|
30
|
+
* }),
|
|
31
|
+
* ],
|
|
32
|
+
* )
|
|
33
|
+
*/
|
|
34
|
+
export declare class SlotComponent extends Element {
|
|
35
|
+
protected _componentName: string;
|
|
36
|
+
protected _props?: Record<string, unknown>;
|
|
37
|
+
protected constructor(componentName: string);
|
|
38
|
+
static make(componentName: string): SlotComponent;
|
|
39
|
+
/**
|
|
40
|
+
* Static props passed verbatim to the registered component. Must be
|
|
41
|
+
* JSON-serialisable — they ride through `viewProps` to the client.
|
|
42
|
+
* Successive calls merge shallowly with the previous bag.
|
|
43
|
+
*/
|
|
44
|
+
props(props: Record<string, unknown>): this;
|
|
45
|
+
getComponentName(): string;
|
|
46
|
+
getType(): string;
|
|
47
|
+
toMeta(): Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=SlotComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlotComponent.d.ts","sourceRoot":"","sources":["../../src/schema/SlotComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC,SAAS,CAAC,cAAc,EAAE,MAAM,CAAA;IAChC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAE1C,SAAS,aAAa,aAAa,EAAE,MAAM;IAK3C,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa;IAIjD;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAK3C,gBAAgB,IAAI,MAAM;IAIjB,OAAO,IAAI,MAAM;IAEjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAO3C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Element } from './Element.js';
|
|
2
|
+
/**
|
|
3
|
+
* Escape-hatch schema element that hands rendering off to a user-supplied
|
|
4
|
+
* React component registered via `registerSlotComponents()`. Distinct from
|
|
5
|
+
* `ComponentEntry` (which is record-bound and label-shelled for infolists)
|
|
6
|
+
* and from `View` (which is widget-shaped with `getData`/polling). Use for
|
|
7
|
+
* plugin-contributed UI that needs to mount inline at any schema position
|
|
8
|
+
* — toolbars, header chips, sidebar contributions, anywhere `Action` /
|
|
9
|
+
* `ActionGroup` would otherwise live.
|
|
10
|
+
*
|
|
11
|
+
* Wire shape ships only the registered name + a serialisable `props` bag.
|
|
12
|
+
* The `_components.ts` build-time manifest doesn't see runtime-registered
|
|
13
|
+
* components (they live in plugin packages, not `cfg.resources / globals
|
|
14
|
+
* / pages` statics), so the lookup happens at render via the runtime
|
|
15
|
+
* registry — same model as `registerEntryComponents` and
|
|
16
|
+
* `registerWidgetComponents`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // bootstrap/providers.ts
|
|
20
|
+
* registerSlotComponents({ BookmarkButton })
|
|
21
|
+
*
|
|
22
|
+
* // A plugin / app contributes the chip into the resource-edit header:
|
|
23
|
+
* panel.renderHook(
|
|
24
|
+
* 'panels::resource.pages.edit-record.header.actions.before',
|
|
25
|
+
* (ctx) => [
|
|
26
|
+
* SlotComponent.make('BookmarkButton').props({
|
|
27
|
+
* basePath: ctx.basePath,
|
|
28
|
+
* resourceSlug: ctx.resource?.getSlug(),
|
|
29
|
+
* recordId: ctx.recordId,
|
|
30
|
+
* }),
|
|
31
|
+
* ],
|
|
32
|
+
* )
|
|
33
|
+
*/
|
|
34
|
+
export class SlotComponent extends Element {
|
|
35
|
+
_componentName;
|
|
36
|
+
_props;
|
|
37
|
+
constructor(componentName) {
|
|
38
|
+
super();
|
|
39
|
+
this._componentName = componentName;
|
|
40
|
+
}
|
|
41
|
+
static make(componentName) {
|
|
42
|
+
return new SlotComponent(componentName);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Static props passed verbatim to the registered component. Must be
|
|
46
|
+
* JSON-serialisable — they ride through `viewProps` to the client.
|
|
47
|
+
* Successive calls merge shallowly with the previous bag.
|
|
48
|
+
*/
|
|
49
|
+
props(props) {
|
|
50
|
+
this._props = { ...(this._props ?? {}), ...props };
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
getComponentName() {
|
|
54
|
+
return this._componentName;
|
|
55
|
+
}
|
|
56
|
+
getType() { return 'slotComponent'; }
|
|
57
|
+
toMeta() {
|
|
58
|
+
return {
|
|
59
|
+
type: 'slotComponent',
|
|
60
|
+
component: this._componentName,
|
|
61
|
+
...(this._props ? { props: this._props } : {}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=SlotComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlotComponent.js","sourceRoot":"","sources":["../../src/schema/SlotComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAO;IAC9B,cAAc,CAAQ;IACtB,MAAM,CAA0B;IAE1C,YAAsB,aAAqB;QACzC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,cAAc,GAAG,aAAa,CAAA;IACrC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,aAAqB;QAC/B,OAAO,IAAI,aAAa,CAAC,aAAa,CAAC,CAAA;IACzC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAA8B;QAClC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAA;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAA;IAC5B,CAAC;IAEQ,OAAO,KAAa,OAAO,eAAe,CAAA,CAAC,CAAC;IAE5C,MAAM;QACb,OAAO;YACL,IAAI,EAAE,eAAwB;YAC9B,SAAS,EAAE,IAAI,CAAC,cAAc;YAC9B,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/C,CAAA;IACH,CAAC;CACF"}
|
package/dist/schema/Wizard.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { Element } from './Element.js';
|
|
2
|
+
/**
|
|
3
|
+
* Context handed to `Step.beforeValidation` / `afterValidation` hooks.
|
|
4
|
+
* Mirrors the shape used by Form lifecycle hooks (record + user; values
|
|
5
|
+
* are passed positionally so handlers can mutate them in place).
|
|
6
|
+
*/
|
|
7
|
+
export interface StepValidationContext {
|
|
8
|
+
record?: unknown;
|
|
9
|
+
user?: unknown;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Hook signature for `Step.beforeValidation` / `afterValidation`.
|
|
13
|
+
* Throwing aborts the wizard advance with a 422 stamped under the
|
|
14
|
+
* reserved `_step` error key — surface a user-facing message via the
|
|
15
|
+
* thrown Error's `.message`.
|
|
16
|
+
*/
|
|
17
|
+
export type StepValidationHook = (values: Record<string, unknown>, ctx: StepValidationContext) => void | Promise<void>;
|
|
2
18
|
/**
|
|
3
19
|
* Single step inside a `Wizard`. Holds a label, optional icon/description,
|
|
4
20
|
* and a list of child Elements. Children resolve unconditionally on every
|
|
@@ -9,6 +25,8 @@ export declare class Step extends Element {
|
|
|
9
25
|
private _label;
|
|
10
26
|
private _icon?;
|
|
11
27
|
private _description?;
|
|
28
|
+
private _beforeValidation?;
|
|
29
|
+
private _afterValidation?;
|
|
12
30
|
private constructor();
|
|
13
31
|
static make(label: string): Step;
|
|
14
32
|
/** Icon shown next to the step label (registry key). */
|
|
@@ -17,6 +35,25 @@ export declare class Step extends Element {
|
|
|
17
35
|
description(d: string): this;
|
|
18
36
|
/** Set the step's children. Any Element type is accepted. */
|
|
19
37
|
schema(elements: Element[]): this;
|
|
38
|
+
/**
|
|
39
|
+
* Runs on the server BEFORE the step's fields are validated when the
|
|
40
|
+
* user clicks Next. Use to mutate `values` in place (e.g. stamp a
|
|
41
|
+
* computed field needed by validators) or run an async availability
|
|
42
|
+
* check that should block advance. Throw an Error to halt — the
|
|
43
|
+
* thrown message lands under the reserved `_step` key in the 422
|
|
44
|
+
* response so the renderer can show it next to the Next button.
|
|
45
|
+
*/
|
|
46
|
+
beforeValidation(fn: StepValidationHook): this;
|
|
47
|
+
/**
|
|
48
|
+
* Runs on the server AFTER the step's validators pass and before the
|
|
49
|
+
* 200 advance response. Use for cross-field invariants, side-effects
|
|
50
|
+
* that should fire only on confirmed advance, or computed-field stamps
|
|
51
|
+
* that downstream steps will read. Throw to halt — same `_step` key
|
|
52
|
+
* convention as `beforeValidation`.
|
|
53
|
+
*/
|
|
54
|
+
afterValidation(fn: StepValidationHook): this;
|
|
55
|
+
getBeforeValidation(): StepValidationHook | undefined;
|
|
56
|
+
getAfterValidation(): StepValidationHook | undefined;
|
|
20
57
|
getType(): string;
|
|
21
58
|
toMeta(): Record<string, unknown>;
|
|
22
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.d.ts","sourceRoot":"","sources":["../../src/schema/Wizard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;;;;GAKG;AACH,qBAAa,IAAK,SAAQ,OAAO;
|
|
1
|
+
{"version":3,"file":"Wizard.d.ts","sourceRoot":"","sources":["../../src/schema/Wizard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAI,OAAO,CAAA;CACjB;AAED;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,EAAK,qBAAqB,KAC1B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAEzB;;;;;GAKG;AACH,qBAAa,IAAK,SAAQ,OAAO;IAMX,OAAO,CAAC,MAAM;IALlC,OAAO,CAAC,KAAK,CAAC,CAAQ;IACtB,OAAO,CAAC,YAAY,CAAC,CA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schema/Wizard.js
CHANGED
|
@@ -9,6 +9,8 @@ export class Step extends Element {
|
|
|
9
9
|
_label;
|
|
10
10
|
_icon;
|
|
11
11
|
_description;
|
|
12
|
+
_beforeValidation;
|
|
13
|
+
_afterValidation;
|
|
12
14
|
constructor(_label) {
|
|
13
15
|
super();
|
|
14
16
|
this._label = _label;
|
|
@@ -25,6 +27,25 @@ export class Step extends Element {
|
|
|
25
27
|
this._children = elements;
|
|
26
28
|
return this;
|
|
27
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Runs on the server BEFORE the step's fields are validated when the
|
|
32
|
+
* user clicks Next. Use to mutate `values` in place (e.g. stamp a
|
|
33
|
+
* computed field needed by validators) or run an async availability
|
|
34
|
+
* check that should block advance. Throw an Error to halt — the
|
|
35
|
+
* thrown message lands under the reserved `_step` key in the 422
|
|
36
|
+
* response so the renderer can show it next to the Next button.
|
|
37
|
+
*/
|
|
38
|
+
beforeValidation(fn) { this._beforeValidation = fn; return this; }
|
|
39
|
+
/**
|
|
40
|
+
* Runs on the server AFTER the step's validators pass and before the
|
|
41
|
+
* 200 advance response. Use for cross-field invariants, side-effects
|
|
42
|
+
* that should fire only on confirmed advance, or computed-field stamps
|
|
43
|
+
* that downstream steps will read. Throw to halt — same `_step` key
|
|
44
|
+
* convention as `beforeValidation`.
|
|
45
|
+
*/
|
|
46
|
+
afterValidation(fn) { this._afterValidation = fn; return this; }
|
|
47
|
+
getBeforeValidation() { return this._beforeValidation; }
|
|
48
|
+
getAfterValidation() { return this._afterValidation; }
|
|
28
49
|
getType() { return 'step'; }
|
|
29
50
|
toMeta() {
|
|
30
51
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.js","sourceRoot":"","sources":["../../src/schema/Wizard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"Wizard.js","sourceRoot":"","sources":["../../src/schema/Wizard.ts"],"names":[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YAC9B,OAAO,EAAM,IAAI,CAAC,QAAQ;SAC3B,CAAA;IACH,CAAC;CACF"}
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -22,5 +22,6 @@ export { Group } from './Group.js';
|
|
|
22
22
|
export { Fieldset } from './Fieldset.js';
|
|
23
23
|
export { Split, type SplitFrom } from './Split.js';
|
|
24
24
|
export { Wizard, Step } from './Wizard.js';
|
|
25
|
+
export { SlotComponent } from './SlotComponent.js';
|
|
25
26
|
export { resolveSchema, registerResolver, type SchemaDefinition, type SchemaContext, type RenderContext, type RenderMode, type ElementResolver, } from './resolveSchema.js';
|
|
26
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,QAAQ,EAA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M,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAA"}
|
package/dist/schema/index.js
CHANGED
|
@@ -22,5 +22,6 @@ export { Group } from './Group.js';
|
|
|
22
22
|
export { Fieldset } from './Fieldset.js';
|
|
23
23
|
export { Split } from './Split.js';
|
|
24
24
|
export { Wizard, Step } from './Wizard.js';
|
|
25
|
+
export { SlotComponent } from './SlotComponent.js';
|
|
25
26
|
export { resolveSchema, registerResolver, } from './resolveSchema.js';
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
package/dist/schema/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,GAKR,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,EAAkD,MAAM,WAAW,CAAA;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,KAAK,EAAkB,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAuB,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,QAAQ,EAA0B,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,C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EAAkB,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,QAAQ,EAA0B,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAuB,MAAQ,cAAc,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAuB,MAAQ,cAAc,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAkB,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EACL,aAAa,EACb,gBAAgB,GAMjB,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slot-components/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Slot-component runtime registry — opt-in component registration for
|
|
2
|
+
// `SlotComponent` schema elements. Imported by panel `bootstrap/providers.ts`
|
|
3
|
+
// or by a plugin's `register(panel)` step (e.g. `@pilotiq-pro/ai`'s
|
|
4
|
+
// resource-header agents dropdown).
|
|
5
|
+
export { registerSlotComponents, getSlotComponent, } from './registry.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/slot-components/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,8EAA8E;AAC9E,oEAAoE;AACpE,oCAAoC;AACpC,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GAGjB,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Render-time component registry for `SlotComponent` schema elements.
|
|
4
|
+
* Mirrors the widget / entry registry pattern: users register components
|
|
5
|
+
* by name in their app's `bootstrap/providers.ts` (or via a plugin's
|
|
6
|
+
* `register(panel)` hook), the `SlotComponent` ships the registered name
|
|
7
|
+
* on the wire (`{ component: 'BookmarkButton' }`), and the renderer
|
|
8
|
+
* looks up the actual component at render through `getSlotComponent()`.
|
|
9
|
+
*
|
|
10
|
+
* Why a runtime registry rather than the build-time `_components.ts`
|
|
11
|
+
* manifest the icon system uses: slot components typically live in plugin
|
|
12
|
+
* packages or app-level bootstrap files, not on Resource / Global / Page
|
|
13
|
+
* top-level statics, so the existing manifest walker doesn't see them. A
|
|
14
|
+
* runtime register-by-name keeps the wire compact and mirrors the
|
|
15
|
+
* `registerWidgetComponents / registerEntryComponents` precedent.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // bootstrap/providers.ts
|
|
19
|
+
* import { registerSlotComponents } from '@pilotiq/pilotiq/slot-components'
|
|
20
|
+
* import { BookmarkButton } from '#components/BookmarkButton.js'
|
|
21
|
+
* registerSlotComponents({ BookmarkButton })
|
|
22
|
+
*
|
|
23
|
+
* // Then a render-hook contribution (or any schema slot) can reference it:
|
|
24
|
+
* panel.renderHook(
|
|
25
|
+
* 'panels::resource.pages.edit-record.header.actions.before',
|
|
26
|
+
* () => [SlotComponent.make('BookmarkButton').props({ … })],
|
|
27
|
+
* )
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Props handed to every registered slot component. The schema-side
|
|
31
|
+
* `SlotComponent.props({...})` setter ships through verbatim — pack
|
|
32
|
+
* everything the component needs into that bag (basePath, recordId,
|
|
33
|
+
* pre-resolved agent metas, etc).
|
|
34
|
+
*/
|
|
35
|
+
export type SlotComponentProps = Record<string, unknown>;
|
|
36
|
+
export type SlotComponent = ComponentType<SlotComponentProps>;
|
|
37
|
+
export declare function registerSlotComponents(map: Record<string, SlotComponent>): void;
|
|
38
|
+
export declare function getSlotComponent(name: string): SlotComponent | undefined;
|
|
39
|
+
/** Test-only: clear the registry. Not exported from the public entry. */
|
|
40
|
+
export declare function _resetSlotComponentRegistryForTests(): void;
|
|
41
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/slot-components/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACxD,MAAM,MAAM,aAAa,GAAQ,aAAa,CAAC,kBAAkB,CAAC,CAAA;AAIlE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,IAAI,CAK/E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAExE;AAED,yEAAyE;AACzE,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const registry = {};
|
|
2
|
+
export function registerSlotComponents(map) {
|
|
3
|
+
for (const key of Object.keys(map)) {
|
|
4
|
+
const c = map[key];
|
|
5
|
+
if (c)
|
|
6
|
+
registry[key] = c;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function getSlotComponent(name) {
|
|
10
|
+
return registry[name];
|
|
11
|
+
}
|
|
12
|
+
/** Test-only: clear the registry. Not exported from the public entry. */
|
|
13
|
+
export function _resetSlotComponentRegistryForTests() {
|
|
14
|
+
for (const key of Object.keys(registry))
|
|
15
|
+
delete registry[key];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/slot-components/registry.ts"],"names":[],"mappings":"AAuCA,MAAM,QAAQ,GAAkC,EAAE,CAAA;AAElD,MAAM,UAAU,sBAAsB,CAAC,GAAkC;IACvE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAA;QAClB,IAAI,CAAC;YAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAA;AACvB,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,mCAAmC;IACjD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;AAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pilotiq/pilotiq",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "View-based admin panel for RudderJS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"import": "./dist/entries/index.js",
|
|
51
51
|
"types": "./dist/entries/index.d.ts"
|
|
52
52
|
},
|
|
53
|
+
"./slot-components": {
|
|
54
|
+
"import": "./dist/slot-components/index.js",
|
|
55
|
+
"types": "./dist/slot-components/index.d.ts"
|
|
56
|
+
},
|
|
53
57
|
"./richtext": {
|
|
54
58
|
"import": "./dist/richtext/index.js",
|
|
55
59
|
"types": "./dist/richtext/index.d.ts"
|
package/src/Column.test.ts
CHANGED
|
@@ -137,4 +137,27 @@ describe('Column', () => {
|
|
|
137
137
|
assert.equal(typeof col.getRecordUrlHandler(), 'function')
|
|
138
138
|
})
|
|
139
139
|
})
|
|
140
|
+
|
|
141
|
+
describe('beforeStateUpdated / afterStateUpdated accessors', () => {
|
|
142
|
+
it('return undefined when no hooks are set', () => {
|
|
143
|
+
const col = Column.make('title')
|
|
144
|
+
assert.equal(col.getBeforeStateUpdated(), undefined)
|
|
145
|
+
assert.equal(col.getAfterStateUpdated(), undefined)
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
it('return the registered hook function', () => {
|
|
149
|
+
const before = async () => {}
|
|
150
|
+
const after = () => {}
|
|
151
|
+
const col = Column.make('title').beforeStateUpdated(before).afterStateUpdated(after)
|
|
152
|
+
assert.equal(col.getBeforeStateUpdated(), before)
|
|
153
|
+
assert.equal(col.getAfterStateUpdated(), after)
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('hooks are not serialized into the wire shape', () => {
|
|
157
|
+
const col = Column.make('title').beforeStateUpdated(() => {}).afterStateUpdated(() => {})
|
|
158
|
+
const meta = col.toMeta()
|
|
159
|
+
assert.equal((meta as Record<string, unknown>)['beforeStateUpdated'], undefined)
|
|
160
|
+
assert.equal((meta as Record<string, unknown>)['afterStateUpdated'], undefined)
|
|
161
|
+
})
|
|
162
|
+
})
|
|
140
163
|
})
|
package/src/Column.ts
CHANGED
|
@@ -25,6 +25,23 @@ export type ColumnType =
|
|
|
25
25
|
* inside `loadTableRecords` so the renderer just reads the result. */
|
|
26
26
|
export type ColumnDisabledFn = (record: Record<string, unknown>) => boolean
|
|
27
27
|
|
|
28
|
+
/** Context handed to `Column.beforeStateUpdated / afterStateUpdated`
|
|
29
|
+
* hooks on editable cell columns. `record` is the row as loaded
|
|
30
|
+
* *before* the update; `user` is the resolved panel user. */
|
|
31
|
+
export interface CellStateHookContext {
|
|
32
|
+
record: Record<string, unknown>
|
|
33
|
+
user?: unknown
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Hook signature for `Column.beforeStateUpdated / afterStateUpdated`.
|
|
37
|
+
* Return value is ignored — these are side-effect hooks. Throw an
|
|
38
|
+
* Error to halt the PATCH; the thrown message lands under `errors._cell`
|
|
39
|
+
* in the 422 response so the renderer can surface it next to the cell. */
|
|
40
|
+
export type CellStateHook = (
|
|
41
|
+
value: unknown,
|
|
42
|
+
ctx: CellStateHookContext,
|
|
43
|
+
) => void | Promise<void>
|
|
44
|
+
|
|
28
45
|
/** SelectColumn option shape — mirrors `SelectField`'s static option form. */
|
|
29
46
|
export interface ColumnSelectOption {
|
|
30
47
|
value: string
|
|
@@ -214,6 +231,8 @@ export class Column extends Element {
|
|
|
214
231
|
protected _confirm?: string
|
|
215
232
|
protected _staticDisabled = false
|
|
216
233
|
protected _disabledFn?: ColumnDisabledFn
|
|
234
|
+
protected _beforeStateUpdated?: CellStateHook
|
|
235
|
+
protected _afterStateUpdated?: CellStateHook
|
|
217
236
|
|
|
218
237
|
protected constructor(name: string) {
|
|
219
238
|
super()
|
|
@@ -448,6 +467,31 @@ export class Column extends Element {
|
|
|
448
467
|
*/
|
|
449
468
|
confirm(message: string): this { this._confirm = message; return this }
|
|
450
469
|
|
|
470
|
+
/**
|
|
471
|
+
* Run a hook on the server BEFORE the editable cell's value is written
|
|
472
|
+
* to the database. Receives the coerced + validated value plus the
|
|
473
|
+
* current row as `{ record, user }`. Use for cross-cell invariants,
|
|
474
|
+
* audit-log writes that must precede the update, or async availability
|
|
475
|
+
* checks that the schema-level validators don't cover. Throw an Error
|
|
476
|
+
* to halt — the thrown message lands under the reserved `_cell` error
|
|
477
|
+
* key in the 422 response.
|
|
478
|
+
*/
|
|
479
|
+
beforeStateUpdated(fn: CellStateHook): this { this._beforeStateUpdated = fn; return this }
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Run a hook on the server AFTER the editable cell's value is written
|
|
483
|
+
* to the database. Same context shape as `beforeStateUpdated`. Use for
|
|
484
|
+
* notifications, broadcast events, or follow-up writes that should
|
|
485
|
+
* fire only on a confirmed save. Throwing here returns 422 with the
|
|
486
|
+
* message under `_cell` — the row is already updated, so prefer
|
|
487
|
+
* surfacing the error and letting the user retry rather than rolling
|
|
488
|
+
* back manually.
|
|
489
|
+
*/
|
|
490
|
+
afterStateUpdated(fn: CellStateHook): this { this._afterStateUpdated = fn; return this }
|
|
491
|
+
|
|
492
|
+
getBeforeStateUpdated(): CellStateHook | undefined { return this._beforeStateUpdated }
|
|
493
|
+
getAfterStateUpdated(): CellStateHook | undefined { return this._afterStateUpdated }
|
|
494
|
+
|
|
451
495
|
/**
|
|
452
496
|
* Render the inline-edit control disabled. Pass `true` (or call with no
|
|
453
497
|
* args) for static disable; pass a `(record) => boolean` predicate for
|
package/src/RenderHook.ts
CHANGED
|
@@ -54,12 +54,20 @@ export type RenderHookName =
|
|
|
54
54
|
| 'panels::resource.pages.list-records.table.before'
|
|
55
55
|
| 'panels::resource.pages.list-records.table.after'
|
|
56
56
|
| 'panels::resource.pages.list-records.tabs.end'
|
|
57
|
+
| 'panels::resource.pages.list-records.header.actions.before'
|
|
58
|
+
| 'panels::resource.pages.list-records.header.actions.after'
|
|
57
59
|
| 'panels::resource.pages.create-record.form.before'
|
|
58
60
|
| 'panels::resource.pages.create-record.form.after'
|
|
61
|
+
| 'panels::resource.pages.create-record.header.actions.before'
|
|
62
|
+
| 'panels::resource.pages.create-record.header.actions.after'
|
|
59
63
|
| 'panels::resource.pages.edit-record.form.before'
|
|
60
64
|
| 'panels::resource.pages.edit-record.form.after'
|
|
65
|
+
| 'panels::resource.pages.edit-record.header.actions.before'
|
|
66
|
+
| 'panels::resource.pages.edit-record.header.actions.after'
|
|
61
67
|
| 'panels::resource.pages.view-record.start'
|
|
62
68
|
| 'panels::resource.pages.view-record.end'
|
|
69
|
+
| 'panels::resource.pages.view-record.header.actions.before'
|
|
70
|
+
| 'panels::resource.pages.view-record.header.actions.after'
|
|
63
71
|
| 'panels::global-search.results.before'
|
|
64
72
|
| 'panels::global-search.results.after'
|
|
65
73
|
|
|
@@ -94,12 +102,20 @@ export const PAGE_HOOK_NAMES = [
|
|
|
94
102
|
'panels::resource.pages.list-records.table.before',
|
|
95
103
|
'panels::resource.pages.list-records.table.after',
|
|
96
104
|
'panels::resource.pages.list-records.tabs.end',
|
|
105
|
+
'panels::resource.pages.list-records.header.actions.before',
|
|
106
|
+
'panels::resource.pages.list-records.header.actions.after',
|
|
97
107
|
'panels::resource.pages.create-record.form.before',
|
|
98
108
|
'panels::resource.pages.create-record.form.after',
|
|
109
|
+
'panels::resource.pages.create-record.header.actions.before',
|
|
110
|
+
'panels::resource.pages.create-record.header.actions.after',
|
|
99
111
|
'panels::resource.pages.edit-record.form.before',
|
|
100
112
|
'panels::resource.pages.edit-record.form.after',
|
|
113
|
+
'panels::resource.pages.edit-record.header.actions.before',
|
|
114
|
+
'panels::resource.pages.edit-record.header.actions.after',
|
|
101
115
|
'panels::resource.pages.view-record.start',
|
|
102
116
|
'panels::resource.pages.view-record.end',
|
|
117
|
+
'panels::resource.pages.view-record.header.actions.before',
|
|
118
|
+
'panels::resource.pages.view-record.header.actions.after',
|
|
103
119
|
'panels::global-search.results.before',
|
|
104
120
|
'panels::global-search.results.after',
|
|
105
121
|
] as const satisfies readonly RenderHookName[]
|