@headless-adminapp/fluent 0.0.17-alpha.3 → 0.0.17-alpha.30
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/App/AppHeaderContianer.js +1 -1
- package/App/NavigationContainer.js +2 -2
- package/App/QuickActionItem.js +1 -1
- package/CommandBar/Button.d.ts +2 -1
- package/CommandBar/Button.js +2 -2
- package/CommandBar/Divider.d.ts +2 -1
- package/CommandBar/Divider.js +2 -2
- package/CommandBar/IconButton.d.ts +2 -1
- package/CommandBar/IconButton.js +2 -2
- package/CommandBar/Label.d.ts +2 -1
- package/CommandBar/Label.js +2 -2
- package/CommandBar/MenuButton.d.ts +2 -1
- package/CommandBar/MenuButton.js +3 -3
- package/CommandBar/MenuItem.js +6 -5
- package/CommandBar/MenuItems.js +3 -3
- package/CommandBar/MenuList.js +4 -3
- package/CommandBar/Wrapper.d.ts +2 -2
- package/CommandBar/Wrapper.js +2 -2
- package/CommandBar/index.d.ts +6 -6
- package/DataGrid/ActionCell.d.ts +1 -1
- package/DataGrid/ActionCell.js +8 -4
- package/DataGrid/CustomizeColumns/AddColumns.js +4 -5
- package/DataGrid/CustomizeColumns/ColumnItem.js +3 -1
- package/DataGrid/GridColumnHeader/FilterForm.js +3 -1
- package/DataGrid/GridColumnHeader/OperatorSelect.js +9 -2
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +8 -8
- package/DataGrid/GridHeaderDesktop.js +0 -1
- package/DataGrid/GridTableContainer.js +22 -23
- package/DataGrid/TableCell/TableCellCheckbox.js +4 -3
- package/DataGrid/TableCell/TableCellLink.js +4 -3
- package/DataGrid/TableCell/TableCellText.js +9 -4
- package/DataGrid/useTableColumns.d.ts +4 -1
- package/DataGrid/useTableColumns.js +184 -167
- package/DialogContainer/PromptDialog.d.ts +3 -2
- package/DialogContainer/PromptDialog.js +10 -6
- package/PageEntityForm/CommandContainer.js +9 -1
- package/PageEntityForm/FormTabRelated.js +1 -2
- package/PageEntityForm/PageEntityFormDesktopContainer.js +6 -6
- package/PageEntityForm/RecordSetNavigatorContainer.js +4 -7
- package/PageEntityForm/RelatedViewSelector.js +4 -2
- package/PageEntityForm/SectionContainer.js +18 -4
- package/PageEntityForm/StandardControl.d.ts +2 -2
- package/PageEntityForm/StandardControl.js +75 -112
- package/PageEntityForm/SubgridControl.js +1 -1
- package/componentStore.d.ts +2 -0
- package/componentStore.js +5 -0
- package/components/PageLogin.js +0 -1
- package/form/FormControl.js +1 -1
- package/form/controls/AttachmentControl.d.ts +17 -0
- package/form/controls/AttachmentControl.js +225 -0
- package/form/controls/AttachmentsControl.d.ts +6 -0
- package/form/controls/AttachmentsControl.js +45 -0
- package/form/controls/CurrencyControl.js +38 -6
- package/form/controls/DateControl.d.ts +1 -1
- package/form/controls/DateControl.js +7 -3
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +1 -1
- package/form/controls/EmailControl.d.ts +1 -1
- package/form/controls/EmailControl.js +1 -1
- package/form/controls/LookupControl.js +2 -2
- package/form/controls/MultiSelectControl.d.ts +1 -1
- package/form/controls/MultiSelectControl.js +1 -1
- package/form/controls/MultiSelectLookupControl.js +1 -1
- package/form/controls/NumberControl.js +1 -0
- package/form/controls/PasswordControl.d.ts +1 -1
- package/form/controls/PasswordControl.js +1 -1
- package/form/controls/RichTextControl.d.ts +5 -0
- package/form/controls/RichTextControl.js +33 -0
- package/form/controls/SelectControl.d.ts +1 -1
- package/form/controls/SelectControl.js +1 -1
- package/form/controls/SwitchControl.d.ts +1 -1
- package/form/controls/SwitchControl.js +4 -2
- package/form/controls/TelephoneControl.d.ts +1 -1
- package/form/controls/TelephoneControl.js +1 -1
- package/form/controls/TextAreaControl.d.ts +1 -1
- package/form/controls/TextAreaControl.js +1 -1
- package/form/controls/utils.d.ts +4 -0
- package/form/controls/utils.js +42 -0
- package/form/layout/FormSection/FormSection.js +1 -1
- package/form/layout/FormSection/FormSectionColumn.js +1 -1
- package/form/layout/FormSection/FormSectionLoading.js +1 -1
- package/form/layout/FormTab/FormTab.js +1 -0
- package/package.json +24 -3
- package/styles.css +100 -0
- package/types/index.d.ts +12 -0
- package/App/AppProvider.d.ts +0 -9
- package/App/AppProvider.js +0 -50
- package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
- package/DataGrid/getAttributeFormattedValue.js +0 -92
|
@@ -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
|
+
}
|
|
@@ -11,7 +11,7 @@ const FormSectionLoading_1 = require("./FormSectionLoading");
|
|
|
11
11
|
function determineItemCount(availableWidth, itemWidth, gap, padding) {
|
|
12
12
|
return Math.floor((availableWidth + gap - 2 * padding) / (itemWidth + gap));
|
|
13
13
|
}
|
|
14
|
-
const FormSection = ({ title, children, columnCount,
|
|
14
|
+
const FormSection = ({ title, children, columnCount, labelPosition, noPadding, hideLabel }) => {
|
|
15
15
|
// const columnCount = 2;
|
|
16
16
|
const divRef = (0, react_1.useRef)(null);
|
|
17
17
|
const divSize = (0, hooks_1.useElementSize)(divRef, 100);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FormSectionColumn = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const FormSectionColumn = ({ children
|
|
5
|
+
const FormSectionColumn = ({ children }) => {
|
|
6
6
|
return ((0, jsx_runtime_1.jsx)("div", {
|
|
7
7
|
// md={span}
|
|
8
8
|
// xs={12}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FormSectionLoading = void 0;
|
|
4
|
-
const FormSectionLoading = (
|
|
4
|
+
const FormSectionLoading = () => {
|
|
5
5
|
return null;
|
|
6
6
|
};
|
|
7
7
|
exports.FormSectionLoading = FormSectionLoading;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FormTab = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/* eslint-disable unused-imports/no-unused-vars */
|
|
5
6
|
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
6
7
|
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
7
8
|
const mutable_1 = require("@headless-adminapp/app/mutable");
|
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.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -17,7 +17,8 @@
|
|
|
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
|
+
"clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo",
|
|
21
22
|
"ts-check": "tsc --noEmit",
|
|
22
23
|
"copy-files": "cp package.json dist",
|
|
23
24
|
"prepublishOnly": "pnpm run build && pnpm run copy-files",
|
|
@@ -26,5 +27,25 @@
|
|
|
26
27
|
"keywords": [],
|
|
27
28
|
"author": "",
|
|
28
29
|
"license": "ISC",
|
|
29
|
-
"
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@fluentui/react-components": "9.54.4",
|
|
32
|
+
"@fluentui/react-datepicker-compat": "^0.4.43",
|
|
33
|
+
"@fluentui/react-nav-preview": "^0.5.1",
|
|
34
|
+
"@hookform/resolvers": "^3.9.0",
|
|
35
|
+
"@tanstack/react-query": "5.51.1",
|
|
36
|
+
"@tanstack/react-table": "^8.20.1",
|
|
37
|
+
"@tanstack/react-virtual": "^3.8.6",
|
|
38
|
+
"dayjs": "^1.11.13",
|
|
39
|
+
"dnd-core": "^16.0.1",
|
|
40
|
+
"immutability-helper": "^3.1.1",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
42
|
+
"react-dnd": "^16.0.1",
|
|
43
|
+
"react-dnd-html5-backend": "^16.0.1",
|
|
44
|
+
"react-hook-form": "7.52.2",
|
|
45
|
+
"react-quill": "^2.0.0",
|
|
46
|
+
"sass": "1.81.0",
|
|
47
|
+
"uuid": "11.0.3",
|
|
48
|
+
"yup": "^1.4.0"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "713f5087ad8c942449ac5e043de6cb1f4df9766a"
|
|
30
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
|
@@ -16,6 +16,7 @@ declare module '@headless-adminapp/icons/types' {
|
|
|
16
16
|
Add: Icon;
|
|
17
17
|
Edit: Icon;
|
|
18
18
|
Delete: Icon;
|
|
19
|
+
Save: Icon;
|
|
19
20
|
Refresh: Icon;
|
|
20
21
|
MoreVertical: Icon;
|
|
21
22
|
MoreHorizontal: Icon;
|
|
@@ -27,6 +28,17 @@ declare module '@headless-adminapp/icons/types' {
|
|
|
27
28
|
FilterDismiss: Icon;
|
|
28
29
|
ListLtr: Icon;
|
|
29
30
|
ListRtl: Icon;
|
|
31
|
+
Export: Icon;
|
|
32
|
+
ExportCsv: Icon;
|
|
33
|
+
ExportExcel: Icon;
|
|
34
|
+
Entity: Icon;
|
|
35
|
+
OpenInNew: Icon;
|
|
36
|
+
Play: Icon;
|
|
37
|
+
Audio: Icon;
|
|
38
|
+
Video: Icon;
|
|
39
|
+
Copy: Icon;
|
|
40
|
+
Document: Icon;
|
|
41
|
+
Image: Icon;
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
44
|
export {};
|
package/App/AppProvider.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
interface AppProviderProps {
|
|
3
|
-
appId: string;
|
|
4
|
-
loadingComponent: React.ReactNode;
|
|
5
|
-
notFoundComponent: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
/*** @todo: move to app */
|
|
8
|
-
export declare const AppProvider: FC<PropsWithChildren<AppProviderProps>>;
|
|
9
|
-
export {};
|
package/App/AppProvider.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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.AppProvider = void 0;
|
|
13
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
-
const app_1 = require("@headless-adminapp/app/app");
|
|
15
|
-
const hooks_1 = require("@headless-adminapp/app/metadata/hooks");
|
|
16
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
17
|
-
const react_1 = require("react");
|
|
18
|
-
/*** @todo: move to app */
|
|
19
|
-
const AppProvider = ({ children, appId, loadingComponent, notFoundComponent, }) => {
|
|
20
|
-
const experienceStore = (0, hooks_1.useExperienceStore)();
|
|
21
|
-
const appStore = (0, hooks_1.useAppStore)();
|
|
22
|
-
const { data: schemaMetadataList } = (0, react_query_1.useQuery)({
|
|
23
|
-
queryKey: ['experience-schema-metadata-list'],
|
|
24
|
-
queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
return experienceStore.getExperienceSchemaMetadatList();
|
|
26
|
-
}),
|
|
27
|
-
initialData: [],
|
|
28
|
-
});
|
|
29
|
-
const { data: app, isLoading } = (0, react_query_1.useQuery)({
|
|
30
|
-
queryKey: ['experience-app', appId],
|
|
31
|
-
queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
-
return appStore.getApp(appId);
|
|
33
|
-
}),
|
|
34
|
-
});
|
|
35
|
-
const schemaMetadataDic = (0, react_1.useMemo)(() => {
|
|
36
|
-
var _a;
|
|
37
|
-
return (_a = schemaMetadataList === null || schemaMetadataList === void 0 ? void 0 : schemaMetadataList.reduce((acc, item) => {
|
|
38
|
-
acc[item.logicalName] = item;
|
|
39
|
-
return acc;
|
|
40
|
-
}, {})) !== null && _a !== void 0 ? _a : {};
|
|
41
|
-
}, [schemaMetadataList]);
|
|
42
|
-
if (isLoading) {
|
|
43
|
-
return loadingComponent;
|
|
44
|
-
}
|
|
45
|
-
if (!app) {
|
|
46
|
-
return notFoundComponent;
|
|
47
|
-
}
|
|
48
|
-
return ((0, jsx_runtime_1.jsx)(app_1.AppContext.Provider, { value: { app, schemaMetadataDic, schemaMetadataList }, children: children }));
|
|
49
|
-
};
|
|
50
|
-
exports.AppProvider = AppProvider;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Attribute, InferredAttributeType } from '@headless-adminapp/core/attributes';
|
|
2
|
-
interface AttributeFormattedValueStringsSet {
|
|
3
|
-
yes: string;
|
|
4
|
-
no: string;
|
|
5
|
-
}
|
|
6
|
-
/*** @todo move to app */
|
|
7
|
-
export declare function getAttributeFormattedValue<A extends Attribute = Attribute>(attribute: Attribute, value: InferredAttributeType<A> | null | undefined, options?: {
|
|
8
|
-
maxCount?: number;
|
|
9
|
-
strings?: AttributeFormattedValueStringsSet;
|
|
10
|
-
dateFormat?: string;
|
|
11
|
-
locale?: string;
|
|
12
|
-
currency?: string;
|
|
13
|
-
currencySign?: 'accounting' | 'standard';
|
|
14
|
-
currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code';
|
|
15
|
-
}): string | null | undefined;
|
|
16
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAttributeFormattedValue = getAttributeFormattedValue;
|
|
7
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
-
const defaultAttributeFormattedValueStrings = {
|
|
9
|
-
yes: 'Yes',
|
|
10
|
-
no: 'No',
|
|
11
|
-
};
|
|
12
|
-
const defaultDateFormat = 'YYYY-MM-DD';
|
|
13
|
-
const defaultLocale = 'en-US';
|
|
14
|
-
const defaultCurrency = 'USD';
|
|
15
|
-
const defaultCurrencySign = 'accounting';
|
|
16
|
-
const defaultCurrencyDisplay = 'symbol';
|
|
17
|
-
/*** @todo move to app */
|
|
18
|
-
function getAttributeFormattedValue(attribute, value, options) {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
20
|
-
if (value === null || value === undefined) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
const strings = (_a = options === null || options === void 0 ? void 0 : options.strings) !== null && _a !== void 0 ? _a : defaultAttributeFormattedValueStrings;
|
|
24
|
-
const dateFormat = (_b = options === null || options === void 0 ? void 0 : options.dateFormat) !== null && _b !== void 0 ? _b : defaultDateFormat;
|
|
25
|
-
const locale = (_c = options === null || options === void 0 ? void 0 : options.locale) !== null && _c !== void 0 ? _c : defaultLocale;
|
|
26
|
-
const currency = (_d = options === null || options === void 0 ? void 0 : options.currency) !== null && _d !== void 0 ? _d : defaultCurrency;
|
|
27
|
-
const currencySign = (_e = options === null || options === void 0 ? void 0 : options.currencySign) !== null && _e !== void 0 ? _e : defaultCurrencySign;
|
|
28
|
-
const currencyDisplay = (_f = options === null || options === void 0 ? void 0 : options.currencyDisplay) !== null && _f !== void 0 ? _f : defaultCurrencyDisplay;
|
|
29
|
-
switch (attribute.type) {
|
|
30
|
-
case 'boolean':
|
|
31
|
-
return value
|
|
32
|
-
? (_g = attribute.trueLabel) !== null && _g !== void 0 ? _g : strings.yes
|
|
33
|
-
: (_h = attribute.falseLabel) !== null && _h !== void 0 ? _h : strings.no;
|
|
34
|
-
case 'choice':
|
|
35
|
-
return ((_j = attribute.options.find((option) => option.value === value)) !== null && _j !== void 0 ? _j : {
|
|
36
|
-
label: '',
|
|
37
|
-
}).label;
|
|
38
|
-
case 'choices':
|
|
39
|
-
return value
|
|
40
|
-
.map((v) => {
|
|
41
|
-
var _a;
|
|
42
|
-
return ((_a = attribute.options.find((option) => option.value === v)) !== null && _a !== void 0 ? _a : {
|
|
43
|
-
label: '',
|
|
44
|
-
}).label;
|
|
45
|
-
})
|
|
46
|
-
.join(', ');
|
|
47
|
-
case 'date':
|
|
48
|
-
return (0, dayjs_1.default)(value).format(dateFormat);
|
|
49
|
-
case 'daterange':
|
|
50
|
-
if (!value)
|
|
51
|
-
return null;
|
|
52
|
-
const from = value[0];
|
|
53
|
-
const to = value[1];
|
|
54
|
-
if (!from && !to) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
if (from && to) {
|
|
58
|
-
return ((0, dayjs_1.default)(from).format(dateFormat) + ' - ' + (0, dayjs_1.default)(to).format(dateFormat));
|
|
59
|
-
}
|
|
60
|
-
if (from) {
|
|
61
|
-
return 'After ' + (0, dayjs_1.default)(from).format(dateFormat);
|
|
62
|
-
}
|
|
63
|
-
if (to) {
|
|
64
|
-
return 'Before ' + (0, dayjs_1.default)(to).format(dateFormat);
|
|
65
|
-
}
|
|
66
|
-
return null;
|
|
67
|
-
case 'lookup':
|
|
68
|
-
return value === null || value === void 0 ? void 0 : value.name;
|
|
69
|
-
case 'lookups':
|
|
70
|
-
const items = value === null || value === void 0 ? void 0 : value.map((v) => v.name);
|
|
71
|
-
if ((options === null || options === void 0 ? void 0 : options.maxCount) && (items === null || items === void 0 ? void 0 : items.length) > options.maxCount) {
|
|
72
|
-
return (items.slice(0, options.maxCount).join(', ') +
|
|
73
|
-
` (+${items.length - options.maxCount})`);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
return items === null || items === void 0 ? void 0 : items.join(', ');
|
|
77
|
-
}
|
|
78
|
-
case 'money':
|
|
79
|
-
return new Intl.NumberFormat(locale, {
|
|
80
|
-
style: 'currency',
|
|
81
|
-
currency,
|
|
82
|
-
currencySign,
|
|
83
|
-
currencyDisplay,
|
|
84
|
-
}).format(value);
|
|
85
|
-
case 'number':
|
|
86
|
-
return new Intl.NumberFormat(locale).format(value);
|
|
87
|
-
default:
|
|
88
|
-
return typeof value === 'object'
|
|
89
|
-
? JSON.stringify(value)
|
|
90
|
-
: value;
|
|
91
|
-
}
|
|
92
|
-
}
|