Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [#5016] Referentielijsten dataSrc for options #64

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/formio/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ export interface VariableValues {
dataSrc: 'variable';
itemsExpression: string | JSONObject;
}

/**
* @category Utilities
*/
export interface ReferentielijstenValues {
dataSrc: 'referentielijsten';
service: string;
code: string;
}
20 changes: 16 additions & 4 deletions src/formio/components/radio.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {InputComponentSchema} from '..';
import {ManualValues, Option, VariableValues} from '../common';
import {ManualValues, Option, ReferentielijstenValues, VariableValues} from '../common';
import {Require} from '../util';

type Validator = 'required';
Expand All @@ -12,6 +12,8 @@ export type RadioInputSchema<Extensions> = InputComponentSchema<
Extensions
>;

export type RadioUnsupported = 'hideLabel' | 'disabled';

/**
* @group Form.io components
* @category Base types
Expand All @@ -25,7 +27,7 @@ interface BaseRadioSchema {
* @group Form.io components
* @category Base types
*/
type RadioManualValuesSchema = Omit<RadioInputSchema<ManualValues>, 'hideLabel' | 'disabled'> &
type RadioManualValuesSchema = Omit<RadioInputSchema<ManualValues>, RadioUnsupported> &
BaseRadioSchema & {
values: Option[];
};
Expand All @@ -34,14 +36,24 @@ type RadioManualValuesSchema = Omit<RadioInputSchema<ManualValues>, 'hideLabel'
* @group Form.io components
* @category Base types
*/
type RadioVariableValuesSchema = Omit<RadioInputSchema<VariableValues>, 'hideLabel' | 'disabled'> &
type RadioVariableValuesSchema = Omit<RadioInputSchema<VariableValues>, RadioUnsupported> &
BaseRadioSchema;

/**
* @group Form.io components
* @category Base types
*/
type RadioReferentielijstenValuesSchema = Omit<
RadioInputSchema<ReferentielijstenValues>,
RadioUnsupported
> &
BaseRadioSchema;

/**
* @group Form.io components
* @category Concrete types
*/
export type RadioComponentSchema = Require<
RadioManualValuesSchema | RadioVariableValuesSchema,
RadioManualValuesSchema | RadioVariableValuesSchema | RadioReferentielijstenValuesSchema,
'openForms'
>;
17 changes: 15 additions & 2 deletions src/formio/components/select.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {InputComponentSchema} from '..';
import {MultipleCapable} from '../base';
import {ManualValues, Option, VariableValues} from '../common';
import {ManualValues, Option, ReferentielijstenValues, VariableValues} from '../common';
import {Require} from '../util';

type Validator = 'required';
Expand Down Expand Up @@ -50,10 +50,23 @@ type SelectManualValuesSchema = Omit<SelectInputSchema<ManualValues>, SelectUnsu
type SelectVariableValuesSchema = Omit<SelectInputSchema<VariableValues>, SelectUnsupported> &
BaseSelectSchema;

/**
* @group Form.io components
* @category Base types
*/
type SelectReferentielijstenValuesSchema = Omit<
SelectInputSchema<ReferentielijstenValues>,
SelectUnsupported
> &
BaseSelectSchema;

/**
* @group Form.io components
* @category Concrete types
*/
export type SelectComponentSchema = MultipleCapable<
Require<SelectManualValuesSchema | SelectVariableValuesSchema, 'openForms'>
Require<
SelectManualValuesSchema | SelectVariableValuesSchema | SelectReferentielijstenValuesSchema,
'openForms'
>
>;
22 changes: 18 additions & 4 deletions src/formio/components/selectboxes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {InputComponentSchema} from '..';
import {ManualValues, Option, VariableValues} from '../common';
import {ManualValues, Option, ReferentielijstenValues, VariableValues} from '../common';
import {Require} from '../util';

type Validator = 'required' | 'minSelectedCount' | 'maxSelectedCount';
Expand All @@ -12,6 +12,8 @@ export type SelectboxesInputSchema<Extensions> = InputComponentSchema<
Extensions
>;

export type SelectboxesUnsupported = 'hideLabel' | 'disabled';

/**
* @group Form.io components
* @category Base types
Expand All @@ -27,7 +29,7 @@ interface BaseSelectboxesSchema {
*/
type SelectboxesManualValuesSchema = Omit<
SelectboxesInputSchema<ManualValues>,
'hideLabel' | 'disabled'
SelectboxesUnsupported
> &
BaseSelectboxesSchema & {
values: Option[];
Expand All @@ -39,7 +41,17 @@ type SelectboxesManualValuesSchema = Omit<
*/
type SelectboxesVariableValuesSchema = Omit<
SelectboxesInputSchema<VariableValues>,
'hideLabel' | 'disabled'
SelectboxesUnsupported
> &
BaseSelectboxesSchema;

/**
* @group Form.io components
* @category Base types
*/
type SelectboxesReferentielijstenValuesSchema = Omit<
SelectboxesInputSchema<ReferentielijstenValues>,
SelectboxesUnsupported
> &
BaseSelectboxesSchema;

Expand All @@ -48,6 +60,8 @@ type SelectboxesVariableValuesSchema = Omit<
* @category Concrete types
*/
export type SelectboxesComponentSchema = Require<
SelectboxesManualValuesSchema | SelectboxesVariableValuesSchema,
| SelectboxesManualValuesSchema
| SelectboxesVariableValuesSchema
| SelectboxesReferentielijstenValuesSchema,
'openForms'
>;
Loading