@headless-adminapp/app 0.0.17-alpha.8 → 1.0.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/app/AppProvider.d.ts +0 -3
- package/app/AppProvider.js +10 -33
- package/app/AuthWrapper.d.ts +1 -1
- package/app/AuthWrapper.js +4 -1
- package/app/LayoutProvider.d.ts +8 -7
- package/app/LayoutProvider.js +28 -2
- package/app/context.d.ts +1 -1
- package/auth/AuthProvider.d.ts +1 -1
- package/auth/AuthProvider.js +30 -23
- package/auth/context.d.ts +2 -0
- package/auth/hooks/useIsSkipAuthCheck.d.ts +1 -0
- package/auth/hooks/useIsSkipAuthCheck.js +8 -0
- package/auth/hooks/useLogout.js +1 -1
- package/board/BoardColumnDataResolver.d.ts +1 -0
- package/board/BoardColumnDataResolver.js +64 -0
- package/board/BoardColumnProvider.d.ts +7 -0
- package/board/BoardColumnProvider.js +36 -0
- package/board/context.d.ts +19 -0
- package/board/context.js +6 -0
- package/board/hooks/index.d.ts +6 -0
- package/board/hooks/index.js +15 -0
- package/board/hooks/useBoardColumnConfig.d.ts +2 -0
- package/board/hooks/useBoardColumnConfig.js +8 -0
- package/board/hooks/useBoardColumnData.d.ts +3 -0
- package/board/hooks/useBoardColumnData.js +9 -0
- package/board/hooks/useBoardColumnDataState.d.ts +5 -0
- package/board/hooks/useBoardColumnDataState.js +9 -0
- package/board/hooks/useBoardConfig.d.ts +3 -0
- package/board/hooks/useBoardConfig.js +8 -0
- package/board/hooks/useBoardSchema.d.ts +2 -0
- package/board/hooks/useBoardSchema.js +7 -0
- package/board/hooks/useSearchText.d.ts +1 -0
- package/board/hooks/useSearchText.js +14 -0
- package/board/types.d.ts +47 -0
- package/board/utils.d.ts +3 -0
- package/board/utils.js +6 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +15 -6
- package/builders/CommandBuilder/DefaultCommandBuilder.js +42 -20
- package/builders/CommandBuilder/FormCommandBuilder.d.ts +14 -13
- package/builders/CommandBuilder/FormCommandBuilder.js +66 -52
- package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +8 -27
- package/builders/CommandBuilder/SubgridCommandBuilder.js +115 -57
- package/builders/CommandBuilder/ViewCommandBuilder.js +32 -52
- package/builders/CommandBuilder/utils.js +1 -1
- package/builders/DefineFormExperience.d.ts +27 -0
- package/builders/DefineFormExperience.js +99 -0
- package/builders/DefineViewExperience.d.ts +13 -0
- package/builders/DefineViewExperience.js +33 -0
- package/builders/SchemaExperienceBuilder.d.ts +9 -7
- package/builders/SchemaExperienceBuilder.js +62 -40
- package/builders/utils.js +30 -44
- package/calendar/baseEventAttributes.d.ts +35 -0
- package/calendar/baseEventAttributes.js +38 -0
- package/calendar/context.d.ts +6 -0
- package/calendar/context.js +5 -0
- package/calendar/hooks/index.d.ts +1 -0
- package/{appearance → calendar}/hooks/index.js +1 -1
- package/calendar/hooks/useConfig.d.ts +3 -0
- package/calendar/hooks/useConfig.js +8 -0
- package/calendar/types.d.ts +41 -0
- package/calendar/types.js +2 -0
- package/calendar/utils.d.ts +3 -0
- package/calendar/utils.js +6 -0
- package/command/hooks/useBaseCommandHandlerContext.js +15 -6
- package/command/hooks/useCommands.js +1 -1
- package/command/utils/index.js +34 -9
- package/components/ScrollView/index.d.ts +1 -1
- package/components/ScrollView/index.js +2 -2
- package/components/ScrollbarWithMoreDataRequest/index.d.ts +9 -0
- package/components/ScrollbarWithMoreDataRequest/index.js +32 -0
- package/dataform/DataFormProvider/CustomHookExecuter.d.ts +5 -0
- package/dataform/DataFormProvider/CustomHookExecuter.js +14 -0
- package/dataform/DataFormProvider/DataResolver.d.ts +6 -4
- package/dataform/DataFormProvider/DataResolver.js +11 -94
- package/dataform/DataFormProvider/InitialValueResolver.js +3 -2
- package/dataform/DataFormProvider/ReadonlyInfoResolver.js +2 -3
- package/dataform/DataFormProvider/getRecord.d.ts +3 -0
- package/dataform/DataFormProvider/getRecord.js +56 -0
- package/dataform/DataFormProvider/index.d.ts +4 -0
- package/dataform/DataFormProvider/index.js +34 -12
- package/dataform/DataFormProvider/types.d.ts +13 -0
- package/dataform/DataFormProvider/types.js +2 -0
- package/dataform/DataFormProvider/utils.d.ts +23 -0
- package/dataform/DataFormProvider/utils.js +105 -0
- package/dataform/FormManager.d.ts +57 -0
- package/dataform/FormManager.js +247 -0
- package/dataform/constants.d.ts +1 -0
- package/dataform/constants.js +4 -0
- package/dataform/context.d.ts +26 -1
- package/dataform/hooks/index.d.ts +11 -0
- package/dataform/hooks/index.js +11 -0
- package/dataform/hooks/useContextKey.d.ts +1 -0
- package/dataform/hooks/useContextKey.js +8 -0
- package/dataform/hooks/useDisabledControlsManager.d.ts +6 -0
- package/dataform/hooks/useDisabledControlsManager.js +46 -0
- package/dataform/hooks/useEventManager.d.ts +1 -0
- package/dataform/hooks/useEventManager.js +8 -0
- package/dataform/hooks/useFormManager.d.ts +2 -0
- package/dataform/hooks/useFormManager.js +13 -0
- package/dataform/hooks/useFormNotifications.js +2 -2
- package/dataform/hooks/useFormSave.js +28 -31
- package/dataform/hooks/useHiddenControlsManager.d.ts +7 -0
- package/dataform/hooks/useHiddenControlsManager.js +50 -0
- package/dataform/hooks/useIsControlDisabled.d.ts +1 -0
- package/dataform/hooks/useIsControlDisabled.js +27 -0
- package/dataform/hooks/useIsControlHiddenByAttributeName.d.ts +1 -0
- package/dataform/hooks/useIsControlHiddenByAttributeName.js +17 -0
- package/dataform/hooks/useIsControlHiddenByKey.d.ts +1 -0
- package/dataform/hooks/useIsControlHiddenByKey.js +17 -0
- package/dataform/hooks/useIsFieldRequired.d.ts +1 -0
- package/dataform/hooks/useIsFieldRequired.js +25 -0
- package/dataform/hooks/useLoadFormGridPage.js +8 -17
- package/dataform/hooks/useMainFormCommands.d.ts +1 -12
- package/dataform/hooks/useMainFormCommands.js +13 -3
- package/dataform/hooks/useOnFieldValueChangeListener.d.ts +1 -0
- package/dataform/hooks/useOnFieldValueChangeListener.js +30 -0
- package/dataform/hooks/useProcessFlowSteps.d.ts +1 -0
- package/dataform/hooks/useProcessFlowSteps.js +45 -0
- package/dataform/hooks/useRecordTitle.d.ts +3 -1
- package/dataform/hooks/useRecordTitle.js +12 -5
- package/dataform/hooks/useRequiredFieldManager.d.ts +6 -0
- package/dataform/hooks/useRequiredFieldManager.js +49 -0
- package/dataform/test.d.ts +57 -0
- package/dataform/test.js +247 -0
- package/dataform/utils/defaultParameters.d.ts +6 -0
- package/dataform/utils/defaultParameters.js +54 -0
- package/dataform/utils/index.d.ts +6 -24
- package/dataform/utils/index.js +164 -190
- package/dataform/utils/saveRecord.d.ts +27 -0
- package/dataform/utils/saveRecord.js +163 -0
- package/datagrid/DataGridProvider/DataResolver.js +38 -109
- package/datagrid/DataGridProvider/index.d.ts +6 -0
- package/datagrid/DataGridProvider/index.js +18 -8
- package/datagrid/DataGridProvider/transformViewColumns.js +10 -2
- package/datagrid/DataGridProvider/utils.js +8 -8
- package/datagrid/column-filter/constants.js +38 -3
- package/datagrid/column-filter/utils.js +7 -1
- package/datagrid/context.d.ts +6 -0
- package/datagrid/hooks/useChangeView.js +1 -1
- package/datagrid/hooks/useGridColumnFilter.js +4 -1
- package/datagrid/hooks/useGridDisabled.d.ts +1 -0
- package/datagrid/hooks/useGridDisabled.js +8 -0
- package/datagrid/hooks/useLoadMainGridPage.js +1 -1
- package/datagrid/hooks/useMainGridCommands.js +23 -9
- package/datagrid/hooks/useOpenRecord.js +2 -2
- package/datagrid/hooks/useSubGridCommands.js +23 -45
- package/defaults.d.ts +2 -0
- package/defaults.js +5 -0
- package/dialog/hooks/useCloseDialog.js +17 -15
- package/dialog/hooks/useOpenAlertDialog.js +8 -3
- package/dialog/hooks/useOpenConfirmDialog.js +10 -4
- package/dialog/hooks/useOpenDialog.js +7 -5
- package/dialog/hooks/useOpenErrorDialog.js +8 -3
- package/dialog/hooks/useOpenPromptDialog.js +10 -4
- package/form/FormValidationStringContext.d.ts +1 -0
- package/form/FormValidationStringContext.js +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +3 -0
- package/hooks/useDebouncedValue.js +0 -1
- package/hooks/useElementLayout.js +1 -1
- package/hooks/useIsMobile.js +0 -1
- package/hooks/useItemsWithKey.d.ts +7 -0
- package/hooks/useItemsWithKey.js +13 -0
- package/hooks/useStorageState.js +1 -2
- package/hooks/useSystemColorScheme.d.ts +1 -1
- package/hooks/useSystemColorScheme.js +0 -1
- package/insights/InsightsProvider.d.ts +8 -0
- package/insights/InsightsProvider.js +27 -0
- package/locale/LocaleProvider.d.ts +2 -1
- package/locale/LocaleProvider.js +3 -3
- package/locale/index.d.ts +1 -0
- package/locale/index.js +1 -0
- package/locale/useCurrencySymbol.d.ts +1 -0
- package/locale/useCurrencySymbol.js +12 -0
- package/locale/utils.js +4 -2
- package/metadata/MetadataProvider.d.ts +8 -4
- package/metadata/MetadataProvider.js +23 -17
- package/metadata/context.d.ts +3 -2
- package/metadata/hooks/index.d.ts +1 -1
- package/metadata/hooks/index.js +1 -1
- package/metadata/hooks/useAppExperience.d.ts +1 -0
- package/metadata/hooks/useAppExperience.js +8 -0
- package/metadata/hooks/useAppStore.d.ts +1 -1
- package/metadata/hooks/useAppStore.js +3 -3
- package/metadata/hooks/useExperienceView.js +2 -11
- package/metadata/hooks/useExperienceViewCommands.d.ts +1 -1
- package/metadata/hooks/useExperienceViewCommands.js +5 -14
- package/metadata/hooks/useExperienceViewLookup.js +2 -11
- package/metadata/hooks/useExperienceViewSubgridCommands.d.ts +1 -1
- package/metadata/hooks/useExperienceViewSubgridCommands.js +5 -14
- package/metadata/hooks/useMetadata.d.ts +11 -10
- package/metadata/hooks/useMetadata.js +4 -16
- package/metadata/hooks/useSchema.d.ts +1 -1
- package/metadata/hooks/useSchema.js +3 -0
- package/mutable/context.d.ts +3 -0
- package/mutable/context.js +8 -0
- package/mutable/utils.js +5 -12
- package/navigation/hooks/useOpenForm.js +4 -0
- package/package.json +6 -10
- package/providers/PageEntityFormProvider/index.d.ts +5 -1
- package/providers/PageEntityFormProvider/index.js +2 -2
- package/recordset/hooks/useRecordSetResult.js +4 -14
- package/route/RouteProvider.d.ts +2 -2
- package/route/RouteProvider.js +4 -1
- package/store/ClientAppStore.js +7 -20
- package/store/ComponentStore.d.ts +1 -1
- package/store/ComponentStore.js +6 -12
- package/store/EventManager.d.ts +2 -2
- package/store/EventManager.js +13 -29
- package/store/SchemaExperienceStore.js +179 -215
- package/store/index.d.ts +0 -1
- package/store/index.js +0 -1
- package/toast-notification/hooks/useCloseToastNotification.js +17 -15
- package/toast-notification/hooks/useOpenToastNotification.js +7 -5
- package/transport/InMemoryDataService/index.js +54 -77
- package/transport/RestDataService/index.d.ts +3 -3
- package/transport/RestDataService/index.js +68 -91
- package/transport/context.d.ts +2 -1
- package/transport/context.js +7 -1
- package/transport/hooks/index.d.ts +1 -0
- package/transport/hooks/index.js +1 -0
- package/transport/hooks/useFileService.d.ts +1 -0
- package/transport/hooks/useFileService.js +9 -0
- package/transport/hooks/useRetriveRecords.d.ts +33 -0
- package/transport/hooks/useRetriveRecords.js +110 -0
- package/utils/calculateColumnWidths.js +1 -1
- package/utils/color.d.ts +1 -0
- package/utils/color.js +14 -0
- package/utils/getAttributeFormattedValue.d.ts +4 -1
- package/utils/getAttributeFormattedValue.js +109 -54
- package/utils/phone.d.ts +13 -0
- package/utils/phone.js +33 -0
- package/appearance/context.d.ts +0 -7
- package/appearance/context.js +0 -5
- package/appearance/hooks/index.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.js +0 -12
- package/appearance/index.d.ts +0 -2
- package/appearance/index.js +0 -20
- package/builders/CommandBuilder.d.ts +0 -176
- package/builders/CommandBuilder.js +0 -567
- package/locale/types.d.ts +0 -2
- /package/{locale → board}/types.js +0 -0
|
@@ -5,84 +5,139 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getAttributeFormattedValue = getAttributeFormattedValue;
|
|
7
7
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
9
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
10
|
+
const phone_1 = require("./phone");
|
|
11
|
+
dayjs_1.default.extend(utc_1.default);
|
|
12
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
8
13
|
const defaultAttributeFormattedValueStrings = {
|
|
9
14
|
yes: 'Yes',
|
|
10
15
|
no: 'No',
|
|
11
16
|
};
|
|
12
17
|
const defaultDateFormat = 'YYYY-MM-DD';
|
|
18
|
+
const defaultTimeFormat = 'HH:mm';
|
|
13
19
|
const defaultLocale = 'en-US';
|
|
14
20
|
const defaultCurrency = 'USD';
|
|
15
21
|
const defaultCurrencySign = 'accounting';
|
|
16
22
|
const defaultCurrencyDisplay = 'symbol';
|
|
23
|
+
function getAttributeLookupsFormattedValue(value, options) {
|
|
24
|
+
const items = value?.map((v) => v.name);
|
|
25
|
+
if (options?.maxCount && items?.length > options.maxCount) {
|
|
26
|
+
return (items.slice(0, options.maxCount).join(', ') +
|
|
27
|
+
` (+${items.length - options.maxCount})`);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return items?.join(', ');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function getAttributeAttachmentFormattedValue(value) {
|
|
34
|
+
return value?.url ?? null;
|
|
35
|
+
}
|
|
36
|
+
function getAttributeDateFormattedValue(attribute, value, options) {
|
|
37
|
+
const dateFormat = options?.dateFormat ?? defaultDateFormat;
|
|
38
|
+
const timeFormat = options?.timeFormat ?? defaultTimeFormat;
|
|
39
|
+
if (attribute.format === 'datetime') {
|
|
40
|
+
return (0, dayjs_1.default)(value)
|
|
41
|
+
.tz(options?.timezone)
|
|
42
|
+
.format(dateFormat + ' ' + timeFormat);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return (0, dayjs_1.default)(value)
|
|
46
|
+
.tz(options?.timezone)
|
|
47
|
+
.format(dateFormat);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function getAttributeDateRangeFormattedValue(value, options) {
|
|
51
|
+
if (!value)
|
|
52
|
+
return null;
|
|
53
|
+
const dateFormat = options?.dateFormat ?? defaultDateFormat;
|
|
54
|
+
const from = value[0];
|
|
55
|
+
const to = value[1];
|
|
56
|
+
if (!from && !to) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
if (from && to) {
|
|
60
|
+
return ((0, dayjs_1.default)(from).tz(options?.timezone).format(dateFormat) +
|
|
61
|
+
' - ' +
|
|
62
|
+
(0, dayjs_1.default)(to).tz(options?.timezone).format(dateFormat));
|
|
63
|
+
}
|
|
64
|
+
if (from) {
|
|
65
|
+
return 'After ' + (0, dayjs_1.default)(from).tz(options?.timezone).format(dateFormat);
|
|
66
|
+
}
|
|
67
|
+
if (to) {
|
|
68
|
+
return 'Before ' + (0, dayjs_1.default)(to).tz(options?.timezone).format(dateFormat);
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function getAttributeBooleanFormattedValue(attribute, value, options) {
|
|
73
|
+
const strings = options?.strings ?? defaultAttributeFormattedValueStrings;
|
|
74
|
+
return value
|
|
75
|
+
? attribute.trueLabel ?? strings.yes
|
|
76
|
+
: attribute.falseLabel ?? strings.no;
|
|
77
|
+
}
|
|
78
|
+
function getAttributeChoiceFormattedValue(attribute, value) {
|
|
79
|
+
return (attribute.options.find((option) => option.value === value) ?? {
|
|
80
|
+
label: '',
|
|
81
|
+
}).label;
|
|
82
|
+
}
|
|
83
|
+
function getAttributeChoicesFormattedValue(attribute, value) {
|
|
84
|
+
return value
|
|
85
|
+
.map((v) => {
|
|
86
|
+
return (attribute.options.find((option) => option.value === v) ?? {
|
|
87
|
+
label: '',
|
|
88
|
+
}).label;
|
|
89
|
+
})
|
|
90
|
+
.join(', ');
|
|
91
|
+
}
|
|
92
|
+
function getAttributeLookupFormattedValue(value) {
|
|
93
|
+
return value?.name;
|
|
94
|
+
}
|
|
95
|
+
function getAttributeMoneyFormattedValue(value, options) {
|
|
96
|
+
const locale = options?.locale ?? defaultLocale;
|
|
97
|
+
const currency = options?.currency ?? defaultCurrency;
|
|
98
|
+
const currencySign = options?.currencySign ?? defaultCurrencySign;
|
|
99
|
+
const currencyDisplay = options?.currencyDisplay ?? defaultCurrencyDisplay;
|
|
100
|
+
return new Intl.NumberFormat(locale, {
|
|
101
|
+
style: 'currency',
|
|
102
|
+
currency,
|
|
103
|
+
currencySign,
|
|
104
|
+
currencyDisplay,
|
|
105
|
+
}).format(value);
|
|
106
|
+
}
|
|
17
107
|
function getAttributeFormattedValue(attribute, value, options) {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
19
108
|
if (value === null || value === undefined) {
|
|
20
109
|
return null;
|
|
21
110
|
}
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const locale = (_c = options === null || options === void 0 ? void 0 : options.locale) !== null && _c !== void 0 ? _c : defaultLocale;
|
|
25
|
-
const currency = (_d = options === null || options === void 0 ? void 0 : options.currency) !== null && _d !== void 0 ? _d : defaultCurrency;
|
|
26
|
-
const currencySign = (_e = options === null || options === void 0 ? void 0 : options.currencySign) !== null && _e !== void 0 ? _e : defaultCurrencySign;
|
|
27
|
-
const currencyDisplay = (_f = options === null || options === void 0 ? void 0 : options.currencyDisplay) !== null && _f !== void 0 ? _f : defaultCurrencyDisplay;
|
|
111
|
+
const locale = options?.locale ?? defaultLocale;
|
|
112
|
+
const region = options?.region ?? 'US';
|
|
28
113
|
switch (attribute.type) {
|
|
29
114
|
case 'boolean':
|
|
30
|
-
return value
|
|
31
|
-
? (_g = attribute.trueLabel) !== null && _g !== void 0 ? _g : strings.yes
|
|
32
|
-
: (_h = attribute.falseLabel) !== null && _h !== void 0 ? _h : strings.no;
|
|
115
|
+
return getAttributeBooleanFormattedValue(attribute, value, options);
|
|
33
116
|
case 'choice':
|
|
34
|
-
return (
|
|
35
|
-
label: '',
|
|
36
|
-
}).label;
|
|
117
|
+
return getAttributeChoiceFormattedValue(attribute, value);
|
|
37
118
|
case 'choices':
|
|
38
|
-
return value
|
|
39
|
-
.map((v) => {
|
|
40
|
-
var _a;
|
|
41
|
-
return ((_a = attribute.options.find((option) => option.value === v)) !== null && _a !== void 0 ? _a : {
|
|
42
|
-
label: '',
|
|
43
|
-
}).label;
|
|
44
|
-
})
|
|
45
|
-
.join(', ');
|
|
119
|
+
return getAttributeChoicesFormattedValue(attribute, value);
|
|
46
120
|
case 'date':
|
|
47
|
-
return (
|
|
121
|
+
return getAttributeDateFormattedValue(attribute, value, options);
|
|
48
122
|
case 'daterange':
|
|
49
|
-
|
|
50
|
-
return null;
|
|
51
|
-
const from = value[0];
|
|
52
|
-
const to = value[1];
|
|
53
|
-
if (!from && !to) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
if (from && to) {
|
|
57
|
-
return ((0, dayjs_1.default)(from).format(dateFormat) + ' - ' + (0, dayjs_1.default)(to).format(dateFormat));
|
|
58
|
-
}
|
|
59
|
-
if (from) {
|
|
60
|
-
return 'After ' + (0, dayjs_1.default)(from).format(dateFormat);
|
|
61
|
-
}
|
|
62
|
-
if (to) {
|
|
63
|
-
return 'Before ' + (0, dayjs_1.default)(to).format(dateFormat);
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
123
|
+
return getAttributeDateRangeFormattedValue(value, options);
|
|
66
124
|
case 'lookup':
|
|
67
|
-
return value
|
|
125
|
+
return getAttributeLookupFormattedValue(value);
|
|
68
126
|
case 'lookups':
|
|
69
|
-
|
|
70
|
-
if ((options === null || options === void 0 ? void 0 : options.maxCount) && (items === null || items === void 0 ? void 0 : items.length) > options.maxCount) {
|
|
71
|
-
return (items.slice(0, options.maxCount).join(', ') +
|
|
72
|
-
` (+${items.length - options.maxCount})`);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return items === null || items === void 0 ? void 0 : items.join(', ');
|
|
76
|
-
}
|
|
127
|
+
return getAttributeLookupsFormattedValue(value, options);
|
|
77
128
|
case 'money':
|
|
78
|
-
return
|
|
79
|
-
style: 'currency',
|
|
80
|
-
currency,
|
|
81
|
-
currencySign,
|
|
82
|
-
currencyDisplay,
|
|
83
|
-
}).format(value);
|
|
129
|
+
return getAttributeMoneyFormattedValue(value, options);
|
|
84
130
|
case 'number':
|
|
85
131
|
return new Intl.NumberFormat(locale).format(value);
|
|
132
|
+
case 'attachment':
|
|
133
|
+
return getAttributeAttachmentFormattedValue(value);
|
|
134
|
+
case 'string':
|
|
135
|
+
if (attribute.format === 'phone' && typeof value === 'string') {
|
|
136
|
+
return (0, phone_1.parsePhoneNumber)(value, region).formattedNationalValue;
|
|
137
|
+
}
|
|
138
|
+
return typeof value === 'object'
|
|
139
|
+
? JSON.stringify(value)
|
|
140
|
+
: value;
|
|
86
141
|
default:
|
|
87
142
|
return typeof value === 'object'
|
|
88
143
|
? JSON.stringify(value)
|
package/utils/phone.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function parsePhoneNumber(input: string, defaultCountry?: string): {
|
|
2
|
+
formattedInternationalValue: string;
|
|
3
|
+
formattedNationalValue: string;
|
|
4
|
+
rawValue: string;
|
|
5
|
+
isValid: boolean;
|
|
6
|
+
uri: string;
|
|
7
|
+
} | {
|
|
8
|
+
formattedInternationalValue: string;
|
|
9
|
+
formattedNationalValue: string;
|
|
10
|
+
rawValue: string;
|
|
11
|
+
isValid: boolean;
|
|
12
|
+
uri: null;
|
|
13
|
+
};
|
package/utils/phone.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parsePhoneNumber = parsePhoneNumber;
|
|
4
|
+
const libphonenumber_js_1 = require("libphonenumber-js");
|
|
5
|
+
function parsePhoneNumber(input, defaultCountry) {
|
|
6
|
+
try {
|
|
7
|
+
const phoneNumber = (0, libphonenumber_js_1.parsePhoneNumberWithError)(input, defaultCountry);
|
|
8
|
+
let rawValue = String(phoneNumber.number);
|
|
9
|
+
if (phoneNumber.ext) {
|
|
10
|
+
rawValue += ';ext=' + phoneNumber.ext;
|
|
11
|
+
}
|
|
12
|
+
let formattedNational = phoneNumber.formatInternational();
|
|
13
|
+
if (defaultCountry && defaultCountry === phoneNumber.country) {
|
|
14
|
+
formattedNational = phoneNumber.formatNational();
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
formattedInternationalValue: phoneNumber.formatInternational(),
|
|
18
|
+
formattedNationalValue: formattedNational,
|
|
19
|
+
rawValue: rawValue,
|
|
20
|
+
isValid: phoneNumber.isPossible(),
|
|
21
|
+
uri: phoneNumber.getURI(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
formattedInternationalValue: input,
|
|
27
|
+
formattedNationalValue: input,
|
|
28
|
+
rawValue: input,
|
|
29
|
+
isValid: false,
|
|
30
|
+
uri: null,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
package/appearance/context.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
export type ColorScheme = 'system' | 'light' | 'dark';
|
|
3
|
-
export interface AppearanceContextState {
|
|
4
|
-
colorScheme: ColorScheme;
|
|
5
|
-
brandColor: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const AppearanceContext: import("react").Context<[AppearanceContextState, Dispatch<SetStateAction<AppearanceContextState>>] | null>;
|
package/appearance/context.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useAppearanceContext';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useAppearanceContext(): [import("../context").AppearanceContextState, import("react").Dispatch<import("react").SetStateAction<import("../context").AppearanceContextState>>];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAppearanceContext = useAppearanceContext;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const context_1 = require("../context");
|
|
6
|
-
function useAppearanceContext() {
|
|
7
|
-
const context = (0, react_1.useContext)(context_1.AppearanceContext);
|
|
8
|
-
if (!context) {
|
|
9
|
-
throw new Error('useAppContext must be used within a AppContextProvider');
|
|
10
|
-
}
|
|
11
|
-
return context;
|
|
12
|
-
}
|
package/appearance/index.d.ts
DELETED
package/appearance/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.AppearanceContext = void 0;
|
|
18
|
-
var context_1 = require("./context");
|
|
19
|
-
Object.defineProperty(exports, "AppearanceContext", { enumerable: true, get: function () { return context_1.AppearanceContext; } });
|
|
20
|
-
__exportStar(require("./hooks"), exports);
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { EntityFormCommandContext, EntityMainFormCommandItemExperience } from '@headless-adminapp/core/experience/form';
|
|
2
|
-
import { EntityMainGridCommandItemExperience, SubGridCommandItemExperience } from '@headless-adminapp/core/experience/view';
|
|
3
|
-
import { Localized } from '@headless-adminapp/core/types';
|
|
4
|
-
import { Icon } from '@headless-adminapp/icons';
|
|
5
|
-
export declare function localizedLabel<T extends {
|
|
6
|
-
label: string;
|
|
7
|
-
localizedLabels?: Localized<string>;
|
|
8
|
-
}>(language: string, value: T, fallback?: T): string;
|
|
9
|
-
export declare function createLocalizedSelector<T>(stringSet: T, localizedStringSet: Localized<T> | undefined, language: string): <U>(selector: (stringSet: T) => U) => U;
|
|
10
|
-
export declare namespace CommandBuilder {
|
|
11
|
-
namespace View {
|
|
12
|
-
export function createNewRecordCommand({ Icon, text, localizedTexts, }: {
|
|
13
|
-
Icon: Icon;
|
|
14
|
-
text: string;
|
|
15
|
-
localizedTexts?: Record<string, string>;
|
|
16
|
-
}): EntityMainGridCommandItemExperience;
|
|
17
|
-
export function createEditRecordCommand({ Icon, text, localizedTexts, }: {
|
|
18
|
-
Icon: Icon;
|
|
19
|
-
text: string;
|
|
20
|
-
localizedTexts?: Record<string, string>;
|
|
21
|
-
}): EntityMainGridCommandItemExperience;
|
|
22
|
-
interface DeleteRecordCommandStringSet {
|
|
23
|
-
confirmation: {
|
|
24
|
-
title: string | string[];
|
|
25
|
-
text: string | string[];
|
|
26
|
-
buttonCancel: string;
|
|
27
|
-
buttonConfirm: string;
|
|
28
|
-
};
|
|
29
|
-
status: {
|
|
30
|
-
deleting: string | string[];
|
|
31
|
-
};
|
|
32
|
-
successNotification: {
|
|
33
|
-
title: string | string[];
|
|
34
|
-
text: string | string[];
|
|
35
|
-
};
|
|
36
|
-
errorNotification: {
|
|
37
|
-
title: string;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
|
|
41
|
-
export function createDeleteRecordCommand({ Icon, localizedText, text, stringSet, localizedStringSet, }: {
|
|
42
|
-
Icon: Icon;
|
|
43
|
-
text: string;
|
|
44
|
-
localizedText?: Record<string, string>;
|
|
45
|
-
stringSet?: DeleteRecordCommandStringSet;
|
|
46
|
-
localizedStringSet?: Localized<DeleteRecordCommandStringSet>;
|
|
47
|
-
}): EntityMainGridCommandItemExperience;
|
|
48
|
-
export function createRefreshCommand({ Icon, localizedTexts, text, }: {
|
|
49
|
-
Icon: Icon;
|
|
50
|
-
text: string;
|
|
51
|
-
localizedTexts?: Record<string, string>;
|
|
52
|
-
}): EntityMainGridCommandItemExperience;
|
|
53
|
-
export function createExportCommand({ button, csv, excel, }: {
|
|
54
|
-
button: {
|
|
55
|
-
Icon: Icon;
|
|
56
|
-
text: string;
|
|
57
|
-
localizedTexts?: Record<string, string>;
|
|
58
|
-
};
|
|
59
|
-
excel: {
|
|
60
|
-
Icon: Icon;
|
|
61
|
-
text: string;
|
|
62
|
-
localizedTexts?: Record<string, string>;
|
|
63
|
-
};
|
|
64
|
-
csv: {
|
|
65
|
-
Icon: Icon;
|
|
66
|
-
text: string;
|
|
67
|
-
localizedTexts?: Record<string, string>;
|
|
68
|
-
};
|
|
69
|
-
}): EntityMainGridCommandItemExperience;
|
|
70
|
-
export {};
|
|
71
|
-
}
|
|
72
|
-
namespace Form {
|
|
73
|
-
export function createSaveCommand({ Icon, text, localizedTexts, }: {
|
|
74
|
-
Icon: Icon;
|
|
75
|
-
text: string;
|
|
76
|
-
localizedTexts?: Record<string, string>;
|
|
77
|
-
}): EntityMainFormCommandItemExperience;
|
|
78
|
-
export function createSaveAndCloseCommand({ Icon, text, localizedTexts, }: {
|
|
79
|
-
Icon: Icon;
|
|
80
|
-
text: string;
|
|
81
|
-
localizedTexts?: Record<string, string>;
|
|
82
|
-
}): EntityMainFormCommandItemExperience;
|
|
83
|
-
interface DeleteRecordCommandStringSet {
|
|
84
|
-
confirmation: {
|
|
85
|
-
title: string;
|
|
86
|
-
text: string;
|
|
87
|
-
buttonCancel: string;
|
|
88
|
-
buttonConfirm: string;
|
|
89
|
-
};
|
|
90
|
-
status: {
|
|
91
|
-
deleting: string;
|
|
92
|
-
};
|
|
93
|
-
successNotification: {
|
|
94
|
-
title: string;
|
|
95
|
-
text: string;
|
|
96
|
-
};
|
|
97
|
-
errorNotification: {
|
|
98
|
-
title: string;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
|
|
102
|
-
export function createDeleteCommand({ Icon, text, localizedTexts, stringSet, }: {
|
|
103
|
-
Icon: Icon;
|
|
104
|
-
text: string;
|
|
105
|
-
localizedTexts?: Record<string, string>;
|
|
106
|
-
stringSet: DeleteRecordCommandStringSet | ((context: EntityFormCommandContext) => DeleteRecordCommandStringSet);
|
|
107
|
-
}): EntityMainFormCommandItemExperience;
|
|
108
|
-
export function createRefreshCommand({ Icon, text, localizedTexts, }: {
|
|
109
|
-
Icon: Icon;
|
|
110
|
-
text: string;
|
|
111
|
-
localizedTexts?: Record<string, string>;
|
|
112
|
-
}): EntityMainFormCommandItemExperience;
|
|
113
|
-
export {};
|
|
114
|
-
}
|
|
115
|
-
namespace Subgrid {
|
|
116
|
-
export function createNewRecordCommand({ Icon, text, localizedTexts, }: {
|
|
117
|
-
Icon: Icon;
|
|
118
|
-
text: string;
|
|
119
|
-
localizedTexts?: Record<string, string>;
|
|
120
|
-
}): SubGridCommandItemExperience;
|
|
121
|
-
export function createEditRecordCommand({ Icon, text, localizedTexts, }: {
|
|
122
|
-
Icon: Icon;
|
|
123
|
-
text: string;
|
|
124
|
-
localizedTexts?: Record<string, string>;
|
|
125
|
-
}): SubGridCommandItemExperience;
|
|
126
|
-
interface DeleteRecordCommandStringSet {
|
|
127
|
-
confirmation: {
|
|
128
|
-
title: string | string[];
|
|
129
|
-
text: string | string[];
|
|
130
|
-
buttonCancel: string;
|
|
131
|
-
buttonConfirm: string;
|
|
132
|
-
};
|
|
133
|
-
status: {
|
|
134
|
-
deleting: string | string[];
|
|
135
|
-
};
|
|
136
|
-
successNotification: {
|
|
137
|
-
title: string | string[];
|
|
138
|
-
text: string | string[];
|
|
139
|
-
};
|
|
140
|
-
errorNotification: {
|
|
141
|
-
title: string;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
|
|
145
|
-
export function createDeleteRecordCommand({ Icon, localizedText, text, stringSet, localizedStringSet, }: {
|
|
146
|
-
Icon: Icon;
|
|
147
|
-
text: string;
|
|
148
|
-
localizedText?: Record<string, string>;
|
|
149
|
-
stringSet?: DeleteRecordCommandStringSet;
|
|
150
|
-
localizedStringSet?: Localized<DeleteRecordCommandStringSet>;
|
|
151
|
-
}): SubGridCommandItemExperience;
|
|
152
|
-
export function createRefreshCommand({ Icon, localizedTexts, text, }: {
|
|
153
|
-
Icon: Icon;
|
|
154
|
-
text: string;
|
|
155
|
-
localizedTexts?: Record<string, string>;
|
|
156
|
-
}): SubGridCommandItemExperience;
|
|
157
|
-
export function createExportCommand({ button, csv, excel, }: {
|
|
158
|
-
button: {
|
|
159
|
-
Icon: Icon;
|
|
160
|
-
text: string;
|
|
161
|
-
localizedTexts?: Record<string, string>;
|
|
162
|
-
};
|
|
163
|
-
excel: {
|
|
164
|
-
Icon: Icon;
|
|
165
|
-
text: string;
|
|
166
|
-
localizedTexts?: Record<string, string>;
|
|
167
|
-
};
|
|
168
|
-
csv: {
|
|
169
|
-
Icon: Icon;
|
|
170
|
-
text: string;
|
|
171
|
-
localizedTexts?: Record<string, string>;
|
|
172
|
-
};
|
|
173
|
-
}): SubGridCommandItemExperience;
|
|
174
|
-
export {};
|
|
175
|
-
}
|
|
176
|
-
}
|