@timeax/digital-service-engine 0.3.4 → 0.3.5
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/core/index.cjs +29 -5
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +29 -5
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +776 -628
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +68 -54
- package/dist/react/index.d.ts +68 -54
- package/dist/react/index.js +776 -628
- package/dist/react/index.js.map +1 -1
- package/dist/workspace/index.cjs +58 -0
- package/dist/workspace/index.cjs.map +1 -1
- package/dist/workspace/index.d.cts +131 -1
- package/dist/workspace/index.d.ts +131 -1
- package/dist/workspace/index.js +58 -0
- package/dist/workspace/index.js.map +1 -1
- package/package.json +1 -1
package/dist/workspace/index.cjs
CHANGED
|
@@ -7466,6 +7466,11 @@ function rateIssueAffectsCandidate(error, candidateId, candidateFieldId, primary
|
|
|
7466
7466
|
});
|
|
7467
7467
|
}
|
|
7468
7468
|
|
|
7469
|
+
// src/react/inputs/registry.ts
|
|
7470
|
+
function resolveInputDescriptor(registry, kind, variant) {
|
|
7471
|
+
return registry.get(kind, variant);
|
|
7472
|
+
}
|
|
7473
|
+
|
|
7469
7474
|
// src/react/canvas/editor/editor-ids.ts
|
|
7470
7475
|
function uniqueId(ctx, base) {
|
|
7471
7476
|
var _a, _b;
|
|
@@ -8376,6 +8381,7 @@ function addField(ctx, partial) {
|
|
|
8376
8381
|
p.fields = ((_a2 = p.fields) != null ? _a2 : []).filter((f) => f.id !== id);
|
|
8377
8382
|
})
|
|
8378
8383
|
});
|
|
8384
|
+
return id;
|
|
8379
8385
|
}
|
|
8380
8386
|
function updateField(ctx, id, patch) {
|
|
8381
8387
|
let prev;
|
|
@@ -9812,6 +9818,36 @@ var Editor = class {
|
|
|
9812
9818
|
addField(partial) {
|
|
9813
9819
|
return addField(this.moduleCtx(), partial);
|
|
9814
9820
|
}
|
|
9821
|
+
addFieldFromDescriptor(registry, partial, opts) {
|
|
9822
|
+
var _a, _b, _c, _d, _e;
|
|
9823
|
+
const variant = (_b = opts == null ? void 0 : opts.variant) != null ? _b : typeof ((_a = partial == null ? void 0 : partial.meta) == null ? void 0 : _a.variant) === "string" ? partial.meta.variant : void 0;
|
|
9824
|
+
const descriptor = resolveInputDescriptor(
|
|
9825
|
+
registry,
|
|
9826
|
+
String(partial.type),
|
|
9827
|
+
variant
|
|
9828
|
+
);
|
|
9829
|
+
const nextMeta = {
|
|
9830
|
+
...(_c = partial.meta) != null ? _c : {}
|
|
9831
|
+
};
|
|
9832
|
+
if (((_d = descriptor == null ? void 0 : descriptor.multi) == null ? void 0 : _d.autoEnable) === true) {
|
|
9833
|
+
nextMeta.multi = true;
|
|
9834
|
+
}
|
|
9835
|
+
const fieldInput = {
|
|
9836
|
+
...partial,
|
|
9837
|
+
...Object.keys(nextMeta).length ? { meta: nextMeta } : {}
|
|
9838
|
+
};
|
|
9839
|
+
const fieldId = this.addField(fieldInput);
|
|
9840
|
+
if (((_e = descriptor == null ? void 0 : descriptor.options) == null ? void 0 : _e.autoCreate) === true) {
|
|
9841
|
+
this.autoCreateOptionsMany([fieldId], () => {
|
|
9842
|
+
var _a2, _b2, _c2, _d2;
|
|
9843
|
+
return {
|
|
9844
|
+
label: (_b2 = (_a2 = descriptor.options) == null ? void 0 : _a2.defaultLabel) != null ? _b2 : "Option label",
|
|
9845
|
+
value: (_d2 = (_c2 = descriptor.options) == null ? void 0 : _c2.defaultValue) != null ? _d2 : "option"
|
|
9846
|
+
};
|
|
9847
|
+
});
|
|
9848
|
+
}
|
|
9849
|
+
return fieldId;
|
|
9850
|
+
}
|
|
9815
9851
|
updateField(id, patch) {
|
|
9816
9852
|
return updateField(this.moduleCtx(), id, patch);
|
|
9817
9853
|
}
|
|
@@ -10007,6 +10043,28 @@ var Editor = class {
|
|
|
10007
10043
|
});
|
|
10008
10044
|
});
|
|
10009
10045
|
}
|
|
10046
|
+
setFieldMulti(fieldId, enabled) {
|
|
10047
|
+
const flag = enabled === true;
|
|
10048
|
+
this.transact("setFieldMulti", () => {
|
|
10049
|
+
this.patchProps((p) => {
|
|
10050
|
+
var _a, _b;
|
|
10051
|
+
const f = ((_a = p.fields) != null ? _a : []).find((x) => x.id === fieldId);
|
|
10052
|
+
if (!f) return;
|
|
10053
|
+
const currentMeta = (_b = f.meta) != null ? _b : {};
|
|
10054
|
+
const nextMeta = { ...currentMeta };
|
|
10055
|
+
if (flag) {
|
|
10056
|
+
nextMeta.multi = true;
|
|
10057
|
+
} else {
|
|
10058
|
+
delete nextMeta.multi;
|
|
10059
|
+
}
|
|
10060
|
+
if (Object.keys(nextMeta).length === 0) {
|
|
10061
|
+
delete f.meta;
|
|
10062
|
+
} else {
|
|
10063
|
+
f.meta = nextMeta;
|
|
10064
|
+
}
|
|
10065
|
+
});
|
|
10066
|
+
});
|
|
10067
|
+
}
|
|
10010
10068
|
autoCreateOptionsMany(ids, makeOption) {
|
|
10011
10069
|
const ordered = Array.from(new Set((ids != null ? ids : []).map((id) => String(id))));
|
|
10012
10070
|
if (!ordered.length) return;
|