@wcardinal/wcardinal-ui 0.164.0 → 0.167.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.
Files changed (106) hide show
  1. package/dist/types/wcardinal/ui/d-dialog-gesture-impl.d.ts +28 -0
  2. package/dist/types/wcardinal/ui/d-dialog-gesture-mode.d.ts +5 -0
  3. package/dist/types/wcardinal/ui/d-dialog-gesture.d.ts +29 -0
  4. package/dist/types/wcardinal/ui/d-dialog.d.ts +43 -10
  5. package/dist/types/wcardinal/ui/d-table-column.d.ts +2 -1
  6. package/dist/types/wcardinal/ui/index.d.ts +3 -0
  7. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-boolean.d.ts +2 -1
  8. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-date.d.ts +2 -1
  9. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-datetime.d.ts +2 -1
  10. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-integer.d.ts +2 -1
  11. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-real.d.ts +2 -1
  12. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-text.d.ts +2 -1
  13. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-time.d.ts +2 -1
  14. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog.d.ts +1 -1
  15. package/dist/types/wcardinal/ui/shape/e-shape.d.ts +3 -3
  16. package/dist/types/wcardinal/ui/shape/variant/e-shape-base.d.ts +4 -4
  17. package/dist/types/wcardinal/ui/shape/variant/e-shape-group-size-editor.d.ts +0 -1
  18. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-dialog.d.ts +12 -4
  19. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-picker-datetime-label.d.ts +2 -0
  20. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-picker-datetime-space.d.ts +2 -0
  21. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-picker-time.d.ts +1 -0
  22. package/dist/types/wcardinal/ui/theme/white/d-theme-white-dialog.d.ts +12 -4
  23. package/dist/types/wcardinal/ui/theme/white/d-theme-white-picker-datetime-label.d.ts +2 -0
  24. package/dist/types/wcardinal/ui/theme/white/d-theme-white-picker-datetime-space.d.ts +2 -0
  25. package/dist/types/wcardinal/ui/theme/white/d-theme-white-picker-time.d.ts +1 -0
  26. package/dist/wcardinal/ui/d-chart-plot-area-container.js +1 -1
  27. package/dist/wcardinal/ui/d-chart-plot-area-container.js.map +1 -1
  28. package/dist/wcardinal/ui/d-dialog-gesture-impl.js +133 -0
  29. package/dist/wcardinal/ui/d-dialog-gesture-impl.js.map +1 -0
  30. package/dist/wcardinal/ui/d-dialog-gesture-mode.js +9 -0
  31. package/dist/wcardinal/ui/d-dialog-gesture-mode.js.map +1 -0
  32. package/dist/wcardinal/ui/d-dialog-gesture.js +6 -0
  33. package/dist/wcardinal/ui/d-dialog-gesture.js.map +1 -0
  34. package/dist/wcardinal/ui/d-dialog-input.js +7 -1
  35. package/dist/wcardinal/ui/d-dialog-input.js.map +1 -1
  36. package/dist/wcardinal/ui/d-dialog.js +196 -84
  37. package/dist/wcardinal/ui/d-dialog.js.map +1 -1
  38. package/dist/wcardinal/ui/d-image-base.js +3 -1
  39. package/dist/wcardinal/ui/d-image-base.js.map +1 -1
  40. package/dist/wcardinal/ui/d-picker-color.js +5 -2
  41. package/dist/wcardinal/ui/d-picker-color.js.map +1 -1
  42. package/dist/wcardinal/ui/d-scroll-bar-thumb.js +0 -1
  43. package/dist/wcardinal/ui/d-scroll-bar-thumb.js.map +1 -1
  44. package/dist/wcardinal/ui/d-table-body-cell-select-dialog.js +1 -1
  45. package/dist/wcardinal/ui/d-table-body-cell-select-dialog.js.map +1 -1
  46. package/dist/wcardinal/ui/d-table-column.js.map +1 -1
  47. package/dist/wcardinal/ui/index.js +3 -0
  48. package/dist/wcardinal/ui/index.js.map +1 -1
  49. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-boolean.js +2 -2
  50. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-boolean.js.map +1 -1
  51. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-date.js +2 -2
  52. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-date.js.map +1 -1
  53. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-datetime.js +2 -2
  54. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-datetime.js.map +1 -1
  55. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-integer.js +2 -2
  56. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-integer.js.map +1 -1
  57. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-real.js +2 -2
  58. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-real.js.map +1 -1
  59. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-text.js +2 -2
  60. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-text.js.map +1 -1
  61. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-time.js +2 -2
  62. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog-time.js.map +1 -1
  63. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog.js +1 -1
  64. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-open-dialog.js.map +1 -1
  65. package/dist/wcardinal/ui/shape/e-shape.js.map +1 -1
  66. package/dist/wcardinal/ui/shape/variant/e-shape-base.js +7 -7
  67. package/dist/wcardinal/ui/shape/variant/e-shape-base.js.map +1 -1
  68. package/dist/wcardinal/ui/shape/variant/e-shape-group-size-editor.js +2 -4
  69. package/dist/wcardinal/ui/shape/variant/e-shape-group-size-editor.js.map +1 -1
  70. package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog.js +42 -7
  71. package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog.js.map +1 -1
  72. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-color-gradient.js +1 -1
  73. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-color-gradient.js.map +1 -1
  74. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-color.js +1 -1
  75. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-color.js.map +1 -1
  76. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-datetime-label.js +4 -0
  77. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-datetime-label.js.map +1 -1
  78. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-datetime-space.js +4 -0
  79. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-datetime-space.js.map +1 -1
  80. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-time.js +4 -1
  81. package/dist/wcardinal/ui/theme/dark/d-theme-dark-picker-time.js.map +1 -1
  82. package/dist/wcardinal/ui/theme/white/d-theme-white-dialog.js +42 -7
  83. package/dist/wcardinal/ui/theme/white/d-theme-white-dialog.js.map +1 -1
  84. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-color-gradient.js +1 -1
  85. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-color-gradient.js.map +1 -1
  86. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-color.js +1 -1
  87. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-color.js.map +1 -1
  88. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-datetime-label.js +4 -0
  89. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-datetime-label.js.map +1 -1
  90. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-datetime-space.js +4 -0
  91. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-datetime-space.js.map +1 -1
  92. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-time.js +4 -1
  93. package/dist/wcardinal/ui/theme/white/d-theme-white-picker-time.js.map +1 -1
  94. package/dist/wcardinal/ui/util/util-html-element.js +3 -1
  95. package/dist/wcardinal/ui/util/util-html-element.js.map +1 -1
  96. package/dist/wcardinal-ui-theme-dark.js +57 -11
  97. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  98. package/dist/wcardinal-ui-theme-dark.min.js.map +1 -1
  99. package/dist/wcardinal-ui-theme-white.js +57 -11
  100. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  101. package/dist/wcardinal-ui-theme-white.min.js.map +1 -1
  102. package/dist/wcardinal-ui.cjs.js +4288 -3953
  103. package/dist/wcardinal-ui.js +19213 -18958
  104. package/dist/wcardinal-ui.min.js +2 -2
  105. package/dist/wcardinal-ui.min.js.map +1 -1
  106. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d-dialog-gesture-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-gesture-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAS3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;IAeC,4BAAY,MAAc,EAAE,OAA8B;;QACzD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,OAAO,CAAC,MAAM,EAAE;YACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;SAC5B;QACD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAA,OAAO,CAAC,IAAI,mCAAI,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;QAClF,IAAI,CAAC,UAAU,GAAG,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AC,CAAC,CAAC;SACnB;IACF,CAAC;IACF,yBAAC;AAAD,CAAC,AA1ID,IA0IC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Point, Rectangle } from \"pixi.js\";\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DBase } from \"./d-base\";\nimport {\n\tDDialogGesture,\n\tDDialogGestureConstraint,\n\tDDialogGestureOptions,\n\tDDialogGestureParent\n} from \"./d-dialog-gesture\";\nimport { DDialogGestureMode } from \"./d-dialog-gesture-mode\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilGesture } from \"./util/util-gesture\";\n\nexport class DDialogGestureImpl<PARENT extends DDialogGestureParent>\n\timplements DDialogGesture<PARENT>\n{\n\tprotected static WORK_BOUNDS?: Rectangle;\n\n\tprotected _parent: PARENT;\n\tprotected _mode: DDialogGestureMode;\n\tprotected _options?: DDialogGestureOptions;\n\n\tprotected _isEnabled: boolean;\n\n\tprotected _isDirty: boolean;\n\tprotected _constraint?: DDialogGestureConstraint;\n\tprotected _util?: UtilGesture<any>;\n\n\tconstructor(parent: PARENT, options: DDialogGestureOptions) {\n\t\tthis._parent = parent;\n\t\tthis._options = options;\n\t\tif (options.enable) {\n\t\t\tthis._util = this.newUtil();\n\t\t}\n\t\tthis._mode = toEnum(options.mode ?? DDialogGestureMode.DIRTY, DDialogGestureMode);\n\t\tthis._isEnabled = true;\n\t\tthis._isDirty = false;\n\t}\n\n\tget parent(): PARENT {\n\t\treturn this._parent;\n\t}\n\n\tget mode(): DDialogGestureMode {\n\t\treturn this._mode;\n\t}\n\n\tset mode(mode: DDialogGestureMode) {\n\t\tthis._mode = mode;\n\t}\n\n\tget constraint(): DDialogGestureConstraint {\n\t\tlet result = this._constraint;\n\t\tif (result == null) {\n\t\t\tresult = this._options?.constraint ?? this.newConstraint();\n\t\t\tthis._constraint = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tset constraint(constraint: DDialogGestureConstraint) {\n\t\tthis._constraint = constraint;\n\t}\n\n\tprotected newConstraint(): DDialogGestureConstraint {\n\t\treturn (target, layer, x, y): void => {\n\t\t\tthis.toConstrained(target, layer, x, y);\n\t\t};\n\t}\n\n\tisDirty(): boolean {\n\t\treturn this._isDirty;\n\t}\n\n\tisClean(): boolean {\n\t\treturn !this._isDirty;\n\t}\n\n\ttoClean(): void {\n\t\tif (this._isDirty) {\n\t\t\tthis._isDirty = false;\n\t\t}\n\t}\n\n\tprotected newUtil(): UtilGesture<any> {\n\t\tconst p = new Point();\n\t\tconst parent = this._parent;\n\t\tconst position = parent.position;\n\t\treturn new UtilGesture<any>({\n\t\t\tbind: parent,\n\t\t\tchecker: {\n\t\t\t\tstart: (e): boolean => {\n\t\t\t\t\t// Are children clicked?\n\t\t\t\t\tif (e.target !== parent) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Is clicked outside?\n\t\t\t\t\tp.copyFrom(e.data.global);\n\t\t\t\t\tparent.toLocal(p, undefined, p, true);\n\t\t\t\t\tconst x = p.x;\n\t\t\t\t\tconst y = p.y;\n\t\t\t\t\tif (x < 0 || y < 0 || parent.width < x || parent.height < y) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Ok\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t},\n\t\t\ton: {\n\t\t\t\tstart: (): void => {\n\t\t\t\t\tp.copyFrom(position);\n\t\t\t\t},\n\t\t\t\tmove: (target: unknown, dx: number, dy: number): void => {\n\t\t\t\t\tp.set(p.x + dx, p.y + dy);\n\t\t\t\t\tif (!this._isDirty) {\n\t\t\t\t\t\tthis._isDirty = true;\n\t\t\t\t\t\tparent.setX(position.x);\n\t\t\t\t\t\tparent.setY(position.y);\n\t\t\t\t\t}\n\t\t\t\t\tconst layer = parent.layer;\n\t\t\t\t\tif (layer != null) {\n\t\t\t\t\t\tthis.constraint(parent, layer, p.x, p.y);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected toConstrained(\n\t\ttarget: DBase,\n\t\tlayer: DApplicationLayerLike,\n\t\tx: number,\n\t\ty: number\n\t): void {\n\t\tconst position = target.position;\n\t\tif (layer) {\n\t\t\tconst bounds = target.getBounds(\n\t\t\t\tfalse,\n\t\t\t\t(DDialogGestureImpl.WORK_BOUNDS ??= new Rectangle())\n\t\t\t);\n\t\t\tconst obx = bounds.x + x - position.x;\n\t\t\tconst oby = bounds.y + y - position.y;\n\t\t\tconst nbx = Math.min(Math.max(0, obx), layer.width - bounds.width);\n\t\t\tconst nby = Math.min(Math.max(0, oby), layer.height - bounds.height);\n\t\t\tposition.set(x + nbx - obx, y + nby - oby);\n\t\t} else {\n\t\t\tposition.set(x, y);\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (C) 2019 Toshiba Corporation
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export var DDialogGestureMode = {
6
+ DIRTY: 0,
7
+ CLEAN: 1
8
+ };
9
+ //# sourceMappingURL=d-dialog-gesture-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d-dialog-gesture-mode.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-gesture-mode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,IAAM,kBAAkB,GAAG;IACjC,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;CACC,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const DDialogGestureMode = {\n\tDIRTY: 0,\n\tCLEAN: 1\n} as const;\n\nexport type DDialogGestureMode = typeof DDialogGestureMode[keyof typeof DDialogGestureMode];\n"]}
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2019 Toshiba Corporation
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=d-dialog-gesture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d-dialog-gesture.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-gesture.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DBase } from \"./d-base\";\nimport { DDialogGestureMode } from \"./d-dialog-gesture-mode\";\n\nexport type DDialogGestureConstraint = (\n\ttarget: DBase,\n\tlayer: DApplicationLayerLike,\n\tx: number,\n\ty: number\n) => void;\n\nexport interface DDialogGestureOptions {\n\tenable?: boolean;\n\tmode?: DDialogGestureMode | keyof typeof DDialogGestureMode;\n\tconstraint?: DDialogGestureConstraint;\n}\n\nexport interface DDialogGestureParent extends DBase {\n\treadonly layer: DApplicationLayerLike | null;\n}\n\nexport interface DDialogGesture<PARENT extends DDialogGestureParent> {\n\tparent: PARENT;\n\n\tmode: DDialogGestureMode;\n\n\tconstraint: DDialogGestureConstraint;\n\n\t/**\n\t * Returns true if thhe dialog position is changed by gestures.\n\t */\n\tisDirty(): boolean;\n\n\t/**\n\t * Returns true if the dialog position is not changed by gestures.\n\t */\n\tisClean(): boolean;\n\n\t/**\n\t * Marks the dialog position is not changed by gestures.\n\t */\n\ttoClean(): void;\n}\n"]}
@@ -3,6 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { __extends } from "tslib";
6
+ import { DBaseInteractive } from "./d-base-interactive";
6
7
  import { DDialogCommand } from "./d-dialog-command";
