mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
Actually change version schema
This commit is contained in:
@@ -233,14 +233,24 @@ Promise.all([
|
|||||||
if (id === version) return
|
if (id === version) return
|
||||||
|
|
||||||
const newCollections = versionSchemas[id].getCollections()
|
const newCollections = versionSchemas[id].getCollections()
|
||||||
RegistryFetcher(COLLECTIONS, id).then(() => {
|
RegistryFetcher(newCollections, id).then(() => {
|
||||||
SCHEMAS = versionSchemas[id].getSchemas(COLLECTIONS)
|
|
||||||
COLLECTIONS = newCollections
|
const newSchemas = versionSchemas[id].getSchemas(newCollections)
|
||||||
|
|
||||||
|
const fixModel = (model: any) => {
|
||||||
|
if (model.schema) {
|
||||||
|
models[model.id].schema = newSchemas.get(model.schema)
|
||||||
|
models[model.id].validate()
|
||||||
|
models[model.id].invalidate()
|
||||||
|
} else if (model.children) {
|
||||||
|
model.children.forEach(fixModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config.models.forEach(fixModel)
|
||||||
|
|
||||||
treeVersionLabel.textContent = id
|
treeVersionLabel.textContent = id
|
||||||
version = id
|
version = id
|
||||||
ga('set', 'dimension3', version);
|
ga('set', 'dimension3', version);
|
||||||
updateModel()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,10 +35,14 @@ export const renderHtml: Hook<[any, Mounter], [string, string, string]> = {
|
|||||||
|
|
||||||
choice({ choices, config, switchNode }, path, value, mounter) {
|
choice({ choices, config, switchNode }, path, value, mounter) {
|
||||||
const choice = switchNode.activeCase(path, true)
|
const choice = switchNode.activeCase(path, true)
|
||||||
const pathWithContext = (config?.context) ?
|
const pathWithContext = (config?.context) ? new ModelPath(path.getModel(), new Path(path.getArray(), [config.context])) : path
|
||||||
new ModelPath(path.getModel(), new Path(path.getArray(), [config.context])) : path
|
|
||||||
const pathWithChoiceContext = config?.choiceContext ? new Path([], [config.choiceContext]) : config?.context ? new Path([], [config.context]) : path
|
const pathWithChoiceContext = config?.choiceContext ? new Path([], [config.choiceContext]) : config?.context ? new Path([], [config.context]) : path
|
||||||
|
|
||||||
|
const [prefix, suffix, body] = choice.node.hook(this, pathWithContext, value, mounter)
|
||||||
|
if (choices.length === 1) {
|
||||||
|
return [prefix, suffix, body]
|
||||||
|
}
|
||||||
|
|
||||||
const inputId = mounter.register(el => {
|
const inputId = mounter.register(el => {
|
||||||
(el as HTMLSelectElement).value = choice.type
|
(el as HTMLSelectElement).value = choice.type
|
||||||
el.addEventListener('change', () => {
|
el.addEventListener('change', () => {
|
||||||
@@ -52,7 +56,6 @@ export const renderHtml: Hook<[any, Mounter], [string, string, string]> = {
|
|||||||
</option>`).join('')}
|
</option>`).join('')}
|
||||||
</select>`
|
</select>`
|
||||||
|
|
||||||
const [prefix, suffix, body] = choice.node.hook(this, pathWithContext, value, mounter)
|
|
||||||
return [prefix, inject + suffix, body]
|
return [prefix, inject + suffix, body]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user