@jd-data-limited/easy-fm 4.1.9 → 4.1.12
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/dist/records/field.d.ts +6 -2
- package/dist/records/field.js +14 -6
- package/dist/records/recordBase.js +4 -4
- package/dist/types.d.ts +7 -1
- package/package.json +1 -1
package/dist/records/field.d.ts
CHANGED
|
@@ -22,9 +22,13 @@ export declare class Field<T extends FieldValue> {
|
|
|
22
22
|
parent: Parentable;
|
|
23
23
|
id: string;
|
|
24
24
|
protected _value: T | null;
|
|
25
|
-
edited: boolean;
|
|
26
25
|
static firstContainerDownload: Promise<any> | null;
|
|
27
|
-
constructor(record: Parentable, id: string,
|
|
26
|
+
constructor(record: Parentable, id: string, originalContents: T);
|
|
27
|
+
get edited(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Resets the 'edited' state of this field, without changing its value
|
|
30
|
+
*/
|
|
31
|
+
updateOriginalContents(): void;
|
|
28
32
|
/**
|
|
29
33
|
* Sets the value of the field.
|
|
30
34
|
*
|
package/dist/records/field.js
CHANGED
|
@@ -70,13 +70,22 @@ let Field = (() => {
|
|
|
70
70
|
parent = __runInitializers(this, _instanceExtraInitializers);
|
|
71
71
|
id;
|
|
72
72
|
_value;
|
|
73
|
-
|
|
73
|
+
#originalContents;
|
|
74
74
|
static firstContainerDownload = null;
|
|
75
|
-
constructor(record, id,
|
|
75
|
+
constructor(record, id, originalContents) {
|
|
76
76
|
this.parent = record;
|
|
77
77
|
this.id = id;
|
|
78
|
-
this._value =
|
|
79
|
-
this
|
|
78
|
+
this._value = originalContents;
|
|
79
|
+
this.#originalContents = originalContents;
|
|
80
|
+
}
|
|
81
|
+
get edited() {
|
|
82
|
+
return this.#originalContents !== this._value;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Resets the 'edited' state of this field, without changing its value
|
|
86
|
+
*/
|
|
87
|
+
updateOriginalContents() {
|
|
88
|
+
this.#originalContents = this._value;
|
|
80
89
|
}
|
|
81
90
|
/**
|
|
82
91
|
* Sets the value of the field.
|
|
@@ -89,7 +98,6 @@ let Field = (() => {
|
|
|
89
98
|
throw new Error('Cannot set container value using set(). Use upload() instead.');
|
|
90
99
|
else
|
|
91
100
|
this._value = content;
|
|
92
|
-
this.edited = true;
|
|
93
101
|
}
|
|
94
102
|
get metadata() {
|
|
95
103
|
if (!this.parent.layout.metadata) {
|
|
@@ -154,7 +162,7 @@ let Field = (() => {
|
|
|
154
162
|
return this._value;
|
|
155
163
|
}
|
|
156
164
|
set value(value) {
|
|
157
|
-
this.
|
|
165
|
+
this.set(value);
|
|
158
166
|
}
|
|
159
167
|
get string() {
|
|
160
168
|
if (typeof this._value === 'string') {
|
|
@@ -49,7 +49,7 @@ export class RecordBase extends EventEmitter {
|
|
|
49
49
|
.utcOffset(this.layout.database.host.timezoneOffsetFunc(date), true)
|
|
50
50
|
.local();
|
|
51
51
|
_field.set(date);
|
|
52
|
-
_field.
|
|
52
|
+
_field.updateOriginalContents();
|
|
53
53
|
}
|
|
54
54
|
else if (_field.metadata.result === 'time') {
|
|
55
55
|
let date = moment.default(fieldData[key]);
|
|
@@ -57,7 +57,7 @@ export class RecordBase extends EventEmitter {
|
|
|
57
57
|
.utcOffset(this.layout.database.host.timezoneOffsetFunc(date), true)
|
|
58
58
|
.local();
|
|
59
59
|
_field.set(date);
|
|
60
|
-
_field.
|
|
60
|
+
_field.updateOriginalContents();
|
|
61
61
|
}
|
|
62
62
|
else if (_field.metadata.result === 'date') {
|
|
63
63
|
let date = moment.default(fieldData[key]);
|
|
@@ -65,7 +65,7 @@ export class RecordBase extends EventEmitter {
|
|
|
65
65
|
.utcOffset(this.layout.database.host.timezoneOffsetFunc(date), true)
|
|
66
66
|
.local();
|
|
67
67
|
_field.set(date);
|
|
68
|
-
_field.
|
|
68
|
+
_field.updateOriginalContents();
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
fields[key] = _field;
|
|
@@ -76,6 +76,6 @@ export class RecordBase extends EventEmitter {
|
|
|
76
76
|
_onSave() {
|
|
77
77
|
this.emit('saved');
|
|
78
78
|
for (const field of this.fieldsArray)
|
|
79
|
-
field.
|
|
79
|
+
field.updateOriginalContents();
|
|
80
80
|
}
|
|
81
81
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -55,7 +55,13 @@ export interface extraBodyOptions {
|
|
|
55
55
|
* user (default) - Field validation occurs as per normal. Request is blocked if validation failed.
|
|
56
56
|
* script - Field validation is overridden/ignored when allowed in the database schema.
|
|
57
57
|
*/
|
|
58
|
-
entrymode
|
|
58
|
+
entrymode?: 'user' | 'script';
|
|
59
|
+
/**
|
|
60
|
+
* Overrides the 'prohibit modification of this field during data entry' property (FileMaker Server 2024 - 21.1.1 and newer)
|
|
61
|
+
* user (default) - Follow this rule
|
|
62
|
+
* script - Ignore this rule
|
|
63
|
+
*/
|
|
64
|
+
prohibitMode?: 'user' | 'script';
|
|
59
65
|
};
|
|
60
66
|
deleteRelatedRecords?: Array<{
|
|
61
67
|
table: string;
|