remult 2.7.32 → 2.7.33

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.
@@ -2,6 +2,7 @@ import { getRelationFieldInfo, } from '../src/remult3/relationInfoMember.js';
2
2
  import { Filter } from '../src/filter/filter-interfaces.js';
3
3
  import { getHtml } from './get-remult-admin-html.js';
4
4
  import { getValueList } from '../src/remult3/RepositoryImplementation.js';
5
+ import { InputTypes } from '../inputTypes.js';
5
6
  export default function remultAdminHtml(options) {
6
7
  const { rootPath, head } = options;
7
8
  return getHtml()
@@ -76,7 +77,7 @@ export function buildEntityInfo(options) {
76
77
  caption: x.caption,
77
78
  relationToOne: relation,
78
79
  inputType: x.inputType,
79
- type: x.valueConverter.fieldTypeInDb == 'json'
80
+ type: x.inputType === InputTypes.json
80
81
  ? 'json'
81
82
  : x.valueType === Number
82
83
  ? 'number'
@@ -95,7 +96,7 @@ export function buildEntityInfo(options) {
95
96
  if (metadata.apiReadAllowed) {
96
97
  let superKey = metadata.key;
97
98
  let caption = metadata.caption;
98
- const nbOfEntities = entities.filter(e => e.key === metadata.key).length;
99
+ const nbOfEntities = entities.filter((e) => e.key === metadata.key).length;
99
100
  if (nbOfEntities > 0) {
100
101
  superKey = metadata.key + '_ext_' + nbOfEntities;
101
102
  caption = metadata.caption + '*'.repeat(nbOfEntities);
@@ -7,6 +7,7 @@ import { relationInfoMemberInOptions } from './relationInfoMember.js';
7
7
  import { remultStatic } from '../remult-static.js';
8
8
  import { addValidator } from './addValidator.js';
9
9
  import { isOfType } from '../isOfType.js';
10
+ import { InputTypes } from '../../inputTypes.js';
10
11
  const validateNumber = createValueValidator((x) => {
11
12
  return !isNaN(x) && isFinite(x);
12
13
  });
@@ -22,9 +23,13 @@ export class Fields {
22
23
  if (op.valueConverter && !op.valueConverter.fieldTypeInDb)
23
24
  //@ts-ignore
24
25
  op.valueConverter.fieldTypeInDb = 'json';
26
+ if (op.valueType && !op.valueType.inputType)
27
+ //@ts-ignore
28
+ op.valueType.inputType = InputTypes.json;
25
29
  return Field(undefined, {
26
30
  valueConverter: {
27
31
  fieldTypeInDb: 'json',
32
+ inputType: InputTypes.json,
28
33
  },
29
34
  }, ...options);
30
35
  }
@@ -51,6 +51,8 @@ export class ValueConverters {
51
51
  var d = val;
52
52
  if (typeof d === 'string' || typeof d === 'number')
53
53
  d = new Date(d);
54
+ if (d === undefined)
55
+ return undefined;
54
56
  if (!d || d == null)
55
57
  return null;
56
58
  if (d.getHours() == 0)
package/inputTypes.d.ts CHANGED
@@ -6,4 +6,5 @@ export declare class InputTypes {
6
6
  static email: string;
7
7
  static tel: string;
8
8
  static time: string;
9
+ static json: string;
9
10
  }
package/inputTypes.js CHANGED
@@ -11,6 +11,7 @@ var InputTypes = /** @class */ (function () {
11
11
  InputTypes.email = 'email';
12
12
  InputTypes.tel = 'tel';
13
13
  InputTypes.time = 'time';
14
+ InputTypes.json = 'json';
14
15
  return InputTypes;
15
16
  }());
16
17
  exports.InputTypes = InputTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "2.7.32",
3
+ "version": "2.7.33",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {