37 lines
809 B
JavaScript
37 lines
809 B
JavaScript
import SimpleSchema from 'simpl-schema';
|
|
|
|
const ToggleSchema = new SimpleSchema({
|
|
name: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
optional: true,
|
|
},
|
|
enabled: {
|
|
type: Boolean,
|
|
optional: true,
|
|
},
|
|
// if neither disabled or enabled, the condition will be run to determine
|
|
// if the children of the toggle should be active
|
|
condition: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
});
|
|
|
|
const ComputedOnlyToggleSchema = new SimpleSchema({
|
|
// The computed result of the effect
|
|
toggleResult: {
|
|
type: SimpleSchema.oneOf(Number, String, Boolean),
|
|
optional: true,
|
|
},
|
|
});
|
|
|
|
const ComputedToggleSchema = new SimpleSchema()
|
|
.extend(ComputedOnlyToggleSchema)
|
|
.extend(ToggleSchema);
|
|
|
|
export { ToggleSchema, ComputedOnlyToggleSchema, ComputedToggleSchema };
|