@headless-adminapp/fluent 0.0.17-alpha.26 → 0.0.17-alpha.28
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/GridColumnHeader/FilterForm.js +3 -1
- package/PageEntityForm/RelatedViewSelector.js +1 -0
- package/PageEntityForm/SectionContainer.js +6 -1
- package/PageEntityForm/StandardControl.d.ts +1 -0
- package/PageEntityForm/StandardControl.js +23 -12
- package/form/controls/AttachmentControl.d.ts +17 -0
- package/form/controls/AttachmentControl.js +217 -0
- package/form/controls/AttachmentsControl.d.ts +0 -2
- package/form/controls/AttachmentsControl.js +2 -30
- package/form/controls/CurrencyControl.js +36 -6
- package/form/controls/RichTextControl.d.ts +5 -0
- package/form/controls/RichTextControl.js +33 -0
- package/form/controls/SwitchControl.d.ts +1 -1
- package/form/controls/SwitchControl.js +4 -2
- package/form/controls/utils.d.ts +4 -0
- package/form/controls/utils.js +42 -0
- package/package.json +6 -4
- package/styles.css +100 -0
- package/types/index.d.ts +7 -0
- package/index.css +0 -27
|
@@ -34,7 +34,9 @@ const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
|
|
|
34
34
|
};
|
|
35
35
|
const isValid = (0, react_1.useMemo)(() => {
|
|
36
36
|
return (!!selectedOption &&
|
|
37
|
-
values.filter(
|
|
37
|
+
values.filter((value) => {
|
|
38
|
+
return value !== null && value !== undefined;
|
|
39
|
+
}).length === selectedOption.controls.length);
|
|
38
40
|
}, [selectedOption, values]);
|
|
39
41
|
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { style: { paddingBlock: 8 }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
40
42
|
display: 'flex',
|
|
@@ -70,6 +70,7 @@ function RelatedViewSelector(props) {
|
|
|
70
70
|
outlineStyle: 'none',
|
|
71
71
|
textTransform: 'none',
|
|
72
72
|
columnGap: react_components_1.tokens.spacingHorizontalSNudge,
|
|
73
|
+
color: react_components_1.tokens.colorNeutralForeground2,
|
|
73
74
|
}, children: [strings.related, (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, { size: 16 })] }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: data.map((item) => {
|
|
74
75
|
var _a, _b;
|
|
75
76
|
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => props.onSelect(item), children: (_b = (_a = item.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.pluralLabel }, item.key));
|
|
@@ -41,7 +41,12 @@ function SectionContainer({ section }) {
|
|
|
41
41
|
? (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message
|
|
42
42
|
: '';
|
|
43
43
|
const label = (_g = (_f = (_d = (_c = control.localizedLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : (_e = attribute.localizedLabels) === null || _e === void 0 ? void 0 : _e[language]) !== null && _f !== void 0 ? _f : control.label) !== null && _g !== void 0 ? _g : attribute.label;
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, disabled: readonly, label: label, placeholder: label, allowNavigation: true, allowNewRecord: true
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, disabled: readonly, label: label, placeholder: label, allowNavigation: true, allowNewRecord: true, fileServiceContext: {
|
|
45
|
+
type: 'entity-form',
|
|
46
|
+
recordId,
|
|
47
|
+
logicalName: control.attributeName,
|
|
48
|
+
schemaLogicalName: schema.logicalName,
|
|
49
|
+
} }) }));
|
|
45
50
|
} }, control.attributeName) }, control.attributeName));
|
|
46
51
|
}
|
|
47
52
|
case 'editablegrid': {
|
|
@@ -9,6 +9,7 @@ const hooks_1 = require("@headless-adminapp/app/metadata/hooks");
|
|
|
9
9
|
const transport_1 = require("@headless-adminapp/app/transport");
|
|
10
10
|
const react_1 = require("react");
|
|
11
11
|
const componentStore_1 = require("../componentStore");
|
|
12
|
+
const AttachmentControl_1 = require("../form/controls/AttachmentControl");
|
|
12
13
|
const AttachmentsControl_1 = require("../form/controls/AttachmentsControl");
|
|
13
14
|
const CurrencyControl_1 = require("../form/controls/CurrencyControl");
|
|
14
15
|
const DateControl_1 = require("../form/controls/DateControl");
|
|
@@ -19,13 +20,14 @@ const LookupControl_1 = require("../form/controls/LookupControl");
|
|
|
19
20
|
const MultiSelectControl_1 = __importDefault(require("../form/controls/MultiSelectControl"));
|
|
20
21
|
const MultiSelectLookupControl_1 = require("../form/controls/MultiSelectLookupControl");
|
|
21
22
|
const NumberControl_1 = require("../form/controls/NumberControl");
|
|
23
|
+
const RichTextControl_1 = require("../form/controls/RichTextControl");
|
|
22
24
|
const SelectControl_1 = __importDefault(require("../form/controls/SelectControl"));
|
|
23
25
|
const SwitchControl_1 = require("../form/controls/SwitchControl");
|
|
24
26
|
const TelephoneControl_1 = require("../form/controls/TelephoneControl");
|
|
25
27
|
const TextAreaControl_1 = require("../form/controls/TextAreaControl");
|
|
26
28
|
const TextControl_1 = require("../form/controls/TextControl");
|
|
27
29
|
const StandardControl = (props) => {
|
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
29
31
|
const { attribute, label: _label, isError,
|
|
30
32
|
// errorMessage,
|
|
31
33
|
name, value, onBlur, onChange,
|
|
@@ -43,6 +45,7 @@ const StandardControl = (props) => {
|
|
|
43
45
|
: (_a = _placeholder !== null && _placeholder !== void 0 ? _placeholder : _label) !== null && _a !== void 0 ? _a : attribute.label;
|
|
44
46
|
// const required = quickViewControl ? false : attribute.required;
|
|
45
47
|
const dataService = (0, transport_1.useDataService)();
|
|
48
|
+
const fileService = (0, transport_1.useFileService)();
|
|
46
49
|
const { schemaStore, experienceStore } = (0, hooks_1.useMetadata)();
|
|
47
50
|
// const { openQuickCreate } = useQuickCreateForm();
|
|
48
51
|
switch (attribute.type) {
|
|
@@ -78,11 +81,15 @@ const StandardControl = (props) => {
|
|
|
78
81
|
const Control = (_f = componentStore_1.componentStore.getComponent('Form.TextAreaControl')) !== null && _f !== void 0 ? _f : TextAreaControl_1.TextAreaControl;
|
|
79
82
|
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
80
83
|
}
|
|
84
|
+
case 'richtext': {
|
|
85
|
+
const Control = (_g = componentStore_1.componentStore.getComponent('Form.RichTextControl')) !== null && _g !== void 0 ? _g : RichTextControl_1.RichTextControl;
|
|
86
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
87
|
+
}
|
|
81
88
|
default:
|
|
82
89
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
83
90
|
}
|
|
84
91
|
case 'number': {
|
|
85
|
-
const Control = (
|
|
92
|
+
const Control = (_h = componentStore_1.componentStore.getComponent('Form.NumberControl')) !== null && _h !== void 0 ? _h : NumberControl_1.NumberControl;
|
|
86
93
|
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
87
94
|
}
|
|
88
95
|
case 'date': {
|
|
@@ -97,11 +104,11 @@ const StandardControl = (props) => {
|
|
|
97
104
|
readOnly,
|
|
98
105
|
};
|
|
99
106
|
if (attribute.format === 'datetime') {
|
|
100
|
-
const Control = (
|
|
107
|
+
const Control = (_j = componentStore_1.componentStore.getComponent('Form.DateTimeControl')) !== null && _j !== void 0 ? _j : DateTimeControl_1.DateTimeControl;
|
|
101
108
|
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
102
109
|
}
|
|
103
110
|
else {
|
|
104
|
-
const Control = (
|
|
111
|
+
const Control = (_k = componentStore_1.componentStore.getComponent('Form.DateControl')) !== null && _k !== void 0 ? _k : DateControl_1.DateControl;
|
|
105
112
|
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
106
113
|
}
|
|
107
114
|
}
|
|
@@ -116,35 +123,39 @@ const StandardControl = (props) => {
|
|
|
116
123
|
disabled: isDisabled,
|
|
117
124
|
readOnly,
|
|
118
125
|
};
|
|
119
|
-
const Control = (
|
|
126
|
+
const Control = (_l = componentStore_1.componentStore.getComponent('Form.DateRangeControl')) !== null && _l !== void 0 ? _l : DateRangeControl_1.DateRangeControl;
|
|
120
127
|
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
121
128
|
}
|
|
122
129
|
case 'money': {
|
|
123
|
-
const Control = (
|
|
130
|
+
const Control = (_m = componentStore_1.componentStore.getComponent('Form.CurrencyControl')) !== null && _m !== void 0 ? _m : CurrencyControl_1.CurrencyControl;
|
|
124
131
|
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 }));
|
|
125
132
|
}
|
|
126
133
|
case 'lookup': {
|
|
127
|
-
const Control = (
|
|
134
|
+
const Control = (_o = componentStore_1.componentStore.getComponent('Form.LookupControl')) !== null && _o !== void 0 ? _o : LookupControl_1.LookupControl;
|
|
128
135
|
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 }));
|
|
129
136
|
}
|
|
130
137
|
case 'lookups': {
|
|
131
|
-
const Control = (
|
|
138
|
+
const Control = (_p = componentStore_1.componentStore.getComponent('Form.MultiSelectLookupControl')) !== null && _p !== void 0 ? _p : MultiSelectLookupControl_1.MultiSelectLookupControl;
|
|
132
139
|
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 }));
|
|
133
140
|
}
|
|
134
141
|
case 'boolean': {
|
|
135
|
-
const Control = (
|
|
142
|
+
const Control = (_q = componentStore_1.componentStore.getComponent('Form.SwitchControl')) !== null && _q !== void 0 ? _q : SwitchControl_1.SwitchControl;
|
|
136
143
|
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
137
144
|
}
|
|
138
145
|
case 'choice': {
|
|
139
|
-
const Control = (
|
|
146
|
+
const Control = (_r = componentStore_1.componentStore.getComponent('Form.SelectControl')) !== null && _r !== void 0 ? _r : SelectControl_1.default;
|
|
140
147
|
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 }));
|
|
141
148
|
}
|
|
142
149
|
case 'choices': {
|
|
143
|
-
const Control = (
|
|
150
|
+
const Control = (_s = componentStore_1.componentStore.getComponent('Form.MultiSelectControl')) !== null && _s !== void 0 ? _s : MultiSelectControl_1.default;
|
|
144
151
|
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 }));
|
|
145
152
|
}
|
|
153
|
+
case 'attachment': {
|
|
154
|
+
const Control = (_t = componentStore_1.componentStore.getComponent('Form.AttachmentControl')) !== null && _t !== void 0 ? _t : AttachmentControl_1.AttachmentControl;
|
|
155
|
+
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 }));
|
|
156
|
+
}
|
|
146
157
|
case 'attachments': {
|
|
147
|
-
const Control = (
|
|
158
|
+
const Control = (_u = componentStore_1.componentStore.getComponent('Form.AttachmentsControl')) !== null && _u !== void 0 ? _u : AttachmentsControl_1.AttachmentsControl;
|
|
148
159
|
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 }));
|
|
149
160
|
}
|
|
150
161
|
// case 'attachment': {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AttachmentAttribute, FileObject } from '@headless-adminapp/core/attributes/AttachmentAttribute';
|
|
2
|
+
import { IFileService } from '@headless-adminapp/core/transport';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
import { ControlProps } from './types';
|
|
5
|
+
export interface AttachmentImageControlProps extends ControlProps<FileObject> {
|
|
6
|
+
fileService: IFileService;
|
|
7
|
+
fileServiceContext?: Record<string, unknown>;
|
|
8
|
+
location: AttachmentAttribute['location'];
|
|
9
|
+
}
|
|
10
|
+
interface AttachmentControlProps extends ControlProps<FileObject> {
|
|
11
|
+
fileService: IFileService;
|
|
12
|
+
fileServiceContext?: Record<string, unknown>;
|
|
13
|
+
location: AttachmentAttribute['location'];
|
|
14
|
+
format: AttachmentAttribute['format'];
|
|
15
|
+
}
|
|
16
|
+
export declare const AttachmentControl: FC<AttachmentControlProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AttachmentControl = void 0;
|
|
13
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
15
|
+
const hooks_1 = require("@headless-adminapp/app/dialog/hooks");
|
|
16
|
+
const utils_1 = require("@headless-adminapp/core/utils");
|
|
17
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
18
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
function useAttachmentSelector({ fileService, fileServiceContext, location, onChange, }) {
|
|
21
|
+
const { isPending, mutate: handleFile } = (0, react_query_1.useMutation)({
|
|
22
|
+
mutationFn: (file) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
if (location === 'local') {
|
|
24
|
+
return (0, utils_1.fileToObject)(file);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const url = yield fileService.uploadFile(file, {
|
|
28
|
+
context: fileServiceContext,
|
|
29
|
+
});
|
|
30
|
+
return (0, utils_1.urlToFileObject)(url);
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
onSuccess: (fileObject) => {
|
|
34
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(fileObject);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const selectFile = (accept) => {
|
|
38
|
+
const input = document.createElement('input');
|
|
39
|
+
input.type = 'file';
|
|
40
|
+
if (accept) {
|
|
41
|
+
input.accept = accept;
|
|
42
|
+
}
|
|
43
|
+
input.onchange = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const files = event.target.files;
|
|
45
|
+
if (!(files === null || files === void 0 ? void 0 : files.length)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const file = files[0];
|
|
49
|
+
handleFile(file);
|
|
50
|
+
});
|
|
51
|
+
input.click();
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
isProcessing: isPending,
|
|
55
|
+
selectFile,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const AttachmentImageControl = ({ value, disabled, readOnly, onChange, fileService, fileServiceContext, location, }) => {
|
|
59
|
+
const { isProcessing, selectFile } = useAttachmentSelector({
|
|
60
|
+
fileService,
|
|
61
|
+
fileServiceContext,
|
|
62
|
+
location,
|
|
63
|
+
onChange,
|
|
64
|
+
});
|
|
65
|
+
if (!value) {
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
67
|
+
width: 100,
|
|
68
|
+
height: 100,
|
|
69
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
70
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
71
|
+
display: 'flex',
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
color: react_components_1.tokens.colorNeutralForeground4,
|
|
75
|
+
cursor: 'pointer',
|
|
76
|
+
pointerEvents: disabled || readOnly || isProcessing ? 'none' : 'auto',
|
|
77
|
+
}, onClick: () => selectFile('image/*'), children: isProcessing ? (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "small" }) : (0, jsx_runtime_1.jsx)(icons_1.Icons.Image, {}) }) }));
|
|
78
|
+
}
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex' }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
80
|
+
maxWidth: '100%',
|
|
81
|
+
height: 100,
|
|
82
|
+
position: 'relative',
|
|
83
|
+
}, children: [(0, jsx_runtime_1.jsx)("img", { src: value.url, style: {
|
|
84
|
+
maxHeight: '100%',
|
|
85
|
+
maxWidth: '100%',
|
|
86
|
+
objectFit: 'contain',
|
|
87
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
88
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', top: 0, right: 0 }, children: (0, jsx_runtime_1.jsx)(ActionMenu, { format: 'image', value: value, disabled: disabled, readOnly: readOnly, onChange: onChange, onChangeClick: () => selectFile('image/*') }) }), isProcessing && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
inset: 0,
|
|
91
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground1,
|
|
92
|
+
opacity: 0.7,
|
|
93
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
94
|
+
position: 'absolute',
|
|
95
|
+
inset: 0,
|
|
96
|
+
display: 'flex',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
justifyContent: 'center',
|
|
99
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "small" }) })] }))] }) }));
|
|
100
|
+
};
|
|
101
|
+
const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChange, placeholder, fileService, fileServiceContext, location, format, }) => {
|
|
102
|
+
const { isProcessing, selectFile } = useAttachmentSelector({
|
|
103
|
+
fileService,
|
|
104
|
+
fileServiceContext,
|
|
105
|
+
location,
|
|
106
|
+
onChange,
|
|
107
|
+
});
|
|
108
|
+
const accept = (0, react_1.useMemo)(() => {
|
|
109
|
+
switch (format) {
|
|
110
|
+
case 'image':
|
|
111
|
+
return 'image/*';
|
|
112
|
+
case 'video':
|
|
113
|
+
return 'video/*';
|
|
114
|
+
case 'audio':
|
|
115
|
+
return 'audio/*';
|
|
116
|
+
case 'document':
|
|
117
|
+
return '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv';
|
|
118
|
+
default:
|
|
119
|
+
return '';
|
|
120
|
+
}
|
|
121
|
+
}, [format]);
|
|
122
|
+
const FormatIcon = (0, react_1.useMemo)(() => {
|
|
123
|
+
switch (format) {
|
|
124
|
+
case 'video':
|
|
125
|
+
return icons_1.Icons.Video;
|
|
126
|
+
case 'audio':
|
|
127
|
+
return icons_1.Icons.Audio;
|
|
128
|
+
default:
|
|
129
|
+
return icons_1.Icons.Document;
|
|
130
|
+
}
|
|
131
|
+
}, [format]);
|
|
132
|
+
if (format === 'image') {
|
|
133
|
+
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 }));
|
|
134
|
+
}
|
|
135
|
+
if (!value) {
|
|
136
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', overflow: 'hidden' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
137
|
+
width: '100%',
|
|
138
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
139
|
+
width: '100%',
|
|
140
|
+
height: 30,
|
|
141
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
142
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
143
|
+
display: 'flex',
|
|
144
|
+
paddingLeft: react_components_1.tokens.spacingHorizontalS,
|
|
145
|
+
gap: react_components_1.tokens.spacingHorizontalS,
|
|
146
|
+
alignItems: 'center',
|
|
147
|
+
overflow: 'hidden',
|
|
148
|
+
color: react_components_1.tokens.colorNeutralForeground4,
|
|
149
|
+
cursor: 'pointer',
|
|
150
|
+
pointerEvents: disabled || readOnly || isProcessing ? 'none' : 'auto',
|
|
151
|
+
}, onClick: () => selectFile(accept), children: [(0, jsx_runtime_1.jsx)(FormatIcon, { size: 16 }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: {
|
|
152
|
+
overflow: 'hidden',
|
|
153
|
+
textOverflow: 'ellipsis',
|
|
154
|
+
whiteSpace: 'nowrap',
|
|
155
|
+
flex: 1,
|
|
156
|
+
}, children: placeholder || 'Select a file' }), isProcessing && ((0, jsx_runtime_1.jsx)("div", { style: { paddingRight: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" }) }))] }) }) }));
|
|
157
|
+
}
|
|
158
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', overflow: 'hidden' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
159
|
+
width: '100%',
|
|
160
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
161
|
+
width: '100%',
|
|
162
|
+
height: 30,
|
|
163
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
164
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
165
|
+
display: 'flex',
|
|
166
|
+
paddingLeft: react_components_1.tokens.spacingHorizontalS,
|
|
167
|
+
gap: react_components_1.tokens.spacingHorizontalS,
|
|
168
|
+
alignItems: 'center',
|
|
169
|
+
overflow: 'hidden',
|
|
170
|
+
}, children: [(0, jsx_runtime_1.jsx)(FormatIcon, { size: 16 }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: {
|
|
171
|
+
overflow: 'hidden',
|
|
172
|
+
textOverflow: 'ellipsis',
|
|
173
|
+
whiteSpace: 'nowrap',
|
|
174
|
+
flex: 1,
|
|
175
|
+
}, children: value.name || value.url }), isProcessing && ((0, jsx_runtime_1.jsx)("div", { style: { paddingRight: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" }) })), !isProcessing && ((0, jsx_runtime_1.jsx)(ActionMenu, { format: format, value: value, disabled: disabled, readOnly: readOnly, onChange: onChange, onChangeClick: () => selectFile(accept) }))] }) }) }));
|
|
176
|
+
};
|
|
177
|
+
exports.AttachmentControl = AttachmentControl;
|
|
178
|
+
const ActionMenu = ({ format, value, disabled, readOnly, onChange, onChangeClick, }) => {
|
|
179
|
+
const openConfirmDialog = (0, hooks_1.useOpenConfirmDialog)();
|
|
180
|
+
const FileOpenIcon = (0, react_1.useMemo)(() => {
|
|
181
|
+
switch (format) {
|
|
182
|
+
case 'video':
|
|
183
|
+
case 'audio':
|
|
184
|
+
return icons_1.Icons.Play;
|
|
185
|
+
default:
|
|
186
|
+
return icons_1.Icons.OpenInNew;
|
|
187
|
+
}
|
|
188
|
+
}, [format]);
|
|
189
|
+
const OpenText = (0, react_1.useMemo)(() => {
|
|
190
|
+
switch (format) {
|
|
191
|
+
case 'video':
|
|
192
|
+
return 'Play';
|
|
193
|
+
case 'audio':
|
|
194
|
+
return 'Play';
|
|
195
|
+
default:
|
|
196
|
+
return 'Open';
|
|
197
|
+
}
|
|
198
|
+
}, [format]);
|
|
199
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "before-top", hasIcons: true, children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.MoreVertical, {}) }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(FileOpenIcon, {}), onClick: () => {
|
|
200
|
+
window.open(value.url, '_blank');
|
|
201
|
+
}, children: OpenText }), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Copy, {}), onClick: () => {
|
|
202
|
+
navigator.clipboard.writeText(value.url).catch(() => { });
|
|
203
|
+
}, children: "Copy Url" }), !(disabled || readOnly) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Edit, {}), onClick: () => {
|
|
204
|
+
onChangeClick === null || onChangeClick === void 0 ? void 0 : onChangeClick();
|
|
205
|
+
}, children: "Change" }), (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Delete, {}), onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
206
|
+
const result = yield openConfirmDialog({
|
|
207
|
+
title: 'Remove file',
|
|
208
|
+
text: 'Are you sure you want to remove this file?',
|
|
209
|
+
confirmButtonLabel: 'Remove',
|
|
210
|
+
cancelButtonLabel: 'Cancel',
|
|
211
|
+
});
|
|
212
|
+
if (!(result === null || result === void 0 ? void 0 : result.confirmed)) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
216
|
+
}), children: "Remove" })] }))] }) })] }));
|
|
217
|
+
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { FileObject } from '@headless-adminapp/core/attributes/AttachmentAttribute';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { ControlProps } from './types';
|
|
4
|
-
export declare function fileToObject(file: File): Promise<FileObject>;
|
|
5
|
-
export declare function dataUrlToFile(dataUrl: string, name: string): File;
|
|
6
4
|
export interface AttachmentsControlProps extends ControlProps<FileObject[]> {
|
|
7
5
|
}
|
|
8
6
|
export declare const AttachmentsControl: FC<AttachmentsControlProps>;
|
|
@@ -10,39 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AttachmentsControl = void 0;
|
|
13
|
-
exports.fileToObject = fileToObject;
|
|
14
|
-
exports.dataUrlToFile = dataUrlToFile;
|
|
15
13
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
14
|
const react_components_1 = require("@fluentui/react-components");
|
|
15
|
+
const utils_1 = require("@headless-adminapp/core/utils");
|
|
17
16
|
const icons_1 = require("@headless-adminapp/icons");
|
|
18
17
|
const react_1 = require("react");
|
|
19
|
-
function fileToObject(file) {
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
const reader = new FileReader();
|
|
22
|
-
reader.onload = () => {
|
|
23
|
-
resolve({
|
|
24
|
-
name: file.name,
|
|
25
|
-
type: file.type,
|
|
26
|
-
size: file.size,
|
|
27
|
-
url: reader.result,
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
reader.onerror = (error) => {
|
|
31
|
-
reject(error);
|
|
32
|
-
};
|
|
33
|
-
reader.readAsDataURL(file);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function dataUrlToFile(dataUrl, name) {
|
|
37
|
-
const byteString = atob(dataUrl.split(',')[1]);
|
|
38
|
-
const mimeString = dataUrl.split(',')[0].split(':')[1].split(';')[0];
|
|
39
|
-
const ab = new ArrayBuffer(byteString.length);
|
|
40
|
-
const ia = new Uint8Array(ab);
|
|
41
|
-
for (let i = 0; i < byteString.length; i++) {
|
|
42
|
-
ia[i] = byteString.charCodeAt(i);
|
|
43
|
-
}
|
|
44
|
-
return new File([ab], name, { type: mimeString });
|
|
45
|
-
}
|
|
46
18
|
const AttachmentsControl = ({ onChange, id, onBlur, onFocus, disabled, readOnly, value, }) => {
|
|
47
19
|
const inputRef = (0, react_1.useRef)(null);
|
|
48
20
|
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: {
|
|
@@ -65,7 +37,7 @@ const AttachmentsControl = ({ onChange, id, onBlur, onFocus, disabled, readOnly,
|
|
|
65
37
|
}, children: "Add" }))] }) }), (0, jsx_runtime_1.jsx)(react_components_1.TagPickerList, {})] }), (0, jsx_runtime_1.jsx)("input", { ref: inputRef, type: "file", multiple: true, style: { display: 'none' }, onChange: (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
38
|
const files = event.target.files;
|
|
67
39
|
if (files === null || files === void 0 ? void 0 : files.length) {
|
|
68
|
-
const fileObjects = yield Promise.all(Array.from(files).map((file) => fileToObject(file)));
|
|
40
|
+
const fileObjects = yield Promise.all(Array.from(files).map((file) => (0, utils_1.fileToObject)(file)));
|
|
69
41
|
onChange === null || onChange === void 0 ? void 0 : onChange([...(value !== null && value !== void 0 ? value : []), ...fileObjects]);
|
|
70
42
|
}
|
|
71
43
|
}) })] }));
|
|
@@ -4,18 +4,48 @@ exports.CurrencyControl = CurrencyControl;
|
|
|
4
4
|
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
|
+
const react_1 = require("react");
|
|
7
8
|
function CurrencyControl({ value, onChange, id, name, onBlur, onFocus,
|
|
8
9
|
// error,
|
|
9
10
|
disabled, placeholder, autoFocus,
|
|
10
11
|
// borderOnFocusOnly,
|
|
11
12
|
readOnly, }) {
|
|
12
|
-
var _a;
|
|
13
13
|
const symbol = (0, locale_1.useCurrencySymbol)();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const [internalValue, setInternalValue] = (0, react_1.useState)(value ? value.toString() : '');
|
|
15
|
+
const internalValueRef = (0, react_1.useRef)(internalValue);
|
|
16
|
+
internalValueRef.current = internalValue;
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
let _value = '';
|
|
19
|
+
if (typeof value === 'number') {
|
|
20
|
+
_value = value.toString();
|
|
21
|
+
}
|
|
22
|
+
if (!_value && internalValueRef.current === '-') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (internalValueRef.current !== _value) {
|
|
26
|
+
setInternalValue(_value);
|
|
27
|
+
}
|
|
28
|
+
}, [value]);
|
|
29
|
+
const handleChange = (e) => {
|
|
30
|
+
let value = e.target.value;
|
|
31
|
+
if (!value) {
|
|
32
|
+
setInternalValue('');
|
|
33
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
value = value.replace(',', '');
|
|
37
|
+
if (value === '-') {
|
|
38
|
+
setInternalValue('-');
|
|
39
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (isNaN(Number(value))) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
setInternalValue(value);
|
|
46
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Number(value));
|
|
47
|
+
};
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, autoFocus: autoFocus, name: name, value: internalValue, onChange: handleChange, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), appearance: "filled-darker", onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), contentBefore: (0, jsx_runtime_1.jsx)("div", { children: symbol }), disabled: disabled, readOnly: readOnly, style: {
|
|
19
49
|
width: '100%',
|
|
20
50
|
} }));
|
|
21
51
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.RichTextControl = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = require("react");
|
|
29
|
+
const ReactQuill = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('react-quill'))));
|
|
30
|
+
const RichTextControl = ({ value, onChange, id, onBlur, onFocus, disabled, readOnly, }) => {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(ReactQuill, { value: value !== null && value !== void 0 ? value : '', onChange: onChange, className: "hdlapp_rte", readOnly: disabled || readOnly, style: { maxHeight: '400px', minHeight: '200px' }, onFocus: onFocus, onBlur: onBlur, id: id }));
|
|
32
|
+
};
|
|
33
|
+
exports.RichTextControl = RichTextControl;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ControlProps } from './types';
|
|
2
2
|
export interface SwitchControlProps extends ControlProps<boolean> {
|
|
3
3
|
}
|
|
4
|
-
export declare function SwitchControl({}: SwitchControlProps):
|
|
4
|
+
export declare function SwitchControl({ value, onChange, id, name, disabled, readOnly, onBlur, onFocus, }: SwitchControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwitchControl = SwitchControl;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
function SwitchControl({ value, onChange, id, name, disabled, readOnly, onBlur, onFocus, }) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Switch, { checked: value !== null && value !== void 0 ? value : false, onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.currentTarget.checked), id: id, name: name, disabled: disabled, readOnly: readOnly, onBlur: onBlur, onFocus: onFocus }));
|
|
6
8
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FileObject } from '@headless-adminapp/core/attributes/AttachmentAttribute';
|
|
2
|
+
export declare function fileToObject(file: File): Promise<FileObject>;
|
|
3
|
+
export declare function dataUrlToFile(dataUrl: string, name: string): File;
|
|
4
|
+
export declare function urlToFileObject(url: string, name?: string): FileObject;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fileToObject = fileToObject;
|
|
4
|
+
exports.dataUrlToFile = dataUrlToFile;
|
|
5
|
+
exports.urlToFileObject = urlToFileObject;
|
|
6
|
+
// TODO: Move to core
|
|
7
|
+
function fileToObject(file) {
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
const reader = new FileReader();
|
|
10
|
+
reader.onload = () => {
|
|
11
|
+
resolve({
|
|
12
|
+
name: file.name,
|
|
13
|
+
type: file.type,
|
|
14
|
+
size: file.size,
|
|
15
|
+
url: reader.result,
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
reader.onerror = (error) => {
|
|
19
|
+
reject(error);
|
|
20
|
+
};
|
|
21
|
+
reader.readAsDataURL(file);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function dataUrlToFile(dataUrl, name) {
|
|
25
|
+
const byteString = atob(dataUrl.split(',')[1]);
|
|
26
|
+
const mimeString = dataUrl.split(',')[0].split(':')[1].split(';')[0];
|
|
27
|
+
const ab = new ArrayBuffer(byteString.length);
|
|
28
|
+
const ia = new Uint8Array(ab);
|
|
29
|
+
for (let i = 0; i < byteString.length; i++) {
|
|
30
|
+
ia[i] = byteString.charCodeAt(i);
|
|
31
|
+
}
|
|
32
|
+
return new File([ab], name, { type: mimeString });
|
|
33
|
+
}
|
|
34
|
+
function urlToFileObject(url, name) {
|
|
35
|
+
const fileName = name || url.split('/').pop() || 'file';
|
|
36
|
+
return {
|
|
37
|
+
name: fileName,
|
|
38
|
+
size: 0,
|
|
39
|
+
type: '',
|
|
40
|
+
url,
|
|
41
|
+
};
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "0.0.17-alpha.
|
|
3
|
+
"version": "0.0.17-alpha.28",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"url": "https://github.com/headless-adminapp/adminapp/issues"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
20
|
+
"build": "tsc && sass src/styles/index.scss dist/styles.css --no-source-map",
|
|
21
21
|
"clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo",
|
|
22
22
|
"ts-check": "tsc --noEmit",
|
|
23
|
-
"copy-files": "cp package.json dist
|
|
23
|
+
"copy-files": "cp package.json dist",
|
|
24
24
|
"prepublishOnly": "pnpm run build && pnpm run copy-files",
|
|
25
25
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
26
26
|
},
|
|
@@ -42,8 +42,10 @@
|
|
|
42
42
|
"react-dnd": "^16.0.1",
|
|
43
43
|
"react-dnd-html5-backend": "^16.0.1",
|
|
44
44
|
"react-hook-form": "7.52.2",
|
|
45
|
+
"react-quill": "^2.0.0",
|
|
46
|
+
"sass": "1.81.0",
|
|
45
47
|
"uuid": "11.0.3",
|
|
46
48
|
"yup": "^1.4.0"
|
|
47
49
|
},
|
|
48
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "e25bcf7611efad55ef448866d149ff5e5d19cd64"
|
|
49
51
|
}
|
package/styles.css
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
html,
|
|
2
|
+
body {
|
|
3
|
+
padding: 0;
|
|
4
|
+
margin: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.TextControl_readonly:after {
|
|
8
|
+
border-bottom-color: var(--colorNeutralStrokeDisabled) !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.FormBody_scrollview > div {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
padding: var(--spacingVerticalM);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
* {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
padding: 0;
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.fui-MenuItem__icon > svg,
|
|
24
|
+
.fui-Button__icon > svg {
|
|
25
|
+
width: inherit;
|
|
26
|
+
height: inherit;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.hdlapp_rte {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
background-color: var(--colorNeutralBackground3);
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
border-radius: var(--borderRadiusMedium);
|
|
35
|
+
border: 1px solid transparent;
|
|
36
|
+
}
|
|
37
|
+
.hdlapp_rte:focus-within {
|
|
38
|
+
border-color: var(--colorNeutralForeground2BrandSelected);
|
|
39
|
+
}
|
|
40
|
+
.hdlapp_rte .ql-snow .ql-picker {
|
|
41
|
+
color: var(--colorNeutralForeground3Hover);
|
|
42
|
+
}
|
|
43
|
+
.hdlapp_rte .ql-snow .ql-stroke {
|
|
44
|
+
stroke: var(--colorNeutralForeground3Hover);
|
|
45
|
+
}
|
|
46
|
+
.hdlapp_rte .ql-snow.ql-toolbar button:hover,
|
|
47
|
+
.hdlapp_rte .ql-snow .ql-toolbar button:hover,
|
|
48
|
+
.hdlapp_rte .ql-snow.ql-toolbar button:focus,
|
|
49
|
+
.hdlapp_rte .ql-snow .ql-toolbar button:focus,
|
|
50
|
+
.hdlapp_rte .ql-snow.ql-toolbar button.ql-active,
|
|
51
|
+
.hdlapp_rte .ql-snow .ql-toolbar button.ql-active,
|
|
52
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-label:hover,
|
|
53
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-label:hover,
|
|
54
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-label.ql-active,
|
|
55
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-label.ql-active,
|
|
56
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-item:hover,
|
|
57
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-item:hover,
|
|
58
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-item.ql-selected,
|
|
59
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-item.ql-selected {
|
|
60
|
+
color: var(--colorNeutralForeground1);
|
|
61
|
+
}
|
|
62
|
+
.hdlapp_rte .ql-snow.ql-toolbar button:hover .ql-stroke,
|
|
63
|
+
.hdlapp_rte .ql-snow .ql-toolbar button:hover .ql-stroke,
|
|
64
|
+
.hdlapp_rte .ql-snow.ql-toolbar button:focus .ql-stroke,
|
|
65
|
+
.hdlapp_rte .ql-snow .ql-toolbar button:focus .ql-stroke,
|
|
66
|
+
.hdlapp_rte .ql-snow.ql-toolbar button.ql-active .ql-stroke,
|
|
67
|
+
.hdlapp_rte .ql-snow .ql-toolbar button.ql-active .ql-stroke,
|
|
68
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,
|
|
69
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke,
|
|
70
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke,
|
|
71
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke,
|
|
72
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke,
|
|
73
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke,
|
|
74
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke,
|
|
75
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke,
|
|
76
|
+
.hdlapp_rte .ql-snow.ql-toolbar button:hover .ql-stroke-miter,
|
|
77
|
+
.hdlapp_rte .ql-snow .ql-toolbar button:hover .ql-stroke-miter,
|
|
78
|
+
.hdlapp_rte .ql-snow.ql-toolbar button:focus .ql-stroke-miter,
|
|
79
|
+
.hdlapp_rte .ql-snow .ql-toolbar button:focus .ql-stroke-miter,
|
|
80
|
+
.hdlapp_rte .ql-snow.ql-toolbar button.ql-active .ql-stroke-miter,
|
|
81
|
+
.hdlapp_rte .ql-snow .ql-toolbar button.ql-active .ql-stroke-miter,
|
|
82
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter,
|
|
83
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-miter,
|
|
84
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,
|
|
85
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,
|
|
86
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter,
|
|
87
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-miter,
|
|
88
|
+
.hdlapp_rte .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter,
|
|
89
|
+
.hdlapp_rte .ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter {
|
|
90
|
+
stroke: var(--colorNeutralForeground1);
|
|
91
|
+
}
|
|
92
|
+
.hdlapp_rte .ql-snow.ql-toolbar {
|
|
93
|
+
border: none;
|
|
94
|
+
}
|
|
95
|
+
.hdlapp_rte .ql-toolbar.ql-snow + .ql-container.ql-snow {
|
|
96
|
+
border-top: 1px solid var(--colorNeutralBackground1Hover);
|
|
97
|
+
}
|
|
98
|
+
.hdlapp_rte .ql-container.ql-snow {
|
|
99
|
+
border: none;
|
|
100
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -32,6 +32,13 @@ declare module '@headless-adminapp/icons/types' {
|
|
|
32
32
|
ExportCsv: Icon;
|
|
33
33
|
ExportExcel: Icon;
|
|
34
34
|
Entity: Icon;
|
|
35
|
+
OpenInNew: Icon;
|
|
36
|
+
Play: Icon;
|
|
37
|
+
Audio: Icon;
|
|
38
|
+
Video: Icon;
|
|
39
|
+
Copy: Icon;
|
|
40
|
+
Document: Icon;
|
|
41
|
+
Image: Icon;
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
44
|
export {};
|
package/index.css
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
html,
|
|
2
|
-
body {
|
|
3
|
-
padding: 0;
|
|
4
|
-
margin: 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.TextControl_readonly:after {
|
|
8
|
-
border-bottom-color: var(--colorNeutralStrokeDisabled) !important;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.FormBody_scrollview > div {
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
padding: var(--spacingVerticalM);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
* {
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
padding: 0;
|
|
20
|
-
margin: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.fui-MenuItem__icon > svg,
|
|
24
|
-
.fui-Button__icon > svg {
|
|
25
|
-
width: inherit;
|
|
26
|
-
height: inherit;
|
|
27
|
-
}
|