7
8
  import { DLayoutHorizontal } from "./d-layout-horizontal";
8
9
  import { DLayoutSpace } from "./d-layout-space";
@@ -75,6 +76,7 @@ var DDialogInput = /** @class */ (function (_super) {
75
76
  if (isString(label)) {
76
77
  return {
77
78
  weight: 1,
79
+ interactive: DBaseInteractive.NONE,
78
80
  text: {
79
81
  value: label
80
82
  }
@@ -87,10 +89,14 @@ var DDialogInput = /** @class */ (function (_super) {
87
89
  if (text.value === undefined) {
88
90
  text.value = theme.getLabel();
89
91
  }
90
- // Margin
92
+ // Weight
91
93
  if (label.width === undefined && label.weight === undefined) {
92
94
  label.weight = 1;
93
95
  }
96
+ // Interactive
97
+ if (label.interactive === undefined) {
98
+ label.interactive = DBaseInteractive.NONE;
99
+ }
94
100
  return label;
95
101
  }
96
102
  };
@@ -1 +1 @@
1
- {"version":3,"file":"d-dialog-input.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,cAAc,EAA8C,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAgB,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAyB5C;IAUU,gCAAqC;IAV/C;;IAqIA,CAAC;IAvHU,6BAAM,GAAhB,UAAiB,MAAuB,EAAE,OAAiB;QAC1D,iBAAM,MAAM,YAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE9B,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC;QAC3C,IAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;QACvC,IAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACzD,IAAI,YAAY,EAAE;YACjB,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GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;gBACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;aACrB;YACD,OAAO,MAAM,CAAC;QACf,CAAC;;;OAAA;IAED,sBAAI,+BAAK;aAAT;YACC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACzB,CAAC;aAED,UAAU,KAAY;YACrB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QAC1B,CAAC;;;OAJA;IAMS,uCAAgB,GAA1B;QACC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IACzB,CAAC;IAES,8BAAO,GAAjB;QACC,OAAO,cAAc,CAAC;IACvB,CAAC;IACF,mBAAC;AAAD,CAAC,AArID,CAUU,cAAc,GA2HvB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DBase, DBaseOptions } from \"./d-base\";\nimport { DDialogCommand, DDialogCommandOptions, DThemeDialogCommand } from \"./d-dialog-command\";\nimport { DLayoutHorizontal } from \"./d-layout-horizontal\";\nimport { DLayoutSpace } from \"./d-layout-space\";\nimport { DLayoutVertical } from \"./d-layout-vertical\";\nimport { DText, DTextOptions } from \"./d-text\";\nimport { isNumber } from \"./util/is-number\";\nimport { isString } from \"./util/is-string\";\n\nexport interface DDialogInputMargin {\n\thorizontal: number;\n\tvertical: number;\n}\n\nexport interface DDialogInputMarginOptions extends Partial<DDialogInputMargin> {}\n\nexport interface DDialogInputOptions<\n\tVALUE = void,\n\tINPUT_OPTIONS extends DBaseOptions = DBaseOptions,\n\tTHEME extends DThemeDialogInput = DThemeDialogInput\n> extends DDialogCommandOptions<VALUE, THEME> {\n\tlabel?: string | DTextOptions<string>;\n\tinput?: INPUT_OPTIONS;\n\tmargin?: number | DDialogInputMarginOptions;\n}\n\nexport interface DThemeDialogInput extends DThemeDialogCommand {\n\tgetMarginVertical(): number;\n\tgetMarginHorizontal(): number;\n\tgetLabel(): string;\n}\n\nexport abstract class DDialogInput<\n\tVALUE = void,\n\tINPUT extends DBase & { value: VALUE } = any,\n\tINPUT_OPTIONS extends DBaseOptions = DBaseOptions,\n\tTHEME extends DThemeDialogInput = DThemeDialogInput,\n\tOPTIONS extends DDialogInputOptions<VALUE, INPUT_OPTIONS, THEME> = DDialogInputOptions<\n\t\tVALUE,\n\t\tINPUT_OPTIONS,\n\t\tTHEME\n\t>\n> extends DDialogCommand<VALUE, THEME, OPTIONS> {\n\tprotected _label?: DText<string>;\n\tprotected _input?: INPUT;\n\n\tprotected onInit(layout: DLayoutVertical, options?: OPTIONS): void {\n\t\tsuper.onInit(layout, options);\n\n\t\tconst theme = this.theme;\n\t\tconst margin = this.toMargin(theme, options);\n\t\tconst marginHorizontal = margin.horizontal;\n\t\tconst marginVertical = margin.vertical;\n\t\tconst labelOptions = this.toLabelOptions(theme, options);\n\t\tif (labelOptions) {\n\t\t\tthis._label = new DText<string>(labelOptions);\n\t\t\tnew DLayoutHorizontal({\n\t\t\t\tparent: layout,\n\t\t\t\twidth: \"padding\",\n\t\t\t\theight: \"auto\",\n\t\t\t\tmargin: 0,\n\t\t\t\tchildren: [new DLayoutSpace({ width: marginHorizontal }), this._label]\n\t\t\t});\n\t\t}\n\t\tnew DLayoutHorizontal({\n\t\t\tparent: layout,\n\t\t\twidth: \"padding\",\n\t\t\theight: \"auto\",\n\t\t\tmargin: 0,\n\t\t\tpadding: labelOptions ? { top: marginVertical } : undefined,\n\t\t\tchildren: [\n\t\t\t\tnew DLayoutSpace({ width: marginHorizontal }),\n\t\t\t\tthis.input,\n\t\t\t\tnew DLayoutSpace({ width: marginHorizontal })\n\t\t\t]\n\t\t});\n\t}\n\n\tprotected toMargin(theme: THEME, options?: OPTIONS): Required<DDialogInputMarginOptions> {\n\t\tconst margin = options?.margin;\n\t\tif (margin != null) {\n\t\t\tif (isNumber(margin)) {\n\t\t\t\treturn {\n\t\t\t\t\thorizontal: margin,\n\t\t\t\t\tvertical: margin\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst horizontal = margin.horizontal;\n\t\t\t\tconst vertical = margin.vertical;\n\t\t\t\treturn {\n\t\t\t\t\thorizontal: horizontal ?? theme.getMarginHorizontal(),\n\t\t\t\t\tvertical: vertical ?? theme.getMarginVertical()\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\thorizontal: theme.getMarginHorizontal(),\n\t\t\tvertical: theme.getMarginVertical()\n\t\t};\n\t}\n\n\tprotected toLabelOptions(\n\t\ttheme: THEME,\n\t\toptions: OPTIONS | undefined\n\t): DTextOptions<string> | null {\n\t\tconst label = options?.label;\n\t\tif (label == null) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (isString(label)) {\n\t\t\treturn {\n\t\t\t\tweight: 1,\n\t\t\t\ttext: {\n\t\t\t\t\tvalue: label\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\t// Text\n\t\t\tconst text = label.text || {};\n\t\t\tlabel.text = text;\n\t\t\tif (text.value === undefined) {\n\t\t\t\ttext.value = theme.getLabel();\n\t\t\t}\n\n\t\t\t// Margin\n\t\t\tif (label.width === undefined && label.weight === undefined) {\n\t\t\t\tlabel.weight = 1;\n\t\t\t}\n\n\t\t\treturn label;\n\t\t}\n\t}\n\n\tget label(): DText<string> | undefined {\n\t\treturn this._label;\n\t}\n\n\tprotected abstract newInput(options?: INPUT_OPTIONS): INPUT;\n\n\tget input(): INPUT {\n\t\tlet result = this._input;\n\t\tif (result == null) {\n\t\t\tconst options = this._options;\n\t\t\tresult = this.newInput(options?.input);\n\t\t\tthis._input = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tget value(): VALUE {\n\t\treturn this.input.value;\n\t}\n\n\tset value(value: VALUE) {\n\t\tthis.input.value = value;\n\t}\n\n\tprotected getResolvedValue(): VALUE | PromiseLike<VALUE> {\n\t\treturn this.input.value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialogInput\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-dialog-input.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAA8C,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAgB,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAyB5C;IAUU,gCAAqC;IAV/C;;IA2IA,CAAC;IA7HU,6BAAM,GAAhB,UAAiB,MAAuB,EAAE,OAAiB;QAC1D,iBAAM,MAAM,YAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE9B,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC;QAC3C,IAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;QACvC,IAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACzD,IAAI,YAAY,EAAE;YACjB,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAS,YAAY,CAAC,CAAC;YAC9C,IAAI,iBAAiB,CAAC;gBACrB,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,CAAC;gBACT,QAAQ,EAAE,CAAC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,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;gBACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;aACrB;YACD,OAAO,MAAM,CAAC;QACf,CAAC;;;OAAA;IAED,sBAAI,+BAAK;aAAT;YACC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACzB,CAAC;aAED,UAAU,KAAY;YACrB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QAC1B,CAAC;;;OAJA;IAMS,uCAAgB,GAA1B;QACC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IACzB,CAAC;IAES,8BAAO,GAAjB;QACC,OAAO,cAAc,CAAC;IACvB,CAAC;IACF,mBAAC;AAAD,CAAC,AA3ID,CAUU,cAAc,GAiIvB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DBase, DBaseOptions } from \"./d-base\";\nimport { DBaseInteractive } from \"./d-base-interactive\";\nimport { DDialogCommand, DDialogCommandOptions, DThemeDialogCommand } from \"./d-dialog-command\";\nimport { DLayoutHorizontal } from \"./d-layout-horizontal\";\nimport { DLayoutSpace } from \"./d-layout-space\";\nimport { DLayoutVertical } from \"./d-layout-vertical\";\nimport { DText, DTextOptions } from \"./d-text\";\nimport { isNumber } from \"./util/is-number\";\nimport { isString } from \"./util/is-string\";\n\nexport interface DDialogInputMargin {\n\thorizontal: number;\n\tvertical: number;\n}\n\nexport interface DDialogInputMarginOptions extends Partial<DDialogInputMargin> {}\n\nexport interface DDialogInputOptions<\n\tVALUE = void,\n\tINPUT_OPTIONS extends DBaseOptions = DBaseOptions,\n\tTHEME extends DThemeDialogInput = DThemeDialogInput\n> extends DDialogCommandOptions<VALUE, THEME> {\n\tlabel?: string | DTextOptions<string>;\n\tinput?: INPUT_OPTIONS;\n\tmargin?: number | DDialogInputMarginOptions;\n}\n\nexport interface DThemeDialogInput extends DThemeDialogCommand {\n\tgetMarginVertical(): number;\n\tgetMarginHorizontal(): number;\n\tgetLabel(): string;\n}\n\nexport abstract class DDialogInput<\n\tVALUE = void,\n\tINPUT extends DBase & { value: VALUE } = any,\n\tINPUT_OPTIONS extends DBaseOptions = DBaseOptions,\n\tTHEME extends DThemeDialogInput = DThemeDialogInput,\n\tOPTIONS extends DDialogInputOptions<VALUE, INPUT_OPTIONS, THEME> = DDialogInputOptions<\n\t\tVALUE,\n\t\tINPUT_OPTIONS,\n\t\tTHEME\n\t>\n> extends DDialogCommand<VALUE, THEME, OPTIONS> {\n\tprotected _label?: DText<string>;\n\tprotected _input?: INPUT;\n\n\tprotected onInit(layout: DLayoutVertical, options?: OPTIONS): void {\n\t\tsuper.onInit(layout, options);\n\n\t\tconst theme = this.theme;\n\t\tconst margin = this.toMargin(theme, options);\n\t\tconst marginHorizontal = margin.horizontal;\n\t\tconst marginVertical = margin.vertical;\n\t\tconst labelOptions = this.toLabelOptions(theme, options);\n\t\tif (labelOptions) {\n\t\t\tthis._label = new DText<string>(labelOptions);\n\t\t\tnew DLayoutHorizontal({\n\t\t\t\tparent: layout,\n\t\t\t\twidth: \"padding\",\n\t\t\t\theight: \"auto\",\n\t\t\t\tmargin: 0,\n\t\t\t\tchildren: [new DLayoutSpace({ width: marginHorizontal }), this._label]\n\t\t\t});\n\t\t}\n\t\tnew DLayoutHorizontal({\n\t\t\tparent: layout,\n\t\t\twidth: \"padding\",\n\t\t\theight: \"auto\",\n\t\t\tmargin: 0,\n\t\t\tpadding: labelOptions ? { top: marginVertical } : undefined,\n\t\t\tchildren: [\n\t\t\t\tnew DLayoutSpace({ width: marginHorizontal }),\n\t\t\t\tthis.input,\n\t\t\t\tnew DLayoutSpace({ width: marginHorizontal })\n\t\t\t]\n\t\t});\n\t}\n\n\tprotected toMargin(theme: THEME, options?: OPTIONS): Required<DDialogInputMarginOptions> {\n\t\tconst margin = options?.margin;\n\t\tif (margin != null) {\n\t\t\tif (isNumber(margin)) {\n\t\t\t\treturn {\n\t\t\t\t\thorizontal: margin,\n\t\t\t\t\tvertical: margin\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst horizontal = margin.horizontal;\n\t\t\t\tconst vertical = margin.vertical;\n\t\t\t\treturn {\n\t\t\t\t\thorizontal: horizontal ?? theme.getMarginHorizontal(),\n\t\t\t\t\tvertical: vertical ?? theme.getMarginVertical()\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\thorizontal: theme.getMarginHorizontal(),\n\t\t\tvertical: theme.getMarginVertical()\n\t\t};\n\t}\n\n\tprotected toLabelOptions(\n\t\ttheme: THEME,\n\t\toptions: OPTIONS | undefined\n\t): DTextOptions<string> | null {\n\t\tconst label = options?.label;\n\t\tif (label == null) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (isString(label)) {\n\t\t\treturn {\n\t\t\t\tweight: 1,\n\t\t\t\tinteractive: DBaseInteractive.NONE,\n\t\t\t\ttext: {\n\t\t\t\t\tvalue: label\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\t// Text\n\t\t\tconst text = label.text || {};\n\t\t\tlabel.text = text;\n\t\t\tif (text.value === undefined) {\n\t\t\t\ttext.value = theme.getLabel();\n\t\t\t}\n\n\t\t\t// Weight\n\t\t\tif (label.width === undefined && label.weight === undefined) {\n\t\t\t\tlabel.weight = 1;\n\t\t\t}\n\n\t\t\t// Interactive\n\t\t\tif (label.interactive === undefined) {\n\t\t\t\tlabel.interactive = DBaseInteractive.NONE;\n\t\t\t}\n\n\t\t\treturn label;\n\t\t}\n\t}\n\n\tget label(): DText<string> | undefined {\n\t\treturn this._label;\n\t}\n\n\tprotected abstract newInput(options?: INPUT_OPTIONS): INPUT;\n\n\tget input(): INPUT {\n\t\tlet result = this._input;\n\t\tif (result == null) {\n\t\t\tconst options = this._options;\n\t\t\tresult = this.newInput(options?.input);\n\t\t\tthis._input = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tget value(): VALUE {\n\t\treturn this.input.value;\n\t}\n\n\tset value(value: VALUE) {\n\t\tthis.input.value = value;\n\t}\n\n\tprotected getResolvedValue(): VALUE | PromiseLike<VALUE> {\n\t\treturn this.input.value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialogInput\";\n\t}\n}\n"]}
@@ -3,13 +3,17 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { __extends } from "tslib";
6
- import { DAnimationFadeIn } from "./d-animation-fade-in";
6
+ import { Rectangle } from "pixi.js";
7
7
  import { DApplications } from "./d-applications";
8
8
  import { DBase } from "./d-base";
9
+ import { DBaseState } from "./d-base-state";
9
10
  import { DDialogAlign } from "./d-dialog-align";
10
11
  import { DDialogCloseOn } from "./d-dialog-close-on";
12
+ import { DDialogGestureImpl } from "./d-dialog-gesture-impl";
13
+ import { DDialogGestureMode } from "./d-dialog-gesture-mode";
11
14
  import { DDialogMode } from "./d-dialog-mode";
12
15
  import { DDialogState } from "./d-dialog-state";
16
+ import { isArray, isString } from "./util";
13
17
  import { toEnum } from "./util/to-enum";
14
18
  import { UtilAttach } from "./util/util-attach";
15
19
  import { UtilClickOutside } from "./util/util-click-outside";
@@ -30,61 +34,159 @@ var DDialog = /** @class */ (function (_super) {
30
34
  }
31
35
  DDialog.prototype.init = function (options) {
32
36
  var _this = this;
33
- var _a, _b, _c, _d;
37
+ var _a, _b;
34
38
  _super.prototype.init.call(this, options);
35
39
  this._onPrerenderBound = function () {
36
40
  _this.onPrerender();
37
41
  };
42
+ this._layer = null;
38
43
  // Mode
39
44
  var theme = this.theme;
40
45
  var mode = toEnum((_a = options === null || options === void 0 ? void 0 : options.mode) !== null && _a !== void 0 ? _a : theme.getMode(), DDialogMode);
41
46
  this._mode = mode;
42
47
  // Sticky
43
- this._sticky = (_b = options === null || options === void 0 ? void 0 : options.sticky) !== null && _b !== void 0 ? _b : theme.isSticky();
48
+ this._sticky = (_b = options === null || options === void 0 ? void 0 : options.sticky) !== null && _b !== void 0 ? _b : theme.isSticky(mode);
44
49
  // Close On
45
- var closeOn = (_c = options === null || options === void 0 ? void 0 : options.closeOn) !== null && _c !== void 0 ? _c : theme.closeOn();
50
+ var closeOn = this.toCloseOn(mode, theme, options);
46
51
  this._closeOn = closeOn;
47
52
  // Align
48
- this._align = toEnum((_d = options === null || options === void 0 ? void 0 : options.align) !== null && _d !== void 0 ? _d : DDialogAlign.BOTTOM, DDialogAlign);
53
+ this._align = this.toAlign(mode, theme, options);
49
54
  // Overlay
50
55
  this._overlay = new UtilOverlay();
51
- // Others
56
+ // Gesture
57
+ this._gesture = new DDialogGestureImpl(this, this.toGestureOptions(mode, theme, options));
58
+ // State
52
59
  switch (mode) {
53
60
  case DDialogMode.MODAL:
54
- case DDialogMode.MENU:
55
61
  this.visible = false;
56
- var state = this.state;
57
- state.lock();
58
- state.isFocusRoot = true;
59
- state.add(mode === DDialogMode.MODAL ? DDialogState.MODAL : DDialogState.MENU);
60
- state.unlock();
61
- if (closeOn & DDialogCloseOn.CLICK_OUTSIDE) {
62
- UtilClickOutside.apply(this, function () {
63
- _this.onCloseOn();
64
- });
65
- }
62
+ this.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MODAL);
66
63
  break;
67
64
  case DDialogMode.MODELESS:
68
65
  this.state.add(DDialogState.MODELESS);
69
66
  break;
67
+ case DDialogMode.MENU:
68
+ this.visible = false;
69
+ this.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MENU);
70
+ break;
71
+ }
72
+ // Outside-click handling
73
+ if (closeOn & DDialogCloseOn.CLICK_OUTSIDE) {
74
+ UtilClickOutside.apply(this, function () {
75
+ _this.onCloseOn();
76
+ });
77
+ }
78
+ };
79
+ DDialog.prototype.toCloseOn = function (mode, theme, options) {
80
+ var closeOn = options === null || options === void 0 ? void 0 : options.closeOn;
81
+ if (closeOn == null) {
82
+ return theme.closeOn(mode);
83
+ }
84
+ else if (isArray(closeOn)) {
85
+ var result = DDialogCloseOn.NONE;
86
+ for (var i = 0, imax = closeOn.length; i < imax; ++i) {
87
+ result |= DDialogCloseOn[closeOn[i]];
88
+ }
89
+ return result;
90
+ }
91
+ else if (isString(closeOn)) {
92
+ return DDialogCloseOn[closeOn];
93
+ }
94
+ return closeOn;
95
+ };
96
+ DDialog.prototype.toAlign = function (mode, theme, options) {
97
+ var align = options === null || options === void 0 ? void 0 : options.align;
98
+ if (align === null) {
99
+ return null;
100
+ }
101
+ else if (align === undefined) {
102
+ return theme.getAlign(mode);
103
+ }
104
+ else {
105
+ return toEnum(align, DDialogAlign);
70
106
  }
71
107
  };
108
+ Object.defineProperty(DDialog.prototype, "mode", {
109
+ get: function () {
110
+ return this._mode;
111
+ },
112
+ enumerable: false,
113
+ configurable: true
114
+ });
115
+ Object.defineProperty(DDialog.prototype, "align", {
116
+ get: function () {
117
+ return this._align;
118
+ },
119
+ enumerable: false,
120
+ configurable: true
121
+ });
122
+ Object.defineProperty(DDialog.prototype, "algin", {
123
+ set: function (align) {
124
+ this._align = align;
125
+ },
126
+ enumerable: false,
127
+ configurable: true
128
+ });
129
+ Object.defineProperty(DDialog.prototype, "gesture", {
130
+ get: function () {
131
+ return this._gesture;
132
+ },
133
+ enumerable: false,
134
+ configurable: true
135
+ });
136
+ Object.defineProperty(DDialog.prototype, "layer", {
137
+ get: function () {
138
+ return this._layer;
139
+ },
140
+ enumerable: false,
141
+ configurable: true
142
+ });
143
+ DDialog.prototype.toGestureOptions = function (mode, theme, options) {
144
+ var gesture = options === null || options === void 0 ? void 0 : options.gesture;
145
+ if (gesture === true) {
146
+ return {
147
+ enable: true,
148
+ mode: theme.getGestureMode(mode)
149
+ };
150
+ }
151
+ else if (gesture === false) {
152
+ return {
153
+ enable: false,
154
+ mode: theme.getGestureMode(mode)
155
+ };
156
+ }
157
+ else if (gesture != null) {
158
+ if (gesture.enable === undefined) {
159
+ gesture.enable = theme.isGestureEnabled(mode);
160
+ }
161
+ if (gesture.mode === undefined) {
162
+ gesture.mode = theme.getGestureMode(mode);
163
+ }
164
+ return gesture;
165
+ }
166
+ return {
167
+ enable: theme.isGestureEnabled(mode),
168
+ mode: theme.getGestureMode(mode)
169
+ };
170
+ };
171
+ DDialog.prototype.onParentResize = function (parentWidth, parentHeight, parentPadding) {
172
+ if (this.isOpened()) {
173
+ var layer = this._layer;
174
+ if (layer != null) {
175
+ var gesture = this._gesture;
176
+ if (gesture.isDirty()) {
177
+ var position = this.position;
178
+ gesture.constraint(this, layer, position.x, position.y);
179
+ }
180
+ }
181
+ }
182
+ _super.prototype.onParentResize.call(this, parentWidth, parentHeight, parentPadding);
183
+ };
72
184
  DDialog.prototype.getAnimation = function () {
73
185
  var _this = this;
74
- var _a, _b, _c, _d;
186
+ var _a, _b;
75
187
  var result = this._animation;
76
188
  if (result === undefined) {
77
- switch (this._mode) {
78
- case DDialogMode.MODAL:
79
- result = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.animation) !== null && _b !== void 0 ? _b : new DAnimationFadeIn();
80
- break;
81
- case DDialogMode.MODELESS:
82
- result = null;
83
- break;
84
- case DDialogMode.MENU:
85
- result = (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.animation) !== null && _d !== void 0 ? _d : null;
86
- break;
87
- }
189
+ result = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.animation) !== null && _b !== void 0 ? _b : this.theme.newAnimation(this._mode);
88
190
  if (result) {
89
191
  result.target = this;
90
192
  result.on("end", function (isReverse) {
@@ -112,7 +214,16 @@ var DDialog = /** @class */ (function (_super) {
112
214
  }
113
215
  }
114
216
  };
115
- DDialog.prototype.open = function (owner) {
217
+ /**
218
+ * Opens a dialog.
219
+ *
220
+ * @param opener An opener of a dialog.
221
+ * The dialog position is determined based on a position and a size of the opener.
222
+ * If the opener is undefined, the dialog is placed at the center of the screen.
223
+ *
224
+ * @returns a value of this dialog
225
+ */
226
+ DDialog.prototype.open = function (opener) {
116
227
  var _this = this;
117
228
  var result = this._promise;
118
229
  if (result == null) {
@@ -121,47 +232,62 @@ var DDialog = /** @class */ (function (_super) {
121
232
  _this._reject = reject;
122
233
  });
123
234
  this._promise = result;
124
- this._owner = owner;
235
+ this._opener = opener;
236
+ // Attach to a layer
237
+ var layer = null;
125
238
  switch (this._mode) {
126
239
  case DDialogMode.MODAL:
127
- {
128
- var layer = this._overlay.pick(this);
129
- layer.stage.addChild(this);
130
- }
240
+ case DDialogMode.MENU:
241
+ layer = this._overlay.pick(this);
242
+ layer.stage.addChild(this);
131
243
  break;
132
244
  case DDialogMode.MODELESS:
245
+ layer = DApplications.getLayer(this);
133
246
  break;
134
- case DDialogMode.MENU:
135
- {
136
- var layer = this._overlay.pick(this);
137
- layer.stage.addChild(this);
138
- // Position & size
139
- var renderer = layer.renderer;
140
- var onPrerenderBound = this._onPrerenderBound;
141
- if (this._sticky) {
142
- renderer.on("prerender", onPrerenderBound);
143
- }
144
- else {
145
- renderer.once("prerender", onPrerenderBound);
146
- }
247
+ }
248
+ this._layer = layer;
249
+ // Position & size
250
+ var gesture = this._gesture;
251
+ if (gesture.mode === DDialogGestureMode.CLEAN) {
252
+ gesture.toClean();
253
+ }
254
+ if (layer != null) {
255
+ if (gesture.isClean()) {
256
+ var renderer = layer.renderer;
257
+ var onPrerenderBound = this._onPrerenderBound;
258
+ if (this._sticky) {
259
+ renderer.on("prerender", onPrerenderBound);
147
260
  }
148
- break;
261
+ else {
262
+ renderer.once("prerender", onPrerenderBound);
263
+ }
264
+ }
265
+ else {
266
+ var position = this.position;
267
+ gesture.constraint(this, layer, position.x, position.y);
268
+ }
149
269
  }
270
+ // Done
150
271
  this.onOpen();
151
272
  }
152
273
  return result;
153
274
  };
154
275
  DDialog.prototype.onPrerender = function () {
155
- var owner = this._owner;
156
- if (owner) {
157
- var bounds = owner.getBounds();
158
- if (bounds) {
159
- var layer = this._overlay.picked;
160
- if (layer) {
161
- var theme = this.theme;
162
- UtilAttach.attach(this, bounds, theme.getOffsetX(), theme.getOffsetY(), layer.width, layer.height, this._align);
163
- }
164
- }
276
+ var _a;
277
+ var layer = this._layer;
278
+ if (layer == null) {
279
+ return;
280
+ }
281
+ var align = this._align;
282
+ var opener = this._opener;
283
+ if (align != null && opener != null) {
284
+ var mode = this._mode;
285
+ var bounds = opener.getBounds(false, ((_a = DDialog.WORK_BOUNDS) !== null && _a !== void 0 ? _a : (DDialog.WORK_BOUNDS = new Rectangle())));
286
+ var theme = this.theme;
287
+ UtilAttach.attach(this, bounds, theme.getOffsetX(mode), theme.getOffsetY(mode), layer.width, layer.height, align);
288
+ }
289
+ else {
290
+ this.position.set((layer.width - this.width) * 0.5, (layer.height - this.height) * 0.5);
165
291
  }
166
292
  };
167
293
  DDialog.prototype.onOpen = function () {
@@ -204,7 +330,7 @@ var DDialog = /** @class */ (function (_super) {
204
330
  };
205
331
  DDialog.prototype.onClose = function () {
206
332
  // Focus
207
- var layer = this._overlay.picked;
333
+ var layer = this._layer;
208
334
  var focused = this._focused;
209
335
  if (focused != null) {
210
336
  this._focused = null;
@@ -222,20 +348,13 @@ var DDialog = /** @class */ (function (_super) {
222
348
  else {
223
349
  this.blur(true);
224
350
  }
225
- // Remove the prerender event handler
226
- switch (this._mode) {
227
- case DDialogMode.MODAL:
228
- break;
229
- case DDialogMode.MODELESS:
230
- break;
231
- case DDialogMode.MENU:
232
- if (layer) {
233
- layer.renderer.off("prerender", this._onPrerenderBound);
234
- }
235
- break;
351
+ // Remove the prerender event handler and forget the layer
352
+ if (layer) {
353
+ layer.renderer.off("prerender", this._onPrerenderBound);
354
+ this._layer = null;
236
355
  }
237
- // Forget the owner
238
- this._owner = null;
356
+ // Forget the opener
357
+ this._opener = null;
239
358
  // Animation
240
359
  var animation = this.getAnimation();
241
360
  if (animation) {
@@ -248,17 +367,10 @@ var DDialog = /** @class */ (function (_super) {
248
367
  this.emit("close", this);
249
368
  };
250
369
  DDialog.prototype.onKeyDown = function (e) {
251
- switch (this._mode) {
252
- case DDialogMode.MODAL:
253
- case DDialogMode.MENU:
254
- if (this._closeOn & DDialogCloseOn.ESC) {
255
- if (UtilKeyboardEvent.isCancelKey(e)) {
256
- this.onCloseOn();
257
- }
258
- }
259
- break;
260
- case DDialogMode.MODELESS:
261
- break;
370
+ if (this._closeOn & DDialogCloseOn.ESC) {
371
+ if (UtilKeyboardEvent.isCancelKey(e)) {
372
+ this.onCloseOn();
373
+ }
262
374
  }
263
375
  return _super.prototype.onKeyDown.call(this, e);
264
376
  };
@@ -1 +1 @@
1
- {"version":3,"file":"d-dialog.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAyC,MAAM,UAAU,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA4DlD;;;;;;;GAOG;AACH;IAIU,2BAAqB;IAJ/B;;IA0SA,CAAC;IAvRU,sBAAI,GAAd,UAAe,OAAiB;QAAhC,iBA6CC;;QA5CA,iBAAM,IAAI,YAAC,OAAO,CAAC,CAAC;QAEpB,IAAI,CAAC,iBAAiB,GAAG;YACxB,KAAI,CAAC,WAAW,EAAE,CAAC;QACpB,CAAC,CAAC;QAEF,OAAO;QACP,IAAM,KAAK,GAA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AAC,GAAG,EAAE;oBACvC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;wBACrC,IAAI,CAAC,SAAS,EAAE,CAAC;qBACjB;iBACD;gBACD,MAAM;YACP,KAAK,WAAW,CAAC,QAAQ;gBACxB,MAAM;SACP;QACD,OAAO,iBAAM,SAAS,YAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAES,2BAAS,GAAnB;QACC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAES,qCAAmB,GAA7B,UAA8B,KAAY;QACzC,QAAQ,IAAI,CAAC,KAAK,EAAE;YACnB,KAAK,WAAW,CAAC,KAAK,CAAC;YACvB,KAAK,WAAW,CAAC,IAAI;gBACpB,OAAO,IAAI,CAAC;YACb,KAAK,WAAW,CAAC,QAAQ;gBACxB,OAAO,iBAAM,mBAAmB,YAAC,KAAK,CAAC,CAAC;SACzC;IACF,CAAC;IAES,yBAAO,GAAjB;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IACF,cAAC;AAAD,CAAC,AA1SD,CAIU,KAAK,GAsSd","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Point } from \"pixi.js\";\nimport { DAnimation } from \"./d-animation\";\nimport { DAnimationFadeIn } from \"./d-animation-fade-in\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase, DBaseEvents, DBaseOptions, DThemeBase } from \"./d-base\";\nimport { DFocusable } from \"./d-controller-focus\";\nimport { DDialogAlign } from \"./d-dialog-align\";\nimport { DDialogCloseOn } from \"./d-dialog-close-on\";\nimport { DDialogMode } from \"./d-dialog-mode\";\nimport { DDialogState } from \"./d-dialog-state\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilAttach } from \"./util/util-attach\";\nimport { UtilClickOutside } from \"./util/util-click-outside\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilOverlay } from \"./util/util-overlay\";\n\n/**\n * {@link DDialog} events.\n */\nexport interface DDialogEvents<EMITTER> extends DBaseEvents<EMITTER> {\n\t/**\n\t * Triggered when a dialog is opened.\n\t *\n\t * @param emitter this\n\t */\n\topen(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when a dialog is closed.\n\t *\n\t * @param emitter this\n\t */\n\tclose(emitter: EMITTER): void;\n}\n\n/**\n * {@link DDialog} `on` options.\n */\nexport interface DDialogOnOptions<EMITTER> extends Partial<DDialogEvents<EMITTER>>, DOnOptions {}\n\n/**\n * {@link DDialog} options.\n */\nexport interface DDialogOptions<THEME extends DThemeDialog = DThemeDialog, EMITTER = any>\n\textends DBaseOptions<THEME> {\n\tcloseOn?: DDialogCloseOn;\n\tanimation?: DAnimation<DBase>;\n\n\t/**\n\t * A dialog mode.\n\t */\n\tmode?: DDialogMode | keyof typeof DDialogMode;\n\n\tsticky?: boolean;\n\n\talign?: DDialogAlign;\n\n\t/**\n\t * Mappings of event names and handlers.\n\t */\n\ton?: DDialogOnOptions<EMITTER>;\n}\n\n/**\n * {@link DDialog} theme.\n */\nexport interface DThemeDialog extends DThemeBase {\n\tgetMode(): DDialogMode;\n\tcloseOn(): DDialogCloseOn;\n\tisSticky(): boolean;\n\tgetOffsetX(): number;\n\tgetOffsetY(): number;\n}\n\n/**\n * A dialog class.\n *\n * If multiple application instances are there, better to set the constructor\n * option `parent` to an `application.stage` so that the dialog picks a right\n * application. By default, the dialog assumes the last created application is\n * the one it belongs to at the time when it is created.\n */\nexport class DDialog<\n\tVALUE = void,\n\tTHEME extends DThemeDialog = DThemeDialog,\n\tOPTIONS extends DDialogOptions<THEME> = DDialogOptions<THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected _promise?: Promise<VALUE>;\n\tprotected _resolve?: (value: VALUE | PromiseLike<VALUE>) => void;\n\tprotected _reject?: (reason?: any) => void;\n\n\tprotected _animation?: DAnimation<DBase> | null;\n\tprotected _closeOn!: DDialogCloseOn;\n\tprotected _focused?: DFocusable | null;\n\tprotected _overlay!: UtilOverlay;\n\tprotected _mode!: DDialogMode;\n\tprotected _sticky!: boolean;\n\tprotected _onPrerenderBound!: () => void;\n\tprotected _align!: DDialogAlign;\n\tprotected _owner?: DBase<any, any> | null;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tthis._onPrerenderBound = (): void => {\n\t\t\tthis.onPrerender();\n\t\t};\n\n\t\t// Mode\n\t\tconst theme = this.theme;\n\t\tconst mode = toEnum(options?.mode ?? theme.getMode(), DDialogMode);\n\t\tthis._mode = mode;\n\n\t\t// Sticky\n\t\tthis._sticky = options?.sticky ?? theme.isSticky();\n\n\t\t// Close On\n\t\tconst closeOn = options?.closeOn ?? theme.closeOn();\n\t\tthis._closeOn = closeOn;\n\n\t\t// Align\n\t\tthis._align = toEnum(options?.align ?? DDialogAlign.BOTTOM, DDialogAlign);\n\n\t\t// Overlay\n\t\tthis._overlay = new UtilOverlay();\n\n\t\t// Others\n\t\tswitch (mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\tthis.visible = false;\n\t\t\t\tconst state = this.state;\n\t\t\t\tstate.lock();\n\t\t\t\tstate.isFocusRoot = true;\n\t\t\t\tstate.add(mode === DDialogMode.MODAL ? DDialogState.MODAL : DDialogState.MENU);\n\t\t\t\tstate.unlock();\n\t\t\t\tif (closeOn & DDialogCloseOn.CLICK_OUTSIDE) {\n\t\t\t\t\tUtilClickOutside.apply(this, (): void => {\n\t\t\t\t\t\tthis.onCloseOn();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\tthis.state.add(DDialogState.MODELESS);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tprotected getAnimation(): DAnimation | null {\n\t\tlet result = this._animation;\n\t\tif (result === undefined) {\n\t\t\tswitch (this._mode) {\n\t\t\t\tcase DDialogMode.MODAL:\n\t\t\t\t\tresult = this._options?.animation ?? new DAnimationFadeIn();\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\t\tresult = null;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MENU:\n\t\t\t\t\tresult = this._options?.animation ?? null;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (result) {\n\t\t\t\tresult.target = this;\n\t\t\t\tresult.on(\"end\", (isReverse: boolean): void => {\n\t\t\t\t\tthis.onAnimationEnd(isReverse);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._animation = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onAnimationEnd(isReverse: boolean): void {\n\t\tif (isReverse) {\n\t\t\tconst parent = this.parent;\n\t\t\tif (parent) {\n\t\t\t\tparent.removeChild(this);\n\t\t\t}\n\t\t} else {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tconst focusController = layer.getFocusController();\n\t\t\t\tthis._focused = focusController.get();\n\t\t\t\tconst firstFocusable = focusController.find(this, false, true, true);\n\t\t\t\tfocusController.focus(firstFocusable || this);\n\t\t\t}\n\t\t}\n\t}\n\n\topen(owner?: DBase<any, any>): Promise<VALUE> {\n\t\tlet result = this._promise;\n\t\tif (result == null) {\n\t\t\tresult = new Promise<VALUE>((resolve, reject): void => {\n\t\t\t\tthis._resolve = resolve;\n\t\t\t\tthis._reject = reject;\n\t\t\t});\n\t\t\tthis._promise = result;\n\n\t\t\tthis._owner = owner;\n\n\t\t\tswitch (this._mode) {\n\t\t\t\tcase DDialogMode.MODAL:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst layer = this._overlay.pick(this);\n\t\t\t\t\t\tlayer.stage.addChild(this);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MENU:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst layer = this._overlay.pick(this);\n\t\t\t\t\t\tlayer.stage.addChild(this);\n\n\t\t\t\t\t\t// Position & size\n\t\t\t\t\t\tconst renderer = layer.renderer;\n\t\t\t\t\t\tconst onPrerenderBound = this._onPrerenderBound;\n\t\t\t\t\t\tif (this._sticky) {\n\t\t\t\t\t\t\trenderer.on(\"prerender\", onPrerenderBound);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trenderer.once(\"prerender\", onPrerenderBound);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis.onOpen();\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onPrerender(): void {\n\t\tconst owner = this._owner;\n\t\tif (owner) {\n\t\t\tconst bounds = owner.getBounds();\n\t\t\tif (bounds) {\n\t\t\t\tconst layer = this._overlay.picked;\n\t\t\t\tif (layer) {\n\t\t\t\t\tconst theme = this.theme;\n\t\t\t\t\tUtilAttach.attach(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tbounds,\n\t\t\t\t\t\ttheme.getOffsetX(),\n\t\t\t\t\t\ttheme.getOffsetY(),\n\t\t\t\t\t\tlayer.width,\n\t\t\t\t\t\tlayer.height,\n\t\t\t\t\t\tthis._align\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onOpen(): void {\n\t\tthis.emit(\"open\", this);\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start();\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = true;\n\t\t\tthis.onAnimationEnd(false);\n\t\t}\n\t}\n\n\tisOpened(): boolean {\n\t\treturn this._promise != null;\n\t}\n\n\tclose(): void {\n\t\tthis.doReject();\n\t}\n\n\tprotected doResolve(value: VALUE | PromiseLike<VALUE>): void {\n\t\tconst resolve = this._resolve;\n\t\tif (resolve) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\tresolve(value);\n\t\t}\n\t}\n\n\tprotected doReject(reason?: any): void {\n\t\tconst reject = this._reject;\n\t\tif (reject) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\treject(reason);\n\t\t}\n\t}\n\n\tprotected onClose(): void {\n\t\t// Focus\n\t\tconst layer = this._overlay.picked;\n\t\tconst focused = this._focused;\n\t\tif (focused != null) {\n\t\t\tthis._focused = null;\n\t\t\tif (layer) {\n\t\t\t\tconst focusedLayer = DApplications.getLayer(focused);\n\t\t\t\tif (focusedLayer != null && layer !== focusedLayer) {\n\t\t\t\t\tfocusedLayer.view.focus();\n\t\t\t\t}\n\t\t\t\tlayer.getFocusController().focus(focused);\n\t\t\t} else {\n\t\t\t\tthis.blur(true);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.blur(true);\n\t\t}\n\n\t\t// Remove the prerender event handler\n\t\tswitch (this._mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\tif (layer) {\n\t\t\t\t\tlayer.renderer.off(\"prerender\", this._onPrerenderBound);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Forget the owner\n\t\tthis._owner = null;\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start(true);\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = false;\n\t\t\tthis.onAnimationEnd(true);\n\t\t}\n\n\t\tthis.emit(\"close\", this);\n\t}\n\n\tonKeyDown(e: KeyboardEvent): boolean {\n\t\tswitch (this._mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\tif (this._closeOn & DDialogCloseOn.ESC) {\n\t\t\t\t\tif (UtilKeyboardEvent.isCancelKey(e)) {\n\t\t\t\t\t\tthis.onCloseOn();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\tbreak;\n\t\t}\n\t\treturn super.onKeyDown(e);\n\t}\n\n\tprotected onCloseOn(): void {\n\t\tthis.close();\n\t}\n\n\tprotected containsGlobalPoint(point: Point): boolean {\n\t\tswitch (this._mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\treturn true;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\treturn super.containsGlobalPoint(point);\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialog\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-dialog.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAS,SAAS,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAyC,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE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,CAAC;SAC1B;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,2BAAS,GAAT,UAAU,CAAgB;QACzB,IAAI,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE;YACvC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;gBACrC,IAAI,CAAC,SAAS,EAAE,CAAC;aACjB;SACD;QACD,OAAO,iBAAM,SAAS,YAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAES,2BAAS,GAAnB;QACC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAES,qCAAmB,GAA7B,UAA8B,KAAY;QACzC,QAAQ,IAAI,CAAC,KAAK,EAAE;YACnB,KAAK,WAAW,CAAC,KAAK,CAAC;YACvB,KAAK,WAAW,CAAC,IAAI;gBACpB,OAAO,IAAI,CAAC;YACb,KAAK,WAAW,CAAC,QAAQ;gBACxB,OAAO,iBAAM,mBAAmB,YAAC,KAAK,CAAC,CAAC;SACzC;IACF,CAAC;IAES,yBAAO,GAAjB;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IACF,cAAC;AAAD,CAAC,AA9YD,CAIU,KAAK,GA0Yd","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Point, Rectangle } from \"pixi.js\";\nimport { DAnimation } from \"./d-animation\";\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase, DBaseEvents, DBaseOptions, DThemeBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DFocusable } from \"./d-controller-focus\";\nimport { DDialogAlign } from \"./d-dialog-align\";\nimport { DDialogCloseOn } from \"./d-dialog-close-on\";\nimport { DDialogGesture, DDialogGestureOptions } from \"./d-dialog-gesture\";\nimport { DDialogGestureImpl } from \"./d-dialog-gesture-impl\";\nimport { DDialogGestureMode } from \"./d-dialog-gesture-mode\";\nimport { DDialogMode } from \"./d-dialog-mode\";\nimport { DDialogState } from \"./d-dialog-state\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DPadding } from \"./d-padding\";\nimport { isArray, isString } from \"./util\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilAttach } from \"./util/util-attach\";\nimport { UtilClickOutside } from \"./util/util-click-outside\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilOverlay } from \"./util/util-overlay\";\n\n/**\n * {@link DDialog} events.\n */\nexport interface DDialogEvents<EMITTER> extends DBaseEvents<EMITTER> {\n\t/**\n\t * Triggered when a dialog is opened.\n\t *\n\t * @param emitter this\n\t */\n\topen(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when a dialog is closed.\n\t *\n\t * @param emitter this\n\t */\n\tclose(emitter: EMITTER): void;\n}\n\n/**\n * {@link DDialog} `on` options.\n */\nexport interface DDialogOnOptions<EMITTER> extends Partial<DDialogEvents<EMITTER>>, DOnOptions {}\n\n/**\n * {@link DDialog} options.\n */\nexport interface DDialogOptions<THEME extends DThemeDialog = DThemeDialog, EMITTER = any>\n\textends DBaseOptions<THEME> {\n\tcloseOn?: DDialogCloseOn | Array<keyof typeof DDialogCloseOn> | keyof typeof DDialogCloseOn;\n\n\tanimation?: DAnimation<DBase>;\n\n\t/**\n\t * A dialog mode.\n\t */\n\tmode?: DDialogMode | keyof typeof DDialogMode;\n\n\tsticky?: boolean;\n\n\tgesture?: boolean | DDialogGestureOptions;\n\n\talign?: DDialogAlign | null | keyof typeof DDialogAlign;\n\n\t/**\n\t * Mappings of event names and handlers.\n\t */\n\ton?: DDialogOnOptions<EMITTER>;\n}\n\n/**\n * {@link DDialog} theme.\n */\nexport interface DThemeDialog extends DThemeBase {\n\tgetMode(): DDialogMode;\n\tcloseOn(mode: DDialogMode): DDialogCloseOn;\n\tisSticky(mode: DDialogMode): boolean;\n\tisGestureEnabled(mode: DDialogMode): boolean;\n\tgetGestureMode(mode: DDialogMode): DDialogGestureMode;\n\tgetOffsetX(mode: DDialogMode): number;\n\tgetOffsetY(mode: DDialogMode): number;\n\tgetAlign(mode: DDialogMode): DDialogAlign | null;\n\tnewAnimation(mode: DDialogMode): DAnimation<DBase> | null;\n}\n\nexport interface DDialogOpener {\n\tgetBounds(skipUpdate: boolean, result: Rectangle): Rectangle;\n}\n\n/**\n * A dialog class.\n *\n * If multiple application instances are there, better to set the constructor\n * option `parent` to an `application.stage` so that the dialog picks a right\n * application. By default, the dialog assumes the last created application is\n * the one it belongs to at the time when it is created.\n */\nexport class DDialog<\n\tVALUE = void,\n\tTHEME extends DThemeDialog = DThemeDialog,\n\tOPTIONS extends DDialogOptions<THEME> = DDialogOptions<THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected static WORK_BOUNDS?: Rectangle;\n\n\tprotected _promise?: Promise<VALUE>;\n\tprotected _resolve?: (value: VALUE | PromiseLike<VALUE>) => void;\n\tprotected _reject?: (reason?: any) => void;\n\n\tprotected _animation?: DAnimation<DBase> | null;\n\tprotected _closeOn!: DDialogCloseOn;\n\tprotected _focused?: DFocusable | null;\n\tprotected _overlay!: UtilOverlay;\n\tprotected _mode!: DDialogMode;\n\tprotected _sticky!: boolean;\n\tprotected _onPrerenderBound!: () => void;\n\tprotected _align!: DDialogAlign | null;\n\tprotected _opener?: DDialogOpener | null;\n\n\tprotected _gesture!: DDialogGesture<this>;\n\tprotected _layer!: DApplicationLayerLike | null;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tthis._onPrerenderBound = (): void => {\n\t\t\tthis.onPrerender();\n\t\t};\n\t\tthis._layer = null;\n\n\t\t// Mode\n\t\tconst theme = this.theme;\n\t\tconst mode = toEnum(options?.mode ?? theme.getMode(), DDialogMode);\n\t\tthis._mode = mode;\n\n\t\t// Sticky\n\t\tthis._sticky = options?.sticky ?? theme.isSticky(mode);\n\n\t\t// Close On\n\t\tconst closeOn = this.toCloseOn(mode, theme, options);\n\t\tthis._closeOn = closeOn;\n\n\t\t// Align\n\t\tthis._align = this.toAlign(mode, theme, options);\n\n\t\t// Overlay\n\t\tthis._overlay = new UtilOverlay();\n\n\t\t// Gesture\n\t\tthis._gesture = new DDialogGestureImpl(this, this.toGestureOptions(mode, theme, options));\n\n\t\t// State\n\t\tswitch (mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tthis.visible = false;\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MODAL);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\tthis.state.add(DDialogState.MODELESS);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\tthis.visible = false;\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MENU);\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Outside-click handling\n\t\tif (closeOn & DDialogCloseOn.CLICK_OUTSIDE) {\n\t\t\tUtilClickOutside.apply(this, (): void => {\n\t\t\t\tthis.onCloseOn();\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected toCloseOn(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogCloseOn {\n\t\tconst closeOn = options?.closeOn;\n\t\tif (closeOn == null) {\n\t\t\treturn theme.closeOn(mode);\n\t\t} else if (isArray(closeOn)) {\n\t\t\tlet result = DDialogCloseOn.NONE;\n\t\t\tfor (let i = 0, imax = closeOn.length; i < imax; ++i) {\n\t\t\t\tresult |= DDialogCloseOn[closeOn[i]];\n\t\t\t}\n\t\t\treturn result;\n\t\t} else if (isString(closeOn)) {\n\t\t\treturn DDialogCloseOn[closeOn];\n\t\t}\n\t\treturn closeOn;\n\t}\n\n\tprotected toAlign(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogAlign | null {\n\t\tconst align = options?.align;\n\t\tif (align === null) {\n\t\t\treturn null;\n\t\t} else if (align === undefined) {\n\t\t\treturn theme.getAlign(mode);\n\t\t} else {\n\t\t\treturn toEnum(align, DDialogAlign);\n\t\t}\n\t}\n\n\tget mode(): DDialogMode {\n\t\treturn this._mode;\n\t}\n\n\tget align(): DDialogAlign | null {\n\t\treturn this._align;\n\t}\n\n\tset algin(align: DDialogAlign | null) {\n\t\tthis._align = align;\n\t}\n\n\tget gesture(): DDialogGesture<this> {\n\t\treturn this._gesture;\n\t}\n\n\tget layer(): DApplicationLayerLike | null {\n\t\treturn this._layer;\n\t}\n\n\tprotected toGestureOptions(\n\t\tmode: DDialogMode,\n\t\ttheme: THEME,\n\t\toptions?: OPTIONS\n\t): DDialogGestureOptions {\n\t\tconst gesture = options?.gesture;\n\t\tif (gesture === true) {\n\t\t\treturn {\n\t\t\t\tenable: true,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture === false) {\n\t\t\treturn {\n\t\t\t\tenable: false,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture != null) {\n\t\t\tif (gesture.enable === undefined) {\n\t\t\t\tgesture.enable = theme.isGestureEnabled(mode);\n\t\t\t}\n\t\t\tif (gesture.mode === undefined) {\n\t\t\t\tgesture.mode = theme.getGestureMode(mode);\n\t\t\t}\n\t\t\treturn gesture;\n\t\t}\n\t\treturn {\n\t\t\tenable: theme.isGestureEnabled(mode),\n\t\t\tmode: theme.getGestureMode(mode)\n\t\t};\n\t}\n\n\tonParentResize(parentWidth: number, parentHeight: number, parentPadding: DPadding): void {\n\t\tif (this.isOpened()) {\n\t\t\tconst layer = this._layer;\n\t\t\tif (layer != null) {\n\t\t\t\tconst gesture = this._gesture;\n\t\t\t\tif (gesture.isDirty()) {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsuper.onParentResize(parentWidth, parentHeight, parentPadding);\n\t}\n\n\tprotected getAnimation(): DAnimation | null {\n\t\tlet result = this._animation;\n\t\tif (result === undefined) {\n\t\t\tresult = this._options?.animation ?? this.theme.newAnimation(this._mode);\n\t\t\tif (result) {\n\t\t\t\tresult.target = this;\n\t\t\t\tresult.on(\"end\", (isReverse: boolean): void => {\n\t\t\t\t\tthis.onAnimationEnd(isReverse);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._animation = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onAnimationEnd(isReverse: boolean): void {\n\t\tif (isReverse) {\n\t\t\tconst parent = this.parent;\n\t\t\tif (parent) {\n\t\t\t\tparent.removeChild(this);\n\t\t\t}\n\t\t} else {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tconst focusController = layer.getFocusController();\n\t\t\t\tthis._focused = focusController.get();\n\t\t\t\tconst firstFocusable = focusController.find(this, false, true, true);\n\t\t\t\tfocusController.focus(firstFocusable || this);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Opens a dialog.\n\t *\n\t * @param opener An opener of a dialog.\n\t * The dialog position is determined based on a position and a size of the opener.\n\t * If the opener is undefined, the dialog is placed at the center of the screen.\n\t *\n\t * @returns a value of this dialog\n\t */\n\topen(opener?: DDialogOpener): Promise<VALUE> {\n\t\tlet result = this._promise;\n\t\tif (result == null) {\n\t\t\tresult = new Promise<VALUE>((resolve, reject): void => {\n\t\t\t\tthis._resolve = resolve;\n\t\t\t\tthis._reject = reject;\n\t\t\t});\n\t\t\tthis._promise = result;\n\n\t\t\tthis._opener = opener;\n\n\t\t\t// Attach to a layer\n\t\t\tlet layer: DApplicationLayerLike | null = null;\n\t\t\tswitch (this._mode) {\n\t\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tcase DDialogMode.MENU:\n\t\t\t\t\tlayer = this._overlay.pick(this);\n\t\t\t\t\tlayer.stage.addChild(this);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\t\tlayer = DApplications.getLayer(this);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis._layer = layer;\n\n\t\t\t// Position & size\n\t\t\tconst gesture = this._gesture;\n\t\t\tif (gesture.mode === DDialogGestureMode.CLEAN) {\n\t\t\t\tgesture.toClean();\n\t\t\t}\n\t\t\tif (layer != null) {\n\t\t\t\tif (gesture.isClean()) {\n\t\t\t\t\tconst renderer = layer.renderer;\n\t\t\t\t\tconst onPrerenderBound = this._onPrerenderBound;\n\t\t\t\t\tif (this._sticky) {\n\t\t\t\t\t\trenderer.on(\"prerender\", onPrerenderBound);\n\t\t\t\t\t} else {\n\t\t\t\t\t\trenderer.once(\"prerender\", onPrerenderBound);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Done\n\t\t\tthis.onOpen();\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onPrerender(): void {\n\t\tconst layer = this._layer;\n\t\tif (layer == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst align = this._align;\n\t\tconst opener = this._opener;\n\t\tif (align != null && opener != null) {\n\t\t\tconst mode = this._mode;\n\t\t\tconst bounds = opener.getBounds(false, (DDialog.WORK_BOUNDS ??= new Rectangle()));\n\t\t\tconst theme = this.theme;\n\t\t\tUtilAttach.attach(\n\t\t\t\tthis,\n\t\t\t\tbounds,\n\t\t\t\ttheme.getOffsetX(mode),\n\t\t\t\ttheme.getOffsetY(mode),\n\t\t\t\tlayer.width,\n\t\t\t\tlayer.height,\n\t\t\t\talign\n\t\t\t);\n\t\t} else {\n\t\t\tthis.position.set((layer.width - this.width) * 0.5, (layer.height - this.height) * 0.5);\n\t\t}\n\t}\n\n\tprotected onOpen(): void {\n\t\tthis.emit(\"open\", this);\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start();\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = true;\n\t\t\tthis.onAnimationEnd(false);\n\t\t}\n\t}\n\n\tisOpened(): boolean {\n\t\treturn this._promise != null;\n\t}\n\n\tclose(): void {\n\t\tthis.doReject();\n\t}\n\n\tprotected doResolve(value: VALUE | PromiseLike<VALUE>): void {\n\t\tconst resolve = this._resolve;\n\t\tif (resolve) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\tresolve(value);\n\t\t}\n\t}\n\n\tprotected doReject(reason?: any): void {\n\t\tconst reject = this._reject;\n\t\tif (reject) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\treject(reason);\n\t\t}\n\t}\n\n\tprotected onClose(): void {\n\t\t// Focus\n\t\tconst layer = this._layer;\n\t\tconst focused = this._focused;\n\t\tif (focused != null) {\n\t\t\tthis._focused = null;\n\t\t\tif (layer) {\n\t\t\t\tconst focusedLayer = DApplications.getLayer(focused);\n\t\t\t\tif (focusedLayer != null && layer !== focusedLayer) {\n\t\t\t\t\tfocusedLayer.view.focus();\n\t\t\t\t}\n\t\t\t\tlayer.getFocusController().focus(focused);\n\t\t\t} else {\n\t\t\t\tthis.blur(true);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.blur(true);\n\t\t}\n\n\t\t// Remove the prerender event handler and forget the layer\n\t\tif (layer) {\n\t\t\tlayer.renderer.off(\"prerender\", this._onPrerenderBound);\n\t\t\tthis._layer = null;\n\t\t}\n\n\t\t// Forget the opener\n\t\tthis._opener = null;\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start(true);\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = false;\n\t\t\tthis.onAnimationEnd(true);\n\t\t}\n\n\t\tthis.emit(\"close\", this);\n\t}\n\n\tonKeyDown(e: KeyboardEvent): boolean {\n\t\tif (this._closeOn & DDialogCloseOn.ESC) {\n\t\t\tif (UtilKeyboardEvent.isCancelKey(e)) {\n\t\t\t\tthis.onCloseOn();\n\t\t\t}\n\t\t}\n\t\treturn super.onKeyDown(e);\n\t}\n\n\tprotected onCloseOn(): void {\n\t\tthis.close();\n\t}\n\n\tprotected containsGlobalPoint(point: Point): boolean {\n\t\tswitch (this._mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\treturn true;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\treturn super.containsGlobalPoint(point);\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialog\";\n\t}\n}\n"]}
@@ -49,7 +49,9 @@ var DImageBase = /** @class */ (function (_super) {
49
49
  return this._images[0].source;
50
50
  },
51
51
  set: function (imageSource) {
52
- this._images[0].source = imageSource;
52
+ var image = this._images[0];
53
+ image.source = imageSource;
54
+ image.updateSource();
53
55
  },
54
56
  enumerable: false,
55
57
  configurable: true