@operato/scene-storage 10.0.0-beta.33 → 10.0.0-beta.34

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 (89) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/crane-3d.d.ts +14 -0
  3. package/dist/crane-3d.js +238 -0
  4. package/dist/crane-3d.js.map +1 -0
  5. package/dist/crane.d.ts +157 -0
  6. package/dist/crane.js +440 -0
  7. package/dist/crane.js.map +1 -0
  8. package/dist/index.d.ts +13 -6
  9. package/dist/index.js +9 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/mobile-storage-rack.d.ts +17 -0
  12. package/dist/mobile-storage-rack.js +55 -0
  13. package/dist/mobile-storage-rack.js.map +1 -0
  14. package/dist/rack-column.d.ts +35 -0
  15. package/dist/rack-column.js +258 -0
  16. package/dist/rack-column.js.map +1 -0
  17. package/dist/rack-grid-3d.d.ts +13 -0
  18. package/dist/rack-grid-3d.js +94 -0
  19. package/dist/rack-grid-3d.js.map +1 -0
  20. package/dist/rack-grid-cell.d.ts +341 -0
  21. package/dist/rack-grid-cell.js +321 -0
  22. package/dist/rack-grid-cell.js.map +1 -0
  23. package/dist/rack-grid-helpers.d.ts +28 -0
  24. package/dist/rack-grid-helpers.js +71 -0
  25. package/dist/rack-grid-helpers.js.map +1 -0
  26. package/dist/rack-grid-location.d.ts +37 -0
  27. package/dist/rack-grid-location.js +227 -0
  28. package/dist/rack-grid-location.js.map +1 -0
  29. package/dist/rack-grid.d.ts +80 -0
  30. package/dist/rack-grid.js +829 -0
  31. package/dist/rack-grid.js.map +1 -0
  32. package/dist/stock.d.ts +78 -0
  33. package/dist/stock.js +333 -0
  34. package/dist/stock.js.map +1 -0
  35. package/dist/{rack-cell-3d.d.ts → storage-cell-3d.d.ts} +1 -1
  36. package/dist/{rack-cell-3d.js → storage-cell-3d.js} +3 -3
  37. package/dist/storage-cell-3d.js.map +1 -0
  38. package/dist/{rack-cell.d.ts → storage-cell.d.ts} +12 -6
  39. package/dist/{rack-cell.js → storage-cell.js} +9 -9
  40. package/dist/storage-cell.js.map +1 -0
  41. package/dist/{asrs-rack-3d.d.ts → storage-rack-3d.d.ts} +1 -1
  42. package/dist/{asrs-rack-3d.js → storage-rack-3d.js} +4 -4
  43. package/dist/storage-rack-3d.js.map +1 -0
  44. package/dist/{asrs-rack.d.ts → storage-rack.d.ts} +22 -16
  45. package/dist/{asrs-rack.js → storage-rack.js} +32 -26
  46. package/dist/storage-rack.js.map +1 -0
  47. package/dist/templates/index.d.ts +60 -0
  48. package/dist/templates/index.js +59 -17
  49. package/dist/templates/index.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/crane-3d.ts +273 -0
  52. package/src/crane.ts +538 -0
  53. package/src/index.ts +13 -6
  54. package/src/mobile-storage-rack.ts +56 -0
  55. package/src/rack-column.ts +340 -0
  56. package/src/rack-grid-3d.ts +128 -0
  57. package/src/rack-grid-cell.ts +404 -0
  58. package/src/rack-grid-helpers.ts +77 -0
  59. package/src/rack-grid-location.ts +286 -0
  60. package/src/rack-grid.ts +994 -0
  61. package/src/stock.ts +426 -0
  62. package/src/{rack-cell-3d.ts → storage-cell-3d.ts} +2 -2
  63. package/src/{rack-cell.ts → storage-cell.ts} +19 -13
  64. package/src/{asrs-rack-3d.ts → storage-rack-3d.ts} +3 -3
  65. package/src/{asrs-rack.ts → storage-rack.ts} +31 -25
  66. package/src/templates/index.ts +59 -17
  67. package/test/test-rack-grid-crane.ts +212 -0
  68. package/test/test-rack-grid.ts +77 -0
  69. package/test/{test-asrs-crane.ts → test-storage-rack-crane.ts} +8 -8
  70. package/translations/en.json +55 -7
  71. package/translations/ja.json +52 -4
  72. package/translations/ko.json +52 -4
  73. package/translations/ms.json +55 -7
  74. package/translations/zh.json +52 -4
  75. package/tsconfig.tsbuildinfo +1 -1
  76. package/dist/asrs-crane-3d.d.ts +0 -17
  77. package/dist/asrs-crane-3d.js +0 -181
  78. package/dist/asrs-crane-3d.js.map +0 -1
  79. package/dist/asrs-crane.d.ts +0 -98
  80. package/dist/asrs-crane.js +0 -216
  81. package/dist/asrs-crane.js.map +0 -1
  82. package/dist/asrs-rack-3d.js.map +0 -1
  83. package/dist/asrs-rack.js.map +0 -1
  84. package/dist/rack-cell-3d.js.map +0 -1
  85. package/dist/rack-cell.js.map +0 -1
  86. package/src/asrs-crane-3d.ts +0 -211
  87. package/src/asrs-crane.ts +0 -275
  88. /package/icons/{asrs-crane.png → crane.png} +0 -0
  89. /package/icons/{asrs-rack.png → storage-rack.png} +0 -0
