@pure-ds/core 0.7.25 → 0.7.27
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/.cursorrules +12 -1
- package/.github/copilot-instructions.md +12 -1
- package/custom-elements.json +1099 -74
- package/dist/types/public/assets/js/pds-ask.d.ts +2 -1
- package/dist/types/public/assets/js/pds-ask.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-autocomplete.d.ts +25 -36
- package/dist/types/public/assets/js/pds-autocomplete.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-enhancers.d.ts +4 -4
- package/dist/types/public/assets/js/pds-enhancers.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-manager.d.ts +444 -159
- package/dist/types/public/assets/js/pds-manager.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-toast.d.ts +7 -6
- package/dist/types/public/assets/js/pds-toast.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds.d.ts +4 -3
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-daterange.d.ts +2 -0
- package/dist/types/public/assets/pds/components/pds-daterange.d.ts.map +1 -0
- package/dist/types/public/assets/pds/components/pds-form.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-rating.d.ts +120 -0
- package/dist/types/public/assets/pds/components/pds-rating.d.ts.map +1 -0
- package/dist/types/public/assets/pds/components/pds-tags.d.ts +2 -0
- package/dist/types/public/assets/pds/components/pds-tags.d.ts.map +1 -0
- package/dist/types/src/js/common/ask.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -1
- package/package.json +2 -2
- package/public/assets/js/app.js +1 -1
- package/public/assets/js/pds-ask.js +6 -6
- package/public/assets/js/pds-manager.js +104 -29
- package/public/assets/pds/components/pds-calendar.js +91 -159
- package/public/assets/pds/components/pds-daterange.js +683 -0
- package/public/assets/pds/components/pds-form.js +123 -21
- package/public/assets/pds/components/pds-rating.js +648 -0
- package/public/assets/pds/components/pds-tags.js +802 -0
- package/public/assets/pds/core/pds-ask.js +6 -6
- package/public/assets/pds/core/pds-manager.js +104 -29
- package/public/assets/pds/custom-elements.json +1099 -74
- package/public/assets/pds/pds-css-complete.json +7 -2
- package/public/assets/pds/pds.css-data.json +4 -4
- package/public/assets/pds/vscode-custom-data.json +97 -0
- package/src/js/pds-core/pds-generator.js +103 -28
- package/src/js/pds-core/pds-ontology.js +2 -2
|
@@ -622,8 +622,14 @@ export class SchemaForm extends LitElement {
|
|
|
622
622
|
widget: null,
|
|
623
623
|
});
|
|
624
624
|
if (picked?.widget) return picked.widget;
|
|
625
|
-
// Honor explicit uiSchema widget hints
|
|
626
|
-
if (ui?.["ui:widget"])
|
|
625
|
+
// Honor explicit uiSchema widget hints (with aliases)
|
|
626
|
+
if (ui?.["ui:widget"]) {
|
|
627
|
+
const explicitWidget = ui["ui:widget"];
|
|
628
|
+
if (explicitWidget === "rating" || explicitWidget === "pds-rating") {
|
|
629
|
+
return "pds-rating";
|
|
630
|
+
}
|
|
631
|
+
return explicitWidget;
|
|
632
|
+
}
|
|
627
633
|
const { values } = this.#extractEnumOptions(schema);
|
|
628
634
|
if (values.length > 0) return values.length <= 5 ? "radio" : "select";
|
|
629
635
|
if (schema.const !== undefined) return "const";
|
|
@@ -650,6 +656,8 @@ export class SchemaForm extends LitElement {
|
|
|
650
656
|
return "input-url";
|
|
651
657
|
case "date":
|
|
652
658
|
return "input-date";
|
|
659
|
+
case "iso-interval":
|
|
660
|
+
return "input-iso-interval";
|
|
653
661
|
case "time":
|
|
654
662
|
return "input-time";
|
|
655
663
|
case "datetime-local":
|
|
@@ -932,11 +940,56 @@ export class SchemaForm extends LitElement {
|
|
|
932
940
|
|
|
933
941
|
const openDialog = async () => {
|
|
934
942
|
// Read current value from this.#data on each open (not captured at render time)
|
|
935
|
-
const
|
|
943
|
+
const currentValueFromData = this.#getByPath(this.#data, path);
|
|
944
|
+
const currentValueFromInitial = this.values
|
|
945
|
+
? this.#getByPath(this.values, path)
|
|
946
|
+
: undefined;
|
|
947
|
+
const currentValue =
|
|
948
|
+
currentValueFromData ?? currentValueFromInitial ?? {};
|
|
949
|
+
|
|
950
|
+
const dialogUiSchema = {};
|
|
951
|
+
|
|
952
|
+
// Preserve root-level ui:* options for dialog form behavior
|
|
953
|
+
if (this.uiSchema && typeof this.uiSchema === "object") {
|
|
954
|
+
for (const [key, value] of Object.entries(this.uiSchema)) {
|
|
955
|
+
if (key.startsWith("ui:")) {
|
|
956
|
+
dialogUiSchema[key] = value;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
// Include nested UI config defined directly under the dialog field
|
|
962
|
+
if (ui && typeof ui === "object") {
|
|
963
|
+
for (const [key, value] of Object.entries(ui)) {
|
|
964
|
+
if (
|
|
965
|
+
key === "ui:dialog" ||
|
|
966
|
+
key === "ui:dialogOptions" ||
|
|
967
|
+
key === "ui:dialogButton" ||
|
|
968
|
+
key === "ui:dialogSize"
|
|
969
|
+
) {
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
if (!key.startsWith("ui:")) {
|
|
973
|
+
dialogUiSchema[key] = value;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
936
977
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
978
|
+
// Include any flat path entries (e.g. '/email') relevant to this dialog schema
|
|
979
|
+
const dialogProps = Object.keys(node?.schema?.properties || {});
|
|
980
|
+
for (const prop of dialogProps) {
|
|
981
|
+
const pointer = `/${this.#escapeJsonPointer(prop)}`;
|
|
982
|
+
if (this.uiSchema?.[pointer] !== undefined) {
|
|
983
|
+
dialogUiSchema[pointer] = this.uiSchema[pointer];
|
|
984
|
+
} else if (this.uiSchema?.[prop] !== undefined) {
|
|
985
|
+
dialogUiSchema[prop] = this.uiSchema[prop];
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
const dialogValues =
|
|
990
|
+
currentValue && typeof currentValue === "object"
|
|
991
|
+
? structuredClone(currentValue)
|
|
992
|
+
: currentValue;
|
|
940
993
|
|
|
941
994
|
this.#emit("pw:dialog-open", {
|
|
942
995
|
path,
|
|
@@ -952,8 +1005,8 @@ export class SchemaForm extends LitElement {
|
|
|
952
1005
|
const formData = await PDS.ask(
|
|
953
1006
|
html`<pds-form
|
|
954
1007
|
.jsonSchema=${dialogSchema}
|
|
955
|
-
.values=${
|
|
956
|
-
.uiSchema=${
|
|
1008
|
+
.values=${dialogValues}
|
|
1009
|
+
.uiSchema=${dialogUiSchema}
|
|
957
1010
|
.options=${this.options}
|
|
958
1011
|
hide-actions
|
|
959
1012
|
hide-legend
|
|
@@ -962,6 +1015,23 @@ export class SchemaForm extends LitElement {
|
|
|
962
1015
|
title: dialogTitle,
|
|
963
1016
|
type: "custom",
|
|
964
1017
|
useForm: true,
|
|
1018
|
+
rendered: (dialogEl) => {
|
|
1019
|
+
try {
|
|
1020
|
+
const dialogForm = dialogEl?.querySelector("pds-form");
|
|
1021
|
+
if (!dialogForm) return;
|
|
1022
|
+
|
|
1023
|
+
// Defensive re-assignment: some template transport paths drop object props
|
|
1024
|
+
dialogForm.jsonSchema = dialogSchema;
|
|
1025
|
+
dialogForm.values = dialogValues;
|
|
1026
|
+
dialogForm.uiSchema = dialogUiSchema;
|
|
1027
|
+
dialogForm.options = this.options;
|
|
1028
|
+
} catch (error) {
|
|
1029
|
+
console.error("pds-form dialog rendered hook failed", {
|
|
1030
|
+
path,
|
|
1031
|
+
error,
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
965
1035
|
size: dialogOpts.size || "lg",
|
|
966
1036
|
buttons: {
|
|
967
1037
|
ok: { name: dialogOpts.submitLabel || "Save", primary: true },
|
|
@@ -984,21 +1054,9 @@ export class SchemaForm extends LitElement {
|
|
|
984
1054
|
dialogSchema
|
|
985
1055
|
);
|
|
986
1056
|
|
|
987
|
-
console.log("Updating path:", path, "with value:", updatedValue);
|
|
988
|
-
console.log(
|
|
989
|
-
"Before update - this.#data:",
|
|
990
|
-
structuredClone(this.#data)
|
|
991
|
-
);
|
|
992
|
-
|
|
993
1057
|
// Update the data at the dialog's path
|
|
994
1058
|
this.#setByPath(this.#data, path, updatedValue);
|
|
995
1059
|
|
|
996
|
-
console.log(
|
|
997
|
-
"After update - this.#data:",
|
|
998
|
-
structuredClone(this.#data)
|
|
999
|
-
);
|
|
1000
|
-
console.log("Verify read back:", this.#getByPath(this.#data, path));
|
|
1001
|
-
|
|
1002
1060
|
this.requestUpdate();
|
|
1003
1061
|
this.#emit("pw:dialog-submit", { path, value: updatedValue });
|
|
1004
1062
|
}
|
|
@@ -1493,7 +1551,11 @@ export class SchemaForm extends LitElement {
|
|
|
1493
1551
|
: node.widgetKey === "checkbox-group"
|
|
1494
1552
|
? "group"
|
|
1495
1553
|
: undefined;
|
|
1496
|
-
const
|
|
1554
|
+
const defaultGroupClass =
|
|
1555
|
+
node.widgetKey === "radio" || node.widgetKey === "checkbox-group"
|
|
1556
|
+
? "buttons"
|
|
1557
|
+
: "stack-sm";
|
|
1558
|
+
const fieldsetClass = ui?.["ui:class"] ?? defaultGroupClass;
|
|
1497
1559
|
return html`
|
|
1498
1560
|
<fieldset
|
|
1499
1561
|
data-path=${path}
|
|
@@ -1700,6 +1762,32 @@ export class SchemaForm extends LitElement {
|
|
|
1700
1762
|
}
|
|
1701
1763
|
);
|
|
1702
1764
|
|
|
1765
|
+
const ratingRenderer = ({ id, path, value, attrs, set, ui }) => {
|
|
1766
|
+
const ratingOpts = ui?.["ui:options"] || {};
|
|
1767
|
+
const max = ratingOpts.max ?? attrs.max ?? 5;
|
|
1768
|
+
const ratingValue = Number(value ?? 0);
|
|
1769
|
+
|
|
1770
|
+
return html`
|
|
1771
|
+
<pds-rating
|
|
1772
|
+
id=${id}
|
|
1773
|
+
name=${path}
|
|
1774
|
+
max=${max}
|
|
1775
|
+
.value=${Number.isFinite(ratingValue) ? ratingValue : 0}
|
|
1776
|
+
?disabled=${!!attrs.disabled}
|
|
1777
|
+
?required=${!!attrs.required}
|
|
1778
|
+
?readonly=${!!attrs.readOnly}
|
|
1779
|
+
@change=${(e) => {
|
|
1780
|
+
const nextValue = Number(e.currentTarget?.value ?? 0);
|
|
1781
|
+
set(Number.isFinite(nextValue) ? nextValue : 0);
|
|
1782
|
+
}}
|
|
1783
|
+
></pds-rating>
|
|
1784
|
+
`;
|
|
1785
|
+
};
|
|
1786
|
+
|
|
1787
|
+
// pds-rating: first-class rating widget (supports "pds-rating" and "rating")
|
|
1788
|
+
this.defineRenderer("pds-rating", ratingRenderer);
|
|
1789
|
+
this.defineRenderer("rating", ratingRenderer);
|
|
1790
|
+
|
|
1703
1791
|
// Range input renderer for ui:widget = 'input-range'
|
|
1704
1792
|
this.defineRenderer(
|
|
1705
1793
|
"input-range",
|
|
@@ -1841,6 +1929,20 @@ export class SchemaForm extends LitElement {
|
|
|
1841
1929
|
`
|
|
1842
1930
|
);
|
|
1843
1931
|
|
|
1932
|
+
this.defineRenderer(
|
|
1933
|
+
"input-iso-interval",
|
|
1934
|
+
({ id, path, value, attrs, set }) => html`
|
|
1935
|
+
<pds-daterange
|
|
1936
|
+
id=${id}
|
|
1937
|
+
name=${path}
|
|
1938
|
+
value=${ifDefined(value ?? undefined)}
|
|
1939
|
+
?required=${!!attrs.required}
|
|
1940
|
+
?disabled=${!!attrs.disabled || !!attrs.readOnly}
|
|
1941
|
+
@range-change=${(e) => set(e.target.value ?? "")}
|
|
1942
|
+
></pds-daterange>
|
|
1943
|
+
`
|
|
1944
|
+
);
|
|
1945
|
+
|
|
1844
1946
|
this.defineRenderer(
|
|
1845
1947
|
"input-time",
|
|
1846
1948
|
({ id, path, value, attrs, set }) => html`
|