@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.48 → 2.3.7-dev.50

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Employee.js +34 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisyamo4131/air-guard-v2-schemas",
3
- "version": "2.3.7-dev.48",
3
+ "version": "2.3.7-dev.50",
4
4
  "description": "Schemas for AirGuard V2",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/Employee.js CHANGED
@@ -254,12 +254,46 @@ export default class Employee extends FireModel {
254
254
 
255
255
  afterInitialize(item = {}) {
256
256
  super.afterInitialize(item);
257
+
258
+ // Define computed properties
257
259
  Object.defineProperties(this, {
258
260
  fullName: defAccessor("fullName"),
259
261
  fullNameKana: defAccessor("fullNameKana"),
260
262
  fullAddress: defAccessor("fullAddress"),
261
263
  prefecture: defAccessor("prefecture"),
262
264
  });
265
+
266
+ // Define trigger fields
267
+ let _lastName = this.lastName;
268
+ let _firstName = this.firstName;
269
+ Object.defineProperties(this, {
270
+ lastName: {
271
+ configurable: true,
272
+ enumerable: true,
273
+ get() {
274
+ return _lastName;
275
+ },
276
+ set(v) {
277
+ if (v !== _lastName) {
278
+ _lastName = v;
279
+ this.displayName = `${_lastName}${this.firstName}`.trim();
280
+ }
281
+ },
282
+ },
283
+ firstName: {
284
+ configurable: true,
285
+ enumerable: true,
286
+ get() {
287
+ return _firstName;
288
+ },
289
+ set(v) {
290
+ if (v !== _firstName) {
291
+ _firstName = v;
292
+ this.displayName = `${this.lastName}${_firstName}`.trim();
293
+ }
294
+ },
295
+ },
296
+ });
263
297
  }
264
298
 
265
299
  /**