d
This commit is contained in:
@@ -93,7 +93,7 @@ extension MeetupId {
|
|||||||
ctrl.pipe(
|
ctrl.pipe(
|
||||||
dbg: "join",
|
dbg: "join",
|
||||||
sub: nil,
|
sub: nil,
|
||||||
Bus.events.compactMap { Bus.convertKeyValue(K.join, $0) }.map { (k: String, v: Void) in v }.eraseToAnyPublisher(),
|
Bus.events.compactMap { Bus.convertKeyValue(K.join, $0) }.map { (k: String, v: Void) in v }.map { _ in }.eraseToAnyPublisher(),
|
||||||
{ $0.join = true },
|
{ $0.join = true },
|
||||||
{ $0.join = false }
|
{ $0.join = false }
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,26 +1,10 @@
|
|||||||
from generation.isNotKeyword import *
|
def pipeBusSource(name, entity, busKey, structure, fmtBusPipe, fmtBusPipeToggle):
|
||||||
|
if "toggle" in entity.pipes[name]:
|
||||||
|
return fmtBusPipeToggle \
|
||||||
|
.replace("%BUS_KEY%", busKey) \
|
||||||
|
.replace("%BUS_VALUE_TYPE%", "Void")
|
||||||
|
|
||||||
def pipeSource(name, entity, structure, fmtBusPipe, fmtBusPipeToggle):
|
valueType = structure.model.fields[name][0]
|
||||||
props = entity.pipes[name]
|
return fmtBusPipe \
|
||||||
if "vm" in props:
|
.replace("%BUS_KEY%", busKey) \
|
||||||
return "core.vm." + name
|
.replace("%BUS_VALUE_TYPE%", valueType)
|
||||||
elif "$vm" in props:
|
|
||||||
return "core.vm.$" + name
|
|
||||||
else:
|
|
||||||
# Если это что-то неизвестное заранее, то ищем строку,
|
|
||||||
# отличную от известных ключевых слов для инструкции pipe.
|
|
||||||
default = "world"
|
|
||||||
src = next(filter(isNotKeyword, props), default)
|
|
||||||
# Прямое обращение к VM.
|
|
||||||
if src.startswith("vm."):
|
|
||||||
src = "core." + src
|
|
||||||
# Обращение к константе шины.
|
|
||||||
elif src.startswith("K."):
|
|
||||||
src = pipeSourceBus(
|
|
||||||
busKey = src
|
|
||||||
busValueType = structure.model.fields[name][0]
|
|
||||||
src = "Bus.events.compactMap { Bus.convertKeyValue(" + busKey + ", $0) }.map { (k: String, v: " + busValueType + ") in v }"
|
|
||||||
# Значение по умолчанию.
|
|
||||||
elif src == default:
|
|
||||||
return default + "." + name
|
|
||||||
return src
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ from generation.pipeFormat import *
|
|||||||
from generation.pipeSource import *
|
from generation.pipeSource import *
|
||||||
|
|
||||||
def sectionGeneratedPipes(entity, sub, c):
|
def sectionGeneratedPipes(entity, sub, c):
|
||||||
fmtBusPipe = c.readFile(f"{c.dir}/templates/section-generated-bus-pipe")
|
fmtBusPipe = c.readFile(f"{c.dir}/templates/section-generated-pipe-src-bus")[0]
|
||||||
fmtBusPipeToggle = c.readFile(f"{c.dir}/templates/section-generated-bus-pipe-toggle")
|
fmtBusPipeToggle = c.readFile(f"{c.dir}/templates/section-generated-pipe-src-bus-toggle")[0]
|
||||||
fmtExRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-ex-recent")
|
fmtExRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-ex-recent")
|
||||||
fmtRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-recent")
|
fmtRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-recent")
|
||||||
fmtSet = c.readFile(f"{c.dir}/templates/section-generated-pipe-set")
|
fmtSet = c.readFile(f"{c.dir}/templates/section-generated-pipe-set")
|
||||||
@@ -32,7 +32,7 @@ def sectionGeneratedPipes(entity, sub, c):
|
|||||||
src = pipeSource(key, entity)
|
src = pipeSource(key, entity)
|
||||||
# Bus.
|
# Bus.
|
||||||
if src.startswith("K."):
|
if src.startswith("K."):
|
||||||
src = pipeBusSource(key, c.structure, fmtBusPipe, fmtBusPipeToggle)
|
src = pipeBusSource(key, entity, src, c.structure, fmtBusPipe, fmtBusPipeToggle)
|
||||||
|
|
||||||
fmtPipe = pipeFormat(fmtExRecent, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity)
|
fmtPipe = pipeFormat(fmtExRecent, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity)
|
||||||
for fmt in fmtPipe:
|
for fmt in fmtPipe:
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Bus.events.compactMap { Bus.convertKeyValue(%BUS_KEY%, $0) }.map { (k: String, v: %BUS_VALUE_TYPE%) in v }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Bus.events.compactMap { Bus.convertKeyValue(%BUS_KEY%, $0) }.map { (k: String, v: %BUS_VALUE_TYPE%) in v }.map { _ in }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user