fomantic-ui 2.9.4-beta.2 → 2.9.4-beta.20
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/.all-contributorsrc +11 -1
- package/.github/workflows/ci.yml +2 -2
- package/.github/workflows/nightly.yml +1 -1
- package/.github/workflows/release.yml +1 -1
- package/CONTRIBUTORS.md +1 -0
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +1 -1
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +1 -1
- package/dist/components/api.min.js +1 -1
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +1 -1
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +1 -1
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +1 -1
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +1 -1
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +15 -17
- package/dist/components/dropdown.js +2 -2
- package/dist/components/dropdown.min.css +2 -2
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +1 -1
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +1 -1
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +1 -1
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +1 -1
- package/dist/components/form.css +14 -5
- package/dist/components/form.js +44 -20
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +5 -5
- package/dist/components/grid.min.css +2 -2
- package/dist/components/header.css +4 -1
- package/dist/components/header.min.css +2 -2
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +30 -10
- package/dist/components/input.min.css +2 -2
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -2
- package/dist/components/label.min.css +2 -2
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -2
- package/dist/components/menu.min.css +2 -2
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +1 -1
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +1 -1
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +1 -1
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +1 -1
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -2
- package/dist/components/popup.js +1 -1
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +1 -1
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +1 -1
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +1 -1
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +1 -1
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +1 -1
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +1 -1
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +1 -1
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +1 -1
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +1 -1
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +1 -1
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +1 -1
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +1 -1
- package/dist/components/state.js +1 -1
- package/dist/components/state.min.js +1 -1
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +1 -1
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +1 -1
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +1 -1
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +1 -1
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +1 -1
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +1 -1
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +1 -1
- package/dist/components/visibility.js +1 -1
- package/dist/components/visibility.min.js +1 -1
- package/dist/semantic.css +118 -89
- package/dist/semantic.js +70 -46
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/src/definitions/behaviors/form.js +43 -19
- package/src/definitions/collections/form.less +13 -4
- package/src/definitions/collections/grid.less +4 -4
- package/src/definitions/elements/header.less +5 -0
- package/src/definitions/elements/input.less +14 -6
- package/src/definitions/modules/dropdown.js +1 -1
- package/src/definitions/modules/dropdown.less +2 -2
- package/src/themes/default/collections/form.variables +1 -0
- package/src/themes/default/globals/variation.variables +1 -0
- package/types/fomantic-ui-api.d.ts +8 -2
- package/types/fomantic-ui-calendar.d.ts +93 -8
- package/types/fomantic-ui-checkbox.d.ts +14 -4
- package/types/fomantic-ui-dropdown.d.ts +12 -17
- package/types/fomantic-ui-flyout.d.ts +21 -7
- package/types/fomantic-ui-form.d.ts +112 -17
- package/types/fomantic-ui-modal.d.ts +74 -4
- package/types/fomantic-ui-nag.d.ts +1 -1
- package/types/fomantic-ui-popup.d.ts +8 -8
- package/types/fomantic-ui-progress.d.ts +6 -0
- package/types/fomantic-ui-search.d.ts +30 -12
- package/types/fomantic-ui-tab.d.ts +1 -1
- package/types/fomantic-ui-tests.ts +162 -0
- package/types/fomantic-ui-toast.d.ts +6 -1
- package/types/fomantic-ui-transition.d.ts +28 -0
- package/types/fomantic-ui-visibility.d.ts +2 -2
@@ -6,7 +6,7 @@ declare namespace FomanticUI {
|
|
6
6
|
* Recreates dropdown menu from passed values.
|
7
7
|
* values should be an object with the following structure: { values: [ {value, text, name} ] }.
|
8
8
|
*/
|
9
|
-
(behavior: 'setup menu', values: object):
|
9
|
+
(behavior: 'setup menu', values: object): JQuery;
|
10
10
|
|
11
11
|
/**
|
12
12
|
* Changes dropdown to use new values.
|
@@ -17,7 +17,7 @@ declare namespace FomanticUI {
|
|
17
17
|
/**
|
18
18
|
* Refreshes all cached selectors and data
|
19
19
|
*/
|
20
|
-
(behavior: 'refresh'):
|
20
|
+
(behavior: 'refresh'): JQuery;
|
21
21
|
|
22
22
|
/**
|
23
23
|
* Toggles current visibility of dropdown
|
@@ -29,20 +29,20 @@ declare namespace FomanticUI {
|
|
29
29
|
* If a function is provided to callback, it's called after the dropdown-menu is shown.
|
30
30
|
* Set preventFocus to true if you don't want the dropdown field to focus after the menu is shown
|
31
31
|
*/
|
32
|
-
(behavior: 'show', callback
|
32
|
+
(behavior: 'show', callback?: Function, preventFocus?: boolean): void;
|
33
33
|
|
34
34
|
/**
|
35
35
|
* Hides dropdown.
|
36
36
|
* If a function is provided to callback, it's called after the dropdown-menu is hidden.
|
37
37
|
* Set preventBlur to true if you don't want the dropdown field to blur after the menu is hidden
|
38
38
|
*/
|
39
|
-
(behavior: 'hide', callback
|
39
|
+
(behavior: 'hide', callback?: Function, preventBlur?: boolean): void;
|
40
40
|
|
41
41
|
/**
|
42
42
|
* Clears dropdown of selection.
|
43
43
|
* Set preventChangeTrigger to true to omit the change event (default: false).
|
44
44
|
*/
|
45
|
-
(behavior: 'clear', preventChangeTrigger
|
45
|
+
(behavior: 'clear', preventChangeTrigger?: boolean): JQuery;
|
46
46
|
|
47
47
|
/**
|
48
48
|
* Hides all other dropdowns that is not current dropdown
|
@@ -53,7 +53,7 @@ declare namespace FomanticUI {
|
|
53
53
|
* Restores dropdown text and value to its value on page load.
|
54
54
|
* Set preventChangeTrigger to true to omit the change event (default: false).
|
55
55
|
*/
|
56
|
-
(behavior: 'restore defaults', preventChangeTrigger
|
56
|
+
(behavior: 'restore defaults', preventChangeTrigger?: boolean): void;
|
57
57
|
|
58
58
|
/**
|
59
59
|
* Restores dropdown text to its value on page load
|
@@ -79,33 +79,28 @@ declare namespace FomanticUI {
|
|
79
79
|
* Sets value as selected.
|
80
80
|
* Set preventChangeTrigger to true to omit the change event (default: false).
|
81
81
|
*/
|
82
|
-
(behavior: 'set selected', value: string, preventChangeTrigger
|
82
|
+
(behavior: 'set selected', value: string | string[], preventChangeTrigger?: boolean, keepSearchTerm?: boolean): JQuery;
|
83
83
|
|
84
84
|
/**
|
85
85
|
* Remove value from selected
|
86
86
|
*/
|
87
87
|
(behavior: 'remove selected', value: string): void;
|
88
88
|
|
89
|
-
/**
|
90
|
-
* Adds a group of values as selected
|
91
|
-
*/
|
92
|
-
(behavior: 'set selected', values: string[]): void;
|
93
|
-
|
94
89
|
/**
|
95
90
|
* Sets selected values to exactly specified values, removing current selection
|
96
91
|
*/
|
97
|
-
(behavior: 'set exactly', values: string[]):
|
92
|
+
(behavior: 'set exactly', values: string[]): JQuery;
|
98
93
|
|
99
94
|
/**
|
100
95
|
* Sets dropdown text to a value
|
101
96
|
*/
|
102
|
-
(behavior: 'text', text: string):
|
97
|
+
(behavior: 'set text', text: string): JQuery;
|
103
98
|
|
104
99
|
/**
|
105
100
|
* Sets dropdown input to value (does not update display state).
|
106
101
|
* Set preventChangeTrigger to true to omit the change event (default: false).
|
107
102
|
*/
|
108
|
-
(behavior: 'set value', value: string, preventChangeTrigger
|
103
|
+
(behavior: 'set value', value: string, preventChangeTrigger?: boolean): JQuery;
|
109
104
|
|
110
105
|
/**
|
111
106
|
* Returns current dropdown text
|
@@ -265,7 +260,7 @@ declare namespace FomanticUI {
|
|
265
260
|
* @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
|
266
261
|
* @default false
|
267
262
|
*/
|
268
|
-
apiSettings: false | APISettings | JQueryAjaxSettings
|
263
|
+
apiSettings: false | Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>;
|
269
264
|
|
270
265
|
/**
|
271
266
|
* Whether dropdown should select new option when using keyboard shortcuts.
|
@@ -506,7 +501,7 @@ declare namespace FomanticUI {
|
|
506
501
|
* Is called after a dropdown value changes.
|
507
502
|
* Receives the name and value of selection and the active menu element.
|
508
503
|
*/
|
509
|
-
onChange(value
|
504
|
+
onChange(value?: string, text?: string, $choice?: JQuery): void;
|
510
505
|
|
511
506
|
/**
|
512
507
|
* Is called after a dropdown selection is added using a multiple select dropdown, only receives the added value.
|
@@ -48,6 +48,11 @@ declare namespace FomanticUI {
|
|
48
48
|
*/
|
49
49
|
(behavior: 'get settings'): FlyoutSettings;
|
50
50
|
|
51
|
+
/**
|
52
|
+
* Templates handling
|
53
|
+
*/
|
54
|
+
(behavior: keyof Flyout.TemplatesSettings, ...args: any): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
|
55
|
+
|
51
56
|
(behavior: 'destroy'): JQuery;
|
52
57
|
<K extends keyof FlyoutSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
|
53
58
|
<K extends keyof FlyoutSettings>(behavior: 'setting', name: K, value: FlyoutSettings[K]): JQuery;
|
@@ -145,43 +150,43 @@ declare namespace FomanticUI {
|
|
145
150
|
* Content of the flyout header.
|
146
151
|
* @default ''
|
147
152
|
*/
|
148
|
-
title:
|
153
|
+
title: string;
|
149
154
|
|
150
155
|
/**
|
151
156
|
* Content of the flyout content.
|
152
157
|
* @default ''
|
153
158
|
*/
|
154
|
-
content:
|
159
|
+
content: string;
|
155
160
|
|
156
161
|
/**
|
157
162
|
* Can hold a string to be added to the flyout class to control its appearance.
|
158
163
|
* @default ''
|
159
164
|
*/
|
160
|
-
class:
|
165
|
+
class: string;
|
161
166
|
|
162
167
|
/**
|
163
168
|
* Can hold a string to be added to the title class to control its appearance.
|
164
169
|
* @default ''
|
165
170
|
*/
|
166
|
-
classTitle:
|
171
|
+
classTitle: string;
|
167
172
|
|
168
173
|
/**
|
169
174
|
* Can hold a string to be added to the content class to control its appearance.
|
170
175
|
* @default ''
|
171
176
|
*/
|
172
|
-
classContent:
|
177
|
+
classContent: string;
|
173
178
|
|
174
179
|
/**
|
175
180
|
* Can hold a string to be added to the actions class to control its appearance.
|
176
181
|
* @default ''
|
177
182
|
*/
|
178
|
-
classActions:
|
183
|
+
classActions: string;
|
179
184
|
|
180
185
|
/**
|
181
186
|
* Can hold a string to be added to the actions class to control its appearance.
|
182
187
|
* @default false
|
183
188
|
*/
|
184
|
-
closeIcon: boolean;
|
189
|
+
closeIcon: boolean | string;
|
185
190
|
|
186
191
|
/**
|
187
192
|
* An array of objects. Each object defines an action with properties `text`, `class`, `icon` and `click`.
|
@@ -261,6 +266,8 @@ declare namespace FomanticUI {
|
|
261
266
|
|
262
267
|
// region Config Template Settings
|
263
268
|
|
269
|
+
templates: Flyout.TemplatesSettings;
|
270
|
+
|
264
271
|
// endregion
|
265
272
|
|
266
273
|
// region Debug Settings
|
@@ -311,6 +318,7 @@ declare namespace FomanticUI {
|
|
311
318
|
type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
|
312
319
|
type RegExpSettings = Partial<Pick<Settings.RegExps, keyof Settings.RegExps>>;
|
313
320
|
type ErrorSettings = Partial<Pick<Settings.Errors, keyof Settings.Errors>>;
|
321
|
+
type TemplatesSettings = Partial<Pick<Settings.Templates, keyof Settings.Templates>> & {[key: string]: (...args: any) => Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>};
|
314
322
|
|
315
323
|
namespace Settings {
|
316
324
|
interface Selectors {
|
@@ -520,6 +528,12 @@ declare namespace FomanticUI {
|
|
520
528
|
*/
|
521
529
|
notFound: string;
|
522
530
|
}
|
531
|
+
|
532
|
+
interface Templates {
|
533
|
+
alert(): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
|
534
|
+
confirm(): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
|
535
|
+
prompt(): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
|
536
|
+
}
|
523
537
|
}
|
524
538
|
}
|
525
539
|
}
|
@@ -15,7 +15,12 @@ declare namespace FomanticUI {
|
|
15
15
|
/**
|
16
16
|
* Adds rule to existing rules for field, also aliased as 'add field'.
|
17
17
|
*/
|
18
|
-
(behavior: 'add rule', field: string, rules:
|
18
|
+
(behavior: 'add rule', field: string, rules: string | string[] | FormField[]): void;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Adds field object to existing fields.
|
22
|
+
*/
|
23
|
+
(behavior: 'add field', name: string, rules: string | string[] | FormRule[]): void;
|
19
24
|
|
20
25
|
/**
|
21
26
|
* Adds fields object to existing fields.
|
@@ -25,13 +30,18 @@ declare namespace FomanticUI {
|
|
25
30
|
/**
|
26
31
|
* Removes specific rule from field leaving other rules.
|
27
32
|
*/
|
28
|
-
(behavior: 'remove rule', field: string, rules
|
33
|
+
(behavior: 'remove rule', field: string, rules?: object[]): void;
|
29
34
|
|
30
35
|
/**
|
31
36
|
* Remove all validation for a field.
|
32
37
|
*/
|
33
38
|
(behavior: 'remove field', field: string): void;
|
34
39
|
|
40
|
+
/**
|
41
|
+
* Remove all validation for an array of fields.
|
42
|
+
*/
|
43
|
+
(behavior: 'remove fields', field: string[]): void;
|
44
|
+
|
35
45
|
/**
|
36
46
|
* Returns 'true'/'false' whether a field passes its validation rules.
|
37
47
|
* If you add 'true' as the second parameter, any failed rule will update the UI.
|
@@ -41,7 +51,7 @@ declare namespace FomanticUI {
|
|
41
51
|
/**
|
42
52
|
* Validates form, updates UI, and calls 'onSuccess' or 'onFailure'.
|
43
53
|
*/
|
44
|
-
(behavior: 'validate form'):
|
54
|
+
(behavior: 'validate form'): boolean;
|
45
55
|
|
46
56
|
/**
|
47
57
|
* Validates field, updates UI, and calls 'onSuccess' or 'onFailure'.
|
@@ -51,7 +61,7 @@ declare namespace FomanticUI {
|
|
51
61
|
/**
|
52
62
|
* Returns element with matching name, id, or data-validate metadata to identifier.
|
53
63
|
*/
|
54
|
-
(behavior: 'get field', identifier: string): string;
|
64
|
+
(behavior: 'get field', identifier: string, strict?: boolean, ignoreMissing?: boolean): string;
|
55
65
|
|
56
66
|
/**
|
57
67
|
* Returns value of element with id.
|
@@ -62,7 +72,7 @@ declare namespace FomanticUI {
|
|
62
72
|
* Returns object of element values that match array of identifiers.
|
63
73
|
* If no IDS are passed will return all fields.
|
64
74
|
*/
|
65
|
-
(behavior: 'get values', identifiers?: string[]):
|
75
|
+
(behavior: 'get values', identifiers?: string[]): Record<string, string>;
|
66
76
|
|
67
77
|
/**
|
68
78
|
* Sets value of element with id.
|
@@ -82,7 +92,7 @@ declare namespace FomanticUI {
|
|
82
92
|
/**
|
83
93
|
* Returns whether a field exists.
|
84
94
|
*/
|
85
|
-
(behavior: 'has field', identifier: string): boolean;
|
95
|
+
(behavior: 'has field', identifier: string, ignoreMissing?: boolean): boolean;
|
86
96
|
|
87
97
|
/**
|
88
98
|
* Manually add errors to form, given an array errors.
|
@@ -97,23 +107,33 @@ declare namespace FomanticUI {
|
|
97
107
|
/**
|
98
108
|
* Adds a custom user prompt for a given element with identifier.
|
99
109
|
*/
|
100
|
-
(behavior: 'add prompt', identifier: string, errors: object[]): void;
|
110
|
+
(behavior: 'add prompt', identifier: string, errors: string | object[]): void;
|
101
111
|
|
102
112
|
/**
|
103
113
|
* Empty all fields and remove possible errors.
|
104
114
|
*/
|
105
|
-
(behavior: 'clear'):
|
115
|
+
(behavior: 'clear'): JQuery;
|
106
116
|
|
107
117
|
/**
|
108
118
|
* Set all fields to their initial value and remove possible errors.
|
109
119
|
*/
|
110
|
-
(behavior: 'reset'):
|
120
|
+
(behavior: 'reset'): JQuery;
|
111
121
|
|
112
122
|
/**
|
113
123
|
* Set fields actual values as default values.
|
114
124
|
*/
|
115
125
|
(behavior: 'set defaults'): void;
|
116
126
|
|
127
|
+
/**
|
128
|
+
* Returns 'true'/'false' whether a form is dirty.
|
129
|
+
*/
|
130
|
+
(behavior: 'is dirty'): boolean;
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Returns 'true'/'false' whether a form is clean.
|
134
|
+
*/
|
135
|
+
(behavior: 'is clean'): boolean;
|
136
|
+
|
117
137
|
/**
|
118
138
|
* Return elements which have been modified since form state was changed to 'dirty'.
|
119
139
|
*/
|
@@ -122,7 +142,7 @@ declare namespace FomanticUI {
|
|
122
142
|
/**
|
123
143
|
* Set the state of the form to 'clean' and set new values as default.
|
124
144
|
*/
|
125
|
-
(behavior: 'set as clean'):
|
145
|
+
(behavior: 'set as clean'): JQuery;
|
126
146
|
|
127
147
|
/**
|
128
148
|
* Automatically adds the "empty" rule or automatically checks a checkbox for all fields with classname or attribute 'required'.
|
@@ -144,12 +164,33 @@ declare namespace FomanticUI {
|
|
144
164
|
(settings?: Partial<Pick<FormSettings, keyof FormSettings>>): JQuery;
|
145
165
|
}
|
146
166
|
|
167
|
+
type FormFields = Record<string, FormField | string[] | string | {}>;
|
168
|
+
|
169
|
+
interface FormRule {
|
170
|
+
type: string;
|
171
|
+
prompt?: string | ((value: string) => void);
|
172
|
+
value?: string | RegExp;
|
173
|
+
}
|
174
|
+
|
175
|
+
interface FormField {
|
176
|
+
identifier?: string;
|
177
|
+
depends?: string;
|
178
|
+
optional?: boolean;
|
179
|
+
rules: FormRule[];
|
180
|
+
}
|
181
|
+
|
147
182
|
/**
|
148
183
|
* @see {@link https://fomantic-ui.com/behaviors/form.html#/settings}
|
149
184
|
*/
|
150
185
|
interface FormSettings {
|
151
186
|
// region Form Settings
|
152
187
|
|
188
|
+
/**
|
189
|
+
* Adds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively.
|
190
|
+
* @default false
|
191
|
+
*/
|
192
|
+
fields: false | FormFields;
|
193
|
+
|
153
194
|
/**
|
154
195
|
* Adds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively.
|
155
196
|
* @default true
|
@@ -227,7 +268,7 @@ declare namespace FomanticUI {
|
|
227
268
|
errorFocus: boolean | string;
|
228
269
|
|
229
270
|
/**
|
230
|
-
*
|
271
|
+
*
|
231
272
|
* @default 0
|
232
273
|
*/
|
233
274
|
errorLimit: number;
|
@@ -248,6 +289,12 @@ declare namespace FomanticUI {
|
|
248
289
|
|
249
290
|
// endregion
|
250
291
|
|
292
|
+
// region Formatters
|
293
|
+
|
294
|
+
rules: Form.RulesSettings;
|
295
|
+
|
296
|
+
// endregion
|
297
|
+
|
251
298
|
// region Callbacks
|
252
299
|
|
253
300
|
/**
|
@@ -258,17 +305,17 @@ declare namespace FomanticUI {
|
|
258
305
|
/**
|
259
306
|
* Callback on each invalid field.
|
260
307
|
*/
|
261
|
-
onInvalid(this: JQuery): void;
|
308
|
+
onInvalid(this: JQuery, fieldErrors: string | string[]): void;
|
262
309
|
|
263
310
|
/**
|
264
311
|
* Callback if a form is all valid.
|
265
312
|
*/
|
266
|
-
onSuccess(this: JQuery, event: Event, fields:
|
313
|
+
onSuccess(this: JQuery, event: Event, fields: {[key: string]: any}): void;
|
267
314
|
|
268
315
|
/**
|
269
316
|
* Callback if any form field is invalid.
|
270
317
|
*/
|
271
|
-
onFailure(this: JQuery, formErrors:
|
318
|
+
onFailure(this: JQuery, formErrors: {[key: string]: any}, fields: {[key: string]: any}): void;
|
272
319
|
|
273
320
|
/**
|
274
321
|
* Callback if form state is modified to 'dirty'.
|
@@ -349,8 +396,9 @@ declare namespace FomanticUI {
|
|
349
396
|
|
350
397
|
namespace Form {
|
351
398
|
type TextSettings = Partial<Pick<Settings.Texts, keyof Settings.Texts>>;
|
352
|
-
type PromptSettings = Partial<Pick<Settings.Prompts, keyof Settings.Prompts
|
399
|
+
type PromptSettings = Partial<Pick<Settings.Prompts, keyof Settings.Prompts>> & {[key: string]: string | undefined};
|
353
400
|
type FormatterSettings = Partial<Pick<Settings.Formatters, keyof Settings.Formatters>>;
|
401
|
+
type RulesSettings = Partial<Pick<Settings.Rules, keyof Settings.Rules>> & {[key: string]: (value?: any, identifier?: string, module?: any) => boolean};
|
354
402
|
type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
|
355
403
|
type MetadataSettings = Partial<Pick<Settings.Metadatas, keyof Settings.Metadatas>>;
|
356
404
|
type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
|
@@ -373,8 +421,23 @@ declare namespace FomanticUI {
|
|
373
421
|
*/
|
374
422
|
leavingMessage: string;
|
375
423
|
}
|
376
|
-
|
424
|
+
|
377
425
|
interface Prompts {
|
426
|
+
/**
|
427
|
+
* @default '{name} must be in a range from {min} to {max}'
|
428
|
+
*/
|
429
|
+
range: string;
|
430
|
+
|
431
|
+
/**
|
432
|
+
* @default '{name} must have a maximum value of {ruleValue}'
|
433
|
+
*/
|
434
|
+
maxValue: string;
|
435
|
+
|
436
|
+
/**
|
437
|
+
* @default '{name} must have a minimum value of {ruleValue}'
|
438
|
+
*/
|
439
|
+
minValue: string;
|
440
|
+
|
378
441
|
/**
|
379
442
|
* @default '{name} must have a value'
|
380
443
|
*/
|
@@ -500,7 +563,7 @@ declare namespace FomanticUI {
|
|
500
563
|
*/
|
501
564
|
maxCount: string;
|
502
565
|
}
|
503
|
-
|
566
|
+
|
504
567
|
interface Formatters {
|
505
568
|
date(date: string): string;
|
506
569
|
datetime(date: string): string;
|
@@ -509,6 +572,38 @@ declare namespace FomanticUI {
|
|
509
572
|
year(date: string): string;
|
510
573
|
}
|
511
574
|
|
575
|
+
interface Rules {
|
576
|
+
empty(value: unknown): boolean;
|
577
|
+
checked(): boolean;
|
578
|
+
email(value: unknown): boolean;
|
579
|
+
url(value: unknown): boolean;
|
580
|
+
regExp(value: unknown, regExp: RegExp): boolean;
|
581
|
+
minValue(value: unknown, range: string): boolean;
|
582
|
+
maxValue(value: unknown, range: string): boolean;
|
583
|
+
integer(value: unknown, range: string): boolean;
|
584
|
+
range(value: unknown, range: string, regExp: RegExp, testLength: boolean): boolean;
|
585
|
+
decimal(value: unknown, range: string): boolean;
|
586
|
+
number(value: unknown, range: string): boolean;
|
587
|
+
is(value: unknown, text: string): boolean;
|
588
|
+
isExactly(value: unknown, text: string): boolean;
|
589
|
+
not(value: unknown, notValue: unknown): boolean;
|
590
|
+
notExactly(value: unknown, notValue: unknown): boolean;
|
591
|
+
contains(value: unknown, text: string): boolean;
|
592
|
+
containsExactly(value: unknown, text: string): boolean;
|
593
|
+
doesntContain(value: unknown, text: string): boolean;
|
594
|
+
doesntContainExactly(value: unknown, text: string): boolean;
|
595
|
+
minLength(value: unknown, minLength: number): boolean;
|
596
|
+
exactLength(value: unknown, requiredLength: number): boolean;
|
597
|
+
maxLength(value: unknown, maxLength: number): boolean;
|
598
|
+
size(value: unknown, range: string): boolean;
|
599
|
+
match(value: unknown, identifier: string, module: unknown): boolean;
|
600
|
+
different(value: unknown, identifier: string, module: unknown): boolean;
|
601
|
+
creditCard(cardNumber: unknown, cardTypes: string): boolean;
|
602
|
+
minCount(value: unknown, minCount: number): boolean;
|
603
|
+
exactCount(value: unknown, exactCount: number): boolean;
|
604
|
+
maxCount(value: unknown, maxCount: number): boolean;
|
605
|
+
}
|
606
|
+
|
512
607
|
interface Selectors {
|
513
608
|
/**
|
514
609
|
* @default 'input[type="checkbox"], input[type="radio"]'
|
@@ -5,12 +5,12 @@ declare namespace FomanticUI {
|
|
5
5
|
/**
|
6
6
|
* Shows the modal.
|
7
7
|
*/
|
8
|
-
(behavior: 'show'): JQuery;
|
8
|
+
(behavior: 'show', callback?: Function): JQuery;
|
9
9
|
|
10
10
|
/**
|
11
11
|
* Hides the modal.
|
12
12
|
*/
|
13
|
-
(behavior: 'hide'): JQuery;
|
13
|
+
(behavior: 'hide', callback?: Function): JQuery;
|
14
14
|
|
15
15
|
/**
|
16
16
|
* Toggles the modal.
|
@@ -62,6 +62,11 @@ declare namespace FomanticUI {
|
|
62
62
|
*/
|
63
63
|
(behavior: 'set active'): JQuery;
|
64
64
|
|
65
|
+
/**
|
66
|
+
* Templates handling
|
67
|
+
*/
|
68
|
+
(behavior: keyof Modal.TemplatesSettings, ...args: any): Partial<Pick<ModalSettings, keyof ModalSettings>>;
|
69
|
+
|
65
70
|
(behavior: 'destroy'): JQuery;
|
66
71
|
<K extends keyof ModalSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<ModalSettings, keyof ModalSettings>>;
|
67
72
|
<K extends keyof ModalSettings>(behavior: 'setting', name: K, value: ModalSettings[K]): JQuery;
|
@@ -166,13 +171,13 @@ declare namespace FomanticUI {
|
|
166
171
|
/**
|
167
172
|
* Custom settings to extend UI dimmer.
|
168
173
|
*/
|
169
|
-
dimmerSettings: DimmerSettings
|
174
|
+
dimmerSettings: Partial<Pick<DimmerSettings, keyof DimmerSettings>>;
|
170
175
|
|
171
176
|
/**
|
172
177
|
* Custom settings to extend UI dimmer.
|
173
178
|
* @default 'scale'
|
174
179
|
*/
|
175
|
-
transition: string | TransitionSettings
|
180
|
+
transition: string | Partial<Pick<TransitionSettings, keyof TransitionSettings>>;
|
176
181
|
|
177
182
|
/**
|
178
183
|
* Duration of animation.
|
@@ -194,6 +199,62 @@ declare namespace FomanticUI {
|
|
194
199
|
*/
|
195
200
|
scrollbarWidth: number;
|
196
201
|
|
202
|
+
// dynamic content
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Title of dynamicly created modal.
|
206
|
+
* @default ''
|
207
|
+
*/
|
208
|
+
title: string;
|
209
|
+
|
210
|
+
/**
|
211
|
+
* HTML content of dynamicly created modal.
|
212
|
+
* @default ''
|
213
|
+
*/
|
214
|
+
content: string;
|
215
|
+
|
216
|
+
/**
|
217
|
+
* CSS classname(s) of dynamicly created modal.
|
218
|
+
* @default ''
|
219
|
+
*/
|
220
|
+
class: string;
|
221
|
+
|
222
|
+
/**
|
223
|
+
* CSS classname(s) of dynamicly created modal's title.
|
224
|
+
* @default ''
|
225
|
+
*/
|
226
|
+
classTitle: string;
|
227
|
+
|
228
|
+
/**
|
229
|
+
* CSS classname(s) of dynamicly created modal's content.
|
230
|
+
* @default ''
|
231
|
+
*/
|
232
|
+
classContent: string;
|
233
|
+
|
234
|
+
/**
|
235
|
+
* CSS classname(s) of dynamicly created modal's actions.
|
236
|
+
* @default ''
|
237
|
+
*/
|
238
|
+
classActions: string;
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Determine if a close icon shoud be displayed on dynamicly created modal.
|
242
|
+
* @default false
|
243
|
+
*/
|
244
|
+
closeIcon: boolean;
|
245
|
+
|
246
|
+
/**
|
247
|
+
*
|
248
|
+
* @default false
|
249
|
+
*/
|
250
|
+
actions: any;
|
251
|
+
|
252
|
+
/**
|
253
|
+
*
|
254
|
+
* @default true
|
255
|
+
*/
|
256
|
+
preserveHTML: boolean;
|
257
|
+
|
197
258
|
// endregion
|
198
259
|
|
199
260
|
// region Callbacks
|
@@ -250,6 +311,8 @@ declare namespace FomanticUI {
|
|
250
311
|
|
251
312
|
// region Config Template Settings
|
252
313
|
|
314
|
+
templates: Modal.TemplatesSettings;
|
315
|
+
|
253
316
|
// endregion
|
254
317
|
|
255
318
|
// region Debug Settings
|
@@ -299,6 +362,7 @@ declare namespace FomanticUI {
|
|
299
362
|
type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
|
300
363
|
type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
|
301
364
|
type ErrorSettings = Partial<Pick<Settings.Errors, keyof Settings.Errors>>;
|
365
|
+
type TemplatesSettings = Partial<Pick<Settings.Templates, keyof Settings.Templates>> & {[key: string]: (...args: any) => Partial<Pick<ModalSettings, keyof ModalSettings>>};
|
302
366
|
|
303
367
|
namespace Settings {
|
304
368
|
interface Selectors {
|
@@ -466,6 +530,12 @@ declare namespace FomanticUI {
|
|
466
530
|
*/
|
467
531
|
notFound: string;
|
468
532
|
}
|
533
|
+
|
534
|
+
interface Templates {
|
535
|
+
alert(): Partial<Pick<ModalSettings, keyof ModalSettings>>;
|
536
|
+
confirm(): Partial<Pick<ModalSettings, keyof ModalSettings>>;
|
537
|
+
prompt(): Partial<Pick<ModalSettings, keyof ModalSettings>>;
|
538
|
+
}
|
469
539
|
}
|
470
540
|
}
|
471
541
|
}
|
@@ -26,7 +26,7 @@ declare namespace FomanticUI {
|
|
26
26
|
<K extends keyof NagSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<NagSettings, keyof NagSettings>>;
|
27
27
|
<K extends keyof NagSettings>(behavior: 'setting', name: K, value: NagSettings[K]): JQuery;
|
28
28
|
(behavior: 'setting', value: Partial<Pick<NagSettings, keyof NagSettings>>): JQuery;
|
29
|
-
(settings?:
|
29
|
+
(settings?: Partial<Pick<NagSettings, keyof NagSettings>>): JQuery;
|
30
30
|
}
|
31
31
|
|
32
32
|
/**
|
@@ -84,7 +84,7 @@ declare namespace FomanticUI {
|
|
84
84
|
* This is useful for including a pre-formatted popup.
|
85
85
|
* @default false
|
86
86
|
*/
|
87
|
-
popup: false | string;
|
87
|
+
popup: false | string | JQuery;
|
88
88
|
|
89
89
|
/**
|
90
90
|
* Whether all other popups should be hidden when this popup is opened.
|
@@ -266,39 +266,39 @@ declare namespace FomanticUI {
|
|
266
266
|
/**
|
267
267
|
* Callback on popup element creation, with created popup.
|
268
268
|
*/
|
269
|
-
onCreate(this: JQuery): void;
|
269
|
+
onCreate(this: JQuery, element?: JQuery<HTMLElement>): void;
|
270
270
|
|
271
271
|
/**
|
272
272
|
* Callback immediately before Popup is removed from DOM.
|
273
273
|
*/
|
274
|
-
onRemove(this: JQuery): void;
|
274
|
+
onRemove(this: JQuery, element?: JQuery<HTMLElement>): void;
|
275
275
|
|
276
276
|
/**
|
277
277
|
* Callback before popup is shown.
|
278
278
|
* Returning 'false' from this callback will cancel the popup from showing.
|
279
279
|
*/
|
280
|
-
onShow(this: JQuery):
|
280
|
+
onShow(this: JQuery, element?: JQuery<HTMLElement>): any;
|
281
281
|
|
282
282
|
/**
|
283
283
|
* Callback after popup is shown.
|
284
284
|
*/
|
285
|
-
onVisible(this: JQuery): void;
|
285
|
+
onVisible(this: JQuery, element?: JQuery<HTMLElement>): void;
|
286
286
|
|
287
287
|
/**
|
288
288
|
* Callback before popup is hidden.
|
289
289
|
* Returning 'false' from this callback will cancel the popup from hiding.
|
290
290
|
*/
|
291
|
-
onHide(this: JQuery):
|
291
|
+
onHide(this: JQuery, element?: JQuery<HTMLElement>): any;
|
292
292
|
|
293
293
|
/**
|
294
294
|
* Callback after popup is hidden.
|
295
295
|
*/
|
296
|
-
onHidden(this: JQuery): void;
|
296
|
+
onHidden(this: JQuery, element?: JQuery<HTMLElement>): void;
|
297
297
|
|
298
298
|
/**
|
299
299
|
* Callback after popup cannot be placed on screen.
|
300
300
|
*/
|
301
|
-
onUnplaceable(this: JQuery): void;
|
301
|
+
onUnplaceable(this: JQuery, element?: JQuery<HTMLElement>): void;
|
302
302
|
|
303
303
|
// endregion
|
304
304
|
|
@@ -208,6 +208,12 @@ declare namespace FomanticUI {
|
|
208
208
|
*/
|
209
209
|
precision: number;
|
210
210
|
|
211
|
+
/**
|
212
|
+
* Sets current overall percent.
|
213
|
+
* @default false
|
214
|
+
*/
|
215
|
+
percent: false | number;
|
216
|
+
|
211
217
|
/**
|
212
218
|
* Setting a total value will make each call to increment get closer to this total (i.e. 1/20, 2/20 etc).
|
213
219
|
* @default false
|