@wcardinal/wcardinal-ui 0.259.0 → 0.260.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.
@@ -44,6 +44,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
44
44
  if (0 < size) {
45
45
  this.remove(size);
46
46
  this._position = 0;
47
+ this.emit("change", this);
47
48
  }
48
49
  this.cleanup();
49
50
  }
@@ -62,10 +63,12 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
62
63
  this.emit("dirty", this);
63
64
  }
64
65
  }
66
+ this.emit("change", this);
65
67
  this.emit("executed", command, this);
66
68
  };
67
69
  DControllerCommandImpl.prototype.onFail = function (command) {
68
70
  command.destroy();
71
+ this.emit("change", this);
69
72
  };
70
73
  DControllerCommandImpl.prototype.cleanup = function () {
71
74
  var done = this._done;
@@ -108,6 +111,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
108
111
  if (0 < this._position) {
109
112
  var current = done[done.length - this._position];
110
113
  this._position -= 1;
114
+ this.emit("change", this);
111
115
  this.emit("redoing", current, this);
112
116
  var result = current.redo();
113
117
  if (result === true) {
@@ -122,10 +126,11 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
122
126
  if (!isCommandClean(redoed)) {
123
127
  this.emit("dirty", this);
124
128
  }
129
+ this.emit("change", this);
125
130
  this.emit("redoed", redoed, this);
126
131
  };
127
132
  DControllerCommandImpl.prototype.onRedoFail = function (command) {
128
- // DO NOTHING
133
+ this.emit("change", this);
129
134
  };
130
135
  DControllerCommandImpl.prototype.isRedoable = function () {
131
136
  return 0 < this._position;
@@ -140,6 +145,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
140
145
  if (this._position < done.length) {
141
146
  var current = done[done.length - 1 - this._position];
142
147
  this._position += 1;
148
+ this.emit("change", this);
143
149
  this.emit("undoing", current, this);
144
150
  var result = current.undo();
145
151
  if (result === true) {
@@ -154,10 +160,11 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
154
160
  if (!isCommandClean(undoed)) {
155
161
  this.emit("dirty", this);
156
162
  }
163
+ this.emit("change", this);
157
164
  this.emit("undoed", undoed, this);
158
165
  };
159
166
  DControllerCommandImpl.prototype.onUndoFail = function (command) {
160
- // DO NOTHING
167
+ this.emit("change", this);
161
168
  };
162
169
  DControllerCommandImpl.prototype.isUndoable = function () {
163
170
  return this._position < this._done.length;
@@ -1 +1 @@
1
- {"version":3,"file":"d-controller-command-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-controller-command-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,IAAM,iBAAiB,GAAG,UAAC,OAAiB;IAC3C,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,IAAM,cAAc,GAAG,UAAC,OAAiB;IACxC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAM,cAAc,GAAG,UAAC,OAAiB;IACxC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;IAA4C,0CAAkB;IAI7D;QAAA,YACC,iBAAO,SAGP;QAFA,KAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,KAAI,CAAC,KAAK,GAAG,EAAE,CAAC;;IACjB,CAAC;IAED,qCAAI,GAAJ;QACC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;YACpB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;IACF,CAAC;IAES,uCAAM,GAAhB;QACC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE;YACjC,IAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;YACvD,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YACpC,IAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;YAC9B,IAAI,MAAM,KAAK,IAAI,EAAE;gBACpB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;aAC5B;iBAAM;gBACN,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;aACzB;SACD;IACF,CAAC;IAES,8CAAa,GAAvB,UAAwB,MAAgB;QACvC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACzB;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAES,2CAAU,GAApB,UAAqB,OAAiB;QACrC,aAAa;IACd,CAAC;IAED,2CAAU,GAAV;QACC,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3C,CAAC;IACF,6BAAC;AAAD,CAAC,AApKD,CAA4C,KAAK,CAAC,YAAY,GAoK7D","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { utils } from \"pixi.js\";\nimport { DCommand } from \"./d-command\";\nimport { DCommandClear } from \"./d-command-clear\";\nimport { DCommandFlag } from \"./d-command-flag\";\nimport { DControllerCommand } from \"./d-controller-command\";\n\nconst isCommandStorable = (command: DCommand): boolean => {\n\treturn !(command.getFlag() & DCommandFlag.UNSTORABLE);\n};\n\nconst isCommandClear = (command: DCommand): boolean => {\n\treturn !!(command.getFlag() & DCommandFlag.CLEAR);\n};\n\nconst isCommandClean = (command: DCommand): boolean => {\n\treturn !!(command.getFlag() & DCommandFlag.CLEAN);\n};\n\nexport class DControllerCommandImpl extends utils.EventEmitter implements DControllerCommand {\n\tprotected _position: number;\n\tprotected _done: DCommand[];\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._position = 0;\n\t\tthis._done = [];\n\t}\n\n\tlast(): DCommand | null {\n\t\tconst done = this._done;\n\t\tif (0 < done.length) {\n\t\t\treturn done[done.length - 1];\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpush(command: DCommand): void {\n\t\tthis.execute(command);\n\t}\n\n\tprotected execute(command: DCommand): void {\n\t\tthis.emit(\"executing\", command, this);\n\t\tconst isClear = isCommandClear(command);\n\t\tconst isStorable = isCommandStorable(command);\n\t\tif (isClear || isStorable) {\n\t\t\tconst size = isClear ? this._done.length : this._position;\n\t\t\tif (0 < size) {\n\t\t\t\tthis.remove(size);\n\t\t\t\tthis._position = 0;\n\t\t\t}\n\t\t\tthis.cleanup();\n\t\t}\n\t\tconst result = command.execute();\n\t\tif (result === true) {\n\t\t\tthis.onSuccess(command);\n\t\t} else {\n\t\t\tthis.onFail(command);\n\t\t}\n\t}\n\n\tprotected onSuccess(command: DCommand): void {\n\t\tif (isCommandStorable(command)) {\n\t\t\tthis._done.push(command);\n\t\t\tif (!isCommandClean(command)) {\n\t\t\t\tthis.emit(\"dirty\", this);\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"executed\", command, this);\n\t}\n\n\tprotected onFail(command: DCommand): void {\n\t\tcommand.destroy();\n\t}\n\n\tprotected cleanup(): void {\n\t\tconst done = this._done;\n\t\tconst size = done.length - 100;\n\t\tif (0 < size) {\n\t\t\tfor (let i = 0; i < size; ++i) {\n\t\t\t\tdone[i].destroy();\n\t\t\t\tdone.shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected remove(size: number): boolean {\n\t\tconst done = this._done;\n\t\tif (0 < size) {\n\t\t\tconst ifrom = Math.max(0, done.length - size);\n\t\t\tsize = done.length - ifrom;\n\t\t\tif (0 < size) {\n\t\t\t\tfor (let i = ifrom, imax = done.length; i < imax; ++i) {\n\t\t\t\t\tdone[i].destroy();\n\t\t\t\t}\n\n\t\t\t\tdone.splice(ifrom, done.length - ifrom);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tsize(): number {\n\t\treturn this._done.length;\n\t}\n\n\tclear(): void {\n\t\tthis.push(new DCommandClear());\n\t}\n\n\tredo(): void {\n\t\tif (this.isRedoable()) {\n\t\t\tthis.doRedo();\n\t\t}\n\t}\n\n\tprotected doRedo(): void {\n\t\tconst done = this._done;\n\t\tif (0 < this._position) {\n\t\t\tconst current = done[done.length - this._position];\n\t\t\tthis._position -= 1;\n\t\t\tthis.emit(\"redoing\", current, this);\n\t\t\tconst result = current.redo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onRedoSuccess(current);\n\t\t\t} else {\n\t\t\t\tthis.onRedoFail(current);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onRedoSuccess(redoed: DCommand): void {\n\t\tif (!isCommandClean(redoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"redoed\", redoed, this);\n\t}\n\n\tprotected onRedoFail(command: DCommand): void {\n\t\t// DO NOTHING\n\t}\n\n\tisRedoable(): boolean {\n\t\treturn 0 < this._position;\n\t}\n\n\tundo(): void {\n\t\tif (this.isUndoable()) {\n\t\t\tthis.doUndo();\n\t\t}\n\t}\n\n\tprotected doUndo(): void {\n\t\tconst done = this._done;\n\t\tif (this._position < done.length) {\n\t\t\tconst current = done[done.length - 1 - this._position];\n\t\t\tthis._position += 1;\n\t\t\tthis.emit(\"undoing\", current, this);\n\t\t\tconst result = current.undo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onUndoSuccess(current);\n\t\t\t} else {\n\t\t\t\tthis.onUndoFail(current);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onUndoSuccess(undoed: DCommand): void {\n\t\tif (!isCommandClean(undoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"undoed\", undoed, this);\n\t}\n\n\tprotected onUndoFail(command: DCommand): void {\n\t\t// DO NOTHING\n\t}\n\n\tisUndoable(): boolean {\n\t\treturn this._position < this._done.length;\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-controller-command-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-controller-command-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,IAAM,iBAAiB,GAAG,UAAC,OAAiB;IAC3C,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,IAAM,cAAc,GAAG,UAAC,OAAiB;IACxC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAM,cAAc,GAAG,UAAC,OAAiB;IACxC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;IAA4C,0CAAkB;IAI7D;QAAA,YACC,iBAAO,SAGP;QAFA,KAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,KAAI,CAAC,KAAK,GAAG,EAAE,CAAC;;IACjB,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C,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACzB;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAES,2CAAU,GAApB,UAAqB,OAAiB;QACrC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,2CAAU,GAAV;QACC,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3C,CAAC;IACF,6BAAC;AAAD,CAAC,AA3KD,CAA4C,KAAK,CAAC,YAAY,GA2K7D","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { utils } from \"pixi.js\";\nimport { DCommand } from \"./d-command\";\nimport { DCommandClear } from \"./d-command-clear\";\nimport { DCommandFlag } from \"./d-command-flag\";\nimport { DControllerCommand } from \"./d-controller-command\";\n\nconst isCommandStorable = (command: DCommand): boolean => {\n\treturn !(command.getFlag() & DCommandFlag.UNSTORABLE);\n};\n\nconst isCommandClear = (command: DCommand): boolean => {\n\treturn !!(command.getFlag() & DCommandFlag.CLEAR);\n};\n\nconst isCommandClean = (command: DCommand): boolean => {\n\treturn !!(command.getFlag() & DCommandFlag.CLEAN);\n};\n\nexport class DControllerCommandImpl extends utils.EventEmitter implements DControllerCommand {\n\tprotected _position: number;\n\tprotected _done: DCommand[];\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._position = 0;\n\t\tthis._done = [];\n\t}\n\n\tlast(): DCommand | null {\n\t\tconst done = this._done;\n\t\tif (0 < done.length) {\n\t\t\treturn done[done.length - 1];\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpush(command: DCommand): void {\n\t\tthis.execute(command);\n\t}\n\n\tprotected execute(command: DCommand): void {\n\t\tthis.emit(\"executing\", command, this);\n\t\tconst isClear = isCommandClear(command);\n\t\tconst isStorable = isCommandStorable(command);\n\t\tif (isClear || isStorable) {\n\t\t\tconst size = isClear ? this._done.length : this._position;\n\t\t\tif (0 < size) {\n\t\t\t\tthis.remove(size);\n\t\t\t\tthis._position = 0;\n\t\t\t\tthis.emit(\"change\", this);\n\t\t\t}\n\t\t\tthis.cleanup();\n\t\t}\n\t\tconst result = command.execute();\n\t\tif (result === true) {\n\t\t\tthis.onSuccess(command);\n\t\t} else {\n\t\t\tthis.onFail(command);\n\t\t}\n\t}\n\n\tprotected onSuccess(command: DCommand): void {\n\t\tif (isCommandStorable(command)) {\n\t\t\tthis._done.push(command);\n\t\t\tif (!isCommandClean(command)) {\n\t\t\t\tthis.emit(\"dirty\", this);\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"executed\", command, this);\n\t}\n\n\tprotected onFail(command: DCommand): void {\n\t\tcommand.destroy();\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tprotected cleanup(): void {\n\t\tconst done = this._done;\n\t\tconst size = done.length - 100;\n\t\tif (0 < size) {\n\t\t\tfor (let i = 0; i < size; ++i) {\n\t\t\t\tdone[i].destroy();\n\t\t\t\tdone.shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected remove(size: number): boolean {\n\t\tconst done = this._done;\n\t\tif (0 < size) {\n\t\t\tconst ifrom = Math.max(0, done.length - size);\n\t\t\tsize = done.length - ifrom;\n\t\t\tif (0 < size) {\n\t\t\t\tfor (let i = ifrom, imax = done.length; i < imax; ++i) {\n\t\t\t\t\tdone[i].destroy();\n\t\t\t\t}\n\n\t\t\t\tdone.splice(ifrom, done.length - ifrom);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tsize(): number {\n\t\treturn this._done.length;\n\t}\n\n\tclear(): void {\n\t\tthis.push(new DCommandClear());\n\t}\n\n\tredo(): void {\n\t\tif (this.isRedoable()) {\n\t\t\tthis.doRedo();\n\t\t}\n\t}\n\n\tprotected doRedo(): void {\n\t\tconst done = this._done;\n\t\tif (0 < this._position) {\n\t\t\tconst current = done[done.length - this._position];\n\t\t\tthis._position -= 1;\n\t\t\tthis.emit(\"change\", this);\n\t\t\tthis.emit(\"redoing\", current, this);\n\t\t\tconst result = current.redo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onRedoSuccess(current);\n\t\t\t} else {\n\t\t\t\tthis.onRedoFail(current);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onRedoSuccess(redoed: DCommand): void {\n\t\tif (!isCommandClean(redoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"redoed\", redoed, this);\n\t}\n\n\tprotected onRedoFail(command: DCommand): void {\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tisRedoable(): boolean {\n\t\treturn 0 < this._position;\n\t}\n\n\tundo(): void {\n\t\tif (this.isUndoable()) {\n\t\t\tthis.doUndo();\n\t\t}\n\t}\n\n\tprotected doUndo(): void {\n\t\tconst done = this._done;\n\t\tif (this._position < done.length) {\n\t\t\tconst current = done[done.length - 1 - this._position];\n\t\t\tthis._position += 1;\n\t\t\tthis.emit(\"change\", this);\n\t\t\tthis.emit(\"undoing\", current, this);\n\t\t\tconst result = current.undo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onUndoSuccess(current);\n\t\t\t} else {\n\t\t\t\tthis.onUndoFail(current);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onUndoSuccess(undoed: DCommand): void {\n\t\tif (!isCommandClean(undoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"undoed\", undoed, this);\n\t}\n\n\tprotected onUndoFail(command: DCommand): void {\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tisUndoable(): boolean {\n\t\treturn this._position < this._done.length;\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.259.0
2
+ Winter Cardinal UI v0.260.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.259.0
2
+ Winter Cardinal UI v0.260.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.259.0
2
+ Winter Cardinal UI v0.260.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.259.0
2
+ Winter Cardinal UI v0.260.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.259.0
2
+ Winter Cardinal UI v0.260.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -65353,6 +65353,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
65353
65353
  if (0 < size) {
65354
65354
  this.remove(size);
65355
65355
  this._position = 0;
65356
+ this.emit("change", this);
65356
65357
  }
65357
65358
  this.cleanup();
65358
65359
  }
@@ -65371,10 +65372,12 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
65371
65372
  this.emit("dirty", this);
65372
65373
  }
65373
65374
  }
65375
+ this.emit("change", this);
65374
65376
  this.emit("executed", command, this);
65375
65377
  };
65376
65378
  DControllerCommandImpl.prototype.onFail = function (command) {
65377
65379
  command.destroy();
65380
+ this.emit("change", this);
65378
65381
  };
65379
65382
  DControllerCommandImpl.prototype.cleanup = function () {
65380
65383
  var done = this._done;
@@ -65417,6 +65420,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
65417
65420
  if (0 < this._position) {
65418
65421
  var current = done[done.length - this._position];
65419
65422
  this._position -= 1;
65423
+ this.emit("change", this);
65420
65424
  this.emit("redoing", current, this);
65421
65425
  var result = current.redo();
65422
65426
  if (result === true) {
@@ -65431,10 +65435,11 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
65431
65435
  if (!isCommandClean(redoed)) {
65432
65436
  this.emit("dirty", this);
65433
65437
  }
65438
+ this.emit("change", this);
65434
65439
  this.emit("redoed", redoed, this);
65435
65440
  };
65436
65441
  DControllerCommandImpl.prototype.onRedoFail = function (command) {
65437
- // DO NOTHING
65442
+ this.emit("change", this);
65438
65443
  };
65439
65444
  DControllerCommandImpl.prototype.isRedoable = function () {
65440
65445
  return 0 < this._position;
@@ -65449,6 +65454,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
65449
65454
  if (this._position < done.length) {
65450
65455
  var current = done[done.length - 1 - this._position];
65451
65456
  this._position += 1;
65457
+ this.emit("change", this);
65452
65458
  this.emit("undoing", current, this);
65453
65459
  var result = current.undo();
65454
65460
  if (result === true) {
@@ -65463,10 +65469,11 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
65463
65469
  if (!isCommandClean(undoed)) {
65464
65470
  this.emit("dirty", this);
65465
65471
  }
65472
+ this.emit("change", this);
65466
65473
  this.emit("undoed", undoed, this);
65467
65474
  };
65468
65475
  DControllerCommandImpl.prototype.onUndoFail = function (command) {
65469
- // DO NOTHING
65476
+ this.emit("change", this);
65470
65477
  };
65471
65478
  DControllerCommandImpl.prototype.isUndoable = function () {
65472
65479
  return this._position < this._done.length;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.259.0
2
+ Winter Cardinal UI v0.260.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -46738,6 +46738,7 @@
46738
46738
  if (0 < size) {
46739
46739
  this.remove(size);
46740
46740
  this._position = 0;
46741
+ this.emit("change", this);
46741
46742
  }
46742
46743
  this.cleanup();
46743
46744
  }
@@ -46756,10 +46757,12 @@
46756
46757
  this.emit("dirty", this);
46757
46758
  }
46758
46759
  }
46760
+ this.emit("change", this);
46759
46761
  this.emit("executed", command, this);
46760
46762
  };
46761
46763
  DControllerCommandImpl.prototype.onFail = function (command) {
46762
46764
  command.destroy();
46765
+ this.emit("change", this);
46763
46766
  };
46764
46767
  DControllerCommandImpl.prototype.cleanup = function () {
46765
46768
  var done = this._done;
@@ -46802,6 +46805,7 @@
46802
46805
  if (0 < this._position) {
46803
46806
  var current = done[done.length - this._position];
46804
46807
  this._position -= 1;
46808
+ this.emit("change", this);
46805
46809
  this.emit("redoing", current, this);
46806
46810
  var result = current.redo();
46807
46811
  if (result === true) {
@@ -46816,10 +46820,11 @@
46816
46820
  if (!isCommandClean(redoed)) {
46817
46821
  this.emit("dirty", this);
46818
46822
  }
46823
+ this.emit("change", this);
46819
46824
  this.emit("redoed", redoed, this);
46820
46825
  };
46821
46826
  DControllerCommandImpl.prototype.onRedoFail = function (command) {
46822
- // DO NOTHING
46827
+ this.emit("change", this);
46823
46828
  };
46824
46829
  DControllerCommandImpl.prototype.isRedoable = function () {
46825
46830
  return 0 < this._position;
@@ -46834,6 +46839,7 @@
46834
46839
  if (this._position < done.length) {
46835
46840
  var current = done[done.length - 1 - this._position];
46836
46841
  this._position += 1;
46842
+ this.emit("change", this);
46837
46843
  this.emit("undoing", current, this);
46838
46844
  var result = current.undo();
46839
46845
  if (result === true) {
@@ -46848,10 +46854,11 @@
46848
46854
  if (!isCommandClean(undoed)) {
46849
46855
  this.emit("dirty", this);
46850
46856
  }
46857
+ this.emit("change", this);
46851
46858
  this.emit("undoed", undoed, this);
46852
46859
  };
46853
46860
  DControllerCommandImpl.prototype.onUndoFail = function (command) {
46854
- // DO NOTHING
46861
+ this.emit("change", this);
46855
46862
  };
46856
46863
  DControllerCommandImpl.prototype.isUndoable = function () {
46857
46864
  return this._position < this._done.length;