@panneau/core 4.0.11 → 4.0.15
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/dist/contexts.d.ts +450 -0
- package/{es → dist}/contexts.js +170 -170
- package/dist/hooks.d.ts +362 -0
- package/{es → dist}/hooks.js +60 -60
- package/dist/index.d.ts +502 -0
- package/{es → dist}/index.js +7 -258
- package/dist/utils.d.ts +207 -0
- package/{es → dist}/utils.js +56 -57
- package/package.json +23 -23
- package/es/types/core.d.ts +0 -133
- package/es/types/form.d.ts +0 -58
- package/es/types/index.d.ts +0 -20
- package/es/types/panneau.d.ts +0 -50
- package/es/types/resource.d.ts +0 -112
- package/lib/contexts.js +0 -1432
- package/lib/hooks.js +0 -1168
- package/lib/index.js +0 -1019
- package/lib/utils.js +0 -789
package/{es → dist}/index.js
RENAMED
|
@@ -2,275 +2,24 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
3
3
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
4
4
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
5
|
-
import {
|
|
6
|
-
import ReactIs from 'react-is';
|
|
5
|
+
import { getComponentFromName, flattenComponents } from '@panneau/core/utils';
|
|
7
6
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
8
|
-
import isArray from 'lodash
|
|
9
|
-
import uniqBy from 'lodash
|
|
7
|
+
import isArray from 'lodash/isArray';
|
|
8
|
+
import uniqBy from 'lodash/uniqBy';
|
|
10
9
|
import _callSuper from '@babel/runtime/helpers/callSuper';
|
|
11
10
|
import _inherits from '@babel/runtime/helpers/inherits';
|
|
12
11
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
13
12
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
14
|
-
import isObject from 'lodash
|
|
15
|
-
import uniq from 'lodash
|
|
13
|
+
import isObject from 'lodash/isObject';
|
|
14
|
+
import uniq from 'lodash/uniq';
|
|
16
15
|
import { Tracking as Tracking$1 } from '@folklore/tracking';
|
|
17
|
-
import PropTypes$1 from 'prop-types';
|
|
18
|
-
|
|
19
|
-
var message = PropTypes$1.shape({
|
|
20
|
-
id: PropTypes$1.string.isRequired,
|
|
21
|
-
defaultMessage: PropTypes$1.string
|
|
22
|
-
});
|
|
23
|
-
var label = PropTypes$1.oneOfType([message, PropTypes$1.node]);
|
|
24
|
-
var statusCode = PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string]);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Core
|
|
28
|
-
*/
|
|
29
|
-
var menuItem = PropTypes$1.shape({
|
|
30
|
-
id: PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string]),
|
|
31
|
-
label: label,
|
|
32
|
-
url: PropTypes$1.string,
|
|
33
|
-
external: PropTypes$1.bool,
|
|
34
|
-
active: PropTypes$1.bool
|
|
35
|
-
});
|
|
36
|
-
var menuItems = PropTypes$1.arrayOf(menuItem);
|
|
37
|
-
var button = PropTypes$1.shape({
|
|
38
|
-
id: PropTypes$1.string,
|
|
39
|
-
label: label,
|
|
40
|
-
onClick: PropTypes$1.func
|
|
41
|
-
});
|
|
42
|
-
var buttons = PropTypes$1.arrayOf(button);
|
|
43
|
-
var buttonTheme = PropTypes$1.oneOf(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark', null]);
|
|
44
|
-
var buttonSize = PropTypes$1.oneOf(['lg', 'md', 'sm', null]);
|
|
45
|
-
var buttonType = PropTypes$1.oneOf(['button', 'submit']);
|
|
46
|
-
var dropdownAlign = PropTypes$1.oneOf(['start', 'end']);
|
|
47
|
-
var controlSize = PropTypes$1.oneOf(['lg', 'sm', null]);
|
|
48
|
-
var formStatus = PropTypes$1.oneOf(['loading', 'success', 'error', null]);
|
|
49
|
-
var fieldOption = PropTypes$1.shape({
|
|
50
|
-
value: PropTypes$1.string,
|
|
51
|
-
label: PropTypes$1.string
|
|
52
|
-
});
|
|
53
|
-
var fieldOptions = PropTypes$1.arrayOf(fieldOption);
|
|
54
|
-
var toggle = PropTypes$1.shape({
|
|
55
|
-
key: PropTypes$1.string,
|
|
56
|
-
label: PropTypes$1.string
|
|
57
|
-
});
|
|
58
|
-
var toggles = PropTypes$1.arrayOf(toggle);
|
|
59
|
-
var tableColumn = PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.shape({
|
|
60
|
-
id: PropTypes$1.string,
|
|
61
|
-
component: PropTypes$1.string,
|
|
62
|
-
path: PropTypes$1.string,
|
|
63
|
-
field: PropTypes$1.string,
|
|
64
|
-
columnClassName: PropTypes$1.string
|
|
65
|
-
})]);
|
|
66
|
-
var tableColumns = PropTypes$1.arrayOf(tableColumn);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Panneau Definitions
|
|
70
|
-
*/
|
|
71
|
-
var routes = PropTypes$1.shape({
|
|
72
|
-
'resources.index': PropTypes$1.string.isRequired,
|
|
73
|
-
'resources.create': PropTypes$1.string.isRequired,
|
|
74
|
-
'resources.store': PropTypes$1.string.isRequired,
|
|
75
|
-
'resources.show': PropTypes$1.string.isRequired,
|
|
76
|
-
'resources.edit': PropTypes$1.string.isRequired,
|
|
77
|
-
'resources.update': PropTypes$1.string.isRequired,
|
|
78
|
-
'resources.delete': PropTypes$1.string.isRequired,
|
|
79
|
-
'resources.destroy': PropTypes$1.string.isRequired,
|
|
80
|
-
'resources.duplicate': PropTypes$1.string.isRequired,
|
|
81
|
-
'resources.clone': PropTypes$1.string.isRequired,
|
|
82
|
-
'resources.restore': PropTypes$1.string.isRequired
|
|
83
|
-
});
|
|
84
|
-
var intl = PropTypes$1.shape({
|
|
85
|
-
locale: PropTypes$1.string,
|
|
86
|
-
messages: PropTypes$1.objectOf(PropTypes$1.string),
|
|
87
|
-
values: PropTypes$1.objectOf(PropTypes$1.string)
|
|
88
|
-
});
|
|
89
|
-
var page = PropTypes$1.shape({
|
|
90
|
-
component: PropTypes$1.string.isRequired
|
|
91
|
-
});
|
|
92
|
-
var pages = PropTypes$1.objectOf(page);
|
|
93
|
-
var field = PropTypes$1.shape({
|
|
94
|
-
name: PropTypes$1.string,
|
|
95
|
-
// Not required on localized fields
|
|
96
|
-
type: PropTypes$1.string,
|
|
97
|
-
component: PropTypes$1.string,
|
|
98
|
-
label: PropTypes$1.node
|
|
99
|
-
});
|
|
100
|
-
var fields = PropTypes$1.arrayOf(field);
|
|
101
|
-
var form = PropTypes$1.shape({
|
|
102
|
-
// type: PropTypes.string.isRequired,
|
|
103
|
-
title: PropTypes$1.isRequired,
|
|
104
|
-
fields: fields
|
|
105
|
-
});
|
|
106
|
-
var forms = PropTypes$1.arrayOf(form);
|
|
107
|
-
var resource = PropTypes$1.shape({
|
|
108
|
-
id: PropTypes$1.string.isRequired,
|
|
109
|
-
name: PropTypes$1.string.isRequired,
|
|
110
|
-
intl: intl,
|
|
111
|
-
fields: fields,
|
|
112
|
-
forms: PropTypes$1.shape({}),
|
|
113
|
-
shows_in_navbar: PropTypes$1.bool
|
|
114
|
-
});
|
|
115
|
-
var resources = PropTypes$1.arrayOf(resource);
|
|
116
|
-
var panneauDefinition = PropTypes$1.shape({
|
|
117
|
-
name: PropTypes$1.string,
|
|
118
|
-
resources: resources,
|
|
119
|
-
routes: routes,
|
|
120
|
-
pages: pages,
|
|
121
|
-
intl: intl
|
|
122
|
-
// intl,
|
|
123
|
-
});
|
|
124
|
-
var definition = PropTypes$1.shape({
|
|
125
|
-
name: PropTypes$1.string
|
|
126
|
-
// resources,
|
|
127
|
-
// routes,
|
|
128
|
-
// intl,
|
|
129
|
-
});
|
|
130
|
-
var item = PropTypes$1.shape({
|
|
131
|
-
id: PropTypes$1.string.isRequired
|
|
132
|
-
});
|
|
133
|
-
var items = PropTypes$1.arrayOf(item);
|
|
134
|
-
var user = PropTypes$1.shape({
|
|
135
|
-
id: PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string])
|
|
136
|
-
});
|
|
137
|
-
var users = PropTypes$1.arrayOf(user);
|
|
138
|
-
var selectOption = PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number, PropTypes$1.shape({
|
|
139
|
-
value: PropTypes$1.any,
|
|
140
|
-
// eslint-disable-line
|
|
141
|
-
label: label
|
|
142
|
-
}), PropTypes$1.object]);
|
|
143
|
-
var selectOptions = PropTypes$1.arrayOf(selectOption);
|
|
144
|
-
var feedback = PropTypes$1.oneOf(['valid', 'invalid', 'loading', null]);
|
|
145
|
-
var formError = PropTypes$1.shape({
|
|
146
|
-
message: PropTypes$1.string
|
|
147
|
-
});
|
|
148
|
-
var formErrors = PropTypes$1.arrayOf(formError);
|
|
149
|
-
var uppy = PropTypes$1.shape({
|
|
150
|
-
tus: PropTypes$1.object
|
|
151
|
-
}); // eslint-disable-line
|
|
152
|
-
|
|
153
|
-
var triggerUpdate = PropTypes$1.string;
|
|
154
|
-
var breadcrumb = PropTypes$1.shape({
|
|
155
|
-
url: PropTypes$1.string
|
|
156
|
-
});
|
|
157
|
-
var breadcrumbs = PropTypes$1.arrayOf(breadcrumb);
|
|
158
|
-
var font = PropTypes$1.shape({
|
|
159
|
-
// url: PropTypes.string,
|
|
160
|
-
});
|
|
161
|
-
var fonts = PropTypes$1.arrayOf(font);
|
|
162
|
-
var trackingVariables = PropTypes$1.shape({});
|
|
163
|
-
var modal = PropTypes$1.shape({
|
|
164
|
-
name: PropTypes$1.string
|
|
165
|
-
});
|
|
166
|
-
var modals = PropTypes$1.arrayOf(modal);
|
|
167
|
-
var filter = PropTypes$1.shape({
|
|
168
|
-
id: PropTypes$1.string,
|
|
169
|
-
component: PropTypes$1.string
|
|
170
|
-
});
|
|
171
|
-
var filters = PropTypes$1.arrayOf(filter);
|
|
172
|
-
var media = PropTypes$1.shape({
|
|
173
|
-
id: PropTypes$1.string.isRequired,
|
|
174
|
-
name: PropTypes$1.string.isRequired,
|
|
175
|
-
type: PropTypes$1.string.isRequired,
|
|
176
|
-
thumbnail_url: PropTypes$1.string
|
|
177
|
-
});
|
|
178
|
-
var medias = PropTypes$1.arrayOf(media);
|
|
179
|
-
var preview = PropTypes$1.shape({
|
|
180
|
-
id: PropTypes$1.string
|
|
181
|
-
});
|
|
182
|
-
var previews = PropTypes$1.arrayOf(preview);
|
|
183
|
-
|
|
184
|
-
var PropTypes = /*#__PURE__*/Object.freeze({
|
|
185
|
-
__proto__: null,
|
|
186
|
-
breadcrumb: breadcrumb,
|
|
187
|
-
breadcrumbs: breadcrumbs,
|
|
188
|
-
button: button,
|
|
189
|
-
buttonSize: buttonSize,
|
|
190
|
-
buttonTheme: buttonTheme,
|
|
191
|
-
buttonType: buttonType,
|
|
192
|
-
buttons: buttons,
|
|
193
|
-
controlSize: controlSize,
|
|
194
|
-
definition: definition,
|
|
195
|
-
dropdownAlign: dropdownAlign,
|
|
196
|
-
feedback: feedback,
|
|
197
|
-
field: field,
|
|
198
|
-
fieldOption: fieldOption,
|
|
199
|
-
fieldOptions: fieldOptions,
|
|
200
|
-
fields: fields,
|
|
201
|
-
filter: filter,
|
|
202
|
-
filters: filters,
|
|
203
|
-
font: font,
|
|
204
|
-
fonts: fonts,
|
|
205
|
-
form: form,
|
|
206
|
-
formError: formError,
|
|
207
|
-
formErrors: formErrors,
|
|
208
|
-
formStatus: formStatus,
|
|
209
|
-
forms: forms,
|
|
210
|
-
intl: intl,
|
|
211
|
-
item: item,
|
|
212
|
-
items: items,
|
|
213
|
-
label: label,
|
|
214
|
-
media: media,
|
|
215
|
-
medias: medias,
|
|
216
|
-
menuItem: menuItem,
|
|
217
|
-
menuItems: menuItems,
|
|
218
|
-
message: message,
|
|
219
|
-
modal: modal,
|
|
220
|
-
modals: modals,
|
|
221
|
-
page: page,
|
|
222
|
-
pages: pages,
|
|
223
|
-
panneauDefinition: panneauDefinition,
|
|
224
|
-
preview: preview,
|
|
225
|
-
previews: previews,
|
|
226
|
-
resource: resource,
|
|
227
|
-
resources: resources,
|
|
228
|
-
routes: routes,
|
|
229
|
-
selectOption: selectOption,
|
|
230
|
-
selectOptions: selectOptions,
|
|
231
|
-
statusCode: statusCode,
|
|
232
|
-
tableColumn: tableColumn,
|
|
233
|
-
tableColumns: tableColumns,
|
|
234
|
-
toggle: toggle,
|
|
235
|
-
toggles: toggles,
|
|
236
|
-
trackingVariables: trackingVariables,
|
|
237
|
-
triggerUpdate: triggerUpdate,
|
|
238
|
-
uppy: uppy,
|
|
239
|
-
user: user,
|
|
240
|
-
users: users
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
var _flattenComponents = function flattenComponents(components) {
|
|
244
|
-
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
245
|
-
if (components === null) {
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
return Object.keys(components).reduce(function (newMap, key) {
|
|
249
|
-
return ReactIs.isValidElementType(components[key]) ? _objectSpread(_objectSpread({}, newMap), {}, _defineProperty({}, prefix !== null ? "".concat(prefix, ".").concat(key) : key, components[key])) : _objectSpread(_objectSpread({}, newMap), _flattenComponents(components[key], key));
|
|
250
|
-
}, {});
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
var getComponentFromName = function getComponentFromName() {
|
|
254
|
-
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
255
|
-
var components = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
256
|
-
var defaultComponent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
257
|
-
if (components === null || name === null) {
|
|
258
|
-
return defaultComponent;
|
|
259
|
-
}
|
|
260
|
-
var pascalName = pascalCase(name);
|
|
261
|
-
var component = components[pascalName] || components[name] || defaultComponent;
|
|
262
|
-
if (!component) {
|
|
263
|
-
console.warn('Could not find component from name', name, pascalName, components);
|
|
264
|
-
}
|
|
265
|
-
return component;
|
|
266
|
-
};
|
|
267
16
|
|
|
268
17
|
var ComponentsManager = /*#__PURE__*/function () {
|
|
269
18
|
function ComponentsManager() {
|
|
270
19
|
var components = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
271
20
|
_classCallCheck(this, ComponentsManager);
|
|
272
21
|
_defineProperty(this, "components", void 0);
|
|
273
|
-
this.components =
|
|
22
|
+
this.components = flattenComponents(components);
|
|
274
23
|
}
|
|
275
24
|
return _createClass(ComponentsManager, [{
|
|
276
25
|
key: "addComponent",
|
|
@@ -910,4 +659,4 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
|
|
|
910
659
|
}]);
|
|
911
660
|
}(Tracking$1);
|
|
912
661
|
|
|
913
|
-
export { ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, FormsManager, MediasParser,
|
|
662
|
+
export { ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, FormsManager, MediasParser, Tracking };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
export { kebabCase as dashCase, pascalCase, snakeCase } from 'change-case';
|
|
2
|
+
import { ComponentType, ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { MessageDescriptor } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
interface CheckClickableOptions {
|
|
6
|
+
maxParentDistance?: number;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface ElementLike {
|
|
10
|
+
tagName?: string | null;
|
|
11
|
+
parentNode?: ElementLike | null;
|
|
12
|
+
dataset?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
declare function checkClickable(el: ElementLike | null, options?: CheckClickableOptions, parentDistance?: number): boolean;
|
|
15
|
+
|
|
16
|
+
declare function convertStyleToString(style: Record<string, unknown> | null): string;
|
|
17
|
+
|
|
18
|
+
declare function createNullableOnChange<T = unknown>(onChange?: ((value: T | null) => void) | null): (newValue: T) => void;
|
|
19
|
+
|
|
20
|
+
interface EventsManager {
|
|
21
|
+
subscribe: (event: string, callback: (...args: unknown[]) => void) => void;
|
|
22
|
+
unsubscribe: (event: string, callback: (...args: unknown[]) => void) => void;
|
|
23
|
+
}
|
|
24
|
+
declare function createUseEvent(eventsManager: EventsManager | null): (event: string, callback: (...args: unknown[]) => void, enabled?: boolean) => void;
|
|
25
|
+
|
|
26
|
+
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
27
|
+
declare function copyToClipboard(text: string): Promise<void>;
|
|
28
|
+
|
|
29
|
+
type ComponentMap = Record<string, ComponentType<unknown> | ComponentMap>;
|
|
30
|
+
declare function flattenComponents(components: ComponentMap | null, prefix?: string | null): Record<string, ComponentType<unknown>> | null;
|
|
31
|
+
|
|
32
|
+
declare function formatDuration(timeInSeconds: number | string): string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Core UI Types
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Internationalization message definition
|
|
40
|
+
*/
|
|
41
|
+
interface Message extends MessageDescriptor {
|
|
42
|
+
id: string;
|
|
43
|
+
defaultMessage?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Label can be either a message object or any React node
|
|
47
|
+
*/
|
|
48
|
+
type Label = Message | ReactNode;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Form Types
|
|
52
|
+
* TypeScript interfaces for form-related components
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Select option (more flexible than FieldOption)
|
|
57
|
+
*/
|
|
58
|
+
type SelectOption = string | number | {
|
|
59
|
+
value?: unknown;
|
|
60
|
+
label?: Label | string;
|
|
61
|
+
} | Record<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Field definition
|
|
64
|
+
*/
|
|
65
|
+
interface Field {
|
|
66
|
+
name?: string;
|
|
67
|
+
type?: string;
|
|
68
|
+
component?: string;
|
|
69
|
+
label?: ReactNode;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Table column definition
|
|
73
|
+
*/
|
|
74
|
+
type TableColumn = string | {
|
|
75
|
+
id?: string;
|
|
76
|
+
component?: string;
|
|
77
|
+
path?: string;
|
|
78
|
+
field?: string;
|
|
79
|
+
columnClassName?: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Resource Types
|
|
84
|
+
* TypeScript interfaces for resources, items, users, media, and other entities
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
interface ResourceIntlValues {
|
|
88
|
+
a_singular?: string;
|
|
89
|
+
a_plural?: string;
|
|
90
|
+
[key: string]: unknown;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Internationalization configuration
|
|
94
|
+
*/
|
|
95
|
+
interface ResourceIntl {
|
|
96
|
+
messages?: Record<string, string>;
|
|
97
|
+
values?: ResourceIntlValues;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Resource definition
|
|
101
|
+
*/
|
|
102
|
+
interface Resource {
|
|
103
|
+
id: string;
|
|
104
|
+
name: string;
|
|
105
|
+
intl?: ResourceIntl;
|
|
106
|
+
fields?: Field[];
|
|
107
|
+
forms?: Record<string, unknown>;
|
|
108
|
+
shows_in_navbar?: boolean;
|
|
109
|
+
settings?: Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Generic item (base interface for data items)
|
|
113
|
+
*/
|
|
114
|
+
interface Item {
|
|
115
|
+
id: string;
|
|
116
|
+
[key: string]: unknown;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Panneau Definition Types
|
|
121
|
+
* TypeScript interfaces for main Panneau configuration and definitions
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Generic definition
|
|
126
|
+
*/
|
|
127
|
+
interface Definition {
|
|
128
|
+
name?: string;
|
|
129
|
+
[key: string]: unknown;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface Column extends Record<string, unknown> {
|
|
133
|
+
id?: string | null;
|
|
134
|
+
label?: unknown;
|
|
135
|
+
valueKey?: string;
|
|
136
|
+
component?: string | null;
|
|
137
|
+
field?: Field | string | null;
|
|
138
|
+
}
|
|
139
|
+
declare function getColumnsWithFields(resource: Resource, columns: TableColumn[] | null): Column[];
|
|
140
|
+
|
|
141
|
+
interface ComponentResult {
|
|
142
|
+
name: unknown;
|
|
143
|
+
props: Record<string, unknown> | null;
|
|
144
|
+
}
|
|
145
|
+
declare function getComponent(component: unknown): ComponentResult;
|
|
146
|
+
|
|
147
|
+
declare function getComponentFromName<T = ComponentType<unknown> | 'string'>(name?: string | null, components?: Record<string, T> | null, defaultComponent?: T | null): T | null;
|
|
148
|
+
|
|
149
|
+
declare function getDefinitionFromId<T extends Definition = Definition>(id?: string | null, items?: T[] | null, defaultObject?: T | null): T | null;
|
|
150
|
+
|
|
151
|
+
interface ComponentWithName {
|
|
152
|
+
displayName?: string | null;
|
|
153
|
+
name?: string | null;
|
|
154
|
+
}
|
|
155
|
+
declare function getDisplayName({ displayName, name }: ComponentWithName): string;
|
|
156
|
+
|
|
157
|
+
interface FieldWithSubFields$1 extends Field {
|
|
158
|
+
fields?: FieldWithSubFields$1[];
|
|
159
|
+
}
|
|
160
|
+
declare function getFieldByName(fields: FieldWithSubFields$1[], name: string | null): FieldWithSubFields$1 | null;
|
|
161
|
+
|
|
162
|
+
interface FieldDefinition {
|
|
163
|
+
fields?: Field[] | null;
|
|
164
|
+
settings?: Field[] | null;
|
|
165
|
+
itemsField?: Field | null;
|
|
166
|
+
}
|
|
167
|
+
interface FieldManager {
|
|
168
|
+
getDefinition: (type: string) => FieldDefinition;
|
|
169
|
+
}
|
|
170
|
+
interface FieldWithSubFields extends Field {
|
|
171
|
+
type?: string | null;
|
|
172
|
+
fields?: Field[] | null;
|
|
173
|
+
field?: Field | null;
|
|
174
|
+
listItems?: boolean;
|
|
175
|
+
}
|
|
176
|
+
declare function getFieldFromPath(path: string | string[], fields: Field[], fieldManager: FieldManager): FieldWithSubFields | null;
|
|
177
|
+
|
|
178
|
+
declare function getFileName(url?: string | null): string | null;
|
|
179
|
+
|
|
180
|
+
declare function getPathValue(it: unknown, path: string | string[]): unknown;
|
|
181
|
+
|
|
182
|
+
interface FormattedOption {
|
|
183
|
+
value: unknown;
|
|
184
|
+
label: string | ReactElement;
|
|
185
|
+
}
|
|
186
|
+
declare function getSelectOptions(options: SelectOption[]): FormattedOption[];
|
|
187
|
+
|
|
188
|
+
declare function isMessage(message: unknown): message is Message;
|
|
189
|
+
|
|
190
|
+
declare function loadPackage<T = unknown>(name: string, loader: () => Promise<T>): Promise<T>;
|
|
191
|
+
|
|
192
|
+
declare function selectItem(item: Item, selectedItems: Item | Item[] | null, onSelectionChange: ((value: Item | Item[] | null) => void) | null, multipleSelection?: boolean): void;
|
|
193
|
+
declare function selectPage(pageSelected: boolean, items: Item[] | null, selectedItems: Item[] | null, onSelectionChange: ((value: Item[]) => void) | null): void;
|
|
194
|
+
|
|
195
|
+
type Value = Record<string, unknown> | unknown[] | null;
|
|
196
|
+
declare function setValue(value: Value, keyParts: string[], fieldValue: unknown): Value;
|
|
197
|
+
|
|
198
|
+
declare function slug(str: string, separator?: string | null): string;
|
|
199
|
+
|
|
200
|
+
interface FieldWithValidation extends Field {
|
|
201
|
+
type?: string;
|
|
202
|
+
fields?: FieldWithValidation[];
|
|
203
|
+
required?: boolean;
|
|
204
|
+
}
|
|
205
|
+
declare function validateFields(fields: FieldWithValidation[], value: Record<string, unknown> | null): boolean;
|
|
206
|
+
|
|
207
|
+
export { checkClickable, convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, flattenComponents, formatDuration, getColumnsWithFields, getComponent, getComponentFromName, getDefinitionFromId, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getPathValue, getSelectOptions, isMessage, loadPackage, selectItem, selectPage, setValue as setFieldValue, slug, validateFields };
|