@streamline-pulse/formkrafter-core 0.32.1 → 0.34.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/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { BrickMold } from "./utils/brick-mold.js";
|
|
|
3
3
|
export { DropType, BrickMoldDropType, BrickSpecDropType } from "./utils/drop-type.js";
|
|
4
4
|
export { BrickStyles } from "./utils/brick-styles.js";
|
|
5
5
|
export { BrickBaseConfigs, CommonBrickProps, WithBrickBaseConfigs } from "./utils/common-brick-props.js";
|
|
6
|
-
export { BrickSpec, buildValidationSchema, iterateBricks, iterateSchemaBricks, defaultFormData, } from "./utils/brick-spec.js";
|
|
6
|
+
export { BrickLayout, BrickSpec, buildValidationSchema, iterateBricks, iterateSchemaBricks, defaultFormData, } from "./utils/brick-spec.js";
|
|
7
7
|
export { getBrickData, wrapBrickData } from "./utils/brick-data.js";
|
|
8
8
|
export { SelectOption, normalizeOptions } from "./utils/options.js";
|
|
9
9
|
export { RecapItem, collectRecapItems } from "./utils/recap.js";
|
|
@@ -48,4 +48,4 @@ export type { SpecSourceService, FetchSpecSourceDefaults } from "./services/spec
|
|
|
48
48
|
export { FetchOptionSourceService } from "./services/option_source_service.js";
|
|
49
49
|
export { FilePickOptions, FilePickerService } from "./services/file_picker_service.js";
|
|
50
50
|
export { DocumentReading, DocumentReadOptions, DocumentReaderService, FetchDocumentReaderDefaults, FetchDocumentReaderService, readDocumentReading, } from "./services/document_reader_service.js";
|
|
51
|
-
export type { OptionSourceService, FetchOptionSourceDefaults } from "./services/option_source_service.js";
|
|
51
|
+
export type { OptionSourceService, OptionCatalogEntry, FetchOptionSourceDefaults } from "./services/option_source_service.js";
|
package/dist/index.js
CHANGED
|
@@ -8217,6 +8217,37 @@ class FetchOptionSourceService {
|
|
|
8217
8217
|
}
|
|
8218
8218
|
return pending;
|
|
8219
8219
|
}
|
|
8220
|
+
catalogs;
|
|
8221
|
+
listCatalogs() {
|
|
8222
|
+
const url = this.defaults.catalogsUrl ?? this.defaults.baseUrl;
|
|
8223
|
+
if (!url)
|
|
8224
|
+
return Promise.resolve([]);
|
|
8225
|
+
if (!this.catalogs) {
|
|
8226
|
+
const fetchImplementation = this.defaults.fetch ?? globalThis.fetch.bind(globalThis);
|
|
8227
|
+
this.catalogs = fetchImplementation(url, { headers: this.defaults.headers, credentials: this.defaults.credentials }).then(async (response) => {
|
|
8228
|
+
if (!response.ok)
|
|
8229
|
+
throw new Error(`Failed to list option catalogs (${response.status})`);
|
|
8230
|
+
const body = await response.json();
|
|
8231
|
+
const rows = Array.isArray(body) ? body : Array.isArray(body?.data) ? body.data : [];
|
|
8232
|
+
return rows.flatMap((row) => {
|
|
8233
|
+
const entry = row ?? {};
|
|
8234
|
+
const ref = String(entry.ref ?? entry.value ?? "");
|
|
8235
|
+
if (!ref)
|
|
8236
|
+
return [];
|
|
8237
|
+
return [
|
|
8238
|
+
{
|
|
8239
|
+
ref,
|
|
8240
|
+
label: String(entry.name ?? entry.label ?? ref),
|
|
8241
|
+
...typeof entry.description === "string" && { description: entry.description },
|
|
8242
|
+
...Array.isArray(entry.filters) && { filters: entry.filters.map(String) }
|
|
8243
|
+
}
|
|
8244
|
+
];
|
|
8245
|
+
});
|
|
8246
|
+
});
|
|
8247
|
+
this.catalogs.catch(() => this.catalogs = undefined);
|
|
8248
|
+
}
|
|
8249
|
+
return this.catalogs;
|
|
8250
|
+
}
|
|
8220
8251
|
}
|
|
8221
8252
|
|
|
8222
8253
|
// lib/services/document_reader_service.ts
|
|
@@ -8931,6 +8962,7 @@ function documentFillPatch(fields, fills) {
|
|
|
8931
8962
|
var flaggedKeys = (annotations) => Object.entries(annotations ?? {}).filter(([, annotation]) => annotation?.incorrect === true).map(([key]) => key);
|
|
8932
8963
|
// lib/utils/lint-spec.ts
|
|
8933
8964
|
var isDataCarrying = (brick) => brick.type === "input" || brick.type === "collection";
|
|
8965
|
+
var isRow = (brick) => brick.type === "panel" && brick.id === "row";
|
|
8934
8966
|
function lintSpec(spec) {
|
|
8935
8967
|
if (!spec)
|
|
8936
8968
|
return [];
|
|
@@ -8977,6 +9009,17 @@ function lintSpec(spec) {
|
|
|
8977
9009
|
message: `collection "${key ?? brick.id}" has no row template — it can never produce data`
|
|
8978
9010
|
});
|
|
8979
9011
|
}
|
|
9012
|
+
if (isRow(brick)) {
|
|
9013
|
+
for (const [index, child] of (brick.children ?? []).entries()) {
|
|
9014
|
+
if (child?.type !== "output")
|
|
9015
|
+
continue;
|
|
9016
|
+
issues.push({
|
|
9017
|
+
code: "content-in-row",
|
|
9018
|
+
path: `${path}.${index}`,
|
|
9019
|
+
message: `${child.id} brick in a row takes a column like a field and reads as a label without one — place it above or below the row`
|
|
9020
|
+
});
|
|
9021
|
+
}
|
|
9022
|
+
}
|
|
8980
9023
|
}
|
|
8981
9024
|
return issues;
|
|
8982
9025
|
}
|
|
@@ -10128,5 +10171,5 @@ export {
|
|
|
10128
10171
|
wrapBrickData
|
|
10129
10172
|
};
|
|
10130
10173
|
|
|
10131
|
-
//# debugId=
|
|
10174
|
+
//# debugId=4C946517E957968D64756E2164756E21
|
|
10132
10175
|
//# sourceMappingURL=index.js.map
|