@headless-adminapp/app 1.2.0 → 1.2.3

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.
@@ -1,3 +1,4 @@
1
+ import type { EventContentArg } from '@fullcalendar/core';
1
2
  import { AuthSession } from '@headless-adminapp/core/experience/auth';
2
3
  import { OpenFormOptions } from '@headless-adminapp/core/experience/command';
3
4
  import { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
@@ -40,6 +41,12 @@ export interface CalendarConfig<SA1 extends SchemaAttributes = SchemaAttributes,
40
41
  description: string;
41
42
  eventLabel: string;
42
43
  disableAllDay?: boolean;
44
+ EventItemPreviewComponent?: React.ComponentType<{
45
+ eventInfo: EventContentArg;
46
+ }>;
47
+ EventExtendedDetailComponent?: React.ComponentType<{
48
+ eventInfo: EventContentArg;
49
+ }>;
43
50
  createOptions?: {
44
51
  mode: 'dialog';
45
52
  } | {
@@ -33,6 +33,8 @@ const utils_1 = require("../../dataform/DataFormProvider/utils");
33
33
  const utils_2 = require("../../locale/utils");
34
34
  var saveRecord_1 = require("./saveRecord");
35
35
  Object.defineProperty(exports, "saveRecord", { enumerable: true, get: function () { return saveRecord_1.saveRecord; } });
36
+ const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
37
+ const objectIdRegex = /^[0-9a-f]{24}$/i;
36
38
  function getInitialValues({ cloneRecord, form, record, recordId, schema, defaultParameters, }) {
37
39
  const formColumns = (0, utils_1.getColumns)(form, schema);
38
40
  const editableGridControls = (0, utils_1.getControls)(form).filter((control) => control.type === 'editablegrid' && control.alias !== false);
@@ -253,6 +255,14 @@ function createAttributeValidationSchema(attribute) {
253
255
  case 'lookups':
254
256
  validationSchema = yup.array().nullable();
255
257
  break;
258
+ case 'id':
259
+ if ('number' in attribute && attribute.number) {
260
+ validationSchema = yup.number().nullable();
261
+ }
262
+ else {
263
+ validationSchema = yup.string().nullable();
264
+ }
265
+ break;
256
266
  default:
257
267
  validationSchema = yup.mixed().nullable();
258
268
  break;
@@ -284,6 +294,14 @@ function extendAttributeValidationSchema({ attribute, validationSchema, label, s
284
294
  strings,
285
295
  });
286
296
  break;
297
+ case 'id':
298
+ validationSchema = extendAttributeIdValidationSchema({
299
+ attribute,
300
+ validationSchema: validationSchema,
301
+ label,
302
+ strings,
303
+ });
304
+ break;
287
305
  default:
288
306
  break;
289
307
  }
@@ -337,6 +355,15 @@ function extendAttributeAttachmentsValidationSchema({ attribute, validationSchem
337
355
  }
338
356
  return validationSchema;
339
357
  }
358
+ function extendAttributeIdValidationSchema({ attribute, validationSchema, label, strings, }) {
359
+ if ('guid' in attribute && attribute.guid) {
360
+ validationSchema = validationSchema.matches(guidRegex, `${label}: ${strings.invalidIdFormat}`);
361
+ }
362
+ else if ('objectId' in attribute && attribute.objectId) {
363
+ validationSchema = validationSchema.matches(objectIdRegex, `${label}: ${strings.invalidIdFormat}`);
364
+ }
365
+ return validationSchema;
366
+ }
340
367
  exports.generateAttributeValidationSchema = (0, lodash_1.memoize)(function generateAttributeValidationSchema(attribute, language, strings, region) {
341
368
  let validationSchema = createAttributeValidationSchema(attribute);
342
369
  const label = (0, utils_2.localizedLabel)(language, attribute);
@@ -7,6 +7,7 @@ export interface FormValidationStringSet {
7
7
  invalidPhoneNumber: string;
8
8
  atLeastOneRowRequired: string;
9
9
  fileSizeExceeded: string;
10
+ invalidIdFormat: string;
10
11
  }
11
12
  export declare const defaultFormValidationStrings: FormValidationStringSet;
12
13
  export declare const FormValidationStringContext: import("react").Context<FormValidationStringSet>;
@@ -12,6 +12,7 @@ exports.defaultFormValidationStrings = {
12
12
  invalidPhoneNumber: 'Invalid phone number.',
13
13
  atLeastOneRowRequired: 'At least one row required.',
14
14
  fileSizeExceeded: 'File size exceeded.',
15
+ invalidIdFormat: 'Invalid ID format.',
15
16
  };
16
17
  exports.FormValidationStringContext = (0, react_1.createContext)(exports.defaultFormValidationStrings);
17
18
  function useFormValidationStrings() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/app",
3
- "version": "1.2.0",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -24,6 +24,7 @@
24
24
  "@tanstack/react-query": "^5.51.1"
25
25
  },
26
26
  "dependencies": {
27
+ "@fullcalendar/core": "6.1.15",
27
28
  "@hookform/resolvers": "^3.9.0",
28
29
  "clsx": "2.1.1",
29
30
  "dayjs": "^1.11.13",
@@ -36,5 +37,5 @@
36
37
  "uuid": "11.0.3",
37
38
  "yup": "^1.4.0"
38
39
  },
39
- "gitHead": "3c59cbbf000e71e39b81c9440a71363b729e6e3c"
40
+ "gitHead": "8d3c42183ed245a59d5200b4f0d4d271ebfe2160"
40
41
  }
@@ -10,6 +10,7 @@ export interface RouterInstance {
10
10
  forward: () => void;
11
11
  push(href: string, options?: NavigateOptions): void;
12
12
  replace(href: string, options?: NavigateOptions): void;
13
+ prefetch(href: string): void;
13
14
  }
14
15
  export declare const RouterContext: import("react").Context<RouterInstance>;
15
16
  export declare const RouterPathnameContext: import("react").Context<string>;