@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 @@
1
+ {"version":3,"file":"rack-grid-cell.js","sourceRoot":"","sources":["../src/rack-grid-cell.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAc,QAAQ,EAAE,cAAc,EAAc,MAAM,wBAAwB,CAAA;AAEpG,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAevC,MAAM,YAAY,GAAG,EAAE,CAAA;AAEvB,SAAS,YAAY,CAAC,GAAW,EAAE,IAAY,EAAE,OAAe;IAC9D,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,CAAA;AACpC,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,IAAY,EAAE,OAAe;IAC7D,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAA;AACjC,CAAC;AAED,SAAS,cAAc,CAAC,CAAM,EAAE,GAAG,UAAoB;IACrD,KAAK,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACpC,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,uBAAuB,GAAG,MAAM,CAAA;AACtC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAC/B,MAAM,qBAAqB,GAAG,S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AAiB,EAAE,MAAkB;QAC5C,IAAI,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;YACrC,QAAQ;YACR,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA;YACtB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAA;QAC3B,CAAC;IACH,CAAC;IAED,YAAY;QACV,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACtB,CAAC;IAED,YAAY;QACV,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3B,CAAC;IAED,QAAQ,CAAC,CAAS,EAAE,CAAS;QAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACrC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;YACrB,IAAI,CAAC,UAAU,EAAE,CAAA;QACnB,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF,CAAA;AAjWY,YAAY;IADxB,cAAc,CAAC,gBAAgB,CAAC;GACpB,YAAY,CAiWxB;;AAED,CAAC;AAAA,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, Properties, RectPath, sceneComponent, RealObject } from '@hatiolab/things-scene'\nimport type { State } from '@hatiolab/things-scene'\nimport { Rack } from './rack-column.js'\n\n/** RackGridCell 컴포넌트 state */\nexport interface RackGridCellState extends State {\n section?: string\n unit?: string\n shelfLocations?: string\n binLocations?: string\n isEmpty?: boolean\n border?: any\n merged?: boolean\n rowspan?: number\n colspan?: number\n}\n\nconst EMPTY_BORDER = {}\n\nfunction isBottomMost(idx: number, rows: number, columns: number) {\n return idx >= (rows - 1) * columns\n}\n\nfunction isRightMost(idx: number, rows: number, columns: number) {\n return (idx + 1) % columns == 0\n}\n\nfunction hasAnyProperty(o: any, ...properties: string[]) {\n for (let p in properties) {\n if (o.hasOwnProperty(properties[p])) {\n return true\n }\n }\n}\n\nconst EMPTY_CELL_STROKE_STYLE = '#ccc'\nconst EMPTY_CELL_LINE_WIDTH = 1\nconst EMPTY_CELL_FILL_STYLE = '#efefef'\n\n/**\n * 1. 스타일을 상속 받아야 함. (cascade-style)\n * 2. 스타일을 동적처리할 수 있음. (로직처리)\n * 3. 데이타를 받을 수 있음.\n */\n@sceneComponent('rack-grid-cell')\nexport class RackGridCell extends RectPath(Component) {\n override get state(): RackGridCellState {\n return super.state as RackGridCellState\n }\n\n _focused: boolean = false\n\n get hasTextProperty() {\n return false\n }\n\n get nature() {\n return {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'section',\n name: 'section'\n },\n {\n type: 'string',\n label: 'unit',\n name: 'unit'\n },\n {\n type: 'string',\n label: 'shelf-locations',\n name: 'shelfLocations',\n placeholder: '1,2,3,... / ,,,04'\n },\n {\n type: 'textarea',\n label: 'bin-locations',\n name: 'binLocations',\n placeholder: '1,2,3,...'\n },\n {\n type: 'checkbox',\n label: 'is-empty',\n name: 'isEmpty'\n },\n {\n type: 'location-increase-pattern',\n label: '',\n name: '',\n property: {\n event: {\n 'increase-location-pattern': (event: CustomEvent) => {\n const { increasingDirection, skipNumbering, startSection, startUnit } = event.detail\n const rackTable = this.parent as any\n rackTable.increaseLocation(increasingDirection, skipNumbering, startSection, startUnit)\n }\n }\n }\n },\n {\n type: 'editor-table',\n label: '',\n name: '',\n property: {\n merge: false,\n split: false\n }\n }\n ]\n }\n }\n\n buildRealObject(): RealObject | undefined {\n // isEmpty cell 은 3D 에 mesh 를 만들지 않는다. v9 에서는 RackGrid3D.createRacks 가\n // cell._realObject 를 사전 설정하면 3D pipeline 이 자동 buildRealObject 호출을 skip\n // 하던 것을, v10 의 ThreeCapability 도입 이후로는 *항상* 자동 호출됨. RackGrid3D\n // createRacks 의 isEmpty 체크와 이 자동 경로 사이의 불일치로 isEmpty=true cell 도\n // 3D 에 그려지던 regression — 여기 isEmpty 체크 추가로 두 경로 정합.\n if (this.getState('isEmpty')) return undefined\n return new Rack(this)\n }\n\n set merged(merged) {\n this.set('merged', !!merged)\n if (merged) this.set('text', '')\n }\n\n get merged() {\n return this.getState('merged')\n }\n\n set rowspan(rowspan) {\n this.set('rowspan', rowspan)\n }\n\n get rowspan() {\n return this.getState('rowspan')\n }\n\n set colspan(colspan) {\n this.set('colspan', colspan)\n }\n\n get colspan() {\n return this.getState('colspan')\n }\n\n get border() {\n return this.state.border || EMPTY_BORDER\n }\n\n get isEmpty() {\n return this.getState('isEmpty')\n }\n\n _drawBorder(context: CanvasRenderingContext2D, x: number, y: number, to_x: number, to_y: number, style: any) {\n if (style && style.strokeStyle && style.lineWidth && style.lineDash) {\n context.beginPath()\n context.moveTo(x, y)\n context.lineTo(to_x, to_y)\n\n Component.drawStroke(context, style)\n }\n }\n\n render(context: CanvasRenderingContext2D) {\n const { left, top, width, height } = this.bounds\n const { isEmpty } = this.state\n\n const border = this.border\n\n if (!isEmpty) {\n this._draw_rack_cell(context)\n }\n\n // Cell 채우기.\n context.beginPath()\n context.lineWidth = 0\n context.rect(left, top, width, height)\n\n // Border 그리기\n const parent = this.parent as any\n const idx = parent.components.indexOf(this)\n const columns = parent.columns || 1\n const rows = parent.rows || 1\n\n this._drawBorder(context, left, top, left + width, top, border.top)\n this._drawBorder(context, left, top + height, left, top, border.left)\n if (isRightMost(idx, rows, columns))\n this._drawBorder(context, left + width, top, left + width, top + height, border.right)\n if (isBottomMost(idx, rows, columns))\n this._drawBorder(context, left + width, top + height, left, top + height, border.bottom)\n }\n\n _draw_rack_cell(context: CanvasRenderingContext2D) {\n const { left, top, width, height } = this.bounds\n\n context.save()\n context.fillStyle = EMPTY_CELL_FILL_STYLE\n context.fillRect(left, top, width, height)\n\n context.beginPath()\n context.lineWidth = EMPTY_CELL_LINE_WIDTH\n context.strokeStyle = EMPTY_CELL_STROKE_STYLE\n\n context.moveTo(left, top)\n context.lineTo(left + width, top + height)\n context.moveTo(left + width, top)\n context.lineTo(left, top + height)\n\n context.stroke()\n context.closePath()\n context.restore()\n }\n\n get decotag() {\n const rackTable = this.parent\n let { locPattern, zone = '' } = rackTable.model\n\n locPattern = locPattern.substring(0, locPattern.indexOf('{u}') + 3)\n\n let locationString = ''\n if (this.getState('section') && this.getState('unit'))\n locationString = locPattern\n .replace('{z}', zone)\n .replace('{s}', this.getState('section'))\n .replace('{u}', this.getState('unit'))\n\n return locationString || ''\n }\n\n get index() {\n const rackTable = this.parent as any\n const index = rackTable.components.indexOf(this)\n\n const rowIndex = Math.floor(index / rackTable.columns)\n const columnIndex = index % rackTable.columns\n\n return {\n row: rowIndex,\n column: columnIndex\n }\n }\n\n get rowIndex() {\n return this.index.row\n }\n\n get columnIndex() {\n return this.index.column\n }\n\n get leftCell() {\n const rackTable = this.parent as any\n\n const rowIndex = this.rowIndex\n const columnIndex = this.columnIndex\n\n if (columnIndex === 0) return null\n\n const leftCell = rackTable.components[rowIndex * rackTable.columns + columnIndex - 1]\n\n return leftCell\n }\n\n get rightCell() {\n const rackTable = this.parent as any\n\n const rowIndex = this.rowIndex\n const columnIndex = this.columnIndex\n\n if (columnIndex === rackTable.columns) return null\n\n const rightCell = rackTable.components[rowIndex * rackTable.columns + columnIndex + 1]\n\n return rightCell\n }\n\n get aboveCell() {\n const rackTable = this.parent as any\n\n const rowIndex = this.rowIndex\n const columnIndex = this.columnIndex\n\n if (rowIndex === 0) return null\n\n const aboveCell = rackTable.components[(rowIndex - 1) * rackTable.columns + columnIndex]\n\n return aboveCell\n }\n\n get belowCell() {\n const rackTable = this.parent as any\n\n const rowIndex = this.rowIndex\n const columnIndex = this.columnIndex\n\n if (rowIndex === rackTable.rows) return null\n\n const belowCell = rackTable.components[(rowIndex + 1) * rackTable.columns + columnIndex]\n\n return belowCell\n }\n\n get rowCells() {\n const rackTable = this.parent as any\n return rackTable.getCellsByRow(this.rowIndex)\n }\n\n get columnCells() {\n const rackTable = this.parent as any\n return rackTable.getCellsByColumn(this.columnIndex)\n }\n\n get aboveRowCells() {\n let aboveCell = this.aboveCell\n while (1) {\n const aboveRowCells = aboveCell.notEmptyRowCells\n\n if (aboveRowCells.length > 0) return aboveRowCells\n\n aboveCell = aboveCell.aboveCell\n }\n }\n\n get lastUnit() {\n const rowCells = this.aboveRowCells\n\n for (let i = rowCells.length - 1; i > 0; i--) {\n const cell = rowCells[i]\n\n const unit = cell.getState('unit')\n\n if (unit) return Number(unit)\n }\n\n return 0\n }\n\n get firstUnit() {\n const rowCells = this.aboveRowCells\n\n for (let i = 0; i < rowCells.length; i++) {\n const cell = rowCells[i]\n\n const unit = cell.getState('unit')\n\n if (unit) return Number(unit)\n }\n\n return 0\n }\n\n get notEmptyRowCells() {\n return this.rowCells.filter((c: Component) => {\n return !c.getState('isEmpty')\n })\n }\n\n get emptyRowCells() {\n return this.rowCells.filter((c: Component) => {\n return c.getState('isEmpty')\n })\n }\n\n get isAisle() {\n return this.notEmptyRowCells.length === 0\n }\n\n onchange(after: Properties, before: Properties) {\n if (hasAnyProperty(after, 'isEmpty')) {\n // FIXME\n delete this.model.unit\n delete this.model.section\n }\n }\n\n onmouseenter() {\n this.trigger('deco')\n }\n\n onmouseleave() {\n this.trigger('decoreset')\n }\n\n contains(x: number, y: number) {\n const contains = super.contains(x, y)\n if (!contains) {\n this._focused = false\n this.invalidate()\n }\n\n return contains\n }\n}\n\n;['border'].forEach(getter => Component.memoize(RackGridCell.prototype, getter, false))\n"]}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Parse shelf-labels string into an array of length `levels`.
3
+ *
4
+ * Format: comma-separated. Empty positions fall back to `String(level + 1)`.
5
+ * ',,,04' over 4 levels → ['1', '2', '3', '04']
6
+ * '1,2,3' over 4 levels → ['1', '2', '3', '4']
7
+ */
8
+ export declare function parseShelfLabels(input: string | undefined, levels: number): string[];
9
+ /**
10
+ * Apply a location pattern with the four standard placeholders.
11
+ *
12
+ * {z} → zone
13
+ * {s} → section (zero-padded outside)
14
+ * {u} → unit (zero-padded outside)
15
+ * {sh} → shelf
16
+ *
17
+ * Caller is responsible for the zero-padding of section/unit (the digit
18
+ * widths are state-driven, not part of the pattern itself).
19
+ */
20
+ export declare function formatLocationId(zone: string, section: string, unit: string, shelf: string, pattern: string): string;
21
+ /**
22
+ * Distribute `total` over `n` slots, honoring per-slot declared sizes when
23
+ * present. Unspecified slots share the remaining space evenly.
24
+ *
25
+ * distribute(1000, 4, [200, undefined, 300, undefined]) → [200, 250, 300, 250]
26
+ * distribute(1000, 4, []) → [250, 250, 250, 250]
27
+ */
28
+ export declare function distribute(total: number, n: number, declared?: (number | undefined)[]): number[];
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ *
4
+ * RackTable pure helpers — separated for unit-testability (no scene-base /
5
+ * things-scene runtime deps).
6
+ */
7
+ /**
8
+ * Parse shelf-labels string into an array of length `levels`.
9
+ *
10
+ * Format: comma-separated. Empty positions fall back to `String(level + 1)`.
11
+ * ',,,04' over 4 levels → ['1', '2', '3', '04']
12
+ * '1,2,3' over 4 levels → ['1', '2', '3', '4']
13
+ */
14
+ export function parseShelfLabels(input, levels) {
15
+ const out = [];
16
+ const parts = (input || '').split(',');
17
+ for (let i = 0; i < levels; i++) {
18
+ const p = parts[i];
19
+ out[i] = p && p.trim().length > 0 ? p.trim() : String(i + 1);
20
+ }
21
+ return out;
22
+ }
23
+ /**
24
+ * Apply a location pattern with the four standard placeholders.
25
+ *
26
+ * {z} → zone
27
+ * {s} → section (zero-padded outside)
28
+ * {u} → unit (zero-padded outside)
29
+ * {sh} → shelf
30
+ *
31
+ * Caller is responsible for the zero-padding of section/unit (the digit
32
+ * widths are state-driven, not part of the pattern itself).
33
+ */
34
+ export function formatLocationId(zone, section, unit, shelf, pattern) {
35
+ return pattern
36
+ .replace(/\{z\}/g, zone)
37
+ .replace(/\{s\}/g, section)
38
+ .replace(/\{u\}/g, unit)
39
+ .replace(/\{sh\}/g, shelf);
40
+ }
41
+ /**
42
+ * Distribute `total` over `n` slots, honoring per-slot declared sizes when
43
+ * present. Unspecified slots share the remaining space evenly.
44
+ *
45
+ * distribute(1000, 4, [200, undefined, 300, undefined]) → [200, 250, 300, 250]
46
+ * distribute(1000, 4, []) → [250, 250, 250, 250]
47
+ */
48
+ export function distribute(total, n, declared = []) {
49
+ const out = [];
50
+ let assigned = 0;
51
+ let auto = 0;
52
+ for (let i = 0; i < n; i++) {
53
+ const v = declared[i];
54
+ if (typeof v === 'number' && Number.isFinite(v)) {
55
+ out[i] = v;
56
+ assigned += v;
57
+ }
58
+ else {
59
+ out[i] = -1;
60
+ auto++;
61
+ }
62
+ }
63
+ const remaining = Math.max(0, total - assigned);
64
+ const autoSize = auto > 0 ? remaining / auto : 0;
65
+ for (let i = 0; i < n; i++) {
66
+ if (out[i] === -1)
67
+ out[i] = autoSize;
68
+ }
69
+ return out;
70
+ }
71
+ //# sourceMappingURL=rack-grid-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rack-grid-helpers.js","sourceRoot":"","sources":["../src/rack-grid-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAyB,EAAE,MAAc;IACxE,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,MAAM,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAClB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,C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C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAA;IACtC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * RackTable pure helpers — separated for unit-testability (no scene-base /\n * things-scene runtime deps).\n */\n\n/**\n * Parse shelf-labels string into an array of length `levels`.\n *\n * Format: comma-separated. Empty positions fall back to `String(level + 1)`.\n * ',,,04' over 4 levels → ['1', '2', '3', '04']\n * '1,2,3' over 4 levels → ['1', '2', '3', '4']\n */\nexport function parseShelfLabels(input: string | undefined, levels: number): string[] {\n const out: string[] = []\n const parts = (input || '').split(',')\n for (let i = 0; i < levels; i++) {\n const p = parts[i]\n out[i] = p && p.trim().length > 0 ? p.trim() : String(i + 1)\n }\n return out\n}\n\n/**\n * Apply a location pattern with the four standard placeholders.\n *\n * {z} → zone\n * {s} → section (zero-padded outside)\n * {u} → unit (zero-padded outside)\n * {sh} → shelf\n *\n * Caller is responsible for the zero-padding of section/unit (the digit\n * widths are state-driven, not part of the pattern itself).\n */\nexport function formatLocationId(\n zone: string,\n section: string,\n unit: string,\n shelf: string,\n pattern: string\n): string {\n return pattern\n .replace(/\\{z\\}/g, zone)\n .replace(/\\{s\\}/g, section)\n .replace(/\\{u\\}/g, unit)\n .replace(/\\{sh\\}/g, shelf)\n}\n\n/**\n * Distribute `total` over `n` slots, honoring per-slot declared sizes when\n * present. Unspecified slots share the remaining space evenly.\n *\n * distribute(1000, 4, [200, undefined, 300, undefined]) → [200, 250, 300, 250]\n * distribute(1000, 4, []) → [250, 250, 250, 250]\n */\nexport function distribute(total: number, n: number, declared: (number | undefined)[] = []): number[] {\n const out: number[] = []\n let assigned = 0\n let auto = 0\n for (let i = 0; i < n; i++) {\n const v = declared[i]\n if (typeof v === 'number' && Number.isFinite(v)) {\n out[i] = v\n assigned += v\n } else {\n out[i] = -1\n auto++\n }\n }\n const remaining = Math.max(0, total - assigned)\n const autoSize = auto > 0 ? remaining / auto : 0\n for (let i = 0; i < n; i++) {\n if (out[i] === -1) out[i] = autoSize\n }\n return out\n}\n"]}
@@ -0,0 +1,37 @@
1
+ import type { RackGridCell } from './rack-grid-cell.js';
2
+ /**
3
+ * Classify cells by their row index.
4
+ */
5
+ export declare function classifyByRow(cells: RackGridCell[]): RackGridCell[][];
6
+ /**
7
+ * Find aisle rows (rows where all cells are empty).
8
+ */
9
+ export declare function findAisle(rows?: RackGridCell[][]): RackGridCell[][];
10
+ /**
11
+ * Get indices of aisle rows.
12
+ */
13
+ export declare function getAisleRowIndices(rows: RackGridCell[][]): number[];
14
+ /**
15
+ * Classify rows into sections separated by aisle rows.
16
+ */
17
+ export declare function classifyCellsBySection(rows: RackGridCell[][], aisleRowIndices: number[]): RackGridCell[][][];
18
+ /**
19
+ * Rearrange cells by aisle direction pattern.
20
+ */
21
+ export declare function rearrangeByAisle(type: string, sections: RackGridCell[][][]): RackGridCell[][][];
22
+ /**
23
+ * Remove empty cells from sections.
24
+ */
25
+ export declare function removeEmptyCells(sections: RackGridCell[][][]): RackGridCell[][][];
26
+ /**
27
+ * Merge section rows into flat arrays.
28
+ */
29
+ export declare function mergeRows(sections: RackGridCell[][][]): RackGridCell[][];
30
+ /**
31
+ * Set section/unit location on cells.
32
+ */
33
+ export declare function setLocations(sections: RackGridCell[][], startSection: number, startUnit: number, sectionDigits: number, unitDigits: number): void;
34
+ /**
35
+ * Run the full location increase flow.
36
+ */
37
+ export declare function increaseLocation(selectedCells: RackGridCell[], type: string, skipNumbering: boolean, startSection: number, startUnit: number, sectionDigits: number, unitDigits: number): void;
@@ -0,0 +1,227 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ *
4
+ * RackGrid location management utilities.
5
+ * Extracted from rack-table.ts for separation of concerns.
6
+ */
7
+ /**
8
+ * Classify cells by their row index.
9
+ */
10
+ export function classifyByRow(cells) {
11
+ const classified = [];
12
+ cells.forEach(c => {
13
+ const { row, column } = c.index;
14
+ if (!classified[row]) {
15
+ classified[row] = [];
16
+ }
17
+ classified[row][column] = c;
18
+ });
19
+ return classified;
20
+ }
21
+ /**
22
+ * Find aisle rows (rows where all cells are empty).
23
+ */
24
+ export function findAisle(rows) {
25
+ if (!rows) {
26
+ return [];
27
+ }
28
+ return rows.filter(r => {
29
+ return r[0] && r[0].isAisle;
30
+ });
31
+ }
32
+ /**
33
+ * Get indices of aisle rows.
34
+ */
35
+ export function getAisleRowIndices(rows) {
36
+ const aisles = findAisle(rows);
37
+ const aisleRowIndices = [];
38
+ aisles.forEach(aisle => {
39
+ aisleRowIndices.push(rows.indexOf(aisle));
40
+ });
41
+ return aisleRowIndices;
42
+ }
43
+ /**
44
+ * Classify rows into sections separated by aisle rows.
45
+ */
46
+ export function classifyCellsBySection(rows, aisleRowIndices) {
47
+ const sections = [];
48
+ let wasAisle = false;
49
+ let section;
50
+ rows.forEach((row, i) => {
51
+ const isAisle = aisleRowIndices.indexOf(i) > -1;
52
+ if (!(wasAisle || isAisle)) {
53
+ section = [];
54
+ sections.push(section);
55
+ }
56
+ wasAisle = isAisle;
57
+ section.push(row);
58
+ });
59
+ return sections;
60
+ }
61
+ /**
62
+ * Rearrange cells by aisle direction pattern.
63
+ */
64
+ export function rearrangeByAisle(type, sections) {
65
+ const rearranged = [];
66
+ switch (type.toLowerCase()) {
67
+ case 'cw': {
68
+ let reverse = false;
69
+ sections.forEach(rows => {
70
+ const section = [];
71
+ rearranged.push(section);
72
+ rows.forEach((r, i) => {
73
+ if (reverse)
74
+ r.reverse();
75
+ if (i % 2 === 0) {
76
+ section.push(r);
77
+ reverse = !reverse;
78
+ }
79
+ });
80
+ });
81
+ break;
82
+ }
83
+ case 'ccw': {
84
+ let reverse = true;
85
+ sections.forEach(rows => {
86
+ const section = [];
87
+ rearranged.push(section);
88
+ rows.forEach((r, i) => {
89
+ if (reverse)
90
+ r.reverse();
91
+ if (i % 2 === 0) {
92
+ section.push(r);
93
+ reverse = !reverse;
94
+ }
95
+ });
96
+ });
97
+ break;
98
+ }
99
+ case 'zigzag':
100
+ sections.forEach(rows => {
101
+ const section = [];
102
+ rows.forEach((r, i) => {
103
+ if (i % 2 === 0) {
104
+ section.push(r);
105
+ }
106
+ });
107
+ const sectionLength = section.length;
108
+ const tempRow = [];
109
+ const tempSection = [];
110
+ section.forEach((row, rowIdx) => {
111
+ row.forEach((cell, idx) => {
112
+ tempRow[rowIdx + idx * section.length] = cell;
113
+ });
114
+ });
115
+ const chunkSize = tempRow.length / sectionLength;
116
+ for (let idx = 0; idx < sectionLength; idx++) {
117
+ tempSection.push(tempRow.slice(idx * chunkSize, (idx + 1) * chunkSize));
118
+ }
119
+ rearranged.push(tempSection);
120
+ });
121
+ break;
122
+ case 'zigzag-reverse':
123
+ sections.forEach(rows => {
124
+ const section = [];
125
+ rows.forEach((r, i) => {
126
+ if (i % 2 === 0) {
127
+ r.reverse();
128
+ section.push(r);
129
+ }
130
+ });
131
+ const sectionLength = section.length;
132
+ const tempRow = [];
133
+ const tempSection = [];
134
+ section.forEach((row, rowIdx) => {
135
+ row.forEach((cell, idx) => {
136
+ tempRow[rowIdx + idx * section.length] = cell;
137
+ });
138
+ });
139
+ const chunkSize = tempRow.length / sectionLength;
140
+ for (let idx = 0; idx < sectionLength; idx++) {
141
+ tempSection.push(tempRow.slice(idx * chunkSize, (idx + 1) * chunkSize));
142
+ }
143
+ rearranged.push(tempSection);
144
+ });
145
+ break;
146
+ }
147
+ return rearranged;
148
+ }
149
+ /**
150
+ * Remove empty cells from sections.
151
+ */
152
+ export function removeEmptyCells(sections) {
153
+ const newSections = [];
154
+ sections.forEach(rows => {
155
+ const newRows = [];
156
+ newSections.push(newRows);
157
+ rows.forEach(row => {
158
+ const newRow = [];
159
+ newRows.push(newRow);
160
+ row.forEach(c => {
161
+ if (!c.isEmpty)
162
+ newRow.push(c);
163
+ });
164
+ });
165
+ });
166
+ return newSections;
167
+ }
168
+ /**
169
+ * Merge section rows into flat arrays.
170
+ */
171
+ export function mergeRows(sections) {
172
+ const merged = [];
173
+ sections.forEach(section => {
174
+ let newSection = [];
175
+ section.forEach(rows => {
176
+ let mergedRow = [];
177
+ rows.forEach(row => {
178
+ mergedRow = mergedRow.concat(row);
179
+ });
180
+ newSection = newSection.concat(mergedRow);
181
+ });
182
+ merged.push(newSection);
183
+ });
184
+ return merged;
185
+ }
186
+ /**
187
+ * Set section/unit location on cells.
188
+ */
189
+ export function setLocations(sections, startSection, startUnit, sectionDigits, unitDigits) {
190
+ let sectionNumber = Number(startSection) || 1;
191
+ sections.forEach(section => {
192
+ let unitNumber = Number(startUnit) || 1;
193
+ section.forEach(c => {
194
+ if (!c.isEmpty) {
195
+ c.set('section', String(sectionNumber).padStart(sectionDigits, '0'));
196
+ c.set('unit', String(unitNumber).padStart(unitDigits, '0'));
197
+ }
198
+ else {
199
+ c.set('section', null);
200
+ c.set('unit', null);
201
+ }
202
+ unitNumber++;
203
+ });
204
+ sectionNumber++;
205
+ });
206
+ }
207
+ /**
208
+ * Run the full location increase flow.
209
+ */
210
+ export function increaseLocation(selectedCells, type, skipNumbering, startSection, startUnit, sectionDigits, unitDigits) {
211
+ // step 1: classify cells by row
212
+ const classified = classifyByRow(selectedCells);
213
+ // step 2: find aisle row indices
214
+ const aisleRowIndices = getAisleRowIndices(classified);
215
+ // step 3: classify cells by section
216
+ const sections = classifyCellsBySection(classified, aisleRowIndices);
217
+ // step 4: rearrange by aisle
218
+ let rearranged = rearrangeByAisle(type, sections);
219
+ // step 5: if skip numbering, remove empty cells
220
+ if (skipNumbering)
221
+ rearranged = removeEmptyCells(rearranged);
222
+ // step 6: merge rows
223
+ const merged = mergeRows(rearranged);
224
+ // step 7: set location
225
+ setLocations(merged, startSection, startUnit, sectionDigits, unitDigits);
226
+ }
227
+ //# sourceMappingURL=rack-grid-location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rack-grid-location.js","sourceRoot":"","sources":["../src/rack-grid-location.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAqB;IACjD,MAAM,UAAU,GAAqB,EAAE,CAAA;IAEvC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAChB,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAA;QAE/B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QACtB,CAAC;QAED,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAuB;IAC/C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,CAAA;IACX,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QACrB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAC7B,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAsB;IACvD,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAC9B,MAAM,eAAe,GAAa,EAAE,CAAA;IAEpC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,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CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YACrB,CAAC;YACD,UAAU,EAAE,CAAA;QACd,CAAC,CAAC,CAAA;QACF,aAAa,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,aAA6B,EAC7B,IAAY,EACZ,aAAsB,EACtB,YAAoB,EACpB,SAAiB,EACjB,aAAqB,EACrB,UAAkB;IAElB,gCAAgC;IAChC,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,CAAA;IAE/C,iCAAiC;IACjC,MAAM,eAAe,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAA;IAEtD,oCAAoC;IACpC,MAAM,QAAQ,GAAG,sBAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAA;IAEpE,6BAA6B;IAC7B,IAAI,UAAU,GAAG,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAEjD,gDAAgD;IAChD,IAAI,aAAa;QAAE,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAE5D,qBAAqB;IACrB,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,CAAA;IAEpC,uBAAuB;IACvB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,CAAC,CAAA;AAC1E,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * RackGrid location management utilities.\n * Extracted from rack-table.ts for separation of concerns.\n */\n\nimport type { RackGridCell } from './rack-grid-cell.js'\n\n/**\n * Classify cells by their row index.\n */\nexport function classifyByRow(cells: RackGridCell[]): RackGridCell[][] {\n const classified: RackGridCell[][] = []\n\n cells.forEach(c => {\n const { row, column } = c.index\n\n if (!classified[row]) {\n classified[row] = []\n }\n\n classified[row][column] = c\n })\n\n return classified\n}\n\n/**\n * Find aisle rows (rows where all cells are empty).\n */\nexport function findAisle(rows?: RackGridCell[][]): RackGridCell[][] {\n if (!rows) {\n return []\n }\n\n return rows.filter(r => {\n return r[0] && r[0].isAisle\n })\n}\n\n/**\n * Get indices of aisle rows.\n */\nexport function getAisleRowIndices(rows: RackGridCell[][]): number[] {\n const aisles = findAisle(rows)\n const aisleRowIndices: number[] = []\n\n aisles.forEach(aisle => {\n aisleRowIndices.push(rows.indexOf(aisle))\n })\n\n return aisleRowIndices\n}\n\n/**\n * Classify rows into sections separated by aisle rows.\n */\nexport function classifyCellsBySection(\n rows: RackGridCell[][],\n aisleRowIndices: number[]\n): RackGridCell[][][] {\n const sections: RackGridCell[][][] = []\n let wasAisle = false\n let section!: RackGridCell[][]\n\n rows.forEach((row, i) => {\n const isAisle = aisleRowIndices.indexOf(i) > -1\n\n if (!(wasAisle || isAisle)) {\n section = []\n sections.push(section)\n }\n\n wasAisle = isAisle\n\n section.push(row)\n })\n\n return sections\n}\n\n/**\n * Rearrange cells by aisle direction pattern.\n */\nexport function rearrangeByAisle(type: string, sections: RackGridCell[][][]): RackGridCell[][][] {\n const rearranged: RackGridCell[][][] = []\n\n switch (type.toLowerCase()) {\n case 'cw': {\n let reverse = false\n sections.forEach(rows => {\n const section: RackGridCell[][] = []\n rearranged.push(section)\n rows.forEach((r, i) => {\n if (reverse) r.reverse()\n\n if (i % 2 === 0) {\n section.push(r)\n reverse = !reverse\n }\n })\n })\n break\n }\n case 'ccw': {\n let reverse = true\n sections.forEach(rows => {\n const section: RackGridCell[][] = []\n rearranged.push(section)\n rows.forEach((r, i) => {\n if (reverse) r.reverse()\n\n if (i % 2 === 0) {\n section.push(r)\n reverse = !reverse\n }\n })\n })\n break\n }\n case 'zigzag':\n sections.forEach(rows => {\n const section: RackGridCell[][] = []\n\n rows.forEach((r, i) => {\n if (i % 2 === 0) {\n section.push(r)\n }\n })\n\n const sectionLength = section.length\n const tempRow: RackGridCell[] = []\n const tempSection: RackGridCell[][] = []\n\n section.forEach((row, rowIdx) => {\n row.forEach((cell, idx) => {\n tempRow[rowIdx + idx * section.length] = cell\n })\n })\n\n const chunkSize = tempRow.length / sectionLength\n for (let idx = 0; idx < sectionLength; idx++) {\n tempSection.push(tempRow.slice(idx * chunkSize, (idx + 1) * chunkSize))\n }\n\n rearranged.push(tempSection)\n })\n break\n case 'zigzag-reverse':\n sections.forEach(rows => {\n const section: RackGridCell[][] = []\n\n rows.forEach((r, i) => {\n if (i % 2 === 0) {\n r.reverse()\n section.push(r)\n }\n })\n\n const sectionLength = section.length\n const tempRow: RackGridCell[] = []\n const tempSection: RackGridCell[][] = []\n\n section.forEach((row, rowIdx) => {\n row.forEach((cell, idx) => {\n tempRow[rowIdx + idx * section.length] = cell\n })\n })\n\n const chunkSize = tempRow.length / sectionLength\n for (let idx = 0; idx < sectionLength; idx++) {\n tempSection.push(tempRow.slice(idx * chunkSize, (idx + 1) * chunkSize))\n }\n\n rearranged.push(tempSection)\n })\n break\n }\n\n return rearranged\n}\n\n/**\n * Remove empty cells from sections.\n */\nexport function removeEmptyCells(sections: RackGridCell[][][]): RackGridCell[][][] {\n const newSections: RackGridCell[][][] = []\n sections.forEach(rows => {\n const newRows: RackGridCell[][] = []\n newSections.push(newRows)\n rows.forEach(row => {\n const newRow: RackGridCell[] = []\n newRows.push(newRow)\n row.forEach(c => {\n if (!c.isEmpty) newRow.push(c)\n })\n })\n })\n\n return newSections\n}\n\n/**\n * Merge section rows into flat arrays.\n */\nexport function mergeRows(sections: RackGridCell[][][]): RackGridCell[][] {\n const merged: RackGridCell[][] = []\n\n sections.forEach(section => {\n let newSection: RackGridCell[] = []\n\n section.forEach(rows => {\n let mergedRow: RackGridCell[] = []\n rows.forEach(row => {\n mergedRow = mergedRow.concat(row)\n })\n newSection = newSection.concat(mergedRow)\n })\n merged.push(newSection)\n })\n\n return merged\n}\n\n/**\n * Set section/unit location on cells.\n */\nexport function setLocations(\n sections: RackGridCell[][],\n startSection: number,\n startUnit: number,\n sectionDigits: number,\n unitDigits: number\n) {\n let sectionNumber = Number(startSection) || 1\n\n sections.forEach(section => {\n let unitNumber = Number(startUnit) || 1\n section.forEach(c => {\n if (!c.isEmpty) {\n c.set('section', String(sectionNumber).padStart(sectionDigits, '0'))\n c.set('unit', String(unitNumber).padStart(unitDigits, '0'))\n } else {\n c.set('section', null)\n c.set('unit', null)\n }\n unitNumber++\n })\n sectionNumber++\n })\n}\n\n/**\n * Run the full location increase flow.\n */\nexport function increaseLocation(\n selectedCells: RackGridCell[],\n type: string,\n skipNumbering: boolean,\n startSection: number,\n startUnit: number,\n sectionDigits: number,\n unitDigits: number\n) {\n // step 1: classify cells by row\n const classified = classifyByRow(selectedCells)\n\n // step 2: find aisle row indices\n const aisleRowIndices = getAisleRowIndices(classified)\n\n // step 3: classify cells by section\n const sections = classifyCellsBySection(classified, aisleRowIndices)\n\n // step 4: rearrange by aisle\n let rearranged = rearrangeByAisle(type, sections)\n\n // step 5: if skip numbering, remove empty cells\n if (skipNumbering) rearranged = removeEmptyCells(rearranged)\n\n // step 6: merge rows\n const merged = mergeRows(rearranged)\n\n // step 7: set location\n setLocations(merged, startSection, startUnit, sectionDigits, unitDigits)\n}\n"]}
@@ -0,0 +1,80 @@
1
+ import { Component, ComponentNature, ContainerAbstract, Control, Properties, RealObject } from '@hatiolab/things-scene';
2
+ import type { State } from '@hatiolab/things-scene';
3
+ import * as THREE from 'three';
4
+ /** RackGrid 컴포넌트 state */
5
+ export interface RackGridState extends State {
6
+ rows?: number;
7
+ columns?: number;
8
+ zone?: string;
9
+ shelves?: number;
10
+ locPattern?: string;
11
+ sectionDigits?: number;
12
+ unitDigits?: number;
13
+ shelfLocations?: string;
14
+ stockScale?: number;
15
+ hideRackFrame?: boolean;
16
+ legendTarget?: string;
17
+ hideEmptyStock?: boolean;
18
+ widths?: number[];
19
+ heights?: number[];
20
+ }
21
+ import { RackGridCell } from './rack-grid-cell.js';
22
+ import type { StockMaterialProvider } from './stock.js';
23
+ export default class RackGrid extends ContainerAbstract implements StockMaterialProvider {
24
+ get state(): RackGridState;
25
+ _focused_cell?: RackGridCell;
26
+ _stock_materials: THREE.Material[];
27
+ _default_material?: THREE.Material;
28
+ _empty_material?: THREE.Material;
29
+ private _legendTarget?;
30
+ get legendTarget(): Component | undefined;
31
+ get hideEmptyStock(): boolean;
32
+ private _onLegendChanged;
33
+ private _resetMaterials;
34
+ buildRealObject(): RealObject | undefined;
35
+ dispose(): void;
36
+ created(): void;
37
+ get focusible(): boolean;
38
+ get widths(): number[];
39
+ get heights(): number[];
40
+ buildCells(newrows: number, newcolumns: number, oldrows: number, oldcolumns: number): void;
41
+ get layout(): any;
42
+ get rows(): any;
43
+ setCellsStyle(cells: RackGridCell[], style: any, where: string): void;
44
+ getRowColumn(cell: RackGridCell): {
45
+ column: number;
46
+ row: number;
47
+ };
48
+ getCellsByRow(row: number): Component[];
49
+ getCellsByColumn(column: number): Component[];
50
+ deleteRows(cells: RackGridCell[]): void;
51
+ deleteColumns(cells: RackGridCell[]): void;
52
+ insertCellsAbove(cells: RackGridCell[]): false | undefined;
53
+ insertCellsBelow(cells: RackGridCell[]): false | undefined;
54
+ insertCellsLeft(cells: RackGridCell[]): false | undefined;
55
+ insertCellsRight(cells: RackGridCell[]): false | undefined;
56
+ distributeHorizontal(cells: RackGridCell[]): void;
57
+ distributeVertical(cells: RackGridCell[]): void;
58
+ increaseLocation(type: string, skipNumbering: boolean, startSection: number, startUnit: number): void;
59
+ get columns(): any;
60
+ get lefts(): Component[];
61
+ get centers(): Component[];
62
+ get rights(): Component[];
63
+ get tops(): Component[];
64
+ get middles(): Component[];
65
+ get bottoms(): Component[];
66
+ get all(): Component[];
67
+ get widths_sum(): any;
68
+ get heights_sum(): any;
69
+ get nature(): ComponentNature;
70
+ get controls(): Array<Control> | undefined;
71
+ onchange(after: Properties, before: Properties): void;
72
+ get eventMap(): {
73
+ '(self)': {
74
+ '(descendant)': {
75
+ change: (after: Properties, before: Properties) => void;
76
+ };
77
+ };
78
+ };
79
+ oncellchanged(after: Properties, before: Properties): void;
80
+ }