@golemui/gui-shared 0.12.2 → 0.13.1
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 +20 -0
- package/index.js +492 -2021
- package/index.umd.cjs +1 -1
- package/internals.d.ts +2 -0
- package/internals.js +5 -0
- package/internals.umd.cjs +1 -0
- package/lib/dx/core/dxValidatorHelper.d.ts +14 -1
- package/lib/dx/formDef.domain.d.ts +4 -5
- package/lib/dx/index.d.ts +1 -0
- package/lib/dx/resolveFormInput.d.ts +7 -5
- package/lib/dx/shortcuts/calendar/calendar.domain.d.ts +2 -1
- package/lib/dx/shortcuts/checkbox/checkbox.domain.d.ts +2 -1
- package/lib/dx/shortcuts/currency/currency.domain.d.ts +2 -1
- package/lib/dx/shortcuts/date-input/dateInput.domain.d.ts +2 -1
- package/lib/dx/shortcuts/date-picker/datePicker.domain.d.ts +2 -1
- package/lib/dx/shortcuts/inputs/inputs.domain.d.ts +5 -5
- package/lib/dx/shortcuts/markdown/markdown.domain.d.ts +2 -1
- package/lib/dx/shortcuts/password/password.domain.d.ts +2 -1
- package/lib/dx/shortcuts/range-calendar/rangeCalendar.domain.d.ts +2 -1
- package/lib/dx/shortcuts/range-date-input/rangeDateInput.domain.d.ts +2 -1
- package/lib/dx/shortcuts/range-date-picker/rangeDatePicker.domain.d.ts +2 -1
- package/lib/dx/shortcuts/repeater/repeater.domain.d.ts +2 -1
- package/lib/dx/shortcuts/textarea/textarea.domain.d.ts +2 -1
- package/lib/golem-form.d.ts +35 -35
- package/lib/utils/repeater.d.ts +2 -0
- package/lib/widget.factory.d.ts +25 -25
- package/package.json +11 -3
package/lib/golem-form.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ActionWidget, DisplayWidget, Form, FormWidget, FunctionWidgetParams, InputWidget, LayoutWidget, ReactiveExpression } from '@golemui/core';
|
|
1
2
|
import { Validator } from '@golemui/gui-validators';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
type ExtractStates<S> = S extends Record<string, Core.ReactiveExpression> ? keyof S : never;
|
|
3
|
+
import { AccordionProps, AlertProps, ButtonProps, CalendarProps, CheckboxProps, CurrencyProps, DatePickerProps, DateRange, DateinputProps, DropdownProps, FlexProps, GridProps, ListProps, MarkdownProps, MarkdownTextProps, NumberinputProps, OptionValue, PasswordProps, RadiogroupProps, RangeCalendarProps, RangeDateInputProps, RangeDatePickerProps, RepeaterProps, SelectProps, TabsProps, TextareaProps, TextinputProps, ToggleProps } from './widget.props';
|
|
4
|
+
type ExtractStates<S> = S extends Record<string, ReactiveExpression> ? keyof S : never;
|
|
5
5
|
/**
|
|
6
6
|
* Make the uid propery optional on all widgets
|
|
7
7
|
*/
|
|
@@ -13,11 +13,11 @@ type DeepPartialUid<T> = T extends (...args: infer A) => infer R ? (...args: A)
|
|
|
13
13
|
type DeepPartialUidArray<T extends any[]> = {
|
|
14
14
|
[P in keyof T]: DeepPartialUid<T[P]>;
|
|
15
15
|
};
|
|
16
|
-
declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidget extends
|
|
17
|
-
create<States extends Record<string,
|
|
16
|
+
declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidget extends FormWidget<any, FormType> = never> {
|
|
17
|
+
create<States extends Record<string, ReactiveExpression>>(config: {
|
|
18
18
|
states?: States;
|
|
19
19
|
form: DeepPartialUid<GolemWidget<FormType, ExtractStates<States>, Validator, CustomWidget>>[];
|
|
20
|
-
}):
|
|
20
|
+
}): Form<ExtractStates<States>, FormType>;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Creates a new GolemFormBuilder instance for building type-safe forms.
|
|
@@ -91,85 +91,85 @@ declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidge
|
|
|
91
91
|
* });
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
export declare function golemForm<FormType extends Record<string, any>, CustomWidget extends
|
|
95
|
-
type GolemWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
96
|
-
type GuiAccordion<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
94
|
+
export declare function golemForm<FormType extends Record<string, any>, CustomWidget extends FormWidget<any, FormType> = never>(): GolemFormBuilder<FormType, CustomWidget>;
|
|
95
|
+
type GolemWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType> = never> = GuiAccordion<FormType, States, V, CustomWidget> | GuiAlert<FormType, States> | GuiButton<FormType, States> | GuiCalendar<FormType, States, V> | GuiCheckbox<FormType, States, V> | GuiCurrency<FormType, States, V> | GuiDateinput<FormType, States, V> | GuiDatePicker<FormType, States, V> | GuiDropdown<FormType, States, V> | GuiFunctionWidget<FormType, States, V, CustomWidget> | GuiList<FormType, States, V> | GuiMarkdown<FormType, States, V> | GuiMarkdownText<FormType, States> | GuiNumberinput<FormType, States, V> | GuiPassword<FormType, States, V> | GuiRadiogroup<FormType, States, V> | GuiRangeCalendar<FormType, States, V> | GuiRangeDateInput<FormType, States, V> | GuiRangeDatePicker<FormType, States, V> | GuiRepeater<FormType, States, V, CustomWidget> | GuiSelect<FormType, States, V> | GuiFlex<FormType, States, V, CustomWidget> | GuiGrid<FormType, States, V, CustomWidget> | GuiTabs<FormType, States, V, CustomWidget> | GuiTextarea<FormType, States, V> | GuiTextInput<FormType, States, V> | GuiToggle<FormType, States, V> | CustomWidget;
|
|
96
|
+
type GuiAccordion<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, AccordionProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
|
|
97
97
|
type: 'accordion';
|
|
98
98
|
};
|
|
99
|
-
type GuiAlert<FormType extends Record<string, any>, States extends string> =
|
|
99
|
+
type GuiAlert<FormType extends Record<string, any>, States extends string> = DisplayWidget<States, FormType, AlertProps> & {
|
|
100
100
|
type: 'alert';
|
|
101
101
|
};
|
|
102
|
-
type GuiButton<FormType extends Record<string, any>, States extends string> =
|
|
102
|
+
type GuiButton<FormType extends Record<string, any>, States extends string> = ActionWidget<States, FormType, ButtonProps> & {
|
|
103
103
|
type: 'button';
|
|
104
104
|
};
|
|
105
|
-
type GuiCalendar<FormType extends Record<string, any>, States extends string, V> =
|
|
105
|
+
type GuiCalendar<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, CalendarProps, V> & {
|
|
106
106
|
type: 'calendar';
|
|
107
107
|
};
|
|
108
|
-
type GuiCheckbox<FormType extends Record<string, any>, States extends string, V> =
|
|
108
|
+
type GuiCheckbox<FormType extends Record<string, any>, States extends string, V> = InputWidget<boolean, States, FormType, CheckboxProps, V> & {
|
|
109
109
|
type: 'checkbox';
|
|
110
110
|
};
|
|
111
|
-
type GuiCurrency<FormType extends Record<string, any>, States extends string, V> =
|
|
111
|
+
type GuiCurrency<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, CurrencyProps, V> & {
|
|
112
112
|
type: 'currency';
|
|
113
113
|
};
|
|
114
|
-
type GuiDateinput<FormType extends Record<string, any>, States extends string, V> =
|
|
114
|
+
type GuiDateinput<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, DateinputProps, V> & {
|
|
115
115
|
type: 'dateInput';
|
|
116
116
|
};
|
|
117
|
-
type GuiDatePicker<FormType extends Record<string, any>, States extends string, V> =
|
|
117
|
+
type GuiDatePicker<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, DatePickerProps, V> & {
|
|
118
118
|
type: 'datePicker';
|
|
119
119
|
};
|
|
120
|
-
type GuiDropdown<FormType extends Record<string, any>, States extends string, V> =
|
|
120
|
+
type GuiDropdown<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, DropdownProps<unknown>, V> & {
|
|
121
121
|
type: 'dropdown';
|
|
122
122
|
};
|
|
123
|
-
type GuiFunctionWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
124
|
-
type GuiList<FormType extends Record<string, any>, States extends string, V> =
|
|
123
|
+
type GuiFunctionWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = (api?: FunctionWidgetParams<FormType>) => Exclude<GolemWidget<FormType, States, V, CustomWidget>, () => any>;
|
|
124
|
+
type GuiList<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, ListProps<unknown>, V> & {
|
|
125
125
|
type: 'list';
|
|
126
126
|
};
|
|
127
|
-
type GuiMarkdown<FormType extends Record<string, any>, States extends string, V> =
|
|
127
|
+
type GuiMarkdown<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, MarkdownProps, V> & {
|
|
128
128
|
type: 'markdown';
|
|
129
129
|
};
|
|
130
|
-
type GuiMarkdownText<FormType extends Record<string, any>, States extends string> =
|
|
130
|
+
type GuiMarkdownText<FormType extends Record<string, any>, States extends string> = DisplayWidget<States, FormType, MarkdownTextProps> & {
|
|
131
131
|
type: 'markdownText';
|
|
132
132
|
};
|
|
133
|
-
type GuiNumberinput<FormType extends Record<string, any>, States extends string, V> =
|
|
133
|
+
type GuiNumberinput<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, NumberinputProps, V> & {
|
|
134
134
|
type: 'number';
|
|
135
135
|
};
|
|
136
|
-
type GuiRadiogroup<FormType extends Record<string, any>, States extends string, V> =
|
|
136
|
+
type GuiRadiogroup<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, RadiogroupProps, V> & {
|
|
137
137
|
type: 'radiogroup';
|
|
138
138
|
};
|
|
139
|
-
type GuiRangeCalendar<FormType extends Record<string, any>, States extends string, V> =
|
|
139
|
+
type GuiRangeCalendar<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, RangeCalendarProps, V> & {
|
|
140
140
|
type: 'rangeCalendar';
|
|
141
141
|
};
|
|
142
|
-
type GuiRangeDateInput<FormType extends Record<string, any>, States extends string, V> =
|
|
142
|
+
type GuiRangeDateInput<FormType extends Record<string, any>, States extends string, V> = InputWidget<DateRange[], States, FormType, RangeDateInputProps, V> & {
|
|
143
143
|
type: 'rangeDateInput';
|
|
144
144
|
};
|
|
145
|
-
type GuiRangeDatePicker<FormType extends Record<string, any>, States extends string, V> =
|
|
145
|
+
type GuiRangeDatePicker<FormType extends Record<string, any>, States extends string, V> = InputWidget<DateRange[], States, FormType, RangeDatePickerProps, V> & {
|
|
146
146
|
type: 'rangeDatePicker';
|
|
147
147
|
};
|
|
148
|
-
type GuiRepeater<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
148
|
+
type GuiRepeater<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = InputWidget<Record<string, unknown>[], States, FormType, RepeaterProps<LayoutWidget<States, FormType, AccordionProps, GolemWidget<FormType, States, V, CustomWidget>[]>>, V> & {
|
|
149
149
|
type: 'repeater';
|
|
150
150
|
};
|
|
151
|
-
type GuiSelect<FormType extends Record<string, any>, States extends string, V> =
|
|
151
|
+
type GuiSelect<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, SelectProps, V> & {
|
|
152
152
|
type: 'select';
|
|
153
153
|
};
|
|
154
|
-
type GuiFlex<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
154
|
+
type GuiFlex<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, FlexProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
|
|
155
155
|
type: 'flex';
|
|
156
156
|
};
|
|
157
|
-
type GuiGrid<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
157
|
+
type GuiGrid<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, GridProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
|
|
158
158
|
type: 'grid';
|
|
159
159
|
};
|
|
160
|
-
type GuiTabs<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
160
|
+
type GuiTabs<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, TabsProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
|
|
161
161
|
type: 'tabs';
|
|
162
162
|
};
|
|
163
|
-
type GuiTextarea<FormType extends Record<string, any>, States extends string, V> =
|
|
163
|
+
type GuiTextarea<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, TextareaProps, V> & {
|
|
164
164
|
type: 'textarea';
|
|
165
165
|
};
|
|
166
|
-
type GuiTextInput<FormType extends Record<string, any>, States extends string, V> =
|
|
166
|
+
type GuiTextInput<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, TextinputProps, V> & {
|
|
167
167
|
type: 'textinput';
|
|
168
168
|
};
|
|
169
|
-
type GuiPassword<FormType extends Record<string, any>, States extends string, V> =
|
|
169
|
+
type GuiPassword<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, PasswordProps, V> & {
|
|
170
170
|
type: 'password';
|
|
171
171
|
};
|
|
172
|
-
type GuiToggle<FormType extends Record<string, any>, States extends string, V> =
|
|
172
|
+
type GuiToggle<FormType extends Record<string, any>, States extends string, V> = InputWidget<boolean, States, FormType, ToggleProps, V> & {
|
|
173
173
|
type: 'toggle';
|
|
174
174
|
};
|
|
175
175
|
export {};
|
package/lib/utils/repeater.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @internal Used by framework Repeater components, not part of the end-user public API.
|
|
3
|
+
*
|
|
2
4
|
* Returns a stable unique key for a repeater data item.
|
|
3
5
|
* Assigns a non-enumerable `__rid` property on first access so the ID
|
|
4
6
|
* survives array operations (splice, filter, spread) without polluting
|
package/lib/widget.factory.d.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
type InputWidgetConfig<T> = Omit<
|
|
4
|
-
type LayoutWidgetConfig = Omit<
|
|
5
|
-
type DisplayWidgetConfig = Omit<
|
|
1
|
+
import { BaseWidget, DisplayWidget, InputWidget, LayoutWidget, UiState } from '@golemui/core';
|
|
2
|
+
import { AlertProps, CheckboxProps, FlexProps, GridProps, MarkdownTextProps, NumberinputProps, PasswordProps, SelectProps, TabsProps, TextinputProps } from './widget.props';
|
|
3
|
+
type InputWidgetConfig<T> = Omit<InputWidget<T>, 'kind' | 'type' | 'uid' | 'props' | 'validator'>;
|
|
4
|
+
type LayoutWidgetConfig = Omit<LayoutWidget, 'kind' | 'type' | 'uid' | 'props'>;
|
|
5
|
+
type DisplayWidgetConfig = Omit<BaseWidget, 'kind' | 'type' | 'uid' | 'props'>;
|
|
6
6
|
/**
|
|
7
7
|
* Golem widget factory
|
|
8
8
|
*/
|
|
9
9
|
export declare const GolemWidgets: {
|
|
10
|
-
textinput: <StateKeys extends
|
|
10
|
+
textinput: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
11
11
|
config: InputWidgetConfig<string>;
|
|
12
|
-
props?:
|
|
12
|
+
props?: TextinputProps;
|
|
13
13
|
validator?: V;
|
|
14
|
-
}) =>
|
|
15
|
-
password: <StateKeys extends
|
|
14
|
+
}) => InputWidget<string, StateKeys>;
|
|
15
|
+
password: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
16
16
|
config: InputWidgetConfig<string>;
|
|
17
|
-
props?:
|
|
17
|
+
props?: PasswordProps;
|
|
18
18
|
validator?: V;
|
|
19
|
-
}) =>
|
|
20
|
-
numberinput: <StateKeys extends
|
|
19
|
+
}) => InputWidget<string, StateKeys>;
|
|
20
|
+
numberinput: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
21
21
|
config: InputWidgetConfig<number>;
|
|
22
|
-
props?:
|
|
22
|
+
props?: NumberinputProps;
|
|
23
23
|
validator?: V;
|
|
24
|
-
}) =>
|
|
25
|
-
checkbox: <StateKeys extends
|
|
24
|
+
}) => InputWidget<number, StateKeys>;
|
|
25
|
+
checkbox: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
26
26
|
config: InputWidgetConfig<boolean>;
|
|
27
|
-
props?:
|
|
27
|
+
props?: CheckboxProps;
|
|
28
28
|
validator?: V;
|
|
29
|
-
}) =>
|
|
30
|
-
select: <StateKeys extends
|
|
29
|
+
}) => InputWidget<boolean, StateKeys>;
|
|
30
|
+
select: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
31
31
|
config: InputWidgetConfig<string>;
|
|
32
|
-
props?:
|
|
32
|
+
props?: SelectProps;
|
|
33
33
|
validator?: V;
|
|
34
|
-
}) =>
|
|
35
|
-
flex: <StateKeys extends
|
|
36
|
-
grid: <StateKeys extends
|
|
37
|
-
tabs: <StateKeys extends
|
|
38
|
-
alert: <StateKeys extends
|
|
39
|
-
markdownText: <StateKeys extends
|
|
34
|
+
}) => InputWidget<string, StateKeys>;
|
|
35
|
+
flex: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: FlexProps) => LayoutWidget<StateKeys>;
|
|
36
|
+
grid: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: GridProps) => LayoutWidget<StateKeys>;
|
|
37
|
+
tabs: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: TabsProps) => LayoutWidget<StateKeys>;
|
|
38
|
+
alert: <StateKeys extends UiState = string>(config: DisplayWidgetConfig, props?: AlertProps) => DisplayWidget<StateKeys>;
|
|
39
|
+
markdownText: <StateKeys extends UiState = string>(config: DisplayWidgetConfig, props?: MarkdownTextProps) => DisplayWidget<StateKeys>;
|
|
40
40
|
};
|
|
41
41
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemui/gui-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.umd.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
11
|
"import": "./index.js",
|
|
12
12
|
"require": "./index.umd.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./internals": {
|
|
15
|
+
"types": "./internals.d.ts",
|
|
16
|
+
"import": "./internals.js",
|
|
17
|
+
"require": "./internals.umd.cjs"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
@@ -17,11 +22,14 @@
|
|
|
17
22
|
"index.d.ts",
|
|
18
23
|
"index.js",
|
|
19
24
|
"index.umd.cjs",
|
|
25
|
+
"internals.d.ts",
|
|
26
|
+
"internals.js",
|
|
27
|
+
"internals.umd.cjs",
|
|
20
28
|
"*.md"
|
|
21
29
|
],
|
|
22
30
|
"dependencies": {
|
|
23
|
-
"@golemui/core": "0.
|
|
24
|
-
"@golemui/gui-validators": "0.
|
|
31
|
+
"@golemui/core": "0.13.1",
|
|
32
|
+
"@golemui/gui-validators": "0.13.1"
|
|
25
33
|
},
|
|
26
34
|
"repository": {
|
|
27
35
|
"type": "git",
|