@coolon/angular-ui-powerups 0.0.120 → 0.0.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/coolon-angular-ui-powerups.umd.js +54 -16
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +8 -3
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm2015/lib/place/place-component.js +28 -6
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-component.metadata.json +1 -1
- package/esm2015/lib/place/place-definition.js +7 -1
- package/esm2015/lib/place/place-definition.js.map +1 -1
- package/esm2015/lib/place/route/parameter-decorators.js +6 -6
- package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +8 -3
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm5/lib/place/place-component.js +32 -7
- package/esm5/lib/place/place-component.js.map +1 -1
- package/esm5/lib/place/place-definition.js +11 -2
- package/esm5/lib/place/place-definition.js.map +1 -1
- package/esm5/lib/place/route/parameter-decorators.js +6 -6
- package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +47 -15
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +55 -17
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/place-component.d.ts +4 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-component.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"place-component.js","sourceRoot":"ng://@cool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,CAAC;IA7BD;QADC,KAAK,EAAE;;iDACmC,mBAAmB;;wDAiB7D;IAGD;QADC,OAAO,EAAE;0CACa,eAAe;;yDAErC;IASH,qBAAC;CAAA,AA5DD,CAAoC,mBAAmB,GA4DtD;SA5DY,cAAc;;;;;;IAEzB,+BAAiC;;IAGjC,4CAAwC;;AAyD1C,WAAiB,cAAc;;;;;IAE7B,SAAgB,2BAA2B,CAAC,MAAW;QACrD,OAAO,IAAI,CAAC,gBAAgB,CAAC,mBAAA,MAAM,EAAsB,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IACtF,CAAC;IAFe,0CAA2B,8BAE1C,CAAA;;;;;IAED,SAAgB,kBAAkB,CAAC,KAAoC;QACrE,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,wBAAwB,CAAC,CAAC;IACpE,CAAC;IAFe,iCAAkB,qBAEjC,CAAA;;;;;IAED,SAAgB,aAAa,CAAC,KAAoC;QAChE,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;IAFe,4BAAa,gBAE5B,CAAA;;;;;;IAED,SAAgB,gBAAgB,CAAC,KAAoC,EAAE,UAA2B;QAChG,OAAO,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAFe,+BAAgB,mBAE/B,CAAA;AAEH,CAAC,EAlBgB,cAAc,KAAd,cAAc,QAkB9B","sourcesContent":["import { AfterViewInit } from '@angular/core';\nimport {\n assert,\n Binding,\n Constructable,\n DebugContext,\n IMutableHasValue,\n lang, Trace,\n TransactionObserver,\n ValueModel\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition.class';\nimport { Visit } from './visit';\n\n// RAKE: making this Symbol(...) broke things.\nexport const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';\n// this one seems ok.\nexport const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');\n\nexport class PlaceComponent extends DisposableComponent implements AfterViewInit {\n\n private visit: ValueModel<Visit>;\n // private _inDeactivationGuard = new MutableValueModel<boolean>(false);\n\n interactionContext?: InteractionContext;\n\n canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;\n\n constructor() {\n super();\n }\n\n public initialiseVisit(visit: ValueModel<Visit>) {\n assert.isNil(this.visit);\n this.visit = visit;\n DebugContext.get(this.visit).tag(`${this.placeDefinition.component.name}.visit`);\n // this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => {\n // this.installBinding(parameterDef);\n // });\n }\n\n ngAfterViewInit(): void {\n this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => {\n this.installBinding(parameterDef);\n });\n }\n\n @Trace()\n private installBinding<T, S>(parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<S>;\n DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);\n const binding = this.registerDisposable(new Binding(this.visit, model, {\n toRight(visit: Visit): S {\n const value = visit.getParameter(parameterDef.name);\n console.log('push to component', {name:parameterDef.name, value, visit});\n return value;\n },\n toLeft(value: S, currentVisit?: Visit): Visit {\n console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n setTimeout(() => {\n binding.writeRight();\n })\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n return PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n }\n\n get childPlaces(): Constructable<PlaceComponent>[] {\n return this.placeDefinition.children.map(d => d.component);\n }\n\n onPlaceReady() {\n }\n\n}\n\nexport namespace PlaceComponent {\n\n export function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent> {\n return lang.constructorChain(target as Constructable<any>).includes(PlaceComponent);\n }\n\n export function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[] {\n return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);\n }\n\n export function getDefinition(klass: Constructable<PlaceComponent>): PlaceDefinition {\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);\n }\n\n export function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition) {\n Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);\n }\n\n}\n"]}
|
|
@@ -150,12 +150,16 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
150
150
|
// an empty string.
|
|
151
151
|
return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : "";
|
|
152
152
|
};
|
|
153
|
+
// @Trace()
|
|
154
|
+
// @Trace()
|
|
153
155
|
/**
|
|
154
156
|
* @param {?} visit
|
|
155
157
|
* @param {?=} includeRouteId
|
|
156
158
|
* @return {?}
|
|
157
159
|
*/
|
|
158
|
-
PlaceDefinition.prototype.getFormattedRouteParameters =
|
|
160
|
+
PlaceDefinition.prototype.getFormattedRouteParameters =
|
|
161
|
+
// @Trace()
|
|
162
|
+
/**
|
|
159
163
|
* @param {?} visit
|
|
160
164
|
* @param {?=} includeRouteId
|
|
161
165
|
* @return {?}
|
|
@@ -241,8 +245,13 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
241
245
|
// params will return null for non existent names
|
|
242
246
|
if (params.has(def.name)) {
|
|
243
247
|
if (def.isArray) {
|
|
248
|
+
// const values = params.getAll(def.name); // TODO: EEEK getAll is returning ["1,2,3,4"] when we gave it ["1","2","3","4"].
|
|
244
249
|
/** @type {?} */
|
|
245
|
-
var values = params.
|
|
250
|
+
var values = params.get(def.name).split(',').map((/**
|
|
251
|
+
* @param {?} s
|
|
252
|
+
* @return {?}
|
|
253
|
+
*/
|
|
254
|
+
function (s) { return s.trim(); }));
|
|
246
255
|
result[def.name] = values.map((/**
|
|
247
256
|
* @param {?} v
|
|
248
257
|
* @return {?}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-definition.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-definition.ts"],"names":[],"mappings":";;;;;AACA,OAAO,EAAE,MAAM,EAAwB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAC3E,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE;IAEE,yBAAqB,SAAwC,EACxC,IAAY,EACZ,YAAqB,EACrB,IAA4B,EAC5B,eAA2C,EAC3C,QAA2B;QAL3B,cAAS,GAAT,SAAS,CAA+B;QACxC,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAS;QACrB,SAAI,GAAJ,IAAI,CAAwB;QAC5B,oBAAe,GAAf,eAAe,CAA4B;QAC3C,aAAQ,GAAR,QAAQ,CAAmB;IAChD,CAAC;;;;IAED,oCAAU;;;IAAV;QACE,OAAO,CAAC,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;IACzC,CAAC;;;;IAGD,gDAAsB;;;IAAtB;QACE,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI;;;;QAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,SAAS,EAAX,CAAW,EAAC,CAAC;IACrD,CAAC;;;;;IAGD,+CAAqB;;;;IAArB,UAAsB,cAAsB;QAAtB,+BAAA,EAAA,sBAAsB;QAC1C,OAAO,IAAI,CAAC,qBAAqB,CAAC,EAAE,cAAc,gBAAA,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC;;;;;IAGD,+CAA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,GAAG;;;;oBAAC,UAAA,CAAC,IAAI,OAAA,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAtB,CAAsB,EAAC,CAAC;iBAC5D;qBAAM;;wBACC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;oBAClC,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,8DAA8D;wBACjF,6EAA6E;wBAC7E,wFAAwF;wBACxF,0EAA0E;wBAC1E,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;4BACrB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;yBAC/C;qBACF;yBAAM;wBACL,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;qBAC/C;iBACF;aACF;QACH,CAAC,EAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IA7GD;QADC,OAAO,EAAE;;;gDACgB,mBAAmB;iEAE5C;IAGD;QADC,OAAO,EAAE;;;;gEAGT;IAGD;QADC,OAAO,EAAE;;;;gEAYT;IA0FH,sBAAC;CAAA,AA9HD,IA8HC;SA9HY,eAAe;;;IAEd,oCAAiD;;IACjD,+BAAqB;;IACrB,uCAA8B;;IAC9B,+BAAqC;;IACrC,0CAAoD;;IACpD,mCAAoC;;AAyHlD,WAAiB,eAAe;;;;IAC9B,+BAIC;;;;QAHC,0CAAyB;;QACzB,kDAAiC;;QACjC,qDAAoC;;AAExC,CAAC,EANgB,eAAe,KAAf,eAAe,QAM/B","sourcesContent":["import { ParamMap } from '@angular/router';\nimport { assert, Constructable, Trace } from '@coolon/pectin';\nimport { Opts } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport _ from 'lodash';\nimport { PlaceComponent } from './place-component';\nimport { ParameterDefinition } from './route/parameter-definition.class';\nimport { Visit } from './visit';\n\nexport class PlaceDefinition {\n\n constructor(readonly component: Constructable<PlaceComponent>,\n readonly path: string,\n readonly authenticate: boolean,\n readonly data: { [key: string]: any },\n readonly routeParameters: ParameterDefinition<any>[],\n readonly children: PlaceDefinition[]) {\n }\n\n hasRouteId() {\n return !!this.getRouteIdParameterDef();\n }\n\n @Memoize()\n getRouteIdParameterDef(): ParameterDefinition<any> {\n return this.routeParameters.find(p => p.isRouteId);\n }\n\n @Memoize()\n getRouteParameterDefs(includeRouteId = false): ParameterDefinition<any>[] {\n return this.getVisitParameterDefs({ includeRouteId, includeRouteParameters: true });\n }\n\n @Memoize()\n getVisitParameterDefs(include?: PlaceDefinition.ParameterOptions): ParameterDefinition<any>[] {\n const opts = Opts.get(include);\n // includes\n const includeRouteId = !include || opts.getOptional('includeRouteId', false);\n const includeRouteParameters = !include || opts.getOptional('includeRouteParameters', false);\n const includeNonRouteParameters = !include || opts.getOptional('includeNonRouteParameters', false);\n return this.routeParameters.filter(p => {\n return (includeRouteId && p.isRouteId)\n || (includeRouteParameters && p.isRouteParameter && !p.isRouteId) // route id is included in the line above\n || (includeNonRouteParameters && !p.isRouteParameter);\n });\n }\n\n getPlaceData<T>(key: string, defaultValue?: T): T {\n return this.data ?\n _.isNil(this.data[key]) ? defaultValue : this.data[key] :\n defaultValue;\n }\n\n searchPlaceData<T>(keys: string[], defaultValue?: T): T {\n if (this.data) {\n const found = keys.find(key => !_.isNil(this.data[key]));\n return found ? this.data[found] : defaultValue;\n } else {\n return defaultValue;\n }\n }\n\n getRouteIdFrom(visit: Visit) {\n const routeIdParameterDef = this.getRouteIdParameterDef();\n return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;\n }\n\n getFormattedRouteId(visit: Visit): any {\n // Note: RouteIds are always present in the url and are just empty strings when not defined. This is\n // mandated by the fact that redirects from <path> to <path>/:id always include the id parameter as\n // an empty string.\n return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : \"\";\n }\n\n getFormattedRouteParameters(visit: Visit, includeRouteId = false): { [p: string]: string } {\n const result: { [p: string]: string } = {};\n this.getVisitParameterDefs({\n includeRouteId, includeRouteParameters: true\n }).forEach(def => {\n const value = visit.getParameter(def.name);\n if (!def.isEmptyValue(value)) {\n if (def.isArray) {\n assert.isArray(value);\n result[def.name] = value.map(v => def.urlFormat.format(v));\n } else {\n assert.isFalsey(Array.isArray(value));\n result[def.name] = def.urlFormat.format(value);\n }\n }\n });\n return result;\n }\n\n getNonRouteParameters(visit: Visit): { [p: string]: string } {\n const result: { [p: string]: string } = {};\n this.getVisitParameterDefs({ includeNonRouteParameters: true }).forEach(def => {\n const value = visit.getParameter(def.name);\n if (!def.isEmptyValue(value)) {\n result[def.name] = value;\n }\n });\n return result;\n }\n\n // @Trace()\n parseRouteParams(params: ParamMap): { [p: string]: any } {\n const result: { [p: string]: any } = {};\n this.getVisitParameterDefs({\n includeRouteId: true,\n includeRouteParameters: true,\n includeNonRouteParameters: false\n }).forEach(def => {\n // params will return null for non existent names\n if (params.has(def.name)) {\n if (def.isArray) {\n const values = params.getAll(def.name);\n result[def.name] = values.map(v => def.urlFormat.parse(v));\n } else {\n const value = params.get(def.name);\n if (def.isRouteId) { // TODO: Move this to parameter def so it's a strategy pattern\n // because our id routes redirect if the id isn't present we always have a id\n // parameter in our params. This will bugger our remember and defaultvalue sanitisation\n // as it'll see that the id is present (event thought its a blank string).\n if (!_.isEmpty(value)) {\n result[def.name] = def.urlFormat.parse(value);\n }\n } else {\n result[def.name] = def.urlFormat.parse(value);\n }\n }\n }\n });\n return result;\n }\n\n}\n\nexport namespace PlaceDefinition {\n export interface ParameterOptions {\n includeRouteId?: boolean;\n includeRouteParameters?: boolean;\n includeNonRouteParameters?: boolean;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"place-definition.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-definition.ts"],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AC,CAAC,CAAC,EAAtB,CAAsB,EAAC,CAAC;iBAC5D;qBAAM;;wBACC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;oBAClC,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,8DAA8D;wBACjF,6EAA6E;wBAC7E,wFAAwF;wBACxF,0EAA0E;wBAC1E,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;4BACrB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;yBAC/C;qBACF;yBAAM;wBACL,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;qBAC/C;iBACF;aACF;QACH,CAAC,EAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IA/GD;QADC,OAAO,EAAE;;;gDACgB,mBAAmB;iEAE5C;IAGD;QADC,OAAO,EAAE;;;;gEAGT;IAGD;QADC,OAAO,EAAE;;;;gEAYT;IA4FH,sBAAC;CAAA,AAhID,IAgIC;SAhIY,eAAe;;;IAEd,oCAAiD;;IACjD,+BAAqB;;IACrB,uCAA8B;;IAC9B,+BAAqC;;IACrC,0CAAoD;;IACpD,mCAAoC;;AA2HlD,WAAiB,eAAe;;;;IAC9B,+BAIC;;;;QAHC,0CAAyB;;QACzB,kDAAiC;;QACjC,qDAAoC;;AAExC,CAAC,EANgB,eAAe,KAAf,eAAe,QAM/B","sourcesContent":["import { ParamMap } from '@angular/router';\nimport { assert, Constructable, Trace } from '@coolon/pectin';\nimport { Opts } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport _ from 'lodash';\nimport { PlaceComponent } from './place-component';\nimport { ParameterDefinition } from './route/parameter-definition.class';\nimport { Visit } from './visit';\n\nexport class PlaceDefinition {\n\n constructor(readonly component: Constructable<PlaceComponent>,\n readonly path: string,\n readonly authenticate: boolean,\n readonly data: { [key: string]: any },\n readonly routeParameters: ParameterDefinition<any>[],\n readonly children: PlaceDefinition[]) {\n }\n\n hasRouteId() {\n return !!this.getRouteIdParameterDef();\n }\n\n @Memoize()\n getRouteIdParameterDef(): ParameterDefinition<any> {\n return this.routeParameters.find(p => p.isRouteId);\n }\n\n @Memoize()\n getRouteParameterDefs(includeRouteId = false): ParameterDefinition<any>[] {\n return this.getVisitParameterDefs({ includeRouteId, includeRouteParameters: true });\n }\n\n @Memoize()\n getVisitParameterDefs(include?: PlaceDefinition.ParameterOptions): ParameterDefinition<any>[] {\n const opts = Opts.get(include);\n // includes\n const includeRouteId = !include || opts.getOptional('includeRouteId', false);\n const includeRouteParameters = !include || opts.getOptional('includeRouteParameters', false);\n const includeNonRouteParameters = !include || opts.getOptional('includeNonRouteParameters', false);\n return this.routeParameters.filter(p => {\n return (includeRouteId && p.isRouteId)\n || (includeRouteParameters && p.isRouteParameter && !p.isRouteId) // route id is included in the line above\n || (includeNonRouteParameters && !p.isRouteParameter);\n });\n }\n\n getPlaceData<T>(key: string, defaultValue?: T): T {\n return this.data ?\n _.isNil(this.data[key]) ? defaultValue : this.data[key] :\n defaultValue;\n }\n\n searchPlaceData<T>(keys: string[], defaultValue?: T): T {\n if (this.data) {\n const found = keys.find(key => !_.isNil(this.data[key]));\n return found ? this.data[found] : defaultValue;\n } else {\n return defaultValue;\n }\n }\n\n getRouteIdFrom(visit: Visit) {\n const routeIdParameterDef = this.getRouteIdParameterDef();\n return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;\n }\n\n getFormattedRouteId(visit: Visit): any {\n // Note: RouteIds are always present in the url and are just empty strings when not defined. This is\n // mandated by the fact that redirects from <path> to <path>/:id always include the id parameter as\n // an empty string.\n return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : \"\";\n }\n\n // @Trace()\n getFormattedRouteParameters(visit: Visit, includeRouteId = false): { [p: string]: string } {\n const result: { [p: string]: string } = {};\n this.getVisitParameterDefs({\n includeRouteId, includeRouteParameters: true\n }).forEach(def => {\n const value = visit.getParameter(def.name);\n if (!def.isEmptyValue(value)) {\n if (def.isArray) {\n assert.isArray(value);\n result[def.name] = value.map(v => def.urlFormat.format(v));\n } else {\n assert.isFalsey(Array.isArray(value));\n result[def.name] = def.urlFormat.format(value);\n }\n }\n });\n return result;\n }\n\n getNonRouteParameters(visit: Visit): { [p: string]: string } {\n const result: { [p: string]: string } = {};\n this.getVisitParameterDefs({ includeNonRouteParameters: true }).forEach(def => {\n const value = visit.getParameter(def.name);\n if (!def.isEmptyValue(value)) {\n result[def.name] = value;\n }\n });\n return result;\n }\n\n // @Trace()\n parseRouteParams(params: ParamMap): { [p: string]: any } {\n const result: { [p: string]: any } = {};\n this.getVisitParameterDefs({\n includeRouteId: true,\n includeRouteParameters: true,\n includeNonRouteParameters: false\n }).forEach(def => {\n // params will return null for non existent names\n if (params.has(def.name)) {\n if (def.isArray) {\n // const values = params.getAll(def.name); // TODO: EEEK getAll is returning [\"1,2,3,4\"] when we gave it [\"1\",\"2\",\"3\",\"4\"].\n const values = params.get(def.name).split(',').map(s => s.trim());\n result[def.name] = values.map(v => def.urlFormat.parse(v));\n } else {\n const value = params.get(def.name);\n if (def.isRouteId) { // TODO: Move this to parameter def so it's a strategy pattern\n // because our id routes redirect if the id isn't present we always have a id\n // parameter in our params. This will bugger our remember and defaultvalue sanitisation\n // as it'll see that the id is present (event thought its a blank string).\n if (!_.isEmpty(value)) {\n result[def.name] = def.urlFormat.parse(value);\n }\n } else {\n result[def.name] = def.urlFormat.parse(value);\n }\n }\n }\n });\n return result;\n }\n\n}\n\nexport namespace PlaceDefinition {\n export interface ParameterOptions {\n includeRouteId?: boolean;\n includeRouteParameters?: boolean;\n includeNonRouteParameters?: boolean;\n }\n}\n"]}
|
|
@@ -71,8 +71,8 @@ export function RouteId(type, options) {
|
|
|
71
71
|
/** @type {?} */
|
|
72
72
|
var param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
|
|
73
73
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
74
|
-
|
|
75
|
-
UseDelegate()(prototype, propertyKey);
|
|
74
|
+
UseDelegate({ tag: "@RouteId(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
|
|
75
|
+
// UseDelegate()(prototype, propertyKey);
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
@@ -92,8 +92,8 @@ export function VisitParameter(options) {
|
|
|
92
92
|
/** @type {?} */
|
|
93
93
|
var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
|
|
94
94
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
95
|
-
|
|
96
|
-
UseDelegate()(prototype, propertyKey);
|
|
95
|
+
UseDelegate({ tag: "@VisitParameter(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
|
|
96
|
+
// UseDelegate()(prototype, propertyKey);
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
@@ -112,8 +112,8 @@ export function VisitParameterList(options) {
|
|
|
112
112
|
function (prototype, propertyKey) {
|
|
113
113
|
/** @type {?} */
|
|
114
114
|
var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
|
|
115
|
-
|
|
116
|
-
UseDelegate()(prototype, propertyKey);
|
|
115
|
+
UseDelegate({ tag: "@VisitParameterList(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
|
|
116
|
+
// UseDelegate()(prototype, propertyKey);
|
|
117
117
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
118
118
|
});
|
|
119
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter-decorators.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/route/parameter-decorators.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;;;;;AAInE,oCAMC;;;IALC,4BAAY;;IACZ,kCAAmB;;IACnB,kCAAmB;;IACnB,sCAAiB;;;;;;AAInB,2CAOC;;;IANC,mCAAY;;IACZ,yCAAmB;;IACnB,yCAAmB;;IACnB,6CAAiB;;IACjB,2CAAyB;;;;;;AAI3B,+CAOC;;;IANC,uCAAY;;IACZ,6CAAmB;;IACnB,6CAAmB;;IACnB,iDAAmB;;IACnB,+CAAyB;;;;;;;;AAI3B,MAAM,UAAU,OAAO,CAA4B,IAAkB,EAAE,OAA2B;IAChG;;;;;IAAO,UAAC,SAAiB,EAAE,WAA4B;;YAC/C,KAAK,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC;QACpF,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC3E,
|
|
1
|
+
{"version":3,"file":"parameter-decorators.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/route/parameter-decorators.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B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S,CAAC,WAAW,CAAC,IAAI,SAAI,WAAW,CAAC,QAAQ,EAAE,MAAG,EAAC,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACvH,yCAAyC;IAC3C,CAAC,EAAC;AACJ,CAAC;;;;;;AAED,MAAM,UAAU,kBAAkB,CAAI,OAAsC;;QACpE,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;IAC9B;;;;;IAAO,UAAC,SAAiB,EAAE,WAA4B;;YAC/C,KAAK,GAAG,IAAI,mBAAmB,CAAC,cAAc,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC3H,WAAW,CAAC,EAAC,GAAG,EAAE,yBAAuB,SAAS,CAAC,WAAW,CAAC,IAAI,SAAI,WAAW,CAAC,QAAQ,EAAE,MAAG,EAAC,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC3H,yCAAyC;QACzC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC,EAAC;AACJ,CAAC","sourcesContent":["import { UseDelegate } from '@coolon/pectin';\nimport { Klass, Opts } from '@coolon/typescript-utilities';\nimport { ROUTE_PARAMETER_LIST_KEY } from '../place-component';\nimport { ParameterDefinition } from './parameter-definition.class';\nimport { Formatter } from './formatter';\n\n\nexport interface RouteIdOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser<T>;\n}\n\nexport interface RouteParameterOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n storeInUrl?: Formatter<T>\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser<T>;\n}\n\nexport interface RouteListParameterOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T[];\n storeInUrl?: Formatter<T>\n // sanitiser?: Constructable<ParameterSanitiser<T[]>> | ParameterSanitiser<T[]>;\n}\n\nexport function RouteId<T extends string | number>(type: Formatter<T>, options?: RouteIdOptions<T>): PropertyDecorator {\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n UseDelegate({tag: `@RouteId(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n // UseDelegate()(prototype, propertyKey);\n };\n}\n\nexport function VisitParameter<T>(options?: RouteParameterOptions<T>): PropertyDecorator {\n const opts = Opts.get(options);\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional(\"storeInUrl\", null));\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n UseDelegate({tag: `@VisitParameter(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n // UseDelegate()(prototype, propertyKey);\n };\n}\n\nexport function VisitParameterList<E>(options?: RouteListParameterOptions<E>): PropertyDecorator {\n const opts = Opts.get(options);\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional(\"storeInUrl\", null));\n UseDelegate({tag: `@VisitParameterList(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n // UseDelegate()(prototype, propertyKey);\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n };\n}\n\n// export function RouteParameter<T>(type: ParameterType<T>, options?: RouteParameterOptions<T>): PropertyDecorator {\n// return (prototype: Object, propertyKey: string | symbol) => {\n// const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, type);\n// Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n// UseDelegate()(prototype, propertyKey);\n// };\n// }\n//\n// export function RouteParameterList<E>(elementType: ParameterType<E>, options?: RouteListParameterOptions<E>): PropertyDecorator {\n// return (prototype: Object, propertyKey: string | symbol) => {\n// const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, elementType);\n// Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n// UseDelegate()(prototype, propertyKey);\n// };\n// }\n"]}
|
|
@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
|
|
|
4
4
|
import { MatInputModule, MatFormFieldModule, MatSelectModule, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule, MatDialog } from '@angular/material';
|
|
5
5
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
6
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
|
-
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding, Guard, StoreInValueModel, Command, ValueHolder } from '@coolon/pectin';
|
|
7
|
+
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, DebugContext, Binding, Trace, Guard, StoreInValueModel, Command, ValueHolder } from '@coolon/pectin';
|
|
8
8
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
10
|
import { RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, NavigationCancel, Router, UrlSerializer } from '@angular/router';
|
|
@@ -2505,6 +2505,7 @@ class PlaceDefinition {
|
|
|
2505
2505
|
// an empty string.
|
|
2506
2506
|
return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : "";
|
|
2507
2507
|
}
|
|
2508
|
+
// @Trace()
|
|
2508
2509
|
/**
|
|
2509
2510
|
* @param {?} visit
|
|
2510
2511
|
* @param {?=} includeRouteId
|
|
@@ -2579,8 +2580,13 @@ class PlaceDefinition {
|
|
|
2579
2580
|
// params will return null for non existent names
|
|
2580
2581
|
if (params.has(def.name)) {
|
|
2581
2582
|
if (def.isArray) {
|
|
2583
|
+
// const values = params.getAll(def.name); // TODO: EEEK getAll is returning ["1,2,3,4"] when we gave it ["1","2","3","4"].
|
|
2582
2584
|
/** @type {?} */
|
|
2583
|
-
const values = params.
|
|
2585
|
+
const values = params.get(def.name).split(',').map((/**
|
|
2586
|
+
* @param {?} s
|
|
2587
|
+
* @return {?}
|
|
2588
|
+
*/
|
|
2589
|
+
s => s.trim()));
|
|
2584
2590
|
result[def.name] = values.map((/**
|
|
2585
2591
|
* @param {?} v
|
|
2586
2592
|
* @return {?}
|
|
@@ -2673,10 +2679,18 @@ class PlaceComponent extends DisposableComponent {
|
|
|
2673
2679
|
* @param {?} visit
|
|
2674
2680
|
* @return {?}
|
|
2675
2681
|
*/
|
|
2676
|
-
|
|
2682
|
+
initialiseVisit(visit) {
|
|
2677
2683
|
assert.isNil(this.visit);
|
|
2678
2684
|
this.visit = visit;
|
|
2679
|
-
|
|
2685
|
+
DebugContext.get(this.visit).tag(`${this.placeDefinition.component.name}.visit`);
|
|
2686
|
+
// this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => {
|
|
2687
|
+
// this.installBinding(parameterDef);
|
|
2688
|
+
// });
|
|
2689
|
+
}
|
|
2690
|
+
/**
|
|
2691
|
+
* @return {?}
|
|
2692
|
+
*/
|
|
2693
|
+
ngAfterViewInit() {
|
|
2680
2694
|
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
2681
2695
|
* @param {?} parameterDef
|
|
2682
2696
|
* @return {?}
|
|
@@ -2694,8 +2708,9 @@ class PlaceComponent extends DisposableComponent {
|
|
|
2694
2708
|
installBinding(parameterDef) {
|
|
2695
2709
|
/** @type {?} */
|
|
2696
2710
|
const model = (/** @type {?} */ (this[parameterDef.propertyName]));
|
|
2697
|
-
|
|
2698
|
-
|
|
2711
|
+
DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);
|
|
2712
|
+
/** @type {?} */
|
|
2713
|
+
const binding = this.registerDisposable(new Binding(this.visit, model, {
|
|
2699
2714
|
/**
|
|
2700
2715
|
* @param {?} visit
|
|
2701
2716
|
* @return {?}
|
|
@@ -2703,7 +2718,7 @@ class PlaceComponent extends DisposableComponent {
|
|
|
2703
2718
|
toRight(visit) {
|
|
2704
2719
|
/** @type {?} */
|
|
2705
2720
|
const value = visit.getParameter(parameterDef.name);
|
|
2706
|
-
|
|
2721
|
+
console.log('push to component', { name: parameterDef.name, value, visit });
|
|
2707
2722
|
return value;
|
|
2708
2723
|
},
|
|
2709
2724
|
/**
|
|
@@ -2716,6 +2731,12 @@ class PlaceComponent extends DisposableComponent {
|
|
|
2716
2731
|
return currentVisit.replace(parameterDef, value);
|
|
2717
2732
|
}
|
|
2718
2733
|
}));
|
|
2734
|
+
setTimeout((/**
|
|
2735
|
+
* @return {?}
|
|
2736
|
+
*/
|
|
2737
|
+
() => {
|
|
2738
|
+
binding.writeRight();
|
|
2739
|
+
}));
|
|
2719
2740
|
}
|
|
2720
2741
|
/**
|
|
2721
2742
|
* @return {?}
|
|
@@ -2739,6 +2760,12 @@ class PlaceComponent extends DisposableComponent {
|
|
|
2739
2760
|
onPlaceReady() {
|
|
2740
2761
|
}
|
|
2741
2762
|
}
|
|
2763
|
+
__decorate([
|
|
2764
|
+
Trace(),
|
|
2765
|
+
__metadata("design:type", Function),
|
|
2766
|
+
__metadata("design:paramtypes", [ParameterDefinition]),
|
|
2767
|
+
__metadata("design:returntype", void 0)
|
|
2768
|
+
], PlaceComponent.prototype, "installBinding", null);
|
|
2742
2769
|
__decorate([
|
|
2743
2770
|
Memoize$1(),
|
|
2744
2771
|
__metadata("design:type", PlaceDefinition),
|
|
@@ -4971,7 +4998,11 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
4971
4998
|
this.initialPlaceIndex = null;
|
|
4972
4999
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
4973
5000
|
this.parentOutletModel = new MutableValueModel(parentOutlet);
|
|
4974
|
-
|
|
5001
|
+
/** @type {?} */
|
|
5002
|
+
const mutableValueModel = new MutableValueModel();
|
|
5003
|
+
DebugContext.tag(mutableValueModel, "PlaceOutletComponent -> mutableValueModel");
|
|
5004
|
+
this._activePlaceVisitModel.setDelegate(mutableValueModel);
|
|
5005
|
+
DebugContext.tag(this._activePlaceVisitModel, "PlaceOutletComponent._activePlaceVisitModel");
|
|
4975
5006
|
this._inOutletUpdate = valueOf.any(this._inOutletDeactivation, this._inOutletActivation).areTruthy();
|
|
4976
5007
|
/** @type {?} */
|
|
4977
5008
|
const defaultPlaceAnimationOrder = chain(this.parentOutletModel)
|
|
@@ -5131,8 +5162,9 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
5131
5162
|
this._placeDefinition.value = place.placeDefinition;
|
|
5132
5163
|
/** @type {?} */
|
|
5133
5164
|
const visitModel = new MutableValueModel();
|
|
5165
|
+
DebugContext.tag(visitModel, "PlaceOutletCompeont.visitModel");
|
|
5134
5166
|
this._activePlaceVisitModel.setDelegate(visitModel);
|
|
5135
|
-
place.
|
|
5167
|
+
place.initialiseVisit(visitModel);
|
|
5136
5168
|
}
|
|
5137
5169
|
catch (error) {
|
|
5138
5170
|
console.error(error);
|
|
@@ -6815,8 +6847,8 @@ function RouteId(type, options) {
|
|
|
6815
6847
|
/** @type {?} */
|
|
6816
6848
|
const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
|
|
6817
6849
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
6818
|
-
|
|
6819
|
-
UseDelegate()(prototype, propertyKey);
|
|
6850
|
+
UseDelegate({ tag: `@RouteId(${prototype.constructor.name}.${propertyKey.toString()})` })(prototype, propertyKey);
|
|
6851
|
+
// UseDelegate()(prototype, propertyKey);
|
|
6820
6852
|
});
|
|
6821
6853
|
}
|
|
6822
6854
|
/**
|
|
@@ -6836,8 +6868,8 @@ function VisitParameter(options) {
|
|
|
6836
6868
|
/** @type {?} */
|
|
6837
6869
|
const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
|
|
6838
6870
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
6839
|
-
|
|
6840
|
-
UseDelegate()(prototype, propertyKey);
|
|
6871
|
+
UseDelegate({ tag: `@VisitParameter(${prototype.constructor.name}.${propertyKey.toString()})` })(prototype, propertyKey);
|
|
6872
|
+
// UseDelegate()(prototype, propertyKey);
|
|
6841
6873
|
});
|
|
6842
6874
|
}
|
|
6843
6875
|
/**
|
|
@@ -6856,8 +6888,8 @@ function VisitParameterList(options) {
|
|
|
6856
6888
|
(prototype, propertyKey) => {
|
|
6857
6889
|
/** @type {?} */
|
|
6858
6890
|
const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
|
|
6859
|
-
|
|
6860
|
-
UseDelegate()(prototype, propertyKey);
|
|
6891
|
+
UseDelegate({ tag: `@VisitParameterList(${prototype.constructor.name}.${propertyKey.toString()})` })(prototype, propertyKey);
|
|
6892
|
+
// UseDelegate()(prototype, propertyKey);
|
|
6861
6893
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
6862
6894
|
});
|
|
6863
6895
|
}
|