@headless-adminapp/fluent 0.0.17-alpha.61 → 0.0.17-alpha.63
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/PageEntityForm/PageCustomEntityForm.d.ts +11 -0
- package/PageEntityForm/PageCustomEntityForm.js +17 -0
- package/PageEntityForm/RelatedViewSelector.js +2 -1
- package/form/controls/CurrencyControl.js +1 -1
- package/form/controls/DecimalControl.js +1 -1
- package/form/controls/IntegerControl.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EntityMainFormCommandItemExperience, Form } from '@headless-adminapp/core/experience/form';
|
|
2
|
+
import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
interface PageCustomEntityFormProps<SA extends SchemaAttributes = SchemaAttributes> {
|
|
5
|
+
recordId?: string;
|
|
6
|
+
schema: Schema<SA>;
|
|
7
|
+
form: Form<SA>;
|
|
8
|
+
commands: EntityMainFormCommandItemExperience[][];
|
|
9
|
+
}
|
|
10
|
+
export declare const PageCustomEntityForm: FC<PageCustomEntityFormProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageCustomEntityForm = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const PageEntityFormProvider_1 = require("@headless-adminapp/app/providers/PageEntityFormProvider");
|
|
7
|
+
const PageEntityFormDesktopContainer_1 = require("./PageEntityFormDesktopContainer");
|
|
8
|
+
const PageCustomEntityForm = ({ recordId, commands, form, schema, }) => {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(PageEntityFormProvider_1.PageEntityFormProvider, { schema: schema, form: form, recordId: recordId, commands: commands, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flex: 1,
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
}, children: (0, jsx_runtime_1.jsx)(PageEntityFormDesktopContainer_1.PageEntityFormDesktopContainer, {}) }) }));
|
|
16
|
+
};
|
|
17
|
+
exports.PageCustomEntityForm = PageCustomEntityForm;
|
|
@@ -72,12 +72,13 @@ function getRelatedItems(currentSchema, schemas, relatedItems) {
|
|
|
72
72
|
}
|
|
73
73
|
function RelatedViewSelector(props) {
|
|
74
74
|
const schema = (0, hooks_1.useDataFormSchema)();
|
|
75
|
+
const recordId = (0, hooks_1.useRecordId)();
|
|
75
76
|
const formConfig = (0, hooks_1.useSelectedForm)();
|
|
76
77
|
const { schemas } = (0, hooks_2.useMetadata)();
|
|
77
78
|
const strings = (0, PageEntityFormStringContext_1.usePageEntityFormStrings)();
|
|
78
79
|
const { language } = (0, locale_1.useLocale)();
|
|
79
80
|
const data = (0, react_1.useMemo)(() => getRelatedItems(schema, schemas, formConfig.experience.relatedItems), [formConfig.experience.relatedItems, schema, schemas]);
|
|
80
|
-
if (!data.length) {
|
|
81
|
+
if (!data.length || !recordId) {
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
84
|
return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsxs)("button", { style: {
|
|
@@ -45,7 +45,7 @@ readOnly, }) {
|
|
|
45
45
|
setInternalValue(value);
|
|
46
46
|
onChange?.(Number(value));
|
|
47
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?.(), appearance: "filled-darker", onFocus: () => onFocus?.(), contentBefore: (0, jsx_runtime_1.jsx)("div", { children: symbol }),
|
|
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?.(), appearance: "filled-darker", onFocus: () => onFocus?.(), contentBefore: (0, jsx_runtime_1.jsx)("div", { children: symbol }), readOnly: readOnly || disabled, style: {
|
|
49
49
|
width: '100%',
|
|
50
50
|
} }));
|
|
51
51
|
}
|
|
@@ -46,7 +46,7 @@ function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, dis
|
|
|
46
46
|
setInternalValue(value);
|
|
47
47
|
onChange?.(Number(value));
|
|
48
48
|
};
|
|
49
|
-
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?.(),
|
|
49
|
+
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
50
|
width: '100%',
|
|
51
51
|
} }));
|
|
52
52
|
}
|
|
@@ -5,7 +5,7 @@ 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
|
function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.SpinButton, { appearance: "filled-darker", placeholder: placeholder, id: id, name: name, value: value ?? null, onChange: (e, data) => {
|
|
8
|
+
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, onChange: (e, data) => {
|
|
9
9
|
if (data.value !== undefined) {
|
|
10
10
|
onChange?.(data.value);
|
|
11
11
|
}
|
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.63",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"uuid": "11.0.3",
|
|
43
43
|
"yup": "^1.4.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "dd0bf7cc124df353fa0b5f56a16d7286a48ee95a"
|
|
46
46
|
}
|