@@ -0,0 +1,341 @@
1
+ import { Component, Properties, RealObject } from '@hatiolab/things-scene';
2
+ import type { State } from '@hatiolab/things-scene';
3
+ /** RackGridCell 컴포넌트 state */
4
+ export interface RackGridCellState extends State {
5
+ section?: string;
6
+ unit?: string;
7
+ shelfLocations?: string;
8
+ binLocations?: string;
9
+ isEmpty?: boolean;
10
+ border?: any;
11
+ merged?: boolean;
12
+ rowspan?: number;
13
+ colspan?: number;
14
+ }
15
+ declare const RackGridCell_base: (new (...args: any[]) => {
16
+ contains(x: number, y: number): boolean;
17
+ get path(): {
18
+ x: any;
19
+ y: any;
20
+ }[];
21
+ set path(path: {
22
+ x: any;
23
+ y: any;
24
+ }[]): any;
25
+ get anchors(): {
26
+ name: string;
27
+ position: {
28
+ x: any;
29
+ y: any;
30
+ };
31
+ }[];
32
+ get bounds(): any;
33
+ set bounds(bounds: any): any;
34
+ render(ctx: CanvasRenderingContext2D): void;
35
+ _app: any;
36
+ _model: any;
37
+ _state: any;
38
+ _delta: any;
39
+ _animation: any;
40
+ _animate: any;
41
+ _parent: any;
42
+ _disposed: any;
43
+ _textHidden: any;
44
+ _text_substitutor: any;
45
+ _value_substitutor: any;
46
+ _mappings: any;
47
+ _realObject: import("@hatiolab/things-scene").IRealObject | undefined;
48
+ _cachedState: any;
49
+ updatedAt: any;
50
+ fontSize: any;
51
+ __cache__: any;
52
+ created(): void;
53
+ added(parent: any): void;
54
+ removed(parent: any): void;
55
+ ready(): Promise<void>;
56
+ touch(): void;
57
+ clearCache(...attrs: any[]): void;
58
+ removeSelf(completely: any): void;
59
+ resetAnimation(): void;
60
+ dispose(): void;
61
+ get nature(): import("@hatiolab/things-scene").ComponentNature;
62
+ get disposed(): boolean;
63
+ isLayer(): boolean;
64
+ isGroup(): boolean;
65
+ isContainer(): this is import("@hatiolab/things-scene").Container;
66
+ isLine(): boolean;
67
+ isRoot(): boolean;
68
+ isRootModel(): boolean;
69
+ is3dish(): boolean;
70
+ get is3dMode(): boolean;
71
+ isIn3DSpace(): boolean;
72
+ isTemplate(): boolean;
73
+ isHTMLElement(): boolean;
74
+ isConnectable(): boolean;
75
+ isIdentifiable(): boolean;
76
+ isPositionable(): boolean;
77
+ replaceRefids(replaceMap: any): void;
78
+ get(property: any): any;
79
+ set(props: any, propval?: any): any;
80
+ getState(property: any): any;
81
+ setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
82
+ get model(): any;
83
+ get state(): import("@hatiolab/things-scene").State;
84
+ get hierarchy(): any;
85
+ get volatile(): never[];
86
+ _applyProps(target: any, props: any, options: any): any;
87
+ move(offset: {
88
+ x: number;
89
+ y: number;
90
+ }, ...args: boolean[]): void;
91
+ symmetryX(x?: number): void;
92
+ symmetryY(y: number): void;
93
+ adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): {
94
+ left: any;
95
+ top: any;
96
+ width: any;
97
+ height: any;
98
+ };
99
+ adjustRotation(rotation: number, step: boolean): number;
100
+ outline(progress: number): any;
101
+ get center(): import("@hatiolab/things-scene").POINT;
102
+ set center(p: import("@hatiolab/things-scene").POINT): any;
103
+ get location(): import("@hatiolab/things-scene").POINT;
104
+ set location(l: import("@hatiolab/things-scene").POINT): any;
105
+ get rotate(): import("@hatiolab/things-scene").POINT;
106
+ set rotate(r: import("@hatiolab/things-scene").POINT): any;
107
+ get dimension(): import("@hatiolab/things-scene").DIMENSION;
108
+ set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
109
+ get drawPath(): import("@hatiolab/things-scene").POINT[];
110
+ get rotatePoint(): import("@hatiolab/things-scene").POINT;
111
+ get mutable(): boolean;
112
+ get resizable(): boolean;
113
+ get rotatable(): boolean;
114
+ buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
115
+ get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
116
+ draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
117
+ prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
118
+ postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
119
+ prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
120
+ prepareIf(condition: boolean): void;
121
+ drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
122
+ drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
123
+ drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
124
+ get strokeStyle(): any;
125
+ set strokeStyle(v: any): any;
126
+ get fillStyle(): any;
127
+ set fillStyle(v: any): any;
128
+ get fontColor(): string;
129
+ set fontColor(v: string): any;
130
+ get rotation(): number;
131
+ set rotation(v: number): any;
132
+ get decorators(): string[];
133
+ get decotag(): string;
134
+ get hidden(): boolean;
135
+ set hidden(v: boolean): any;
136
+ get tag(): string;
137
+ set tag(v: string): any;
138
+ get appendum(): any;
139
+ set appendum(v: any): any;
140
+ defaultTextSubstitutor(): string;
141
+ textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any[][];
142
+ get font(): string;
143
+ get lineHeight(): number;
144
+ get textSubstitutor(): () => string;
145
+ get text(): string;
146
+ set text(v: string): any;
147
+ get textBounds(): import("@hatiolab/things-scene").BOUNDS;
148
+ get textRotation(): number;
149
+ get textHidden(): boolean;
150
+ set textHidden(v: boolean): any;
151
+ get hasTextProperty(): boolean;
152
+ animate(opts: import("@hatiolab/things-scene").AnimationConfig): any;
153
+ effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): void;
154
+ serialize(...others: any[]): string;
155
+ trim(): void;
156
+ closeScene(data: any): void;
157
+ delta(attr?: string | object, value?: any): any;
158
+ invalidate(): void;
159
+ get value(): any;
160
+ set value(v: any): any;
161
+ get data(): any;
162
+ set data(v: any): any;
163
+ set tap(v: any): any;
164
+ get mappings(): any[];
165
+ get retention(): number;
166
+ get animation(): import("@hatiolab/things-scene").AnimationController | undefined;
167
+ get started(): boolean;
168
+ set started(v: boolean): any;
169
+ get controls(): import("@hatiolab/things-scene").Control[] | undefined;
170
+ findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
171
+ findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
172
+ capture(x: number, y: number, except?: (c: Component) => boolean): any;
173
+ findAnchor(name: string): any;
174
+ isDescendible(container: Component | any): boolean;
175
+ getContext(component?: unknown): any;
176
+ get root(): Component;
177
+ get rootModel(): Component;
178
+ get parent(): Component;
179
+ set parent(v: Component): any;
180
+ get scalable(): boolean;
181
+ get stuck(): boolean;
182
+ get capturable(): boolean;
183
+ get position(): string;
184
+ get origin(): string;
185
+ get offset(): import("@hatiolab/things-scene").POINT;
186
+ get app(): import("@hatiolab/things-scene").ApplicationContext;
187
+ drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
188
+ prepareFill(resolve: Function, reject: Function): void;
189
+ prepareFillIf(condition: boolean): void;
190
+ onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
191
+ drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
192
+ mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
193
+ mutatePath(beforeLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, afterLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, context?: any): void;
194
+ access(accessor: string): any;
195
+ substitute(template: string, data: any): string | undefined;
196
+ onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
197
+ onchangeData(after: Record<string, any>, before: Record<string, any>): void;
198
+ buildMappings(): void;
199
+ executeMappings(force?: boolean): void;
200
+ disposeMappings(): void;
201
+ ondropfile(transfered: FileList, files: string[]): void;
202
+ transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
203
+ transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
204
+ transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
205
+ transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
206
+ transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
207
+ transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
208
+ transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
209
+ transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
210
+ transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
211
+ toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
212
+ fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
213
+ toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
214
+ fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
215
+ toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
216
+ toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
217
+ toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
218
+ on<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
219
+ on(name: string | object, callback: Function, context?: any): any;
220
+ off<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback?: ((...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void) | undefined, context?: any): any;
221
+ off(name?: string | object, callback?: Function, context?: any): any;
222
+ once<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
223
+ once(name: string | object, callback: Function, context?: any): any;
224
+ trigger<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, ...args: import("@hatiolab/things-scene").ComponentEventMap[K]): any;
225
+ trigger(name: string, ...args: any[]): any;
226
+ delegate_on(delegator: any): any;
227
+ delegate_off(delegator: any): any;
228
+ onchange(after: Record<string, any>, before: Record<string, any>): void;
229
+ calculateBounds?(): void;
230
+ oncreate_element?(element: HTMLElement): void;
231
+ removeComponent(component: Component, ghost?: boolean): void;
232
+ addComponent(component: Component, ghost?: boolean): void;
233
+ insertComponentAt(component: Component, index: number, ghost?: boolean): void;
234
+ getOverlay(component: Component): HTMLElement | undefined;
235
+ findById(id: string): Component | undefined;
236
+ findByRefid(ref: string | number): Component | undefined;
237
+ findAllById(id: string): Component[];
238
+ resize(): void;
239
+ fit(type?: string): void;
240
+ get components(): Component[] | undefined;
241
+ get layout(): any;
242
+ get auxOverlay(): HTMLElement | undefined;
243
+ get isReady(): boolean;
244
+ get unitScale(): number;
245
+ get selected(): Component[];
246
+ set selected(_v: Component[]): any;
247
+ get focused(): Component | null;
248
+ set focused(_v: Component | null): any;
249
+ get hasSameParentForAllSelected(): boolean;
250
+ set hasSameParentForAllSelected(_v: boolean): any;
251
+ get fitMode(): string | undefined;
252
+ set fitMode(_v: string | undefined): any;
253
+ get element(): HTMLElement | null;
254
+ set element(_v: HTMLElement | null): any;
255
+ }) & typeof Component;
256
+ /**
257
+ * 1. 스타일을 상속 받아야 함. (cascade-style)
258
+ * 2. 스타일을 동적처리할 수 있음. (로직처리)
259
+ * 3. 데이타를 받을 수 있음.
260
+ */
261
+ export declare class RackGridCell extends RackGridCell_base {
262
+ get state(): RackGridCellState;
263
+ _focused: boolean;
264
+ get hasTextProperty(): boolean;
265
+ get nature(): {
266
+ mutable: boolean;
267
+ resizable: boolean;
268
+ rotatable: boolean;
269
+ properties: ({
270
+ type: string;
271
+ label: string;
272
+ name: string;
273
+ placeholder?: undefined;
274
+ property?: undefined;
275
+ } | {
276
+ type: string;
277
+ label: string;
278
+ name: string;
279
+ placeholder: string;
280
+ property?: undefined;
281
+ } | {
282
+ type: string;
283
+ label: string;
284
+ name: string;
285
+ property: {
286
+ event: {
287
+ 'increase-location-pattern': (event: CustomEvent) => void;
288
+ };
289
+ merge?: undefined;
290
+ split?: undefined;
291
+ };
292
+ placeholder?: undefined;
293
+ } | {
294
+ type: string;
295
+ label: string;
296
+ name: string;
297
+ property: {
298
+ merge: boolean;
299
+ split: boolean;
300
+ event?: undefined;
301
+ };
302
+ placeholder?: undefined;
303
+ })[];
304
+ };
305
+ buildRealObject(): RealObject | undefined;
306
+ set merged(merged: any);
307
+ get merged(): any;
308
+ set rowspan(rowspan: any);
309
+ get rowspan(): any;
310
+ set colspan(colspan: any);
311
+ get colspan(): any;
312
+ get border(): any;
313
+ get isEmpty(): any;
314
+ _drawBorder(context: CanvasRenderingContext2D, x: number, y: number, to_x: number, to_y: number, style: any): void;
315
+ render(context: CanvasRenderingContext2D): void;
316
+ _draw_rack_cell(context: CanvasRenderingContext2D): void;
317
+ get decotag(): string;
318
+ get index(): {
319
+ row: number;
320
+ column: number;
321
+ };
322
+ get rowIndex(): number;
323
+ get columnIndex(): number;
324
+ get leftCell(): any;
325
+ get rightCell(): any;
326
+ get aboveCell(): any;
327
+ get belowCell(): any;
328
+ get rowCells(): any;
329
+ get columnCells(): any;
330
+ get aboveRowCells(): any;
331
+ get lastUnit(): number;
332
+ get firstUnit(): number;
333
+ get notEmptyRowCells(): any;
334
+ get emptyRowCells(): any;
335
+ get isAisle(): boolean;
336
+ onchange(after: Properties, before: Properties): void;
337
+ onmouseenter(): void;
338
+ onmouseleave(): void;
339
+ contains(x: number, y: number): boolean;
340
+ }
341
+ export {};
@@ -0,0 +1,321 @@
1
+ import { __decorate } from "tslib";
2
+ /*
3
+ * Copyright © HatioLab Inc. All rights reserved.
4
+ */
5
+ import { Component, RectPath, sceneComponent } from '@hatiolab/things-scene';
6
+ import { Rack } from './rack-column.js';
7
+ const EMPTY_BORDER = {};
8
+ function isBottomMost(idx, rows, columns) {
9
+ return idx >= (rows - 1) * columns;
10
+ }
11
+ function isRightMost(idx, rows, columns) {
12
+ return (idx + 1) % columns == 0;
13
+ }
14
+ function hasAnyProperty(o, ...properties) {
15
+ for (let p in properties) {
16
+ if (o.hasOwnProperty(properties[p])) {
17
+ return true;
18
+ }
19
+ }
20
+ }
21
+ const EMPTY_CELL_STROKE_STYLE = '#ccc';
22
+ const EMPTY_CELL_LINE_WIDTH = 1;
23
+ const EMPTY_CELL_FILL_STYLE = '#efefef';
24
+ /**
25
+ * 1. 스타일을 상속 받아야 함. (cascade-style)
26
+ * 2. 스타일을 동적처리할 수 있음. (로직처리)
27
+ * 3. 데이타를 받을 수 있음.
28
+ */
29
+ let RackGridCell = class RackGridCell extends RectPath(Component) {
30
+ get state() {
31
+ return super.state;
32
+ }
33
+ _focused = false;
34
+ get hasTextProperty() {
35
+ return false;
36
+ }
37
+ get nature() {
38
+ return {
39
+ mutable: false,
40
+ resizable: true,
41
+ rotatable: true,
42
+ properties: [
43
+ {
44
+ type: 'string',
45
+ label: 'section',
46
+ name: 'section'
47
+ },
48
+ {
49
+ type: 'string',
50
+ label: 'unit',
51
+ name: 'unit'
52
+ },
53
+ {
54
+ type: 'string',
55
+ label: 'shelf-locations',
56
+ name: 'shelfLocations',
57
+ placeholder: '1,2,3,... / ,,,04'
58
+ },
59
+ {
60
+ type: 'textarea',
61
+ label: 'bin-locations',
62
+ name: 'binLocations',
63
+ placeholder: '1,2,3,...'
64
+ },
65
+ {
66
+ type: 'checkbox',
67
+ label: 'is-empty',
68
+ name: 'isEmpty'
69
+ },
70
+ {
71
+ type: 'location-increase-pattern',
72
+ label: '',
73
+ name: '',
74
+ property: {
75
+ event: {
76
+ 'increase-location-pattern': (event) => {
77
+ const { increasingDirection, skipNumbering, startSection, startUnit } = event.detail;
78
+ const rackTable = this.parent;
79
+ rackTable.increaseLocation(increasingDirection, skipNumbering, startSection, startUnit);
80
+ }
81
+ }
82
+ }
83
+ },
84
+ {
85
+ type: 'editor-table',
86
+ label: '',
87
+ name: '',
88
+ property: {
89
+ merge: false,
90
+ split: false
91
+ }
92
+ }
93
+ ]
94
+ };
95
+ }
96
+ buildRealObject() {
97
+ // isEmpty cell 은 3D 에 mesh 를 만들지 않는다. v9 에서는 RackGrid3D.createRacks 가
98
+ // cell._realObject 를 사전 설정하면 3D pipeline 이 자동 buildRealObject 호출을 skip
99
+ // 하던 것을, v10 의 ThreeCapability 도입 이후로는 *항상* 자동 호출됨. RackGrid3D
100
+ // createRacks 의 isEmpty 체크와 이 자동 경로 사이의 불일치로 isEmpty=true cell 도
101
+ // 3D 에 그려지던 regression — 여기 isEmpty 체크 추가로 두 경로 정합.
102
+ if (this.getState('isEmpty'))
103
+ return undefined;
104
+ return new Rack(this);
105
+ }
106
+ set merged(merged) {
107
+ this.set('merged', !!merged);
108
+ if (merged)
109
+ this.set('text', '');
110
+ }
111
+ get merged() {
112
+ return this.getState('merged');
113
+ }
114
+ set rowspan(rowspan) {
115
+ this.set('rowspan', rowspan);
116
+ }
117
+ get rowspan() {
118
+ return this.getState('rowspan');
119
+ }
120
+ set colspan(colspan) {
121
+ this.set('colspan', colspan);
122
+ }
123
+ get colspan() {
124
+ return this.getState('colspan');
125
+ }
126
+ get border() {
127
+ return this.state.border || EMPTY_BORDER;
128
+ }
129
+ get isEmpty() {
130
+ return this.getState('isEmpty');
131
+ }
132
+ _drawBorder(context, x, y, to_x, to_y, style) {
133
+ if (style && style.strokeStyle && style.lineWidth && style.lineDash) {
134
+ context.beginPath();
135
+ context.moveTo(x, y);
136
+ context.lineTo(to_x, to_y);
137
+ Component.drawStroke(context, style);
138
+ }
139
+ }
140
+ render(context) {
141
+ const { left, top, width, height } = this.bounds;
142
+ const { isEmpty } = this.state;
143
+ const border = this.border;
144
+ if (!isEmpty) {
145
+ this._draw_rack_cell(context);
146
+ }
147
+ // Cell 채우기.
148
+ context.beginPath();
149
+ context.lineWidth = 0;
150
+ context.rect(left, top, width, height);
151
+ // Border 그리기
152
+ const parent = this.parent;
153
+ const idx = parent.components.indexOf(this);
154
+ const columns = parent.columns || 1;
155
+ const rows = parent.rows || 1;
156
+ this._drawBorder(context, left, top, left + width, top, border.top);
157
+ this._drawBorder(context, left, top + height, left, top, border.left);
158
+ if (isRightMost(idx, rows, columns))
159
+ this._drawBorder(context, left + width, top, left + width, top + height, border.right);
160
+ if (isBottomMost(idx, rows, columns))
161
+ this._drawBorder(context, left + width, top + height, left, top + height, border.bottom);
162
+ }
163
+ _draw_rack_cell(context) {
164
+ const { left, top, width, height } = this.bounds;
165
+ context.save();
166
+ context.fillStyle = EMPTY_CELL_FILL_STYLE;
167
+ context.fillRect(left, top, width, height);
168
+ context.beginPath();
169
+ context.lineWidth = EMPTY_CELL_LINE_WIDTH;
170
+ context.strokeStyle = EMPTY_CELL_STROKE_STYLE;
171
+ context.moveTo(left, top);
172
+ context.lineTo(left + width, top + height);
173
+ context.moveTo(left + width, top);
174
+ context.lineTo(left, top + height);
175
+ context.stroke();
176
+ context.closePath();
177
+ context.restore();
178
+ }
179
+ get decotag() {
180
+ const rackTable = this.parent;
181
+ let { locPattern, zone = '' } = rackTable.model;
182
+ locPattern = locPattern.substring(0, locPattern.indexOf('{u}') + 3);
183
+ let locationString = '';
184
+ if (this.getState('section') && this.getState('unit'))
185
+ locationString = locPattern
186
+ .replace('{z}', zone)
187
+ .replace('{s}', this.getState('section'))
188
+ .replace('{u}', this.getState('unit'));
189
+ return locationString || '';
190
+ }
191
+ get index() {
192
+ const rackTable = this.parent;
193
+ const index = rackTable.components.indexOf(this);
194
+ const rowIndex = Math.floor(index / rackTable.columns);
195
+ const columnIndex = index % rackTable.columns;
196
+ return {
197
+ row: rowIndex,
198
+ column: columnIndex
199
+ };
200
+ }
201
+ get rowIndex() {
202
+ return this.index.row;
203
+ }
204
+ get columnIndex() {
205
+ return this.index.column;
206
+ }
207
+ get leftCell() {
208
+ const rackTable = this.parent;
209
+ const rowIndex = this.rowIndex;
210
+ const columnIndex = this.columnIndex;
211
+ if (columnIndex === 0)
212
+ return null;
213
+ const leftCell = rackTable.components[rowIndex * rackTable.columns + columnIndex - 1];
214
+ return leftCell;
215
+ }
216
+ get rightCell() {
217
+ const rackTable = this.parent;
218
+ const rowIndex = this.rowIndex;
219
+ const columnIndex = this.columnIndex;
220
+ if (columnIndex === rackTable.columns)
221
+ return null;
222
+ const rightCell = rackTable.components[rowIndex * rackTable.columns + columnIndex + 1];
223
+ return rightCell;
224
+ }
225
+ get aboveCell() {
226
+ const rackTable = this.parent;
227
+ const rowIndex = this.rowIndex;
228
+ const columnIndex = this.columnIndex;
229
+ if (rowIndex === 0)
230
+ return null;
231
+ const aboveCell = rackTable.components[(rowIndex - 1) * rackTable.columns + columnIndex];
232
+ return aboveCell;
233
+ }
234
+ get belowCell() {
235
+ const rackTable = this.parent;
236
+ const rowIndex = this.rowIndex;
237
+ const columnIndex = this.columnIndex;
238
+ if (rowIndex === rackTable.rows)
239
+ return null;
240
+ const belowCell = rackTable.components[(rowIndex + 1) * rackTable.columns + columnIndex];
241
+ return belowCell;
242
+ }
243
+ get rowCells() {
244
+ const rackTable = this.parent;
245
+ return rackTable.getCellsByRow(this.rowIndex);
246
+ }
247
+ get columnCells() {
248
+ const rackTable = this.parent;
249
+ return rackTable.getCellsByColumn(this.columnIndex);
250
+ }
251
+ get aboveRowCells() {
252
+ let aboveCell = this.aboveCell;
253
+ while (1) {
254
+ const aboveRowCells = aboveCell.notEmptyRowCells;
255
+ if (aboveRowCells.length > 0)
256
+ return aboveRowCells;
257
+ aboveCell = aboveCell.aboveCell;
258
+ }
259
+ }
260
+ get lastUnit() {
261
+ const rowCells = this.aboveRowCells;
262
+ for (let i = rowCells.length - 1; i > 0; i--) {
263
+ const cell = rowCells[i];
264
+ const unit = cell.getState('unit');
265
+ if (unit)
266
+ return Number(unit);
267
+ }
268
+ return 0;
269
+ }
270
+ get firstUnit() {
271
+ const rowCells = this.aboveRowCells;
272
+ for (let i = 0; i < rowCells.length; i++) {
273
+ const cell = rowCells[i];
274
+ const unit = cell.getState('unit');
275
+ if (unit)
276
+ return Number(unit);
277
+ }
278
+ return 0;
279
+ }
280
+ get notEmptyRowCells() {
281
+ return this.rowCells.filter((c) => {
282
+ return !c.getState('isEmpty');
283
+ });
284
+ }
285
+ get emptyRowCells() {
286
+ return this.rowCells.filter((c) => {
287
+ return c.getState('isEmpty');
288
+ });
289
+ }
290
+ get isAisle() {
291
+ return this.notEmptyRowCells.length === 0;
292
+ }
293
+ onchange(after, before) {
294
+ if (hasAnyProperty(after, 'isEmpty')) {
295
+ // FIXME
296
+ delete this.model.unit;
297
+ delete this.model.section;
298
+ }
299
+ }
300
+ onmouseenter() {
301
+ this.trigger('deco');
302
+ }
303
+ onmouseleave() {
304
+ this.trigger('decoreset');
305
+ }
306
+ contains(x, y) {
307
+ const contains = super.contains(x, y);
308
+ if (!contains) {
309
+ this._focused = false;
310
+ this.invalidate();
311
+ }
312
+ return contains;
313
+ }
314
+ };
315
+ RackGridCell = __decorate([
316
+ sceneComponent('rack-grid-cell')
317
+ ], RackGridCell);
318
+ export { RackGridCell };
319
+ ;
320
+ ['border'].forEach(getter => Component.memoize(RackGridCell.prototype, getter, false));
321
+ //# sourceMappingURL=rack-grid-cell.js.map