@headless-adminapp/fluent 1.3.1 → 1.4.0
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/DataGrid/GridListContainer.js +2 -5
- package/DataGrid/GridTableContainer.js +2 -5
- package/DataGrid/useTableColumns.js +6 -14
- package/PageEntityForm/CommandContainer.d.ts +5 -1
- package/PageEntityForm/CommandContainer.js +33 -4
- package/PageEntityForm/FormTabRelated.d.ts +1 -1
- package/PageEntityForm/FormTabRelated.js +7 -5
- package/PageEntityForm/PageEntityForm.js +9 -7
- package/PageEntityForm/PageEntityFormDesktopContainer.js +24 -41
- package/PageEntityForm/ProcessFlow.d.ts +2 -1
- package/PageEntityForm/ProcessFlow.js +27 -12
- package/PageEntityForm/RecordAvatar.js +14 -0
- package/PageEntityForm/RelatedViewSelector.d.ts +1 -8
- package/PageEntityForm/SectionContainer.d.ts +2 -1
- package/PageEntityForm/SectionContainer.js +11 -9
- package/PageEntityForm/StandardControl.js +17 -36
- package/PageEntityView/PageEntityView.js +2 -1
- package/Skeleton/TextSkeleton.d.ts +10 -0
- package/Skeleton/TextSkeleton.js +21 -0
- package/form/controls/AttachmentControl.js +10 -3
- package/form/controls/AttachmentsControl.js +5 -1
- package/form/controls/CurrencyControl.d.ts +1 -1
- package/form/controls/CurrencyControl.js +5 -1
- package/form/controls/DateControl.d.ts +1 -1
- package/form/controls/DateControl.js +5 -1
- package/form/controls/DateRangeControl/DateRangeControl.d.ts +1 -1
- package/form/controls/DateRangeControl/DateRangeControl.js +5 -1
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +9 -1
- package/form/controls/DecimalControl.d.ts +1 -1
- package/form/controls/DecimalControl.js +5 -1
- package/form/controls/DurationControl.js +5 -1
- package/form/controls/EmailControl.d.ts +1 -1
- package/form/controls/EmailControl.js +5 -1
- package/form/controls/IdControl.d.ts +1 -1
- package/form/controls/IdControl.js +5 -1
- package/form/controls/IntegerControl.d.ts +1 -1
- package/form/controls/IntegerControl.js +5 -1
- package/form/controls/LookupControl.js +5 -1
- package/form/controls/MultiSelectControl.d.ts +1 -1
- package/form/controls/MultiSelectControl.js +5 -1
- package/form/controls/MultiSelectLookupControl.js +5 -1
- package/form/controls/RegardingControl.js +5 -1
- package/form/controls/RichTextControl.js +5 -1
- package/form/controls/SelectControl.d.ts +1 -1
- package/form/controls/SelectControl.js +5 -1
- package/form/controls/SkeletonControl.d.ts +7 -0
- package/form/controls/SkeletonControl.js +18 -0
- package/form/controls/SwitchControl.d.ts +1 -1
- package/form/controls/SwitchControl.js +5 -1
- package/form/controls/TelephoneControl.d.ts +1 -1
- package/form/controls/TelephoneControl.js +5 -1
- package/form/controls/TextAreaControl.d.ts +1 -1
- package/form/controls/TextAreaControl.js +5 -1
- package/form/controls/TextControl.d.ts +1 -1
- package/form/controls/TextControl.js +5 -1
- package/form/controls/TimeControl/TimeControl.d.ts +1 -1
- package/form/controls/TimeControl/TimeControl.js +5 -1
- package/form/controls/UrlControl.d.ts +1 -1
- package/form/controls/UrlControl.js +5 -1
- package/form/controls/types.d.ts +1 -0
- package/package.json +2 -2
- package/PageCalendar/EventDialog/AttributeController.d.ts +0 -11
- package/PageCalendar/EventDialog/AttributeController.js +0 -17
- package/form/controls/DateRangeControl.d.ts +0 -12
- package/form/controls/DateRangeControl.js +0 -293
- package/form/controls/TimeControl.d.ts +0 -4
- package/form/controls/TimeControl.js +0 -87
|
@@ -45,7 +45,7 @@ const StandardControl = (props) => {
|
|
|
45
45
|
// hideLabel,
|
|
46
46
|
hidePlaceholder, readOnly,
|
|
47
47
|
// quickViewControl,
|
|
48
|
-
allowNavigation, allowNewRecord, autoHeight, maxHeight, } = props;
|
|
48
|
+
allowNavigation, allowNewRecord, autoHeight, maxHeight, skeleton, } = props;
|
|
49
49
|
const isDisabled = readOnly;
|
|
50
50
|
// const label = hideLabel ? undefined : _label ?? attribute.label;
|
|
51
51
|
const placeholder = hidePlaceholder
|
|
@@ -82,6 +82,7 @@ const StandardControl = (props) => {
|
|
|
82
82
|
error: isError,
|
|
83
83
|
disabled: readOnly,
|
|
84
84
|
readOnly,
|
|
85
|
+
skeleton,
|
|
85
86
|
};
|
|
86
87
|
switch (attribute.format) {
|
|
87
88
|
case 'text': {
|
|
@@ -117,19 +118,19 @@ const StandardControl = (props) => {
|
|
|
117
118
|
switch (attribute.format) {
|
|
118
119
|
case 'decimal': {
|
|
119
120
|
const Control = componentStore_1.componentStore.getComponent('Form.DecimalControl') ?? DecimalControl_1.DecimalControl;
|
|
120
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly, decimalPlaces: attribute.decimalPlaces }));
|
|
121
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly, decimalPlaces: attribute.decimalPlaces, skeleton: skeleton }));
|
|
121
122
|
}
|
|
122
123
|
case 'integer': {
|
|
123
124
|
const Control = componentStore_1.componentStore.getComponent('Form.IntegerControl') ?? IntegerControl_1.IntegerControl;
|
|
124
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
125
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly, skeleton: skeleton }));
|
|
125
126
|
}
|
|
126
127
|
case 'duration': {
|
|
127
128
|
const Control = componentStore_1.componentStore.getComponent('Form.DurationControl') ?? DurationControl_1.DurationControl;
|
|
128
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
129
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly, skeleton: skeleton }));
|
|
129
130
|
}
|
|
130
131
|
case 'time': {
|
|
131
132
|
const Control = componentStore_1.componentStore.getComponent('Form.TimeControl') ?? TimeControl_1.TimeControl;
|
|
132
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
133
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly, skeleton: skeleton }));
|
|
133
134
|
}
|
|
134
135
|
default: {
|
|
135
136
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
@@ -146,6 +147,7 @@ const StandardControl = (props) => {
|
|
|
146
147
|
error: isError,
|
|
147
148
|
disabled: isDisabled,
|
|
148
149
|
readOnly,
|
|
150
|
+
skeleton,
|
|
149
151
|
};
|
|
150
152
|
if (attribute.format === 'datetime') {
|
|
151
153
|
const Control = componentStore_1.componentStore.getComponent('Form.DateTimeControl') ?? DateTimeControl_1.DateTimeControl;
|
|
@@ -167,68 +169,47 @@ const StandardControl = (props) => {
|
|
|
167
169
|
error: isError,
|
|
168
170
|
disabled: isDisabled,
|
|
169
171
|
readOnly,
|
|
172
|
+
skeleton,
|
|
170
173
|
};
|
|
171
174
|
const Control = componentStore_1.componentStore.getComponent('Form.DateRangeControl') ?? DateRangeControl_1.DateRangeControl;
|
|
172
175
|
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
173
176
|
}
|
|
174
177
|
case 'money': {
|
|
175
178
|
const Control = componentStore_1.componentStore.getComponent('Form.CurrencyControl') ?? CurrencyControl_1.CurrencyControl;
|
|
176
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly }));
|
|
179
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly, skeleton: skeleton }));
|
|
177
180
|
}
|
|
178
181
|
case 'lookup': {
|
|
179
182
|
const Control = componentStore_1.componentStore.getComponent('Form.LookupControl') ?? LookupControl_1.LookupControl;
|
|
180
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord }));
|
|
183
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord, skeleton: skeleton }));
|
|
181
184
|
}
|
|
182
185
|
case 'lookups': {
|
|
183
186
|
const Control = componentStore_1.componentStore.getComponent('Form.MultiSelectLookupControl') ?? MultiSelectLookupControl_1.MultiSelectLookupControl;
|
|
184
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord }));
|
|
187
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord, skeleton: skeleton }));
|
|
185
188
|
}
|
|
186
189
|
case 'regarding': {
|
|
187
190
|
const Control = componentStore_1.componentStore.getComponent('Form.RegardingControl') ?? RegardingControl_1.RegardingControl;
|
|
188
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, entities: attribute.entities, schemaStore: schemaStore, experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord }));
|
|
191
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, entities: attribute.entities, schemaStore: schemaStore, experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord, skeleton: skeleton }));
|
|
189
192
|
}
|
|
190
193
|
case 'boolean': {
|
|
191
194
|
const Control = componentStore_1.componentStore.getComponent('Form.SwitchControl') ?? SwitchControl_1.SwitchControl;
|
|
192
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
195
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly, skeleton: skeleton }));
|
|
193
196
|
}
|
|
194
197
|
case 'choice': {
|
|
195
198
|
const Control = componentStore_1.componentStore.getComponent('Form.SelectControl') ?? SelectControl_1.default;
|
|
196
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, options: attribute.options, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly }));
|
|
199
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, options: attribute.options, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly, skeleton: skeleton }));
|
|
197
200
|
}
|
|
198
201
|
case 'choices': {
|
|
199
202
|
const Control = componentStore_1.componentStore.getComponent('Form.MultiSelectControl') ?? MultiSelectControl_1.default;
|
|
200
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, options: attribute.options, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly }));
|
|
203
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, options: attribute.options, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly, skeleton: skeleton }));
|
|
201
204
|
}
|
|
202
205
|
case 'attachment': {
|
|
203
206
|
const Control = componentStore_1.componentStore.getComponent('Form.AttachmentControl') ?? AttachmentControl_1.AttachmentControl;
|
|
204
|
-
return ((0, jsx_runtime_1.jsx)(Control, { fileService: fileService, format: attribute.format, location: attribute.location, name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly, fileServiceContext: props.fileServiceContext }));
|
|
207
|
+
return ((0, jsx_runtime_1.jsx)(Control, { fileService: fileService, format: attribute.format, location: attribute.location, name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly, fileServiceContext: props.fileServiceContext, skeleton: skeleton }));
|
|
205
208
|
}
|
|
206
209
|
case 'attachments': {
|
|
207
210
|
const Control = componentStore_1.componentStore.getComponent('Form.AttachmentsControl') ?? AttachmentsControl_1.AttachmentsControl;
|
|
208
|
-
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly }));
|
|
211
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly, skeleton: skeleton }));
|
|
209
212
|
}
|
|
210
|
-
// case 'attachment': {
|
|
211
|
-
// return (
|
|
212
|
-
// <FormControl
|
|
213
|
-
// type="attachment"
|
|
214
|
-
// name={name}
|
|
215
|
-
// label={label}
|
|
216
|
-
// required={required}
|
|
217
|
-
// value={value}
|
|
218
|
-
// onChange={onChange}
|
|
219
|
-
// onBlur={onBlur}
|
|
220
|
-
// error={isError}
|
|
221
|
-
// helperText={errorMessage}
|
|
222
|
-
// disabled={isDisabled}
|
|
223
|
-
// placeholder={placeholder}
|
|
224
|
-
// borderOnFocusOnly={borderOnFocusOnly}
|
|
225
|
-
// readOnly={readOnly}
|
|
226
|
-
// format={attribute.format}
|
|
227
|
-
// maxSize={attribute.maxSize}
|
|
228
|
-
// fileService={fileService}
|
|
229
|
-
// />
|
|
230
|
-
// );
|
|
231
|
-
// }
|
|
232
213
|
}
|
|
233
214
|
const FallBackControl = componentStore_1.componentStore.getComponent('StandardControl.FallBack');
|
|
234
215
|
if (FallBackControl) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PageEntityView = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
6
|
+
const historystate_1 = require("@headless-adminapp/app/historystate");
|
|
6
7
|
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
7
8
|
const PageEntityViewProvider_1 = require("@headless-adminapp/app/providers/PageEntityViewProvider");
|
|
8
9
|
const icons_1 = require("@headless-adminapp/icons");
|
|
@@ -30,6 +31,6 @@ const PageEntityView = ({ logicalName, viewId, onChangeView, useV2, }) => {
|
|
|
30
31
|
else {
|
|
31
32
|
content = (0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainerV2, {});
|
|
32
33
|
}
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: content }));
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: 'page-entity-view.' + logicalName, children: (0, jsx_runtime_1.jsx)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: content }) }));
|
|
34
35
|
};
|
|
35
36
|
exports.PageEntityView = PageEntityView;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface TextSkeletonProps {
|
|
3
|
+
width?: number | string;
|
|
4
|
+
height?: number | string;
|
|
5
|
+
}
|
|
6
|
+
export declare const TextSkeletonProps: FC<TextSkeletonProps>;
|
|
7
|
+
export declare const Body1Skeleton: FC<Omit<TextSkeletonProps, 'height' | 'textHeight'>>;
|
|
8
|
+
export declare const Subtitle2Skeleton: FC<Omit<TextSkeletonProps, 'height' | 'textHeight'>>;
|
|
9
|
+
export declare const Caption1Skeleton: FC<Omit<TextSkeletonProps, 'height' | 'textHeight'>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Caption1Skeleton = exports.Subtitle2Skeleton = exports.Body1Skeleton = exports.TextSkeletonProps = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const TextSkeletonProps = ({ width, height }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { height: height, display: 'flex', alignItems: 'center' }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { style: { width, height: '75%' } }) }));
|
|
8
|
+
};
|
|
9
|
+
exports.TextSkeletonProps = TextSkeletonProps;
|
|
10
|
+
const Body1Skeleton = (props) => {
|
|
11
|
+
return (0, jsx_runtime_1.jsx)(exports.TextSkeletonProps, { ...props, height: react_components_1.tokens.lineHeightBase300 });
|
|
12
|
+
};
|
|
13
|
+
exports.Body1Skeleton = Body1Skeleton;
|
|
14
|
+
const Subtitle2Skeleton = (props) => {
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(exports.TextSkeletonProps, { ...props, height: react_components_1.tokens.lineHeightBase400 });
|
|
16
|
+
};
|
|
17
|
+
exports.Subtitle2Skeleton = Subtitle2Skeleton;
|
|
18
|
+
const Caption1Skeleton = (props) => {
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(exports.TextSkeletonProps, { ...props, height: react_components_1.tokens.lineHeightBase300 });
|
|
20
|
+
};
|
|
21
|
+
exports.Caption1Skeleton = Caption1Skeleton;
|
|
@@ -9,6 +9,7 @@ const utils_1 = require("@headless-adminapp/core/utils");
|
|
|
9
9
|
const icons_1 = require("@headless-adminapp/icons");
|
|
10
10
|
const react_query_1 = require("@tanstack/react-query");
|
|
11
11
|
const react_1 = require("react");
|
|
12
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
12
13
|
function useAttachmentSelector({ fileService, fileServiceContext, location, onChange, }) {
|
|
13
14
|
const openErrorDialog = (0, hooks_1.useOpenErrorDialog)();
|
|
14
15
|
const { isPending, mutate: handleFile } = (0, react_query_1.useMutation)({
|
|
@@ -101,7 +102,7 @@ const AttachmentImageControl = ({ value, disabled, readOnly, onChange, fileServi
|
|
|
101
102
|
justifyContent: 'center',
|
|
102
103
|
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "small" }) })] }))] }) }));
|
|
103
104
|
};
|
|
104
|
-
const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChange, placeholder, fileService, fileServiceContext, location, format, }) => {
|
|
105
|
+
const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChange, placeholder, fileService, fileServiceContext, location, format, skeleton, }) => {
|
|
105
106
|
const { isProcessing, selectFile } = useAttachmentSelector({
|
|
106
107
|
fileService,
|
|
107
108
|
fileServiceContext,
|
|
@@ -132,6 +133,12 @@ const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChan
|
|
|
132
133
|
return icons_1.Icons.Document;
|
|
133
134
|
}
|
|
134
135
|
}, [format]);
|
|
136
|
+
if (skeleton) {
|
|
137
|
+
if (format === 'image') {
|
|
138
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, { height: 100, width: 100 });
|
|
139
|
+
}
|
|
140
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
141
|
+
}
|
|
135
142
|
if (format === 'image') {
|
|
136
143
|
return ((0, jsx_runtime_1.jsx)(AttachmentImageControl, { value: value, disabled: disabled, readOnly: readOnly, id: id, name: name, onBlur: onBlur, onChange: onChange, placeholder: placeholder, fileService: fileService, fileServiceContext: fileServiceContext, location: location }));
|
|
137
144
|
}
|
|
@@ -142,7 +149,7 @@ const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChan
|
|
|
142
149
|
width: '100%',
|
|
143
150
|
height: 30,
|
|
144
151
|
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
145
|
-
backgroundColor: react_components_1.tokens.
|
|
152
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground3,
|
|
146
153
|
display: 'flex',
|
|
147
154
|
paddingLeft: react_components_1.tokens.spacingHorizontalS,
|
|
148
155
|
gap: react_components_1.tokens.spacingHorizontalS,
|
|
@@ -164,7 +171,7 @@ const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChan
|
|
|
164
171
|
width: '100%',
|
|
165
172
|
height: 30,
|
|
166
173
|
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
167
|
-
backgroundColor: react_components_1.tokens.
|
|
174
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground3,
|
|
168
175
|
display: 'flex',
|
|
169
176
|
paddingLeft: react_components_1.tokens.spacingHorizontalS,
|
|
170
177
|
gap: react_components_1.tokens.spacingHorizontalS,
|
|
@@ -6,8 +6,12 @@ const react_components_1 = require("@fluentui/react-components");
|
|
|
6
6
|
const utils_1 = require("@headless-adminapp/core/utils");
|
|
7
7
|
const icons_1 = require("@headless-adminapp/icons");
|
|
8
8
|
const react_1 = require("react");
|
|
9
|
-
const
|
|
9
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
10
|
+
const AttachmentsControl = ({ onChange, id, onBlur, onFocus, disabled, readOnly, value, skeleton, }) => {
|
|
10
11
|
const inputRef = (0, react_1.useRef)(null);
|
|
12
|
+
if (skeleton) {
|
|
13
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
14
|
+
}
|
|
11
15
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.TagPicker, { appearance: "filled-darker", disabled: disabled, open: false, children: [(0, jsx_runtime_1.jsx)(react_components_1.TagPickerControl, { onFocus: onFocus, onBlur: onBlur, id: id, style: { paddingBlock: react_components_1.tokens.spacingVerticalXXS }, expandIcon: null, children: (0, jsx_runtime_1.jsxs)(react_components_1.TagGroup, { style: {
|
|
12
16
|
flexWrap: 'wrap',
|
|
13
17
|
columnGap: react_components_1.tokens.spacingHorizontalXS,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ControlProps } from './types';
|
|
2
2
|
export interface CurrencyControlProps extends ControlProps<number> {
|
|
3
3
|
}
|
|
4
|
-
export declare function CurrencyControl({ value, onChange, id, name, onBlur, onFocus, disabled, placeholder, autoFocus, readOnly, }: CurrencyControlProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function CurrencyControl({ value, onChange, id, name, onBlur, onFocus, disabled, placeholder, autoFocus, readOnly, skeleton, }: CurrencyControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,11 +5,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
8
9
|
function CurrencyControl({ value, onChange, id, name, onBlur, onFocus,
|
|
9
10
|
// error,
|
|
10
11
|
disabled, placeholder, autoFocus,
|
|
11
12
|
// borderOnFocusOnly,
|
|
12
|
-
readOnly, }) {
|
|
13
|
+
readOnly, skeleton, }) {
|
|
13
14
|
const symbol = (0, locale_1.useCurrencySymbol)();
|
|
14
15
|
const [internalValue, setInternalValue] = (0, react_1.useState)(value ? value.toString() : '');
|
|
15
16
|
const internalValueRef = (0, react_1.useRef)(internalValue);
|
|
@@ -45,6 +46,9 @@ readOnly, }) {
|
|
|
45
46
|
setInternalValue(value);
|
|
46
47
|
onChange?.(Number(value));
|
|
47
48
|
};
|
|
49
|
+
if (skeleton) {
|
|
50
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
51
|
+
}
|
|
48
52
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, autoFocus: autoFocus, name: name, value: internalValue, onChange: handleChange, onBlur: () => onBlur?.(), appearance: "filled-darker", onFocus: () => onFocus?.(), contentBefore: (0, jsx_runtime_1.jsx)("div", { children: symbol }), readOnly: readOnly || disabled, style: {
|
|
49
53
|
width: '100%',
|
|
50
54
|
} }));
|
|
@@ -3,4 +3,4 @@ export interface DateControlProps extends ControlProps<string> {
|
|
|
3
3
|
maxDate?: Date;
|
|
4
4
|
minDate?: Date;
|
|
5
5
|
}
|
|
6
|
-
export declare function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }: Readonly<DateControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, skeleton, }: Readonly<DateControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,11 +14,15 @@ const dayjs_1 = __importDefault(require("dayjs"));
|
|
|
14
14
|
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
15
15
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
16
16
|
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
17
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
17
18
|
dayjs_1.default.extend(utc_1.default);
|
|
18
19
|
dayjs_1.default.extend(timezone_1.default);
|
|
19
|
-
function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
|
|
20
|
+
function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, skeleton, }) {
|
|
20
21
|
const { dateFormats } = (0, locale_1.useLocale)();
|
|
21
22
|
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
23
|
+
if (skeleton) {
|
|
24
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
25
|
+
}
|
|
22
26
|
return ((0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus?.(), onBlur: () => onBlur?.(), placeholder: placeholder, appearance: "filled-darker", firstDayOfWeek: react_calendar_compat_1.DayOfWeek.Monday, showMonthPickerAsOverlay: true, disabled: disabled, readOnly: readOnly, formatDate: (date) => (date ? (0, dayjs_1.default)(date).format(dateFormats.short) : ''), value: value ? new Date(value) : null, onSelectDate: (date) => {
|
|
23
27
|
onChange?.(date ? (0, dayjs_1.default)(date).format('YYYY-MM-DD') : null);
|
|
24
28
|
}, strings: datePickerStrings, style: {
|
|
@@ -3,4 +3,4 @@ export interface DateRangeControlProps extends ControlProps<[string, string]> {
|
|
|
3
3
|
maxDate?: Date;
|
|
4
4
|
minDate?: Date;
|
|
5
5
|
}
|
|
6
|
-
export declare function DateRangeControl({ value, onChange, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }: Readonly<DateRangeControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function DateRangeControl({ value, onChange, onBlur, onFocus, disabled, maxDate, minDate, readOnly, skeleton, }: Readonly<DateRangeControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
+
const SkeletonControl_1 = require("../SkeletonControl");
|
|
8
9
|
const PopoverContent_1 = require("./PopoverContent");
|
|
9
10
|
const utils_1 = require("./utils");
|
|
10
11
|
const useStyles = (0, react_components_1.makeStyles)({
|
|
@@ -14,13 +15,16 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
});
|
|
17
|
-
function DateRangeControl({ value, onChange, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }) {
|
|
18
|
+
function DateRangeControl({ value, onChange, onBlur, onFocus, disabled, maxDate, minDate, readOnly, skeleton, }) {
|
|
18
19
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
19
20
|
const styles = useStyles();
|
|
20
21
|
const { dateRangeFormats } = (0, locale_1.useLocale)();
|
|
21
22
|
const formattedValue = (0, react_1.useMemo)(() => {
|
|
22
23
|
return (0, utils_1.formatDateRange)(value, dateRangeFormats.short);
|
|
23
24
|
}, [value, dateRangeFormats]);
|
|
25
|
+
if (skeleton) {
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
27
|
+
}
|
|
24
28
|
return ((0, jsx_runtime_1.jsxs)(react_components_1.Popover, { open: open, onOpenChange: (_, data) => {
|
|
25
29
|
if (readOnly || disabled) {
|
|
26
30
|
return;
|
|
@@ -3,4 +3,4 @@ export interface DateTimeControlProps extends ControlProps<string> {
|
|
|
3
3
|
maxDate?: Date;
|
|
4
4
|
minDate?: Date;
|
|
5
5
|
}
|
|
6
|
-
export declare function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }: Readonly<DateTimeControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, skeleton, }: Readonly<DateTimeControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -15,11 +15,12 @@ const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFor
|
|
|
15
15
|
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
16
16
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
17
17
|
const react_1 = require("react");
|
|
18
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
18
19
|
const utils_1 = require("./TimeControl/utils");
|
|
19
20
|
dayjs_1.default.extend(customParseFormat_1.default);
|
|
20
21
|
dayjs_1.default.extend(utc_1.default);
|
|
21
22
|
dayjs_1.default.extend(timezone_1.default);
|
|
22
|
-
function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
|
|
23
|
+
function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, skeleton, }) {
|
|
23
24
|
const { dateFormats: { short: dateFormat }, timeFormats: { short: timeFormat }, timezone, } = (0, locale_1.useLocale)();
|
|
24
25
|
const [internalTimeValue, setInternalTimeValue] = (0, react_1.useState)(value ? (0, dayjs_1.default)(value).tz(timezone).format(timeFormat) : '');
|
|
25
26
|
const internalTimeValueRef = (0, react_1.useRef)(internalTimeValue);
|
|
@@ -34,6 +35,13 @@ function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
34
35
|
}, [value, timezone, timeFormat]);
|
|
35
36
|
const isReadonly = readOnly || disabled;
|
|
36
37
|
const [isDatePickerOpen, setIsDatePickerOpen] = (0, react_1.useState)(false);
|
|
38
|
+
if (skeleton) {
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
gap: react_components_1.tokens.spacingHorizontalS,
|
|
43
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {}) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {}) })] }));
|
|
44
|
+
}
|
|
37
45
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
38
46
|
display: 'flex',
|
|
39
47
|
alignItems: 'center',
|
|
@@ -2,4 +2,4 @@ import { ControlProps } from './types';
|
|
|
2
2
|
export interface DecimalControlProps extends ControlProps<number> {
|
|
3
3
|
decimalPlaces?: number;
|
|
4
4
|
}
|
|
5
|
-
export declare function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, }: DecimalControlProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, skeleton, }: DecimalControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
6
6
|
const react_components_1 = require("@fluentui/react-components");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
|
|
8
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
9
|
+
function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, skeleton, }) {
|
|
9
10
|
const [internalValue, setInternalValue] = (0, react_1.useState)(value ? value.toString() : '');
|
|
10
11
|
const internalValueRef = (0, react_1.useRef)(internalValue);
|
|
11
12
|
internalValueRef.current = internalValue;
|
|
@@ -46,6 +47,9 @@ function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, dis
|
|
|
46
47
|
setInternalValue(value);
|
|
47
48
|
onChange?.(Number(value));
|
|
48
49
|
};
|
|
50
|
+
if (skeleton) {
|
|
51
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
52
|
+
}
|
|
49
53
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: internalValue, onChange: handleChange, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(), readOnly: readOnly || disabled, style: {
|
|
50
54
|
width: '100%',
|
|
51
55
|
} }));
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const utils_1 = require("@headless-adminapp/app/utils");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
8
9
|
const useStyles = (0, react_components_1.makeStyles)({
|
|
9
10
|
listbox: {
|
|
10
11
|
maxHeight: '300px !important',
|
|
@@ -101,7 +102,7 @@ const options = [
|
|
|
101
102
|
value: '4320',
|
|
102
103
|
},
|
|
103
104
|
];
|
|
104
|
-
const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, }) => {
|
|
105
|
+
const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, skeleton, }) => {
|
|
105
106
|
const [searchText, setSearchText] = (0, react_1.useState)('');
|
|
106
107
|
const [filterEnabled, setFilterEnabled] = (0, react_1.useState)(false);
|
|
107
108
|
const styles = useStyles();
|
|
@@ -114,6 +115,9 @@ const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
114
115
|
}
|
|
115
116
|
return options.filter((item) => item.text.toLowerCase().includes(searchText.toLowerCase()));
|
|
116
117
|
}, [searchText, filterEnabled]);
|
|
118
|
+
if (skeleton) {
|
|
119
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
120
|
+
}
|
|
117
121
|
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_components_1.Combobox, { name: name, appearance: "filled-darker", placeholder: placeholder, inputMode: "search", style: { width: '100%', minWidth: 'unset' }, listbox: { className: styles.listbox }, autoComplete: "off", readOnly: readOnly || disabled, value: searchText, disableAutoFocus: true, selectedOptions: value ? [value.toString()] : [], onBlur: () => {
|
|
118
122
|
let newValue = null;
|
|
119
123
|
if (searchText) {
|
|
@@ -3,4 +3,4 @@ export interface EmailControlProps extends ControlProps<string> {
|
|
|
3
3
|
autoComplete?: string;
|
|
4
4
|
textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
|
|
5
5
|
}
|
|
6
|
-
export declare function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }: Readonly<EmailControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, skeleton, }: Readonly<EmailControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,11 @@ exports.EmailControl = EmailControl;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const icons_1 = require("@headless-adminapp/icons");
|
|
7
|
-
|
|
7
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
8
|
+
function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, skeleton, }) {
|
|
9
|
+
if (skeleton) {
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
11
|
+
}
|
|
8
12
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "email", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
|
|
9
13
|
// size="sm"
|
|
10
14
|
value: value || '', onChange: (e) => {
|
|
@@ -4,4 +4,4 @@ import { ControlProps } from './types';
|
|
|
4
4
|
export interface IdControlProps extends ControlProps<Id> {
|
|
5
5
|
idTypes: IdTypes;
|
|
6
6
|
}
|
|
7
|
-
export declare function IdControl({ idTypes, ...props }: Readonly<IdControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function IdControl({ idTypes, skeleton, ...props }: Readonly<IdControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IdControl = IdControl;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const IntegerControl_1 = require("./IntegerControl");
|
|
6
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
6
7
|
const TextControl_1 = require("./TextControl");
|
|
7
8
|
function formatGuid(value) {
|
|
8
9
|
if (!value) {
|
|
@@ -37,7 +38,10 @@ function formatObjectId(value) {
|
|
|
37
38
|
value = value.replace(/[^0-9a-fA-F]/g, '');
|
|
38
39
|
return value.substring(0, 24).toLowerCase();
|
|
39
40
|
}
|
|
40
|
-
function IdControl({ idTypes, ...props }) {
|
|
41
|
+
function IdControl({ idTypes, skeleton, ...props }) {
|
|
42
|
+
if (skeleton) {
|
|
43
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
44
|
+
}
|
|
41
45
|
if ('string' in idTypes && idTypes.string) {
|
|
42
46
|
return (0, jsx_runtime_1.jsx)(TextControl_1.TextControl, { ...props, value: props.value });
|
|
43
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ControlProps } from './types';
|
|
2
2
|
export interface IntegerControlProps extends ControlProps<number> {
|
|
3
3
|
}
|
|
4
|
-
export declare function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }: IntegerControlProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, skeleton, }: IntegerControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,11 @@ exports.IntegerControl = IntegerControl;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
6
6
|
const react_components_1 = require("@fluentui/react-components");
|
|
7
|
-
|
|
7
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
8
|
+
function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, skeleton, }) {
|
|
9
|
+
if (skeleton) {
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
11
|
+
}
|
|
8
12
|
return ((0, jsx_runtime_1.jsx)(react_components_1.SpinButton, { appearance: "filled-darker", placeholder: placeholder, id: id, name: name, value: value ?? null, readOnly: readOnly || disabled, style: {
|
|
9
13
|
width: '100%',
|
|
10
14
|
}, onChange: (e, data) => {
|
|
@@ -12,6 +12,7 @@ const react_1 = require("react");
|
|
|
12
12
|
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
13
13
|
const RecordCard_1 = require("../../PageEntityForm/RecordCard");
|
|
14
14
|
const avatar_1 = require("../../utils/avatar");
|
|
15
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
15
16
|
const useLookupData_1 = require("./useLookupData");
|
|
16
17
|
function LookupControl(props) {
|
|
17
18
|
const Control = LookupControlMd;
|
|
@@ -32,7 +33,7 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
32
33
|
},
|
|
33
34
|
},
|
|
34
35
|
});
|
|
35
|
-
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, schema, viewId, allowNavigation, allowNewRecord, }) => {
|
|
36
|
+
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, schema, viewId, allowNavigation, allowNewRecord, skeleton, }) => {
|
|
36
37
|
const [lookupEnabled, setLookupEnabled] = (0, react_1.useState)(false);
|
|
37
38
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
38
39
|
const [searchText, setSearchText] = (0, react_1.useState)('');
|
|
@@ -113,6 +114,9 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
116
|
};
|
|
117
|
+
if (skeleton) {
|
|
118
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
119
|
+
}
|
|
116
120
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%' }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.Combobox, { name: name, appearance: "filled-darker", expandIcon: readOnly || disabled ? null : isLoading ? ((0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" })) : ((0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 18 })), placeholder: !value ? placeholder : '', inputMode: "search", style: { width: '100%', minWidth: 'unset' }, autoComplete: "off", readOnly: readOnly || disabled,
|
|
117
121
|
// disabled={disabled}
|
|
118
122
|
open: open && !value && !readOnly && !disabled, value: !value ? searchText : '', onOpenChange: (e, data) => setOpen(data.open), onChange: (e) => {
|
|
@@ -3,4 +3,4 @@ import { ControlProps } from './types';
|
|
|
3
3
|
export interface MultiSelectControlProps<T> extends ControlProps<T[]> {
|
|
4
4
|
options: Lookup<T>[];
|
|
5
5
|
}
|
|
6
|
-
export default function MultiSelectControl<T extends string | number>({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }: MultiSelectControlProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default function MultiSelectControl<T extends string | number>({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, skeleton, }: MultiSelectControlProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,13 +4,17 @@ exports.default = MultiSelectControl;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
|
|
7
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
8
|
+
function MultiSelectControl({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, skeleton, }) {
|
|
8
9
|
const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
|
|
9
10
|
const handleChange = (value) => {
|
|
10
11
|
const selectedOptions = options.filter((x) => value.includes(String(x.value)));
|
|
11
12
|
onChange?.(selectedOptions.map((x) => x.value));
|
|
12
13
|
};
|
|
13
14
|
const selectedOptions = (0, react_1.useMemo)(() => options.filter((x) => value?.includes(x.value)), [options, value]);
|
|
15
|
+
if (skeleton) {
|
|
16
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
17
|
+
}
|
|
14
18
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { placeholder: placeholder, id: id, name: name, appearance: "filled-darker", multiselect: true, value: selectedOptions.map((x) => x.label).join(', '), selectedOptions: value ? value.map(String) : [], onOptionSelect: (event, data) => {
|
|
15
19
|
handleChange(data.selectedOptions);
|
|
16
20
|
}, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(), disabled: disabled, style: {
|
|
@@ -10,6 +10,7 @@ const icons_1 = require("@headless-adminapp/icons");
|
|
|
10
10
|
const react_1 = require("react");
|
|
11
11
|
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
12
12
|
const RecordCard_1 = require("../../PageEntityForm/RecordCard");
|
|
13
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
13
14
|
const useLookupData_1 = require("./useLookupData");
|
|
14
15
|
function MultiSelectLookupControl(props) {
|
|
15
16
|
const Control = LookupControlMd;
|
|
@@ -30,7 +31,7 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
30
31
|
},
|
|
31
32
|
},
|
|
32
33
|
});
|
|
33
|
-
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, schema, viewId, allowNavigation, allowNewRecord, }) => {
|
|
34
|
+
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, schema, viewId, allowNavigation, allowNewRecord, skeleton, }) => {
|
|
34
35
|
const [lookupEnabled, setLookupEnabled] = (0, react_1.useState)(false);
|
|
35
36
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
36
37
|
const [searchText, setSearchText] = (0, react_1.useState)('');
|
|
@@ -121,6 +122,9 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
121
122
|
onChange?.(newValue);
|
|
122
123
|
}
|
|
123
124
|
};
|
|
125
|
+
if (skeleton) {
|
|
126
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
127
|
+
}
|
|
124
128
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%', height: containerHeight }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.Combobox, { name: name, appearance: "filled-darker", expandIcon: (0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', right: 4, bottom: 8 }, children: readOnly || disabled ? null : isLoading ? ((0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" })) : ((0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 18 })) }), input: {
|
|
125
129
|
style: {
|
|
126
130
|
position: 'absolute',
|