|
|
|
@ -62,12 +62,20 @@ export class EditableProvider {
|
|
|
|
private constructor(opts: EditableOpts) {
|
|
|
|
private constructor(opts: EditableOpts) {
|
|
|
|
this.opts = opts;
|
|
|
|
this.opts = opts;
|
|
|
|
this.soma = Soma.require();
|
|
|
|
this.soma = Soma.require();
|
|
|
|
this.runtime = this.soma.runtime(editableMorfo, {});
|
|
|
|
this.runtime = this.soma.runtime(editableMorfo, {
|
|
|
|
|
|
|
|
props: {
|
|
|
|
|
|
|
|
editing: () => this.isEditing,
|
|
|
|
|
|
|
|
empty: () => this.isEmpty,
|
|
|
|
|
|
|
|
disabled: () => this.opts.disabled.current,
|
|
|
|
|
|
|
|
readonly: () => this.opts.readonly.current
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
this.runtimePart = this.runtime.part('provider', {
|
|
|
|
this.runtimePart = this.runtime.part('provider', {
|
|
|
|
id: opts.id,
|
|
|
|
id: opts.id,
|
|
|
|
ref: opts.ref,
|
|
|
|
ref: opts.ref,
|
|
|
|
owner: this,
|
|
|
|
owner: this,
|
|
|
|
context: EditableProvider.ctx
|
|
|
|
context: EditableProvider.ctx,
|
|
|
|
|
|
|
|
syncAttrs: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.draft = opts.value.current;
|
|
|
|
this.draft = opts.value.current;
|
|
|
|
@ -134,11 +142,7 @@ export class EditableProvider {
|
|
|
|
|
|
|
|
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
this.runtimePart.assert({
|
|
|
|
this.runtimePart.assert({
|
|
|
|
...this.runtimePart.props,
|
|
|
|
...this.runtimePart.props
|
|
|
|
'data-editing': boolToEmptyStrOrUndef(this.isEditing),
|
|
|
|
|
|
|
|
'data-empty': boolToEmptyStrOrUndef(this.isEmpty),
|
|
|
|
|
|
|
|
'data-disabled': boolToEmptyStrOrUndef(this.opts.disabled.current),
|
|
|
|
|
|
|
|
'data-readonly': boolToEmptyStrOrUndef(this.opts.readonly.current)
|
|
|
|
|
|
|
|
} as const)
|
|
|
|
} as const)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -162,16 +166,14 @@ export class EditableAreaProvider {
|
|
|
|
this.runtimePart = this.provider.runtime.part('area', {
|
|
|
|
this.runtimePart = this.provider.runtime.part('area', {
|
|
|
|
id: opts.id,
|
|
|
|
id: opts.id,
|
|
|
|
ref: opts.ref,
|
|
|
|
ref: opts.ref,
|
|
|
|
owner: this
|
|
|
|
owner: this,
|
|
|
|
|
|
|
|
syncAttrs: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
this.runtimePart.assert({
|
|
|
|
this.runtimePart.assert({
|
|
|
|
...this.runtimePart.props,
|
|
|
|
...this.runtimePart.props
|
|
|
|
'data-editing': boolToEmptyStrOrUndef(this.provider.isEditing),
|
|
|
|
|
|
|
|
'data-disabled': boolToEmptyStrOrUndef(this.provider.opts.disabled.current),
|
|
|
|
|
|
|
|
'data-readonly': boolToEmptyStrOrUndef(this.provider.opts.readonly.current)
|
|
|
|
|
|
|
|
} as const)
|
|
|
|
} as const)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|