@open-mercato/ui 0.6.6-develop.6227.1.2695efff30 → 0.6.6-develop.6229.1.ebe6706732

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.
@@ -97,6 +97,38 @@ function buildFormFieldFromCustomFieldDef(def, opts) {
97
97
  } : {},
98
98
  ...def.multi && def.input === "listbox" ? { listbox: true } : {}
99
99
  };
100
+ case "dictionary": {
101
+ if (!def.multi) {
102
+ const input = FieldRegistry.getInput(def.kind);
103
+ if (input) {
104
+ return {
105
+ id,
106
+ label,
107
+ type: "custom",
108
+ ...baseProps,
109
+ component: (props) => input({ ...props, def })
110
+ };
111
+ }
112
+ return { id, label, type: "text", ...baseProps };
113
+ }
114
+ const optionsUrl = def.optionsUrl || (def.dictionaryId ? `/api/dictionaries/${def.dictionaryId}/entries` : void 0);
115
+ return {
116
+ id,
117
+ label,
118
+ type: "select",
119
+ description: def.description,
120
+ required,
121
+ options: [],
122
+ multiple: true,
123
+ listbox: true,
124
+ ...optionsUrl ? {
125
+ loadOptions: async (query) => {
126
+ const url = buildOptionsUrl(optionsUrl, query);
127
+ return loadRemoteOptions(url);
128
+ }
129
+ } : {}
130
+ };
131
+ }
100
132
  default: {
101
133
  if (def.kind === "text" && def.multi) {
102
134
  const base = { id, label, type: "tags", ...baseProps };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/backend/utils/customFieldForms.ts"],
4
- "sourcesContent": ["import type { CrudField } from '../CrudForm'\nimport type {\n CustomFieldDefDto,\n CustomFieldDefinitionsPayload,\n} from './customFieldDefs'\nimport {\n filterCustomFieldDefs,\n fetchCustomFieldDefs,\n fetchCustomFieldDefinitionsPayload,\n} from './customFieldDefs'\nimport { FieldRegistry, loadGeneratedFieldRegistrations } from '../fields/registry'\nimport { apiCall } from './apiCall'\nimport { normalizeCustomFieldOptions } from '@open-mercato/shared/modules/entities/options'\nimport { CURRENCY_OPTIONS_URL } from '@open-mercato/shared/modules/entities/kinds'\n\nlet registryReady: Promise<void> | null = null\n\nasync function ensureFieldRegistryReady() {\n if (!registryReady) {\n registryReady = loadGeneratedFieldRegistrations().catch((err) => {\n registryReady = null\n throw err\n })\n }\n await registryReady\n}\n\nfunction buildOptionsUrl(base: string, query?: string): string {\n if (!query) return base\n try {\n const isAbsolute = /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(base)\n const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost'\n const url = isAbsolute ? new URL(base) : new URL(base, origin)\n if (!url.searchParams.has('query')) url.searchParams.append('query', query)\n if (!url.searchParams.has('q')) url.searchParams.append('q', query)\n if (isAbsolute) return url.toString()\n return `${url.pathname}${url.search}`\n } catch {\n const sep = base.includes('?') ? '&' : '?'\n if (base.includes('query=')) return `${base}${sep}q=${encodeURIComponent(query)}`\n return `${base}${sep}query=${encodeURIComponent(query)}`\n }\n}\n\ntype OptionsResponse = { items?: unknown[] }\n\nasync function loadRemoteOptions(url: string): Promise<Array<{ value: string; label: string }>> {\n try {\n const call = await apiCall<OptionsResponse>(url, undefined, { fallback: { items: [] } })\n if (!call.ok) return []\n const payload = call.result ?? { items: [] }\n const items = Array.isArray(payload?.items) ? payload.items : []\n return items.map((it: any) => ({\n value: String(it?.value ?? it),\n label: String(it?.label ?? it?.value ?? it),\n }))\n } catch {\n return []\n }\n}\n\nexport function buildFormFieldFromCustomFieldDef(\n def: CustomFieldDefDto,\n opts?: { bareIds?: boolean }\n): CrudField | null {\n const id = opts?.bareIds ? def.key : `cf_${def.key}`\n const label = def.label || def.key\n const required = Array.isArray((def as any).validation)\n ? ((def as any).validation as any[]).some((rule) => rule && rule.rule === 'required')\n : false\n const baseProps = {\n description: def.description,\n required,\n ...(def.defaultValue !== undefined && def.defaultValue !== null ? { defaultValue: def.defaultValue } : {}),\n }\n\n switch (def.kind) {\n case 'boolean':\n return { id, label, type: 'checkbox', ...baseProps }\n case 'integer':\n case 'float':\n return { id, label, type: 'number', ...baseProps }\n case 'date':\n return { id, label, type: 'datepicker', ...baseProps }\n case 'datetime':\n return { id, label, type: 'datetime', ...baseProps }\n case 'multiline': {\n let editor: 'simple' | 'uiw' | 'html' = 'html'\n if (def.editor === 'simpleMarkdown') editor = 'simple'\n else if (def.editor === 'htmlRichText') editor = 'html'\n return { id, label, type: 'richtext', ...baseProps, editor }\n }\n case 'select':\n case 'currency':\n case 'relation':\n return {\n id,\n label,\n type: 'select',\n ...baseProps,\n options: normalizeCustomFieldOptions(def.options || []).map((option) => ({\n value: option.value,\n label: option.label,\n })),\n multiple: !!def.multi,\n ...(def.kind === 'currency'\n ? {\n loadOptions: async (query?: string) => {\n const url = buildOptionsUrl(CURRENCY_OPTIONS_URL, query)\n return loadRemoteOptions(url)\n },\n }\n : def.optionsUrl\n ? {\n loadOptions: async (query?: string) => {\n const url = buildOptionsUrl(def.optionsUrl!, query)\n return loadRemoteOptions(url)\n },\n }\n : {}),\n ...(def.multi && def.input === 'listbox' ? ({ listbox: true } as any) : {}),\n }\n default: {\n if (def.kind === 'text' && def.multi) {\n const base: any = { id, label, type: 'tags', ...baseProps }\n const resolvedOptions = normalizeCustomFieldOptions(def.options || [])\n if (resolvedOptions.length > 0) {\n base.options = resolvedOptions.map((option) => ({ value: option.value, label: option.label }))\n }\n if (def.optionsUrl) {\n base.loadOptions = async (query?: string) => {\n const url = buildOptionsUrl(def.optionsUrl!, query)\n return loadRemoteOptions(url)\n }\n }\n return base\n }\n if (def.kind === 'text' && typeof def.editor === 'string' && def.editor) {\n let editor: 'simple' | 'uiw' | 'html' = 'html'\n if (def.editor === 'simpleMarkdown') editor = 'simple'\n else if (def.editor === 'htmlRichText') editor = 'html'\n return { id, label, type: 'richtext', ...baseProps, editor }\n }\n const input = FieldRegistry.getInput(def.kind)\n if (input) {\n return {\n id,\n label,\n type: 'custom',\n ...baseProps,\n component: (props) => input({ ...props, def }),\n }\n }\n return { id, label, type: 'text', ...baseProps }\n }\n }\n}\n\nexport function buildFormFieldsFromCustomFields(\n defs: CustomFieldDefDto[],\n opts?: { bareIds?: boolean }\n): CrudField[] {\n const fields: CrudField[] = []\n const visible = filterCustomFieldDefs(defs, 'form')\n const seenKeys = new Set<string>()\n for (const def of visible) {\n const keyLower = String(def.key).toLowerCase()\n if (seenKeys.has(keyLower)) continue\n seenKeys.add(keyLower)\n const field = buildFormFieldFromCustomFieldDef(def, opts)\n if (field) fields.push(field)\n }\n return fields\n}\n\nexport async function fetchCustomFieldFormStructure(\n entityIds: string | string[],\n fetchImpl?: typeof fetch,\n options?: { bareIds?: boolean },\n): Promise<{ fields: CrudField[]; definitions: CustomFieldDefDto[]; metadata: CustomFieldDefinitionsPayload }> {\n await ensureFieldRegistryReady()\n const metadata = await fetchCustomFieldDefinitionsPayload(entityIds, fetchImpl)\n const definitions = Array.isArray(metadata.items) ? metadata.items : []\n const fields = buildFormFieldsFromCustomFields(definitions, options)\n return { fields, definitions, metadata }\n}\n\nexport async function fetchCustomFieldFormFields(\n entityIds: string | string[],\n fetchImpl?: typeof fetch,\n options?: { bareIds?: boolean },\n): Promise<CrudField[]> {\n const { fields } = await fetchCustomFieldFormStructure(entityIds, fetchImpl, options)\n return fields\n}\n\nexport async function fetchCustomFieldFormFieldsWithDefinitions(\n entityIds: string | string[],\n fetchImpl?: typeof fetch,\n options?: { bareIds?: boolean },\n): Promise<{ fields: CrudField[]; definitions: CustomFieldDefDto[]; metadata: CustomFieldDefinitionsPayload }> {\n return fetchCustomFieldFormStructure(entityIds, fetchImpl, options)\n}\n"],
5
- "mappings": "AAKA;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,eAAe,uCAAuC;AAC/D,SAAS,eAAe;AACxB,SAAS,mCAAmC;AAC5C,SAAS,4BAA4B;AAErC,IAAI,gBAAsC;AAE1C,eAAe,2BAA2B;AACxC,MAAI,CAAC,eAAe;AAClB,oBAAgB,gCAAgC,EAAE,MAAM,CAAC,QAAQ;AAC/D,sBAAgB;AAChB,YAAM;AAAA,IACR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AAAA,UACA,MAAM;AAAA,UACN,GAAG;AAAA,UACH,WAAW,CAAC,UAAU,MAAM,EAAE,GAAG,OAAO,IAAI,CAAC;AAAA,QAC/C;AAAA,MACF;AACA,aAAO,EAAE,IAAI,OAAO,MAAM,QAAQ,GAAG,UAAU;AAAA,IACjD;AAAA,EACF;AACF;AAEO,SAAS,gCACd,MACA,MACa;AACb,QAAM,SAAsB,CAAC;AAC7B,QAAM,UAAU,sBAAsB,MAAM,MAAM;AAClD,QAAM,WAAW,oBAAI,IAAY;AACjC,aAAW,OAAO,SAAS;AACzB,UAAM,WAAW,OAAO,IAAI,GAAG,EAAE,YAAY;AAC7C,QAAI,SAAS,IAAI,QAAQ,EAAG;AAC5B,aAAS,IAAI,QAAQ;AACrB,UAAM,QAAQ,iCAAiC,KAAK,IAAI;AACxD,QAAI,MAAO,QAAO,KAAK,KAAK;AAAA,EAC9B;AACA,SAAO;AACT;AAEA,eAAsB,8BACpB,WACA,WACA,SAC6G;AAC7G,QAAM,yBAAyB;AAC/B,QAAM,WAAW,MAAM,mCAAmC,WAAW,SAAS;AAC9E,QAAM,cAAc,MAAM,QAAQ,SAAS,KAAK,IAAI,SAAS,QAAQ,CAAC;AACtE,QAAM,SAAS,gCAAgC,aAAa,OAAO;AACnE,SAAO,EAAE,QAAQ,aAAa,SAAS;AACzC;AAEA,eAAsB,2BACpB,WACA,WACA,SACsB;AACtB,QAAM,EAAE,OAAO,IAAI,MAAM,8BAA8B,WAAW,WAAW,OAAO;AACpF,SAAO;AACT;AAEA,eAAsB,0CACpB,WACA,WACA,SAC6G;AAC7G,SAAO,8BAA8B,WAAW,WAAW,OAAO;AACpE;",
4
+ "sourcesContent": ["import type { CrudField } from '../CrudForm'\nimport type {\n CustomFieldDefDto,\n CustomFieldDefinitionsPayload,\n} from './customFieldDefs'\nimport {\n filterCustomFieldDefs,\n fetchCustomFieldDefs,\n fetchCustomFieldDefinitionsPayload,\n} from './customFieldDefs'\nimport { FieldRegistry, loadGeneratedFieldRegistrations } from '../fields/registry'\nimport { apiCall } from './apiCall'\nimport { normalizeCustomFieldOptions } from '@open-mercato/shared/modules/entities/options'\nimport { CURRENCY_OPTIONS_URL } from '@open-mercato/shared/modules/entities/kinds'\n\nlet registryReady: Promise<void> | null = null\n\nasync function ensureFieldRegistryReady() {\n if (!registryReady) {\n registryReady = loadGeneratedFieldRegistrations().catch((err) => {\n registryReady = null\n throw err\n })\n }\n await registryReady\n}\n\nfunction buildOptionsUrl(base: string, query?: string): string {\n if (!query) return base\n try {\n const isAbsolute = /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(base)\n const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost'\n const url = isAbsolute ? new URL(base) : new URL(base, origin)\n if (!url.searchParams.has('query')) url.searchParams.append('query', query)\n if (!url.searchParams.has('q')) url.searchParams.append('q', query)\n if (isAbsolute) return url.toString()\n return `${url.pathname}${url.search}`\n } catch {\n const sep = base.includes('?') ? '&' : '?'\n if (base.includes('query=')) return `${base}${sep}q=${encodeURIComponent(query)}`\n return `${base}${sep}query=${encodeURIComponent(query)}`\n }\n}\n\ntype OptionsResponse = { items?: unknown[] }\n\nasync function loadRemoteOptions(url: string): Promise<Array<{ value: string; label: string }>> {\n try {\n const call = await apiCall<OptionsResponse>(url, undefined, { fallback: { items: [] } })\n if (!call.ok) return []\n const payload = call.result ?? { items: [] }\n const items = Array.isArray(payload?.items) ? payload.items : []\n return items.map((it: any) => ({\n value: String(it?.value ?? it),\n label: String(it?.label ?? it?.value ?? it),\n }))\n } catch {\n return []\n }\n}\n\nexport function buildFormFieldFromCustomFieldDef(\n def: CustomFieldDefDto,\n opts?: { bareIds?: boolean }\n): CrudField | null {\n const id = opts?.bareIds ? def.key : `cf_${def.key}`\n const label = def.label || def.key\n const required = Array.isArray((def as any).validation)\n ? ((def as any).validation as any[]).some((rule) => rule && rule.rule === 'required')\n : false\n const baseProps = {\n description: def.description,\n required,\n ...(def.defaultValue !== undefined && def.defaultValue !== null ? { defaultValue: def.defaultValue } : {}),\n }\n\n switch (def.kind) {\n case 'boolean':\n return { id, label, type: 'checkbox', ...baseProps }\n case 'integer':\n case 'float':\n return { id, label, type: 'number', ...baseProps }\n case 'date':\n return { id, label, type: 'datepicker', ...baseProps }\n case 'datetime':\n return { id, label, type: 'datetime', ...baseProps }\n case 'multiline': {\n let editor: 'simple' | 'uiw' | 'html' = 'html'\n if (def.editor === 'simpleMarkdown') editor = 'simple'\n else if (def.editor === 'htmlRichText') editor = 'html'\n return { id, label, type: 'richtext', ...baseProps, editor }\n }\n case 'select':\n case 'currency':\n case 'relation':\n return {\n id,\n label,\n type: 'select',\n ...baseProps,\n options: normalizeCustomFieldOptions(def.options || []).map((option) => ({\n value: option.value,\n label: option.label,\n })),\n multiple: !!def.multi,\n ...(def.kind === 'currency'\n ? {\n loadOptions: async (query?: string) => {\n const url = buildOptionsUrl(CURRENCY_OPTIONS_URL, query)\n return loadRemoteOptions(url)\n },\n }\n : def.optionsUrl\n ? {\n loadOptions: async (query?: string) => {\n const url = buildOptionsUrl(def.optionsUrl!, query)\n return loadRemoteOptions(url)\n },\n }\n : {}),\n ...(def.multi && def.input === 'listbox' ? ({ listbox: true } as any) : {}),\n }\n case 'dictionary': {\n if (!def.multi) {\n const input = FieldRegistry.getInput(def.kind)\n if (input) {\n return {\n id,\n label,\n type: 'custom',\n ...baseProps,\n component: (props) => input({ ...props, def }),\n }\n }\n return { id, label, type: 'text', ...baseProps }\n }\n const optionsUrl = def.optionsUrl || (def.dictionaryId ? `/api/dictionaries/${def.dictionaryId}/entries` : undefined)\n return {\n id,\n label,\n type: 'select',\n description: def.description,\n required,\n options: [],\n multiple: true,\n listbox: true,\n ...(optionsUrl\n ? {\n loadOptions: async (query?: string) => {\n const url = buildOptionsUrl(optionsUrl, query)\n return loadRemoteOptions(url)\n },\n }\n : {}),\n }\n }\n default: {\n if (def.kind === 'text' && def.multi) {\n const base: any = { id, label, type: 'tags', ...baseProps }\n const resolvedOptions = normalizeCustomFieldOptions(def.options || [])\n if (resolvedOptions.length > 0) {\n base.options = resolvedOptions.map((option) => ({ value: option.value, label: option.label }))\n }\n if (def.optionsUrl) {\n base.loadOptions = async (query?: string) => {\n const url = buildOptionsUrl(def.optionsUrl!, query)\n return loadRemoteOptions(url)\n }\n }\n return base\n }\n if (def.kind === 'text' && typeof def.editor === 'string' && def.editor) {\n let editor: 'simple' | 'uiw' | 'html' = 'html'\n if (def.editor === 'simpleMarkdown') editor = 'simple'\n else if (def.editor === 'htmlRichText') editor = 'html'\n return { id, label, type: 'richtext', ...baseProps, editor }\n }\n const input = FieldRegistry.getInput(def.kind)\n if (input) {\n return {\n id,\n label,\n type: 'custom',\n ...baseProps,\n component: (props) => input({ ...props, def }),\n }\n }\n return { id, label, type: 'text', ...baseProps }\n }\n }\n}\n\nexport function buildFormFieldsFromCustomFields(\n defs: CustomFieldDefDto[],\n opts?: { bareIds?: boolean }\n): CrudField[] {\n const fields: CrudField[] = []\n const visible = filterCustomFieldDefs(defs, 'form')\n const seenKeys = new Set<string>()\n for (const def of visible) {\n const keyLower = String(def.key).toLowerCase()\n if (seenKeys.has(keyLower)) continue\n seenKeys.add(keyLower)\n const field = buildFormFieldFromCustomFieldDef(def, opts)\n if (field) fields.push(field)\n }\n return fields\n}\n\nexport async function fetchCustomFieldFormStructure(\n entityIds: string | string[],\n fetchImpl?: typeof fetch,\n options?: { bareIds?: boolean },\n): Promise<{ fields: CrudField[]; definitions: CustomFieldDefDto[]; metadata: CustomFieldDefinitionsPayload }> {\n await ensureFieldRegistryReady()\n const metadata = await fetchCustomFieldDefinitionsPayload(entityIds, fetchImpl)\n const definitions = Array.isArray(metadata.items) ? metadata.items : []\n const fields = buildFormFieldsFromCustomFields(definitions, options)\n return { fields, definitions, metadata }\n}\n\nexport async function fetchCustomFieldFormFields(\n entityIds: string | string[],\n fetchImpl?: typeof fetch,\n options?: { bareIds?: boolean },\n): Promise<CrudField[]> {\n const { fields } = await fetchCustomFieldFormStructure(entityIds, fetchImpl, options)\n return fields\n}\n\nexport async function fetchCustomFieldFormFieldsWithDefinitions(\n entityIds: string | string[],\n fetchImpl?: typeof fetch,\n options?: { bareIds?: boolean },\n): Promise<{ fields: CrudField[]; definitions: CustomFieldDefDto[]; metadata: CustomFieldDefinitionsPayload }> {\n return fetchCustomFieldFormStructure(entityIds, fetchImpl, options)\n}\n"],
5
+ "mappings": "AAKA;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,eAAe,uCAAuC;AAC/D,SAAS,eAAe;AACxB,SAAS,mCAAmC;AAC5C,SAAS,4BAA4B;AAErC,IAAI,gBAAsC;AAE1C,eAAe,2BAA2B;AACxC,MAAI,CAAC,eAAe;AAClB,oBAAgB,gCAAgC,EAAE,MAAM,CAAC,QAAQ;AAC/D,sBAAgB;AAChB,YAAM;AAAA,IACR,CAAC;AAAA,EACH;AACA,QAAM;AACR;AAEA,SAAS,gBAAgB,MAAc,OAAwB;AAC7D,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI;AACF,UAAM,aAAa,8BAA8B,KAAK,IAAI;AAC1D,UAAM,SAAS,OAAO,WAAW,cAAc,OAAO,SAAS,SAAS;AACxE,UAAM,MAAM,aAAa,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,MAAM;AAC7D,QAAI,CAAC,IAAI,aAAa,IAAI,OAAO,EAAG,KAAI,aAAa,OAAO,SAAS,KAAK;AAC1E,QAAI,CAAC,IAAI,aAAa,IAAI,GAAG,EAAG,KAAI,aAAa,OAAO,KAAK,KAAK;AAClE,QAAI,WAAY,QAAO,IAAI,SAAS;AACpC,WAAO,GAAG,IAAI,QAAQ,GAAG,IAAI,MAAM;AAAA,EACrC,QAAQ;AACN,UAAM,MAAM,KAAK,SAAS,GAAG,IAAI,MAAM;AACvC,QAAI,KAAK,SAAS,QAAQ,EAAG,QAAO,GAAG,IAAI,GAAG,GAAG,KAAK,mBAAmB,KAAK,CAAC;AAC/E,WAAO,GAAG,IAAI,GAAG,GAA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AAA,UACA;AAAA,UACA,MAAM;AAAA,UACN,GAAG;AAAA,UACH,WAAW,CAAC,UAAU,MAAM,EAAE,GAAG,OAAO,IAAI,CAAC;AAAA,QAC/C;AAAA,MACF;AACA,aAAO,EAAE,IAAI,OAAO,MAAM,QAAQ,GAAG,UAAU;AAAA,IACjD;AAAA,EACF;AACF;AAEO,SAAS,gCACd,MACA,MACa;AACb,QAAM,SAAsB,CAAC;AAC7B,QAAM,UAAU,sBAAsB,MAAM,MAAM;AAClD,QAAM,WAAW,oBAAI,IAAY;AACjC,aAAW,OAAO,SAAS;AACzB,UAAM,WAAW,OAAO,IAAI,GAAG,EAAE,YAAY;AAC7C,QAAI,SAAS,IAAI,QAAQ,EAAG;AAC5B,aAAS,IAAI,QAAQ;AACrB,UAAM,QAAQ,iCAAiC,KAAK,IAAI;AACxD,QAAI,MAAO,QAAO,KAAK,KAAK;AAAA,EAC9B;AACA,SAAO;AACT;AAEA,eAAsB,8BACpB,WACA,WACA,SAC6G;AAC7G,QAAM,yBAAyB;AAC/B,QAAM,WAAW,MAAM,mCAAmC,WAAW,SAAS;AAC9E,QAAM,cAAc,MAAM,QAAQ,SAAS,KAAK,IAAI,SAAS,QAAQ,CAAC;AACtE,QAAM,SAAS,gCAAgC,aAAa,OAAO;AACnE,SAAO,EAAE,QAAQ,aAAa,SAAS;AACzC;AAEA,eAAsB,2BACpB,WACA,WACA,SACsB;AACtB,QAAM,EAAE,OAAO,IAAI,MAAM,8BAA8B,WAAW,WAAW,OAAO;AACpF,SAAO;AACT;AAEA,eAAsB,0CACpB,WACA,WACA,SAC6G;AAC7G,SAAO,8BAA8B,WAAW,WAAW,OAAO;AACpE;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/ui",
3
- "version": "0.6.6-develop.6227.1.2695efff30",
3
+ "version": "0.6.6-develop.6229.1.ebe6706732",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -155,13 +155,13 @@
155
155
  "remark-gfm": "^4.0.1"
156
156
  },
157
157
  "peerDependencies": {
158
- "@open-mercato/shared": "0.6.6-develop.6227.1.2695efff30",
158
+ "@open-mercato/shared": "0.6.6-develop.6229.1.ebe6706732",
159
159
  "react": ">=18.0.0",
160
160
  "react-dom": ">=18.0.0",
161
161
  "react-is": ">=18.0.0"
162
162
  },
163
163
  "devDependencies": {
164
- "@open-mercato/shared": "0.6.6-develop.6227.1.2695efff30",
164
+ "@open-mercato/shared": "0.6.6-develop.6229.1.ebe6706732",
165
165
  "@testing-library/dom": "^10.4.1",
166
166
  "@testing-library/jest-dom": "^6.9.1",
167
167
  "@testing-library/react": "^16.3.1",
@@ -2689,6 +2689,12 @@ export function CrudForm<TValues extends Record<string, unknown>>({
2689
2689
  for (const injectedId of injectedFieldIdSet) {
2690
2690
  delete coreValues[injectedId]
2691
2691
  }
2692
+ if (customEntity) {
2693
+ const allowedKeys = new Set(cfDefinitions.map((definition) => definition.key).filter(Boolean))
2694
+ for (const key of Object.keys(coreValues)) {
2695
+ if (!allowedKeys.has(key)) delete coreValues[key]
2696
+ }
2697
+ }
2692
2698
 
2693
2699
  let parsedValues: TValues
2694
2700
  if (schema) {
@@ -2722,6 +2728,12 @@ export function CrudForm<TValues extends Record<string, unknown>>({
2722
2728
  for (const injectedId of injectedFieldIdSet) {
2723
2729
  delete projectedCoreValues[injectedId]
2724
2730
  }
2731
+ if (customEntity) {
2732
+ const allowedKeys = new Set(cfDefinitions.map((definition) => definition.key).filter(Boolean))
2733
+ for (const key of Object.keys(projectedCoreValues)) {
2734
+ if (!allowedKeys.has(key)) delete projectedCoreValues[key]
2735
+ }
2736
+ }
2725
2737
  coreSubmitValues = schema
2726
2738
  ? schema.parse(collapseDotPathFields(projectedCoreValues, dotPathBaseFieldIds))
2727
2739
  : (projectedCoreValues as TValues)
@@ -275,6 +275,73 @@ describe('CrudForm custom field loading', () => {
275
275
  expect(container.querySelector('[data-crud-field-id="cf_renewal_quarter"]')?.textContent).toContain('Q3')
276
276
  })
277
277
 
278
+ it('submits custom entity values without loaded record metadata', async () => {
279
+ const handleSubmit = jest.fn().mockResolvedValue(undefined)
280
+
281
+ buildFormFieldFromCustomFieldDefMock.mockImplementation((definition: any) => ({
282
+ id: definition.key,
283
+ label: definition.label ?? definition.key,
284
+ type: 'select',
285
+ multiple: true,
286
+ listbox: true,
287
+ options: [
288
+ { value: 'north', label: 'North' },
289
+ { value: 'south', label: 'South' },
290
+ ],
291
+ }))
292
+ fetchCustomFieldFormStructureMock.mockResolvedValue({
293
+ fields: [],
294
+ definitions: [
295
+ {
296
+ entityId: 'user:qa_entity',
297
+ key: 'regions',
298
+ label: 'Regions',
299
+ kind: 'dictionary',
300
+ multi: true,
301
+ },
302
+ ],
303
+ metadata: {
304
+ items: [],
305
+ fieldsetsByEntity: {},
306
+ entitySettings: {},
307
+ },
308
+ })
309
+
310
+ renderWithProviders(
311
+ <CrudForm
312
+ title="Form"
313
+ entityId="user:qa_entity"
314
+ fields={[]}
315
+ customEntity
316
+ initialValues={{
317
+ id: '123e4567-e89b-12d3-a456-426614174000',
318
+ regions: ['north', 'south'],
319
+ updatedAt: '2026-06-19T10:00:00.000Z',
320
+ createdAt: '2026-06-19T09:00:00.000Z',
321
+ }}
322
+ onSubmit={handleSubmit}
323
+ />,
324
+ {
325
+ dict: {
326
+ 'ui.forms.actions.save': 'Save',
327
+ },
328
+ },
329
+ )
330
+
331
+ await waitFor(() => {
332
+ expect(screen.getByText('North')).toBeInTheDocument()
333
+ })
334
+
335
+ await act(async () => {
336
+ fireEvent.click(screen.getAllByRole('button', { name: 'Save' })[0]!)
337
+ })
338
+
339
+ await waitFor(() => {
340
+ expect(handleSubmit).toHaveBeenCalledTimes(1)
341
+ })
342
+ expect(handleSubmit).toHaveBeenCalledWith({ regions: ['north', 'south'] }, expect.any(Object))
343
+ })
344
+
278
345
  it('opens the field manager without submitting the parent form', async () => {
279
346
  const handleSubmit = jest.fn().mockResolvedValue(undefined)
280
347
 
@@ -24,6 +24,13 @@ describe('buildFilterDefsFromCustomFields', () => {
24
24
  ],
25
25
  multi: true,
26
26
  },
27
+ {
28
+ key: 'regions',
29
+ kind: 'dictionary',
30
+ filterable: true,
31
+ optionsUrl: '/api/dictionaries/dictionary-1/entries',
32
+ multi: true,
33
+ },
27
34
  { key: 'notes', kind: 'multiline', filterable: true },
28
35
  { key: 'hidden', kind: 'text', filterable: false },
29
36
  ]
@@ -44,6 +51,11 @@ describe('buildFilterDefsFromCustomFields', () => {
44
51
  if (labels.type !== 'select') throw new Error('expected select')
45
52
  expect(labels.multiple).toBe(true)
46
53
  expect((labels.options || []).map((o) => o.value)).toEqual(['bug','feature'])
54
+ const regions = out.find(f => f.id === 'cf_regionsIn')!
55
+ expect(regions.type).toBe('select')
56
+ if (regions.type !== 'select') throw new Error('expected select')
57
+ expect(regions.multiple).toBe(true)
58
+ expect(typeof regions.loadOptions).toBe('function')
47
59
  // text-like (multiline) => text
48
60
  expect(out.find(f => f.id === 'cf_notes')!.type).toBe('text')
49
61
  // non-filterable omitted
@@ -1,7 +1,12 @@
1
1
  import { buildFormFieldsFromCustomFields } from '../utils/customFieldForms'
2
2
  import type { CustomFieldDefDto } from '../utils/customFieldFilters'
3
+ import { FieldRegistry } from '../fields/registry'
3
4
 
4
5
  describe('buildFormFieldsFromCustomFields', () => {
6
+ beforeAll(() => {
7
+ FieldRegistry.register('dictionary', { input: () => null })
8
+ })
9
+
5
10
  it('maps kinds to CrudField and filters by formEditable', () => {
6
11
  const defs: CustomFieldDefDto[] = [
7
12
  { key: 'blocked', kind: 'boolean', filterable: true, formEditable: true },
@@ -31,6 +36,23 @@ describe('buildFormFieldsFromCustomFields', () => {
31
36
  { key: 'notes', kind: 'multiline', filterable: false, formEditable: true },
32
37
  // text with editor hint should render richtext
33
38
  { key: 'desc', kind: 'text', filterable: false, formEditable: true, editor: 'htmlRichText' },
39
+ {
40
+ key: 'region',
41
+ kind: 'dictionary',
42
+ dictionaryId: 'dictionary-1',
43
+ optionsUrl: '/api/dictionaries/dictionary-1/entries',
44
+ filterable: true,
45
+ formEditable: true,
46
+ },
47
+ {
48
+ key: 'regions',
49
+ kind: 'dictionary',
50
+ dictionaryId: 'dictionary-1',
51
+ optionsUrl: '/api/dictionaries/dictionary-1/entries',
52
+ multi: true,
53
+ filterable: true,
54
+ formEditable: true,
55
+ },
34
56
  { key: 'hidden', kind: 'text', filterable: true, formEditable: false },
35
57
  ]
36
58
 
@@ -49,6 +71,13 @@ describe('buildFormFieldsFromCustomFields', () => {
49
71
  if (byId['cf_desc']?.type === 'richtext') {
50
72
  expect(byId['cf_desc'].editor).toBe('html')
51
73
  }
74
+ expect(byId['cf_region']?.type).toBe('custom')
75
+ expect(byId['cf_regions']?.type).toBe('select')
76
+ if (byId['cf_regions']?.type === 'select') {
77
+ expect(byId['cf_regions'].multiple).toBe(true)
78
+ expect(byId['cf_regions'].listbox).toBe(true)
79
+ expect(typeof byId['cf_regions'].loadOptions).toBe('function')
80
+ }
52
81
  expect(byId['cf_hidden']).toBeUndefined()
53
82
  })
54
83
  })
@@ -120,6 +120,40 @@ export function buildFormFieldFromCustomFieldDef(
120
120
  : {}),
121
121
  ...(def.multi && def.input === 'listbox' ? ({ listbox: true } as any) : {}),
122
122
  }
123
+ case 'dictionary': {
124
+ if (!def.multi) {
125
+ const input = FieldRegistry.getInput(def.kind)
126
+ if (input) {
127
+ return {
128
+ id,
129
+ label,
130
+ type: 'custom',
131
+ ...baseProps,
132
+ component: (props) => input({ ...props, def }),
133
+ }
134
+ }
135
+ return { id, label, type: 'text', ...baseProps }
136
+ }
137
+ const optionsUrl = def.optionsUrl || (def.dictionaryId ? `/api/dictionaries/${def.dictionaryId}/entries` : undefined)
138
+ return {
139
+ id,
140
+ label,
141
+ type: 'select',
142
+ description: def.description,
143
+ required,
144
+ options: [],
145
+ multiple: true,
146
+ listbox: true,
147
+ ...(optionsUrl
148
+ ? {
149
+ loadOptions: async (query?: string) => {
150
+ const url = buildOptionsUrl(optionsUrl, query)
151
+ return loadRemoteOptions(url)
152
+ },
153
+ }
154
+ : {}),
155
+ }
156
+ }
123
157
  default: {
124
158
  if (def.kind === 'text' && def.multi) {
125
159
  const base: any = { id, label, type: 'tags', ...baseProps }