Skip to content

Commit

Permalink
Formatointimuutoksia
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkkahanninen committed Oct 22, 2024
1 parent 8a4f177 commit 0ecb8b7
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions web/app/editor/EditorModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ const ensureModelId = <T extends EditorModel>(
force?: boolean
): Identified<T> | undefined => {
if (model && (force || !isIdentified(model))) {
;(model as any).modelId = calculateModelId(model)
;(model as any).data = null // reset modelData caching
; (model as any).modelId = calculateModelId(model)
; (model as any).data = null // reset modelData caching
}
return model as Identified<T>
}
Expand Down Expand Up @@ -504,9 +504,9 @@ export const createOptionalEmpty = <M extends EditorModel & OptionalModel>(
): OptionalModel =>
isSomeOptionalModel(optModel)
? {
optional: optModel.optional,
optionalPrototype: optModel.optionalPrototype
}
optional: optModel.optional,
optionalPrototype: optModel.optionalPrototype
}
: {}

export const resetOptionalModel = <
Expand Down Expand Up @@ -761,13 +761,13 @@ export const validateModel = <

const pushError =
(model: EditorModel & Contextualized, results: ModelErrorRecord) =>
(error: ModelError) => {
const path = justPath(model.path)
const fullPath = path.concat(error.path || []).join('.')
results[fullPath]
? results[fullPath].push(error)
: (results[fullPath] = [error])
}
(error: ModelError) => {
const path = justPath(model.path)
const fullPath = path.concat(error.path || []).join('.')
results[fullPath]
? results[fullPath].push(error)
: (results[fullPath] = [error])
}

const validateInner = (
model: EditableModel & Contextualized<EditorMappingContext>,
Expand Down Expand Up @@ -865,18 +865,18 @@ const modelItemsRaw = (model?: EditorModel): EditorModel[] =>

const contextualizeProperty =
<M extends ObjectModel & Contextualized<T>, T extends object>(mainModel: M) =>
(
property?: ObjectModelProperty
): ContextualizedObjectModelProperty<M, T> | undefined => {
if (!property) return property
const model = contextualizeChild(mainModel, property.model, property.key)!
return R.mergeRight(property, {
model,
owner: mainModel,
editable:
property.editable === undefined ? mainModel.editable : property.editable
}) as any as ContextualizedObjectModelProperty<M, T>
}
(
property?: ObjectModelProperty
): ContextualizedObjectModelProperty<M, T> | undefined => {
if (!property) return property
const model = contextualizeChild(mainModel, property.model, property.key)!
return R.mergeRight(property, {
model,
owner: mainModel,
editable:
property.editable === undefined ? mainModel.editable : property.editable
}) as any as ContextualizedObjectModelProperty<M, T>
}

let arrayKeyCounter = 0
export const ensureArrayKey = (v: ListModel) => {
Expand Down

0 comments on commit 0ecb8b7

Please sign in to comment.