@panneau/core 4.0.38 → 4.0.40-alpha.3
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 +78 -34
- package/dist/contexts.js +1332 -621
- package/dist/hooks.d.ts +41 -0
- package/dist/hooks.js +1395 -847
- package/dist/index.d.ts +26 -9
- package/dist/index.js +485 -609
- package/dist/utils.d.ts +40 -6
- package/dist/utils.js +232 -354
- package/package.json +3 -3
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { kebabCase as dashCase, pascalCase, snakeCase } from 'change-case';
|
|
2
|
-
import {
|
|
2
|
+
import { ElementType, ReactNode, ComponentType, ReactElement } from 'react';
|
|
3
3
|
import { MessageDescriptor } from 'react-intl';
|
|
4
4
|
|
|
5
5
|
interface CheckClickableOptions {
|
|
@@ -26,8 +26,8 @@ declare function createUseEvent(eventsManager: EventsManager | null): (event: st
|
|
|
26
26
|
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
27
27
|
declare function copyToClipboard(text: string): Promise<void>;
|
|
28
28
|
|
|
29
|
-
type ComponentMap = Record<string,
|
|
30
|
-
declare function flattenComponents(components: ComponentMap | null, prefix?: string | null): Record<string,
|
|
29
|
+
type ComponentMap = Record<string, ElementType | Record<string, unknown>>;
|
|
30
|
+
declare function flattenComponents(components: ComponentMap | null, prefix?: string | null): Record<string, ElementType> | null;
|
|
31
31
|
|
|
32
32
|
declare function formatDuration(timeInSeconds: number | string): string;
|
|
33
33
|
|
|
@@ -84,6 +84,21 @@ type TableColumn = string | {
|
|
|
84
84
|
* TypeScript interfaces for resources, items, users, media, and other entities
|
|
85
85
|
*/
|
|
86
86
|
|
|
87
|
+
interface Action {
|
|
88
|
+
id?: string;
|
|
89
|
+
component?: string;
|
|
90
|
+
label?: string | null;
|
|
91
|
+
icon?: string | null;
|
|
92
|
+
href?: string | null;
|
|
93
|
+
external?: boolean;
|
|
94
|
+
theme?: string;
|
|
95
|
+
target?: string;
|
|
96
|
+
onClick?: (() => void) | null;
|
|
97
|
+
endpoint?: string | null;
|
|
98
|
+
withConfirmation?: boolean;
|
|
99
|
+
[key: string]: unknown;
|
|
100
|
+
}
|
|
101
|
+
type ActionDefinition = string | Action;
|
|
87
102
|
interface ResourceIntlValues {
|
|
88
103
|
a_singular?: string;
|
|
89
104
|
a_plural?: string;
|
|
@@ -99,11 +114,19 @@ interface ResourceIntl {
|
|
|
99
114
|
/**
|
|
100
115
|
* Resource definition
|
|
101
116
|
*/
|
|
117
|
+
interface ResourceIndex {
|
|
118
|
+
filters?: Filter[];
|
|
119
|
+
columns?: TableColumn[];
|
|
120
|
+
actions?: ActionDefinition[];
|
|
121
|
+
fields?: Field[];
|
|
122
|
+
[key: string]: unknown;
|
|
123
|
+
}
|
|
102
124
|
interface Resource {
|
|
103
125
|
id: string;
|
|
104
126
|
name: string;
|
|
105
127
|
intl?: ResourceIntl;
|
|
106
128
|
fields?: Field[];
|
|
129
|
+
index?: ResourceIndex;
|
|
107
130
|
forms?: Record<string, unknown>;
|
|
108
131
|
shows_in_navbar?: boolean;
|
|
109
132
|
settings?: Record<string, unknown>;
|
|
@@ -115,6 +138,14 @@ interface Item {
|
|
|
115
138
|
id: string;
|
|
116
139
|
[key: string]: unknown;
|
|
117
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Filter definition
|
|
143
|
+
*/
|
|
144
|
+
interface Filter {
|
|
145
|
+
id?: string;
|
|
146
|
+
component?: string;
|
|
147
|
+
[key: string]: unknown;
|
|
148
|
+
}
|
|
118
149
|
|
|
119
150
|
/**
|
|
120
151
|
* Panneau Definition Types
|
|
@@ -189,8 +220,11 @@ declare function isMessage(message: unknown): message is Message;
|
|
|
189
220
|
|
|
190
221
|
declare function loadPackage<T = unknown>(name: string, loader: () => Promise<T>): Promise<T>;
|
|
191
222
|
|
|
192
|
-
declare function
|
|
193
|
-
|
|
223
|
+
declare function toggleSelectedItem(items: Item[] | null, item: Item, { multiple: multipleSelection }?: {
|
|
224
|
+
multiple?: boolean;
|
|
225
|
+
}): Item[] | null;
|
|
226
|
+
declare function selectItems(items: Item[] | null, itemsToSelect: Item[]): Item[] | null;
|
|
227
|
+
declare function unselectItems(items: Item[] | null, itemsToUnselect: Item[]): Item[] | null;
|
|
194
228
|
|
|
195
229
|
type Value = Record<string, unknown> | unknown[] | null;
|
|
196
230
|
declare function setValue(value: Value, keyParts: string[], fieldValue: unknown): Value;
|
|
@@ -204,4 +238,4 @@ interface FieldWithValidation extends Field {
|
|
|
204
238
|
}
|
|
205
239
|
declare function validateFields(fields: FieldWithValidation[], value: Record<string, unknown> | null): boolean;
|
|
206
240
|
|
|
207
|
-
export { checkClickable, convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, flattenComponents, formatDuration, getColumnsWithFields, getComponent, getComponentFromName, getDefinitionFromId, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getPathValue, getSelectOptions, isMessage, loadPackage,
|
|
241
|
+
export { checkClickable, convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, flattenComponents, formatDuration, getColumnsWithFields, getComponent, getComponentFromName, getDefinitionFromId, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getPathValue, getSelectOptions, isMessage, loadPackage, selectItems, setValue as setFieldValue, slug, toggleSelectedItem, unselectItems, validateFields };
|