Михаил Капелько vor 10 Monaten
Ursprung
Commit
e8f330ad2a
12 geänderte Dateien mit 47 neuen und 12 gelöschten Zeilen
  1. +4
    -1
      Modules/MeetupIdX/src/MeetupId.Generated.swift
  2. +8
    -1
      Utilities/platform/2/generation/fieldFormat.py
  3. +2
    -1
      Utilities/platform/2/generation/generateContextFields.py
  4. +2
    -1
      Utilities/platform/2/generation/generateModelFields.py
  5. +5
    -0
      Utilities/platform/2/generation/isPipeMany.py
  6. +6
    -0
      Utilities/platform/2/generation/pipeBusSource.py
  7. +4
    -2
      Utilities/platform/2/generation/pipeFormat.py
  8. +2
    -1
      Utilities/platform/2/generation/sectionGeneratedPipes.py
  9. +1
    -0
      Utilities/platform/2/templates/context-field
  10. +1
    -0
      Utilities/platform/2/templates/model-field
  11. +12
    -0
      Utilities/platform/2/templates/section-generated-pipe-many
  12. +0
    -5
      Utilities/platform/2/templates/section-generated-pipe-src-bus

+ 4
- 1
Modules/MeetupIdX/src/MeetupId.Generated.swift Datei anzeigen

@@ -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 {
)




}

}


+ 8
- 1
Utilities/platform/2/generation/fieldFormat.py Datei anzeigen

@@ -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

+ 2
- 1
Utilities/platform/2/generation/generateContextFields.py Datei anzeigen

@@ -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])


+ 2
- 1
Utilities/platform/2/generation/generateModelFields.py Datei anzeigen

@@ -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
- 0
Utilities/platform/2/generation/isPipeMany.py Datei anzeigen

@@ -0,0 +1,5 @@
def isPipeMany(name, entity):
if name in entity.pipes:
props = entity.pipes[name]
return "many" in props
return False

+ 6
- 0
Utilities/platform/2/generation/pipeBusSource.py Datei anzeigen

@@ -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)

+ 4
- 2
Utilities/platform/2/generation/pipeFormat.py Datei anzeigen

@@ -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


+ 2
- 1
Utilities/platform/2/generation/sectionGeneratedPipes.py Datei anzeigen

@@ -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
- 0
Utilities/platform/2/templates/context-field Datei anzeigen

@@ -1,2 +1,3 @@
var %NAME%: %TYPE% { get }
var %NAME%: MPAK.Recent<%TYPE%> { get }
var %NAME%: MPAK.Many<%TYPE%> { get }

+ 1
- 0
Utilities/platform/2/templates/model-field Datei anzeigen

@@ -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
- 0
Utilities/platform/2/templates/section-generated-pipe-many Datei anzeigen

@@ -0,0 +1,12 @@
ctrl.%PIPE%(
dbg: "%SHORT_SRC%",
sub: %SUB%,
%SRC%.eraseToAnyPublisher(),
{
$0.%NAME% = $1
},
{ m, _ in m.%NAME%.keys = [] }
)

+ 0
- 5
Utilities/platform/2/templates/section-generated-pipe-src-bus Datei anzeigen

@@ -1,6 +1 @@
Bus.events.compactMap { Bus.convertKeyValue(%BUS_KEY%, $0) }.map { (k: String, v: %BUS_VALUE_TYPE%) in v }

Laden…
Abbrechen
Speichern