@ifc-lite/cli 0.26.0 → 0.28.0
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/README.md +1 -1
- package/dist/commands/ask.d.ts +8 -0
- package/dist/commands/ask.d.ts.map +1 -1
- package/dist/commands/ask.js +10 -9
- package/dist/commands/ask.js.map +1 -1
- package/dist/commands/bsdd.d.ts.map +1 -1
- package/dist/commands/bsdd.js +49 -13
- package/dist/commands/bsdd.js.map +1 -1
- package/dist/commands/delivery-checks.d.ts +56 -0
- package/dist/commands/delivery-checks.d.ts.map +1 -0
- package/dist/commands/delivery-checks.js +222 -0
- package/dist/commands/delivery-checks.js.map +1 -0
- package/dist/commands/delivery-recipe.d.ts +23 -0
- package/dist/commands/delivery-recipe.d.ts.map +1 -0
- package/dist/commands/delivery-recipe.js +104 -0
- package/dist/commands/delivery-recipe.js.map +1 -0
- package/dist/commands/delivery-report.d.ts +51 -0
- package/dist/commands/delivery-report.d.ts.map +1 -0
- package/dist/commands/delivery-report.js +114 -0
- package/dist/commands/delivery-report.js.map +1 -0
- package/dist/commands/delivery.d.ts +2 -0
- package/dist/commands/delivery.d.ts.map +1 -0
- package/dist/commands/delivery.js +127 -0
- package/dist/commands/delivery.js.map +1 -0
- package/dist/commands/diff-classification-label.d.ts +12 -0
- package/dist/commands/diff-classification-label.d.ts.map +1 -0
- package/dist/commands/diff-classification-label.js +20 -0
- package/dist/commands/diff-classification-label.js.map +1 -0
- package/dist/commands/diff-engine.d.ts.map +1 -1
- package/dist/commands/diff-engine.js +33 -11
- package/dist/commands/diff-engine.js.map +1 -1
- package/dist/commands/diff-test-helpers.d.ts +12 -0
- package/dist/commands/diff-test-helpers.d.ts.map +1 -1
- package/dist/commands/diff-test-helpers.js +68 -0
- package/dist/commands/diff-test-helpers.js.map +1 -1
- package/dist/commands/diff-unit-scale-fixtures.d.ts +34 -0
- package/dist/commands/diff-unit-scale-fixtures.d.ts.map +1 -0
- package/dist/commands/diff-unit-scale-fixtures.js +94 -0
- package/dist/commands/diff-unit-scale-fixtures.js.map +1 -0
- package/dist/commands/export.d.ts +11 -0
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +9 -14
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/gym.js +2 -2
- package/dist/commands/merge.d.ts.map +1 -1
- package/dist/commands/merge.js +8 -0
- package/dist/commands/merge.js.map +1 -1
- package/dist/commands/query-aggregation.d.ts +27 -4
- package/dist/commands/query-aggregation.d.ts.map +1 -1
- package/dist/commands/query-aggregation.js +67 -6
- package/dist/commands/query-aggregation.js.map +1 -1
- package/dist/commands/query-output.d.ts +7 -0
- package/dist/commands/query-output.d.ts.map +1 -1
- package/dist/commands/query-output.js +63 -27
- package/dist/commands/query-output.js.map +1 -1
- package/dist/commands/query-storey.d.ts +24 -0
- package/dist/commands/query-storey.d.ts.map +1 -0
- package/dist/commands/query-storey.js +71 -0
- package/dist/commands/query-storey.js.map +1 -0
- package/dist/commands/query.d.ts +2 -25
- package/dist/commands/query.d.ts.map +1 -1
- package/dist/commands/query.js +39 -158
- package/dist/commands/query.js.map +1 -1
- package/dist/commands/schedule-aggregate.d.ts +51 -0
- package/dist/commands/schedule-aggregate.d.ts.map +1 -0
- package/dist/commands/schedule-aggregate.js +121 -0
- package/dist/commands/schedule-aggregate.js.map +1 -0
- package/dist/commands/schedule-columns.d.ts +15 -0
- package/dist/commands/schedule-columns.d.ts.map +1 -0
- package/dist/commands/schedule-columns.js +63 -0
- package/dist/commands/schedule-columns.js.map +1 -0
- package/dist/commands/schedule-group.d.ts +65 -0
- package/dist/commands/schedule-group.d.ts.map +1 -0
- package/dist/commands/schedule-group.js +0 -0
- package/dist/commands/schedule-group.js.map +1 -0
- package/dist/commands/schedule-presets.d.ts +21 -0
- package/dist/commands/schedule-presets.d.ts.map +1 -0
- package/dist/commands/schedule-presets.js +62 -0
- package/dist/commands/schedule-presets.js.map +1 -0
- package/dist/commands/schedule-render-html.d.ts +13 -0
- package/dist/commands/schedule-render-html.d.ts.map +1 -0
- package/dist/commands/schedule-render-html.js +100 -0
- package/dist/commands/schedule-render-html.js.map +1 -0
- package/dist/commands/schedule-render-md.d.ts +12 -0
- package/dist/commands/schedule-render-md.d.ts.map +1 -0
- package/dist/commands/schedule-render-md.js +77 -0
- package/dist/commands/schedule-render-md.js.map +1 -0
- package/dist/commands/schedule-render.d.ts +51 -0
- package/dist/commands/schedule-render.d.ts.map +1 -0
- package/dist/commands/schedule-render.js +205 -0
- package/dist/commands/schedule-render.js.map +1 -0
- package/dist/commands/schedule-spec.d.ts +29 -0
- package/dist/commands/schedule-spec.d.ts.map +1 -0
- package/dist/commands/schedule-spec.js +111 -0
- package/dist/commands/schedule-spec.js.map +1 -0
- package/dist/commands/schedule.d.ts +23 -0
- package/dist/commands/schedule.d.ts.map +1 -0
- package/dist/commands/schedule.js +249 -0
- package/dist/commands/schedule.js.map +1 -0
- package/dist/commands/schema.d.ts.map +1 -1
- package/dist/commands/schema.js +192 -17
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/stats-aggregation.d.ts +31 -6
- package/dist/commands/stats-aggregation.d.ts.map +1 -1
- package/dist/commands/stats-aggregation.js +79 -11
- package/dist/commands/stats-aggregation.js.map +1 -1
- package/dist/commands/stats.d.ts.map +1 -1
- package/dist/commands/stats.js +4 -4
- package/dist/commands/stats.js.map +1 -1
- package/dist/commands/validate.d.ts +7 -4
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +9 -6
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/where-filter.d.ts +42 -0
- package/dist/commands/where-filter.d.ts.map +1 -0
- package/dist/commands/where-filter.js +88 -0
- package/dist/commands/where-filter.js.map +1 -0
- package/dist/energy-export.d.ts.map +1 -1
- package/dist/energy-export.js +12 -2
- package/dist/energy-export.js.map +1 -1
- package/dist/geometry-report.d.ts.map +1 -1
- package/dist/geometry-report.js +15 -3
- package/dist/geometry-report.js.map +1 -1
- package/dist/headless-backend.d.ts +20 -5
- package/dist/headless-backend.d.ts.map +1 -1
- package/dist/headless-backend.js +131 -90
- package/dist/headless-backend.js.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/output.d.ts +13 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +21 -0
- package/dist/output.js.map +1 -1
- package/dist/property-filter-match.d.ts +12 -0
- package/dist/property-filter-match.d.ts.map +1 -0
- package/dist/property-filter-match.js +17 -0
- package/dist/property-filter-match.js.map +1 -0
- package/dist/query-overlay-relations.d.ts +29 -0
- package/dist/query-overlay-relations.d.ts.map +1 -0
- package/dist/query-overlay-relations.js +88 -0
- package/dist/query-overlay-relations.js.map +1 -0
- package/dist/query-overlay.d.ts +44 -0
- package/dist/query-overlay.d.ts.map +1 -0
- package/dist/query-overlay.js +100 -0
- package/dist/query-overlay.js.map +1 -0
- package/package.json +21 -21
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ScheduleColumn } from './schedule-columns.js';
|
|
2
|
+
import type { ScheduleRow } from './schedule-render.js';
|
|
3
|
+
export type SortDir = 'asc' | 'desc';
|
|
4
|
+
/** One `--sort` key: a declared column plus a direction. */
|
|
5
|
+
export interface SortKey {
|
|
6
|
+
header: string;
|
|
7
|
+
index: number;
|
|
8
|
+
dir: SortDir;
|
|
9
|
+
}
|
|
10
|
+
/** One `--group-by` key: a declared column. */
|
|
11
|
+
export interface GroupKey {
|
|
12
|
+
header: string;
|
|
13
|
+
index: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse `--sort "<Header>[:asc|desc][, ...]"` into ordered keys. Default
|
|
17
|
+
* direction is asc; an unknown direction suffix is a `fatal(...)`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseSortSpec(spec: string | undefined, columns: ScheduleColumn[]): SortKey[];
|
|
20
|
+
/** Parse `--group-by "<Header>[, ...]"` into ordered keys. */
|
|
21
|
+
export declare function parseGroupBySpec(spec: string | undefined, columns: ScheduleColumn[]): GroupKey[];
|
|
22
|
+
/**
|
|
23
|
+
* Coerce a cell to a finite number when it fully parses as one, else `null`.
|
|
24
|
+
* A `null`/empty cell and a non-numeric string are both `null` so the caller
|
|
25
|
+
* can sort them last and skip them in a numeric aggregation.
|
|
26
|
+
*/
|
|
27
|
+
export declare function cellToNumber(value: unknown): number | null;
|
|
28
|
+
/** True for a cell that sorts last (missing / empty). */
|
|
29
|
+
export declare function isNullish(value: unknown): boolean;
|
|
30
|
+
/** Whether a column's cells should compare/group numerically or as strings. */
|
|
31
|
+
export type CellMode = 'numeric' | 'string';
|
|
32
|
+
/**
|
|
33
|
+
* Decide one column's comparison mode from EVERY row, not per compared pair:
|
|
34
|
+
* numeric only when every non-blank cell in the column parses as a finite
|
|
35
|
+
* number, else string. Deciding per pair (the pre-fix behaviour) is
|
|
36
|
+
* intransitive — e.g. over ['2', '10', '1x', '3'], the pair (2, 10) compares
|
|
37
|
+
* numerically (2 < 10) while (2, '1x') falls back to string compare, so the
|
|
38
|
+
* apparent order depends on which pairs `Array.sort` happens to compare
|
|
39
|
+
* rather than forming one consistent ranking. An all-blank column has no
|
|
40
|
+
* cell to disagree on; its mode is irrelevant (every cell sorts/groups by
|
|
41
|
+
* `isNullish` before the mode is ever consulted) but 'string' is the safe
|
|
42
|
+
* default.
|
|
43
|
+
*/
|
|
44
|
+
export declare function columnMode(rows: ScheduleRow[], index: number): CellMode;
|
|
45
|
+
/**
|
|
46
|
+
* Canonical grouping/equality key for one cell, given the column's decided
|
|
47
|
+
* mode. Every nullish cell (missing, `null`, or a whitespace-only string)
|
|
48
|
+
* canonicalises to the SAME key regardless of its exact spelling, and in
|
|
49
|
+
* numeric mode every cell that parses to the same number canonicalises to
|
|
50
|
+
* the same key ('1' and '1.0' both become '#1') — the single canonicaliser
|
|
51
|
+
* `orderRows`' grouping order and `buildSubtotalPlan`'s contiguous-run
|
|
52
|
+
* boundary test (`schedule-aggregate.ts`) both use, so a group that sorts
|
|
53
|
+
* together is also recognised as one group rather than splitting into
|
|
54
|
+
* repeated "Subtotal (...)" headings over raw-string differences the sorter
|
|
55
|
+
* already treats as equal.
|
|
56
|
+
*/
|
|
57
|
+
export declare function cellCanonicalKey(value: unknown, mode: CellMode): string;
|
|
58
|
+
/**
|
|
59
|
+
* Order rows for output. Group headers order first (asc, or the direction the
|
|
60
|
+
* same header carries as a `--sort` key) so each group is contiguous, then the
|
|
61
|
+
* remaining `--sort` keys, then the original entity index as the stable
|
|
62
|
+
* tiebreaker. Returns a new array; the input is not mutated.
|
|
63
|
+
*/
|
|
64
|
+
export declare function orderRows(rows: ScheduleRow[], sortKeys: SortKey[], groupKeys: GroupKey[]): ScheduleRow[];
|
|
65
|
+
//# sourceMappingURL=schedule-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-group.d.ts","sourceRoot":"","sources":["../../src/commands/schedule-group.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAErC,4DAA4D;AAC5D,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;CACd;AAED,+CAA+C;AAC/C,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAWD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,EAAE,CAsB5F;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,QAAQ,EAAE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AO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface SchedulePreset {
|
|
2
|
+
type: string;
|
|
3
|
+
columns: string;
|
|
4
|
+
groupBy?: string;
|
|
5
|
+
sort?: string;
|
|
6
|
+
subtotals?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const SCHEDULE_PRESETS: Record<string, SchedulePreset>;
|
|
9
|
+
/**
|
|
10
|
+
* Look up a preset by name (case-insensitive). An unknown name is a
|
|
11
|
+
* `fatal(...)` that lists the valid preset names.
|
|
12
|
+
*
|
|
13
|
+
* `Object.hasOwn` guards a plain-object-property lookup against a name that
|
|
14
|
+
* collides with something every object inherits from `Object.prototype`
|
|
15
|
+
* (`constructor`, `toString`, `hasOwnProperty`, ...) — a bare
|
|
16
|
+
* `SCHEDULE_PRESETS[name]` would resolve `--preset constructor` to the
|
|
17
|
+
* inherited `Function` value instead of failing, since a function is truthy
|
|
18
|
+
* and a plain `!preset` check never catches it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolvePreset(name: string): SchedulePreset;
|
|
21
|
+
//# sourceMappingURL=schedule-presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-presets.d.ts","sourceRoot":"","sources":["../../src/commands/schedule-presets.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CA4B3D,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAQ1D"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Named presets for `ifc-lite schedule --preset <name>`.
|
|
6
|
+
*
|
|
7
|
+
* A preset supplies a default `--type` and a default `--columns` set (and,
|
|
8
|
+
* optionally, a default `--group-by`/`--sort`/`--subtotals`) so a common
|
|
9
|
+
* schedule runs with no other flags. Explicit `--type`/`--columns`/
|
|
10
|
+
* `--group-by`/`--sort`/`--subtotals` each override the preset's corresponding
|
|
11
|
+
* default (explicit flag wins); `--where`/`--format` apply as normal.
|
|
12
|
+
*
|
|
13
|
+
* Column paths use the standard IFC4 property/quantity sets. A path is `Attr`,
|
|
14
|
+
* `Pset.Prop`, or `Qto.Qty`, written `Header=path`. The `Material` pseudo-path
|
|
15
|
+
* resolves an element's associated material name via the shared material
|
|
16
|
+
* accessor (see `resolveScheduleValue`).
|
|
17
|
+
*/
|
|
18
|
+
import { fatal } from '../output.js';
|
|
19
|
+
export const SCHEDULE_PRESETS = {
|
|
20
|
+
door: {
|
|
21
|
+
type: 'IfcDoor',
|
|
22
|
+
columns: 'Mark=Tag, Name, FireRating=Pset_DoorCommon.FireRating, IsExternal=Pset_DoorCommon.IsExternal, Width=Qto_DoorBaseQuantities.Width, Height=Qto_DoorBaseQuantities.Height',
|
|
23
|
+
},
|
|
24
|
+
window: {
|
|
25
|
+
type: 'IfcWindow',
|
|
26
|
+
columns: 'Mark=Tag, Name, FireRating=Pset_WindowCommon.FireRating, IsExternal=Pset_WindowCommon.IsExternal, Width=Qto_WindowBaseQuantities.Width, Height=Qto_WindowBaseQuantities.Height',
|
|
27
|
+
},
|
|
28
|
+
space: {
|
|
29
|
+
type: 'IfcSpace',
|
|
30
|
+
columns: 'Number=Name, LongName=LongName, Category=Pset_SpaceCommon.Category, NetFloorArea=Qto_SpaceBaseQuantities.NetFloorArea, NetVolume=Qto_SpaceBaseQuantities.NetVolume',
|
|
31
|
+
sort: 'NetFloorArea:desc',
|
|
32
|
+
},
|
|
33
|
+
wall: {
|
|
34
|
+
type: 'IfcWall',
|
|
35
|
+
columns: 'Name, FireRating=Pset_WallCommon.FireRating, IsExternal=Pset_WallCommon.IsExternal, LoadBearing=Pset_WallCommon.LoadBearing, Length=Qto_WallBaseQuantities.Length, Height=Qto_WallBaseQuantities.Height, NetVolume=Qto_WallBaseQuantities.NetVolume',
|
|
36
|
+
},
|
|
37
|
+
'material-takeoff': {
|
|
38
|
+
type: 'IfcWall',
|
|
39
|
+
columns: 'Material=Material, NetVolume=Qto_WallBaseQuantities.NetVolume',
|
|
40
|
+
groupBy: 'Material',
|
|
41
|
+
subtotals: 'count, sum:NetVolume',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Look up a preset by name (case-insensitive). An unknown name is a
|
|
46
|
+
* `fatal(...)` that lists the valid preset names.
|
|
47
|
+
*
|
|
48
|
+
* `Object.hasOwn` guards a plain-object-property lookup against a name that
|
|
49
|
+
* collides with something every object inherits from `Object.prototype`
|
|
50
|
+
* (`constructor`, `toString`, `hasOwnProperty`, ...) — a bare
|
|
51
|
+
* `SCHEDULE_PRESETS[name]` would resolve `--preset constructor` to the
|
|
52
|
+
* inherited `Function` value instead of failing, since a function is truthy
|
|
53
|
+
* and a plain `!preset` check never catches it.
|
|
54
|
+
*/
|
|
55
|
+
export function resolvePreset(name) {
|
|
56
|
+
const key = name.toLowerCase();
|
|
57
|
+
if (!Object.hasOwn(SCHEDULE_PRESETS, key)) {
|
|
58
|
+
fatal(`Unknown --preset "${name}". Valid presets: ${Object.keys(SCHEDULE_PRESETS).join(', ')}.`);
|
|
59
|
+
}
|
|
60
|
+
return SCHEDULE_PRESETS[key];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=schedule-presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-presets.js","sourceRoot":"","sources":["../../src/commands/schedule-presets.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAUrC,MAAM,CAAC,MAAM,gBAAgB,GAAmC;IAC9D,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,OAAO,EACL,wKAAwK;KAC3K;IACD,MAAM,EAAE;QACN,IAAI,EAAE,WAAW;QACjB,OAAO,EACL,gLAAgL;KACnL;IACD,KAAK,EAAE;QACL,IAAI,EAAE,UAAU;QAChB,OAAO,EACL,oKAAoK;QACtK,IAAI,EAAE,mBAAmB;KAC1B;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,OAAO,EACL,qPAAqP;KACxP;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,+DAA+D;QACxE,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE,sBAAsB;KAClC;CACF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,GAAG,CAAC,EAAE,CAAC;QAC1C,KAAK,CACH,qBAAqB,IAAI,qBAAqB,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC1F,CAAC;IACJ,CAAC;IACD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ScheduleColumn } from './schedule-columns.js';
|
|
2
|
+
import type { SubtotalPlan } from './schedule-aggregate.js';
|
|
3
|
+
import type { ScheduleRow } from './schedule-render.js';
|
|
4
|
+
/** Render the schedule as a standalone HTML document containing one `<table>`. */
|
|
5
|
+
export declare function renderScheduleHtml(columns: ScheduleColumn[], rows: ScheduleRow[]): string;
|
|
6
|
+
/**
|
|
7
|
+
* Render a schedule with `--subtotals` as a standalone HTML document: grouped
|
|
8
|
+
* rows followed by their subtotal `<tr class="subtotal">`, then the grand
|
|
9
|
+
* total `<tr class="total">` — the same layout `renderScheduleCsvWithSubtotals`
|
|
10
|
+
* produces.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderScheduleHtmlWithSubtotals(columns: ScheduleColumn[], plan: SubtotalPlan): string;
|
|
13
|
+
//# sourceMappingURL=schedule-render-html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-render-html.d.ts","sourceRoot":"","sources":["../../src/commands/schedule-render-html.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,yBAAyB,CAAC;AAE7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA8CxD,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,MAAM,CAEzF;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAarG"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* HTML rendering for `ifc-lite schedule --format html`.
|
|
6
|
+
*
|
|
7
|
+
* Emits a complete, standalone HTML document (`<!doctype html>` through
|
|
8
|
+
* `</html>`) with one `<table>`: a `<thead>` header row and a `<tbody>` data
|
|
9
|
+
* row per entity, then — with `--subtotals` — a subtotal `<tr>` per contiguous
|
|
10
|
+
* group and a closing grand-total `<tr>`, using the exact same `subtotalCells`
|
|
11
|
+
* layout as CSV/Markdown so a value/label lands in the same column across
|
|
12
|
+
* every output format. A standalone document (not a bare `<table>` fragment)
|
|
13
|
+
* so `ifc-lite schedule ... --format html > schedule.html` opens directly in a
|
|
14
|
+
* browser.
|
|
15
|
+
*
|
|
16
|
+
* Cell text is untrusted model data (IFC attribute/property/quantity values
|
|
17
|
+
* authored by whoever produced the model) landing in an HTML document, so
|
|
18
|
+
* every cell — headers included — is escaped: `&` first (so escaping the
|
|
19
|
+
* other characters doesn't get re-escaped), then `<`, `>`, `"`, `'`. Subtotal
|
|
20
|
+
* rows carry a `class` for CSS hooks, not to change escaping.
|
|
21
|
+
*
|
|
22
|
+
* Contract, and how it differs from `schedule-render-md.ts`: THIS renderer's
|
|
23
|
+
* output is a document a browser executes as HTML the moment it's opened, so
|
|
24
|
+
* full HTML-escaping is mandatory here — unlike the Markdown renderer, which
|
|
25
|
+
* only neutralises table-structure characters and deliberately leaves inline
|
|
26
|
+
* HTML in a cell alone (GFM permits it). Both renderers treat cell content as
|
|
27
|
+
* untrusted; they differ because their output has a different execution
|
|
28
|
+
* model.
|
|
29
|
+
*/
|
|
30
|
+
import { columnValueToCsv } from './export.js';
|
|
31
|
+
import { subtotalCells } from './schedule-render.js';
|
|
32
|
+
/** Escape one cell's text for HTML text content (and safe inside a quoted attribute). */
|
|
33
|
+
function escapeHtml(value) {
|
|
34
|
+
const text = columnValueToCsv(value);
|
|
35
|
+
return text
|
|
36
|
+
.replace(/&/g, '&')
|
|
37
|
+
.replace(/</g, '<')
|
|
38
|
+
.replace(/>/g, '>')
|
|
39
|
+
.replace(/"/g, '"')
|
|
40
|
+
.replace(/'/g, ''');
|
|
41
|
+
}
|
|
42
|
+
function tr(cells, cssClass) {
|
|
43
|
+
const attr = cssClass ? ` class="${cssClass}"` : '';
|
|
44
|
+
return ` <tr${attr}>${cells.map(c => `<td>${escapeHtml(c)}</td>`).join('')}</tr>`;
|
|
45
|
+
}
|
|
46
|
+
function documentShell(columns, bodyRows) {
|
|
47
|
+
const headCells = columns.map(c => `<th>${escapeHtml(c.header)}</th>`).join('');
|
|
48
|
+
return [
|
|
49
|
+
'<!doctype html>',
|
|
50
|
+
'<html lang="en">',
|
|
51
|
+
'<head>',
|
|
52
|
+
'<meta charset="utf-8">',
|
|
53
|
+
'<title>Schedule</title>',
|
|
54
|
+
'<style>',
|
|
55
|
+
'table { border-collapse: collapse; font-family: sans-serif; font-size: 14px; }',
|
|
56
|
+
'th, td { border: 1px solid #ccc; padding: 4px 8px; text-align: left; }',
|
|
57
|
+
'th { background: #f0f0f0; }',
|
|
58
|
+
'tr.subtotal td, tr.total td { font-weight: bold; background: #fafafa; }',
|
|
59
|
+
'</style>',
|
|
60
|
+
'</head>',
|
|
61
|
+
'<body>',
|
|
62
|
+
' <table>',
|
|
63
|
+
` <thead><tr>${headCells}</tr></thead>`,
|
|
64
|
+
' <tbody>',
|
|
65
|
+
...bodyRows,
|
|
66
|
+
' </tbody>',
|
|
67
|
+
' </table>',
|
|
68
|
+
'</body>',
|
|
69
|
+
'</html>',
|
|
70
|
+
'',
|
|
71
|
+
].join('\n');
|
|
72
|
+
}
|
|
73
|
+
/** Render the schedule as a standalone HTML document containing one `<table>`. */
|
|
74
|
+
export function renderScheduleHtml(columns, rows) {
|
|
75
|
+
return documentShell(columns, rows.map(row => tr(row)));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Render a schedule with `--subtotals` as a standalone HTML document: grouped
|
|
79
|
+
* rows followed by their subtotal `<tr class="subtotal">`, then the grand
|
|
80
|
+
* total `<tr class="total">` — the same layout `renderScheduleCsvWithSubtotals`
|
|
81
|
+
* produces.
|
|
82
|
+
*/
|
|
83
|
+
export function renderScheduleHtmlWithSubtotals(columns, plan) {
|
|
84
|
+
const bodyRows = [];
|
|
85
|
+
const subtotalClass = (data) => (data.kind === 'total' ? 'total' : 'subtotal');
|
|
86
|
+
if (plan.groups.length > 0) {
|
|
87
|
+
for (const group of plan.groups) {
|
|
88
|
+
for (const row of group.rows)
|
|
89
|
+
bodyRows.push(tr(row));
|
|
90
|
+
bodyRows.push(tr(subtotalCells(columns, group.subtotal), subtotalClass(group.subtotal)));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
for (const row of plan.rows)
|
|
95
|
+
bodyRows.push(tr(row));
|
|
96
|
+
}
|
|
97
|
+
bodyRows.push(tr(subtotalCells(columns, plan.total), subtotalClass(plan.total)));
|
|
98
|
+
return documentShell(columns, bodyRows);
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=schedule-render-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-render-html.js","sourceRoot":"","sources":["../../src/commands/schedule-render-html.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,yFAAyF;AACzF,SAAS,UAAU,CAAC,KAAc;IAChC,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACrC,OAAO,IAAI;SACR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,EAAE,CAAC,KAAgB,EAAE,QAAiB;IAC7C,MAAM,IAAI,GAAG,QAAQ,C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AO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAChG,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI;gBAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI;YAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjF,OAAO,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ScheduleColumn } from './schedule-columns.js';
|
|
2
|
+
import type { SubtotalPlan } from './schedule-aggregate.js';
|
|
3
|
+
import type { ScheduleRow } from './schedule-render.js';
|
|
4
|
+
/** Render the schedule as a GFM Markdown table. */
|
|
5
|
+
export declare function renderScheduleMarkdown(columns: ScheduleColumn[], rows: ScheduleRow[]): string;
|
|
6
|
+
/**
|
|
7
|
+
* Render a schedule with `--subtotals` as a GFM Markdown table: grouped rows
|
|
8
|
+
* followed by their subtotal row, then the grand total — the same layout
|
|
9
|
+
* `renderScheduleCsvWithSubtotals` produces.
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderScheduleMarkdownWithSubtotals(columns: ScheduleColumn[], plan: SubtotalPlan): string;
|
|
12
|
+
//# sourceMappingURL=schedule-render-md.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-render-md.d.ts","sourceRoot":"","sources":["../../src/commands/schedule-render-md.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAkBxD,mDAAmD;AACnD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,MAAM,CAG7F;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAYzG"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Markdown (GFM table) rendering for `ifc-lite schedule --format md`.
|
|
6
|
+
*
|
|
7
|
+
* Same row/column shape as `renderScheduleCsv`/`renderScheduleCsvWithSubtotals`
|
|
8
|
+
* (see `schedule-render.ts`): one header row, one `---` separator row (GFM
|
|
9
|
+
* table syntax), then one row per entity, then — with `--subtotals` — a
|
|
10
|
+
* subtotal row per contiguous group and a closing grand-total row, using the
|
|
11
|
+
* exact same `subtotalCells` layout as CSV so a value/label lands in the same
|
|
12
|
+
* column across every output format.
|
|
13
|
+
*
|
|
14
|
+
* A GFM table cell is delimited by `|` and terminated by a newline, so both
|
|
15
|
+
* must be neutralised or the cell would fracture the row: a literal `|`
|
|
16
|
+
* becomes `\|` and an embedded newline becomes `<br>` (GFM tables render
|
|
17
|
+
* inline HTML in a cell, so this stays a single visual line without losing the
|
|
18
|
+
* break). The backslash introduced by the `|` escape is itself escaped first
|
|
19
|
+
* so a value already containing a backslash can't produce an unintended
|
|
20
|
+
* escape sequence.
|
|
21
|
+
*
|
|
22
|
+
* Contract, and how it differs from `schedule-render-html.ts`: this renderer
|
|
23
|
+
* does NOT HTML-escape (`&`/`<`/`>`/`"`/`'` pass through verbatim) — only
|
|
24
|
+
* table-structure characters are neutralised. That is deliberate, not an
|
|
25
|
+
* oversight: GFM's own spec renders inline HTML in a cell, so escaping `<`
|
|
26
|
+
* would defeat legitimate uses (e.g. a deliberate `<br>`) without this tool's
|
|
27
|
+
* involvement being what makes the difference. It is safe in THIS codebase
|
|
28
|
+
* because the output only ever reaches `process.stdout` in `schedule.ts` —
|
|
29
|
+
* nothing here writes it to a file or hands it to an HTML-rendering pipeline.
|
|
30
|
+
* A caller who pipes this Markdown into a raw-HTML-enabled renderer (e.g.
|
|
31
|
+
* `remark`+`rehype-raw` with no sanitize schema) is responsible for treating
|
|
32
|
+
* cell content as untrusted model text and sanitising it there — the same way
|
|
33
|
+
* `escapeHtml` in `schedule-render-html.ts` treats it as untrusted for a
|
|
34
|
+
* renderer that unconditionally executes markup.
|
|
35
|
+
*/
|
|
36
|
+
import { columnValueToCsv } from './export.js';
|
|
37
|
+
import { subtotalCells } from './schedule-render.js';
|
|
38
|
+
/** Escape one cell's text for a GFM table: backslash, then `|`, then newline. */
|
|
39
|
+
function escapeMarkdownCell(value) {
|
|
40
|
+
const text = columnValueToCsv(value);
|
|
41
|
+
return text.replace(/\\/g, '\\\\').replace(/\|/g, '\\|').replace(/\r\n|\r|\n/g, '<br>');
|
|
42
|
+
}
|
|
43
|
+
function headerAndSeparator(columns) {
|
|
44
|
+
const header = `| ${columns.map(c => escapeMarkdownCell(c.header)).join(' | ')} |`;
|
|
45
|
+
const separator = `| ${columns.map(() => '---').join(' | ')} |`;
|
|
46
|
+
return [header, separator];
|
|
47
|
+
}
|
|
48
|
+
function rowLine(row) {
|
|
49
|
+
return `| ${row.map(escapeMarkdownCell).join(' | ')} |`;
|
|
50
|
+
}
|
|
51
|
+
/** Render the schedule as a GFM Markdown table. */
|
|
52
|
+
export function renderScheduleMarkdown(columns, rows) {
|
|
53
|
+
const lines = [...headerAndSeparator(columns), ...rows.map(rowLine)];
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Render a schedule with `--subtotals` as a GFM Markdown table: grouped rows
|
|
58
|
+
* followed by their subtotal row, then the grand total — the same layout
|
|
59
|
+
* `renderScheduleCsvWithSubtotals` produces.
|
|
60
|
+
*/
|
|
61
|
+
export function renderScheduleMarkdownWithSubtotals(columns, plan) {
|
|
62
|
+
const lines = headerAndSeparator(columns);
|
|
63
|
+
if (plan.groups.length > 0) {
|
|
64
|
+
for (const group of plan.groups) {
|
|
65
|
+
for (const row of group.rows)
|
|
66
|
+
lines.push(rowLine(row));
|
|
67
|
+
lines.push(rowLine(subtotalCells(columns, group.subtotal)));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
for (const row of plan.rows)
|
|
72
|
+
lines.push(rowLine(row));
|
|
73
|
+
}
|
|
74
|
+
lines.push(rowLine(subtotalCells(columns, plan.total)));
|
|
75
|
+
return lines.join('\n');
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=schedule-render-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-render-md.js","sourceRoot":"","sources":["../../src/commands/schedule-render-md.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG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,CAAC;QAC3B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ScheduleColumn } from './schedule-columns.js';
|
|
2
|
+
import type { SubtotalPlan, SubtotalRowData } from './schedule-aggregate.js';
|
|
3
|
+
/** One resolved row: the raw value for each column, in column order. */
|
|
4
|
+
export type ScheduleRow = unknown[];
|
|
5
|
+
/**
|
|
6
|
+
* Render the schedule as RFC-4180 CSV. Headers and cells both go through the
|
|
7
|
+
* shared escaper so a header or value containing a comma, quote, newline, or a
|
|
8
|
+
* leading formula trigger is correctly quoted/neutralised.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderScheduleCsv(columns: ScheduleColumn[], rows: ScheduleRow[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* Render the schedule as a JSON array of row objects keyed by header. Raw
|
|
13
|
+
* values keep their type; a missing value is `null`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderScheduleJson(columns: ScheduleColumn[], rows: ScheduleRow[]): Record<string, unknown>[];
|
|
16
|
+
/**
|
|
17
|
+
* A subtotal/total row as a full-width cell array. The label sits in a
|
|
18
|
+
* column none of this row's aggregations target (see `chooseLabelCol`); each
|
|
19
|
+
* numeric aggregation fills its own target column; every other column is
|
|
20
|
+
* blank.
|
|
21
|
+
*
|
|
22
|
+
* `--subtotals` allows more than one aggregation on the same `--columns`
|
|
23
|
+
* header (`sum:Area,avg:Area` is a reasonable request, and the JSON renderer
|
|
24
|
+
* already keys those by `spec` without collision — see `subtotalToJson`).
|
|
25
|
+
* The tabular formats have only one cell per column, so when two or more
|
|
26
|
+
* aggregations target the same column their values are joined into one cell
|
|
27
|
+
* as `"sum: 30, avg: 15"` instead of the second one silently overwriting the
|
|
28
|
+
* first. A single aggregation on a column keeps rendering as its bare value
|
|
29
|
+
* (a number, same as before) so the common case is unaffected.
|
|
30
|
+
*
|
|
31
|
+
* When every declared column is an aggregation target there is no free slot
|
|
32
|
+
* for the label at all (`--columns Area --subtotals sum:Area`), so the label
|
|
33
|
+
* takes a targeted column. Those displaced aggregations are appended to the
|
|
34
|
+
* label cell as `Total (sum: 30, avg: 15)` rather than dropped, which is what
|
|
35
|
+
* used to happen: the tabular formats printed a bare `Total` while JSON still
|
|
36
|
+
* reported the values.
|
|
37
|
+
*
|
|
38
|
+
* Exported so the Markdown/HTML renderers (`schedule-render-md.ts`,
|
|
39
|
+
* `schedule-render-html.ts`) lay out subtotal/total rows identically to CSV —
|
|
40
|
+
* same label, same column placement — instead of re-deriving the shape.
|
|
41
|
+
*/
|
|
42
|
+
export declare function subtotalCells(columns: ScheduleColumn[], data: SubtotalRowData): unknown[];
|
|
43
|
+
/**
|
|
44
|
+
* Render a schedule with `--subtotals`. Grouped output emits each contiguous
|
|
45
|
+
* group's rows followed by its subtotal row; the grand total closes the table.
|
|
46
|
+
* Without `--group-by` only the flat rows and the grand total are emitted.
|
|
47
|
+
*/
|
|
48
|
+
export declare function renderScheduleCsvWithSubtotals(columns: ScheduleColumn[], plan: SubtotalPlan): string;
|
|
49
|
+
/** Render a schedule with `--subtotals` as flat JSON rows plus `__row`-marked subtotal/total objects. */
|
|
50
|
+
export declare function renderScheduleJsonWithSubtotals(columns: ScheduleColumn[], plan: SubtotalPlan): Record<string, unknown>[];
|
|
51
|
+
//# sourceMappingURL=schedule-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-render.d.ts","sourceRoot":"","sources":["../../src/commands/schedule-render.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAiB,MAAM,yBAAyB,CAAC;AAE5F,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,OAAO,EAAE,CAAC;AAEpC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,MAAM,CAOxF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAE5G;AAwDD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,EAAE,CAkCzF;AASD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAgBpG;AAUD,yGAAyG;AACzG,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAYxH"}
|