@asteby/metacore-runtime-react 36.0.1 → 36.1.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 36.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4698928: DynamicSelectField gains generic `createDefaults` / `createLockedFields`
|
|
8
|
+
props: the inline "+" forwards them on the `metacore:create-record`
|
|
9
|
+
event so the host's create modal seeds those values and locks those
|
|
10
|
+
fields. Any model, any fields — e.g. a mechanic picker creating a team
|
|
11
|
+
user with `{ role: 'mecanico' }` pre-set and locked, no HR dependency.
|
|
12
|
+
|
|
3
13
|
## 36.0.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -76,7 +76,19 @@ export interface DynamicSelectFieldProps {
|
|
|
76
76
|
* meaningful in context.
|
|
77
77
|
*/
|
|
78
78
|
hideCreate?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Pre-filled values for the record the inline "+" creates, forwarded to
|
|
81
|
+
* the host's create modal via the `metacore:create-record` event.
|
|
82
|
+
* Generic: any model, any fields (e.g. a mechanic picker seeding
|
|
83
|
+
* `{ role: 'mecanico' }` on a new team user).
|
|
84
|
+
*/
|
|
85
|
+
createDefaults?: Record<string, unknown>;
|
|
86
|
+
/**
|
|
87
|
+
* Fields of the inline-created record the user must NOT change — the
|
|
88
|
+
* host's create modal renders them locked. Pairs with `createDefaults`.
|
|
89
|
+
*/
|
|
90
|
+
createLockedFields?: string[];
|
|
79
91
|
}
|
|
80
|
-
export declare function DynamicSelectField({ field, value, onChange, seedOption, dependsValue, dependsHint, readonly, staticOptions, descriptionAsBadge, hideCreate, }: DynamicSelectFieldProps): import("react").JSX.Element;
|
|
92
|
+
export declare function DynamicSelectField({ field, value, onChange, seedOption, dependsValue, dependsHint, readonly, staticOptions, descriptionAsBadge, hideCreate, createDefaults, createLockedFields, }: DynamicSelectFieldProps): import("react").JSX.Element;
|
|
81
93
|
export default DynamicSelectField;
|
|
82
94
|
//# sourceMappingURL=dynamic-select-field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-select-field.d.ts","sourceRoot":"","sources":["../src/dynamic-select-field.tsx"],"names":[],"mappings":"AA4CA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gDAAgD,CAAA;AAEjF;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,IAAI,EACJ,IAAS,GACZ,EAAE;IACC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,+BA4BA;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACvB,MAAM,EACN,IAAS,GACZ,EAAE;IACC,MAAM,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,CAAA;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,sCA4BA;AAMD,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;IAC1B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IAClC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,C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MAAM,CAAA;IACrB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,SAAS,cAAc,EAAE,GAAG,IAAI,CAAA;IAChD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACxC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAChC;AAED,wBAAgB,kBAAkB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,WAAW,EACX,QAAgB,EAChB,aAAoB,EACpB,kBAA0B,EAC1B,UAAkB,EAClB,cAAc,EACd,kBAAkB,GACrB,EAAE,uBAAuB,+BAsTzB;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -88,7 +88,7 @@ export function OptionLead({ option, size = 20, }) {
|
|
|
88
88
|
function useDebounced(value, ms) {
|
|
89
89
|
return useDebouncedValue(value, ms);
|
|
90
90
|
}
|
|
91
|
-
export function DynamicSelectField({ field, value, onChange, seedOption, dependsValue, dependsHint, readonly = false, staticOptions = null, descriptionAsBadge = false, hideCreate = false, }) {
|
|
91
|
+
export function DynamicSelectField({ field, value, onChange, seedOption, dependsValue, dependsHint, readonly = false, staticOptions = null, descriptionAsBadge = false, hideCreate = false, createDefaults, createLockedFields, }) {
|
|
92
92
|
const { t } = useTranslation();
|
|
93
93
|
const ph = (fallback) => field.placeholder ? t(field.placeholder, { defaultValue: field.placeholder }) : fallback;
|
|
94
94
|
const [open, setOpen] = useState(false);
|
|
@@ -194,6 +194,11 @@ export function DynamicSelectField({ field, value, onChange, seedOption, depends
|
|
|
194
194
|
window.dispatchEvent(new CustomEvent('metacore:create-record', {
|
|
195
195
|
detail: {
|
|
196
196
|
model: fieldRef,
|
|
197
|
+
// Generic passthrough: the host's create modal seeds these
|
|
198
|
+
// values and locks these fields (DynamicRecordDialog's own
|
|
199
|
+
// defaults/lockedFields props). Undefined when unused.
|
|
200
|
+
defaults: createDefaults,
|
|
201
|
+
lockedFields: createLockedFields,
|
|
197
202
|
onCreated: (rec) => {
|
|
198
203
|
if (rec && rec.id != null) {
|
|
199
204
|
const id = String(rec.id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asteby/metacore-runtime-react",
|
|
3
|
-
"version": "36.0
|
|
3
|
+
"version": "36.1.0",
|
|
4
4
|
"description": "React runtime for metacore hosts — renders addon contributions dynamically",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"sonner": ">=1.7",
|
|
39
39
|
"zustand": ">=5",
|
|
40
40
|
"@asteby/metacore-sdk": "^3.6.0",
|
|
41
|
-
"@asteby/metacore-ui": "^2.17.
|
|
41
|
+
"@asteby/metacore-ui": "^2.17.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"@tanstack/react-router": {
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"typescript": "^6.0.0",
|
|
68
68
|
"vitest": "^4.0.0",
|
|
69
69
|
"zustand": "^5.0.0",
|
|
70
|
-
"@asteby/metacore-
|
|
71
|
-
"@asteby/metacore-
|
|
70
|
+
"@asteby/metacore-sdk": "3.6.0",
|
|
71
|
+
"@asteby/metacore-ui": "2.17.3"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "tsc -p tsconfig.json",
|
|
@@ -192,6 +192,18 @@ export interface DynamicSelectFieldProps {
|
|
|
192
192
|
* meaningful in context.
|
|
193
193
|
*/
|
|
194
194
|
hideCreate?: boolean
|
|
195
|
+
/**
|
|
196
|
+
* Pre-filled values for the record the inline "+" creates, forwarded to
|
|
197
|
+
* the host's create modal via the `metacore:create-record` event.
|
|
198
|
+
* Generic: any model, any fields (e.g. a mechanic picker seeding
|
|
199
|
+
* `{ role: 'mecanico' }` on a new team user).
|
|
200
|
+
*/
|
|
201
|
+
createDefaults?: Record<string, unknown>
|
|
202
|
+
/**
|
|
203
|
+
* Fields of the inline-created record the user must NOT change — the
|
|
204
|
+
* host's create modal renders them locked. Pairs with `createDefaults`.
|
|
205
|
+
*/
|
|
206
|
+
createLockedFields?: string[]
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
export function DynamicSelectField({
|
|
@@ -205,6 +217,8 @@ export function DynamicSelectField({
|
|
|
205
217
|
staticOptions = null,
|
|
206
218
|
descriptionAsBadge = false,
|
|
207
219
|
hideCreate = false,
|
|
220
|
+
createDefaults,
|
|
221
|
+
createLockedFields,
|
|
208
222
|
}: DynamicSelectFieldProps) {
|
|
209
223
|
const { t } = useTranslation()
|
|
210
224
|
const ph = (fallback: string) =>
|
|
@@ -325,6 +339,11 @@ export function DynamicSelectField({
|
|
|
325
339
|
new CustomEvent('metacore:create-record', {
|
|
326
340
|
detail: {
|
|
327
341
|
model: fieldRef,
|
|
342
|
+
// Generic passthrough: the host's create modal seeds these
|
|
343
|
+
// values and locks these fields (DynamicRecordDialog's own
|
|
344
|
+
// defaults/lockedFields props). Undefined when unused.
|
|
345
|
+
defaults: createDefaults,
|
|
346
|
+
lockedFields: createLockedFields,
|
|
328
347
|
onCreated: (rec: any) => {
|
|
329
348
|
if (rec && rec.id != null) {
|
|
330
349
|
const id = String(rec.id)
|