d
This commit is contained in:
@@ -144,10 +144,11 @@ extension MeetupId {
|
||||
)
|
||||
|
||||
|
||||
|
||||
ctrl.pipeValue(
|
||||
dbg: "testTUI",
|
||||
sub: nil,
|
||||
Bus.events.compactMap { Bus.convertKeyValue(K.testTextUI, $0) }.map { (k: String, v: MPAK.Many<String>) in v }.eraseToAnyPublisher(),
|
||||
many.eraseToAnyPublisher(),
|
||||
{
|
||||
$0.testTextUI = $1
|
||||
},
|
||||
@@ -155,6 +156,8 @@ extension MeetupId {
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
from generation.isPipeMany import *
|
||||
from generation.isPipeRecent import *
|
||||
|
||||
def fieldFormat(fmtPlain, fmtRecent, name, structure):
|
||||
def fieldFormat(fmtMany, fmtPlain, fmtRecent, name, structure):
|
||||
fmt = fmtPlain
|
||||
if (
|
||||
isPipeRecent(name, structure.core) or
|
||||
isPipeRecent(name, structure.service)
|
||||
):
|
||||
fmt = fmtRecent
|
||||
|
||||
if (
|
||||
isPipeMany(name, structure.core) or
|
||||
isPipeMany(name, structure.service)
|
||||
):
|
||||
fmt = fmtMany
|
||||
return fmt
|
||||
|
||||
@@ -5,11 +5,12 @@ def generateContextFields(c):
|
||||
lines = c.readFile(fileName)
|
||||
fmtPlain = lines[0]
|
||||
fmtRecent = lines[1]
|
||||
fmtMany = lines[2]
|
||||
fields = []
|
||||
|
||||
for key in c.structure.model.fields:
|
||||
values = c.structure.model.fields[key]
|
||||
fmt = fieldFormat(fmtPlain, fmtRecent, key, c.structure)
|
||||
fmt = fieldFormat(fmtMany, fmtPlain, fmtRecent, key, c.structure)
|
||||
ln = fmt \
|
||||
.replace("%NAME%", key) \
|
||||
.replace("%TYPE%", values[0])
|
||||
|
||||
@@ -5,11 +5,12 @@ def generateModelFields(c):
|
||||
lines = c.readFile(fileName)
|
||||
fmtPlain = lines[0]
|
||||
fmtRecent = lines[1]
|
||||
fmtMany = lines[2]
|
||||
fields = []
|
||||
|
||||
for key in c.structure.model.fields:
|
||||
values = c.structure.model.fields[key]
|
||||
fmt = fieldFormat(fmtPlain, fmtRecent, key, c.structure)
|
||||
fmt = fieldFormat(fmtMany, fmtPlain, fmtRecent, key, c.structure)
|
||||
ln = fmt \
|
||||
.replace("%NAME%", key) \
|
||||
.replace("%TYPE%", values[0]) \
|
||||
|
||||
5
Utilities/platform/2/generation/isPipeMany.py
Normal file
5
Utilities/platform/2/generation/isPipeMany.py
Normal file
@@ -0,0 +1,5 @@
|
||||
def isPipeMany(name, entity):
|
||||
if name in entity.pipes:
|
||||
props = entity.pipes[name]
|
||||
return "many" in props
|
||||
return False
|
||||
@@ -1,5 +1,11 @@
|
||||
from generation.isPipeMany import *
|
||||
|
||||
def pipeBusSource(name, entity, busKey, structure, fmt):
|
||||
valueType = structure.model.fields[name][0]
|
||||
if isPipeMany(name, entity):
|
||||
itemType = structure.model.fields[key][0]
|
||||
valueType = f"MPAK.Many<{itemType}>"
|
||||
|
||||
return fmt \
|
||||
.replace("%BUS_KEY%", busKey) \
|
||||
.replace("%BUS_VALUE_TYPE%", valueType)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
def pipeFormat(fmtExRecent, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, name, entity):
|
||||
def pipeFormat(fmtExRecent, fmtMany, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, name, entity):
|
||||
props = entity.pipes[name]
|
||||
if "recent" and "ex" in props:
|
||||
if "many" in props:
|
||||
return fmtMany
|
||||
elif "recent" and "ex" in props:
|
||||
return fmtExRecent
|
||||
elif "recent" in props:
|
||||
return fmtRecent
|
||||
|
||||
@@ -6,6 +6,7 @@ from generation.pipeSource import *
|
||||
def sectionGeneratedPipes(entity, sub, c):
|
||||
fmtBusPipe = c.readFile(f"{c.dir}/templates/section-generated-pipe-src-bus")[0]
|
||||
fmtExRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-ex-recent")
|
||||
fmtMany = c.readFile(f"{c.dir}/templates/section-generated-pipe-many")
|
||||
fmtRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-recent")
|
||||
fmtSet = c.readFile(f"{c.dir}/templates/section-generated-pipe-set")
|
||||
fmtToggle = c.readFile(f"{c.dir}/templates/section-generated-pipe-toggle")
|
||||
@@ -33,7 +34,7 @@ def sectionGeneratedPipes(entity, sub, c):
|
||||
if src.startswith("K."):
|
||||
src = pipeBusSource(key, entity, src, c.structure, fmtBusPipe)
|
||||
|
||||
fmtPipe = pipeFormat(fmtExRecent, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity)
|
||||
fmtPipe = pipeFormat(fmtExRecent, fmtMany, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity)
|
||||
for fmt in fmtPipe:
|
||||
ln = fmt \
|
||||
.replace("%EX_NAME%", exName) \
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
var %NAME%: %TYPE% { get }
|
||||
var %NAME%: MPAK.Recent<%TYPE%> { get }
|
||||
var %NAME%: MPAK.Many<%TYPE%> { get }
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
public var %NAME%: %TYPE% = %DEFAULT%
|
||||
public var %NAME%: MPAK.Recent<%TYPE%> = .init(%DEFAULT%)
|
||||
public var %NAME%: MPAK.Many<%TYPE%> = .init()
|
||||
|
||||
12
Utilities/platform/2/templates/section-generated-pipe-many
Normal file
12
Utilities/platform/2/templates/section-generated-pipe-many
Normal file
@@ -0,0 +1,12 @@
|
||||
ctrl.%PIPE%(
|
||||
dbg: "%SHORT_SRC%",
|
||||
sub: %SUB%,
|
||||
%SRC%.eraseToAnyPublisher(),
|
||||
{
|
||||
$0.%NAME% = $1
|
||||
},
|
||||
{ m, _ in m.%NAME%.keys = [] }
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1 @@
|
||||
Bus.events.compactMap { Bus.convertKeyValue(%BUS_KEY%, $0) }.map { (k: String, v: %BUS_VALUE_TYPE%) in v }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user