@arbocollab/arbo-plugin-item-table 0.0.109 → 0.0.110
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.
- package/CHANGELOG.md +231 -0
- package/README.md +1 -1
- package/lib/es/index.es.js +1 -1
- package/lib/umd/index.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,237 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.0.110] - 2026-01-30
|
|
6
|
+
|
|
7
|
+
### 🚀 Features
|
|
8
|
+
|
|
9
|
+
**Input Components**
|
|
10
|
+
|
|
11
|
+
- **Enhanced InputText Component:** Complete rewrite with advanced input handling
|
|
12
|
+
- Added support for multiple input types: `text`, `number`, `email`, `url`, `tel`
|
|
13
|
+
- Implemented auto-emit mode with configurable debounce delay (default 300ms)
|
|
14
|
+
- Added intelligent formatters and validators for each input type
|
|
15
|
+
- Number inputs now limited to 17 digits (excluding decimal point and minus sign)
|
|
16
|
+
- Text inputs capped at 255 characters (configurable via maxLength)
|
|
17
|
+
- Email and URL inputs automatically remove spaces
|
|
18
|
+
- Telephone inputs only allow valid phone characters
|
|
19
|
+
- Improved keyboard navigation (Enter to submit, Escape to cancel/blur)
|
|
20
|
+
- Fixed cursor jumping issues during character deletion
|
|
21
|
+
- Clear button now prevents blur event and maintains focus
|
|
22
|
+
|
|
23
|
+
**Metric Components**
|
|
24
|
+
|
|
25
|
+
- **New MetricEditorInput:** Dedicated component for metric number inputs
|
|
26
|
+
- Supports dynamic decimal place formatting based on metric config
|
|
27
|
+
- Implements proper value caching and revert on Escape
|
|
28
|
+
- Enhanced blur/enter/clear event handling
|
|
29
|
+
- Auto-focuses on mount for better UX
|
|
30
|
+
|
|
31
|
+
- **Enhanced MetricEditorDropdown:**
|
|
32
|
+
- Added empty option ("-") for clearing values
|
|
33
|
+
- Improved tooltip support for long metric names
|
|
34
|
+
- Better overflow handling with max-width constraints
|
|
35
|
+
|
|
36
|
+
- **MetricEditor Refactor:**
|
|
37
|
+
- Replaced generic InputText with specialized MetricEditorInput
|
|
38
|
+
- Simplified metric type handling
|
|
39
|
+
- Improved confirm/cancel logic
|
|
40
|
+
|
|
41
|
+
- **MetricEditorWrapper Improvements:**
|
|
42
|
+
- Added smart value comparison to prevent unnecessary API calls
|
|
43
|
+
- Proper handling of null/clear operations with `clear` flag
|
|
44
|
+
- Enhanced row data updates with forced cell refresh
|
|
45
|
+
- Better logging for debugging
|
|
46
|
+
|
|
47
|
+
**Metric Rendering**
|
|
48
|
+
|
|
49
|
+
- **Large Number Support:** Fixed JavaScript precision issues
|
|
50
|
+
- Numbers with >16 digits now kept as strings to preserve precision
|
|
51
|
+
- Custom formatting for large numbers without precision loss
|
|
52
|
+
- Prevents `22222222222222222` from becoming `22222222222222224`
|
|
53
|
+
|
|
54
|
+
- **Enhanced MetricRenderer:**
|
|
55
|
+
- Improved tooltip behavior with `bypassOverflowCheck` for morpheme values
|
|
56
|
+
- Better formatted value display with proper morpheme handling
|
|
57
|
+
- Fixed string-to-number conversion for large values
|
|
58
|
+
|
|
59
|
+
**Bulk Operations**
|
|
60
|
+
|
|
61
|
+
- **New useMetricUpdate Composable:** Centralized metric update logic
|
|
62
|
+
- Handles both single and bulk metric updates
|
|
63
|
+
- Supports clear operations with proper API payload construction
|
|
64
|
+
- Integrated callback system for post-update actions
|
|
65
|
+
- Better error handling and logging
|
|
66
|
+
|
|
67
|
+
- **Enhanced BulkUpdate Component:**
|
|
68
|
+
- Refactored action handling with switch statement for clarity
|
|
69
|
+
- Improved loading states and error handling
|
|
70
|
+
- Better integration with MetricUpdateButton
|
|
71
|
+
|
|
72
|
+
- **MetricUpdateButton Improvements:**
|
|
73
|
+
- Integrated with new useMetricUpdate composable
|
|
74
|
+
- Fixed prop naming: `ids` → `selectedIds`
|
|
75
|
+
- Removed duplicate logic, delegated to composable
|
|
76
|
+
- Cleaner emit handling
|
|
77
|
+
|
|
78
|
+
**Search & Filter**
|
|
79
|
+
|
|
80
|
+
- **SearchBox Enhancements:**
|
|
81
|
+
- Now uses `auto-emit` mode for real-time search
|
|
82
|
+
- Integrated with standardized debounce delay constant
|
|
83
|
+
- Removed manual debounce logic in favor of InputText's built-in handling
|
|
84
|
+
- Better cancel/escape key behavior
|
|
85
|
+
|
|
86
|
+
- **SearchList Improvements:**
|
|
87
|
+
- Dynamic min-height based on content state
|
|
88
|
+
- Improved empty/no-results states styling
|
|
89
|
+
- Better scrollable detection (>8 items)
|
|
90
|
+
- Enhanced loading skeleton (8 items instead of 7)
|
|
91
|
+
- Cleaner state management with reduced code complexity
|
|
92
|
+
|
|
93
|
+
**API & Services**
|
|
94
|
+
|
|
95
|
+
- **ItemService Updates:**
|
|
96
|
+
- Fixed typo: `builkMetricUpdate` → `bulkMetricUpdate`
|
|
97
|
+
- Added `clear` parameter support for metric updates
|
|
98
|
+
- Automatic clear flag when value is null
|
|
99
|
+
- Better payload construction
|
|
100
|
+
|
|
101
|
+
- **API Configuration:**
|
|
102
|
+
- Updated endpoint naming for consistency
|
|
103
|
+
- Fixed method signatures across the codebase
|
|
104
|
+
|
|
105
|
+
**Data Management**
|
|
106
|
+
|
|
107
|
+
- **useRowUpdater Enhancements:**
|
|
108
|
+
- Only updates fields when data exists (no overwrites of missing data)
|
|
109
|
+
- Dynamic column refresh (only refreshes changed columns)
|
|
110
|
+
- Better handling of assignees, permissions, and metric values
|
|
111
|
+
- Removed hardcoded column refreshes
|
|
112
|
+
- Improved logging for debugging
|
|
113
|
+
|
|
114
|
+
- **useItems Improvements:**
|
|
115
|
+
- Separated metric value fetching from other data fetching
|
|
116
|
+
- Better async handling of post-fetch operations
|
|
117
|
+
- Reduced race conditions in data updates
|
|
118
|
+
|
|
119
|
+
**UI/UX Improvements**
|
|
120
|
+
|
|
121
|
+
- **Button Component:**
|
|
122
|
+
- Optimized variant detection with Set instead of array
|
|
123
|
+
- Cleaner loading state handling
|
|
124
|
+
- Removed commented-out code
|
|
125
|
+
|
|
126
|
+
- **FileUploader:**
|
|
127
|
+
- Fixed error state logic (proper validation)
|
|
128
|
+
- Cleaner emit types with function syntax
|
|
129
|
+
|
|
130
|
+
- **ImportVisual:**
|
|
131
|
+
- Removed min-height constraint for better responsiveness
|
|
132
|
+
- Cleaner prop definitions
|
|
133
|
+
|
|
134
|
+
- **Calendar Components:**
|
|
135
|
+
- Added proper Mode type definition
|
|
136
|
+
- Improved type safety
|
|
137
|
+
- Removed unused hover styles
|
|
138
|
+
|
|
139
|
+
### ⚡ Performance & Code Quality
|
|
140
|
+
|
|
141
|
+
**Constants & Configuration**
|
|
142
|
+
|
|
143
|
+
- Increased `STANDARD_DEBOUNCE_DELAY` from 300ms to 800ms for better UX
|
|
144
|
+
- Centralized debounce delay across all components
|
|
145
|
+
- Removed duplicate debounce implementations
|
|
146
|
+
|
|
147
|
+
**Code Cleanup**
|
|
148
|
+
|
|
149
|
+
- Removed obsolete BulkUpdate Storybook story
|
|
150
|
+
- Cleaned up unused imports across multiple files
|
|
151
|
+
- Fixed ESLint configuration for consistent semicolon usage
|
|
152
|
+
- Removed commented-out code blocks
|
|
153
|
+
- Improved code formatting and consistency
|
|
154
|
+
- Better TypeScript type definitions
|
|
155
|
+
|
|
156
|
+
**Refactoring**
|
|
157
|
+
|
|
158
|
+
- Simplified conditional logic throughout codebase
|
|
159
|
+
- Replaced if-else chains with switch statements
|
|
160
|
+
- Used optional chaining and nullish coalescing
|
|
161
|
+
- Better function composition and reusability
|
|
162
|
+
- Improved variable naming for clarity
|
|
163
|
+
|
|
164
|
+
### 🐛 Bug Fixes
|
|
165
|
+
|
|
166
|
+
**Input Handling**
|
|
167
|
+
|
|
168
|
+
- Fixed cursor position jumping during input deletion
|
|
169
|
+
- Fixed blur event firing when clearing input
|
|
170
|
+
- Fixed Escape key behavior in auto-emit mode (now blurs instead of reverting)
|
|
171
|
+
- Fixed number input precision for large numbers (>16 digits)
|
|
172
|
+
|
|
173
|
+
**Metric Updates**
|
|
174
|
+
|
|
175
|
+
- Fixed `bulkMetricUpdate` API method name typo
|
|
176
|
+
- Fixed metric clear operations not working properly
|
|
177
|
+
- Fixed unnecessary API calls when value unchanged
|
|
178
|
+
- Fixed row data not updating after metric change
|
|
179
|
+
|
|
180
|
+
**Data Updates**
|
|
181
|
+
|
|
182
|
+
- Fixed assignees being overwritten when not in response
|
|
183
|
+
- Fixed permissions being cleared when not provided
|
|
184
|
+
- Fixed metric values being reset inappropriately
|
|
185
|
+
|
|
186
|
+
**UI/UX**
|
|
187
|
+
|
|
188
|
+
- Fixed SearchList height issues with empty states
|
|
189
|
+
- Fixed loading skeleton count inconsistency
|
|
190
|
+
- Fixed tooltip overflow checks for metric morphemes
|
|
191
|
+
- Fixed error state in file uploader validation
|
|
192
|
+
|
|
193
|
+
### 🔧 Technical Improvements
|
|
194
|
+
|
|
195
|
+
**Type Safety**
|
|
196
|
+
|
|
197
|
+
- Better TypeScript definitions for emit signatures
|
|
198
|
+
- Proper Mode type for calendar navigation
|
|
199
|
+
- Improved API response types
|
|
200
|
+
- Cleaner generic type usage
|
|
201
|
+
|
|
202
|
+
**Performance**
|
|
203
|
+
|
|
204
|
+
- Reduced unnecessary re-renders with smarter computed properties
|
|
205
|
+
- Optimized cache handling in remote file composables
|
|
206
|
+
- Better debounce strategies across components
|
|
207
|
+
- Removed v-memo where not needed
|
|
208
|
+
|
|
209
|
+
**Testing & Development**
|
|
210
|
+
|
|
211
|
+
- Better console logging for debugging
|
|
212
|
+
- Improved error messages
|
|
213
|
+
- Enhanced development experience with better type hints
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### Breaking Changes
|
|
218
|
+
|
|
219
|
+
⚠️ **API Method Rename:**
|
|
220
|
+
|
|
221
|
+
- `builkMetricUpdate` → `bulkMetricUpdate` (typo fix)
|
|
222
|
+
|
|
223
|
+
⚠️ **Prop Changes:**
|
|
224
|
+
|
|
225
|
+
- `MetricUpdateButton`: `ids` prop renamed to `selectedIds`
|
|
226
|
+
|
|
227
|
+
⚠️ **Behavior Changes:**
|
|
228
|
+
|
|
229
|
+
- Escape key in auto-emit mode now blurs input instead of reverting value
|
|
230
|
+
- Debounce delay increased from 300ms to 800ms globally
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
[0.0.110]: https://github.com/arbocollab/arbo-plugins/releases/tag/v0.0.110
|
|
235
|
+
|
|
5
236
|
## [0.0.103] - 2026-01-30 1:36 PM
|
|
6
237
|
|
|
7
238
|
### 🚀 Features
|
package/README.md
CHANGED
|
@@ -180,7 +180,7 @@ import { ItemTable } from '@arbocollab/arbo-plugin-item-table';
|
|
|
180
180
|
|
|
181
181
|
## 📝 Changelog
|
|
182
182
|
|
|
183
|
-
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@arbocollab/arbo-plugin-item-table@0.0.
|
|
183
|
+
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@arbocollab/arbo-plugin-item-table@0.0.110/CHANGELOG.md) for a detailed list of changes in each release.
|
|
184
184
|
|
|
185
185
|
### Latest Release: v0.0.100 (2026-01-28)
|
|
186
186
|
|
package/lib/es/index.es.js
CHANGED
|
@@ -79024,7 +79024,7 @@ const kye = {
|
|
|
79024
79024
|
"beta-tag": "_beta-tag_1lefh_57"
|
|
79025
79025
|
}, Xye = {
|
|
79026
79026
|
$style: Zye
|
|
79027
|
-
}, Jye = /* @__PURE__ */ Ct(Uye, [["__cssModules", Xye]]), ZL = "0.0.
|
|
79027
|
+
}, Jye = /* @__PURE__ */ Ct(Uye, [["__cssModules", Xye]]), ZL = "0.0.110", Qye = { key: 0 }, ewe = /* @__PURE__ */ ut({
|
|
79028
79028
|
__name: "app",
|
|
79029
79029
|
setup(e) {
|
|
79030
79030
|
const t = U(() => n.id.length === 0 || n.workspaceId.length === 0), n = ko({
|
package/lib/umd/index.umd.js
CHANGED
|
@@ -176,4 +176,4 @@ If you are trying to annotate ${i} with application data, use the '${i}.context'
|
|
|
176
176
|
<path d="M11 9C9.89688 9 9 9.89688 9 11V21C9 22.1031 9.89688 23 11 23H21C22.1031 23 23 22.1031 23 21V11C23 9.89688 22.1031 9 21 9H11ZM19.5312 14.5312L15.5312 18.5312C15.2375 18.825 14.7625 18.825 14.4719 18.5312L12.4719 16.5312C12.1781 16.2375 12.1781 15.7625 12.4719 15.4719C12.7656 15.1813 13.2406 15.1781 13.5312 15.4719L15 16.9406L18.4688 13.4688C18.7625 13.175 19.2375 13.175 19.5281 13.4688C19.8187 13.7625 19.8219 14.2375 19.5281 14.5281L19.5312 14.5312Z" fill="#00A18D"/>
|
|
177
177
|
</svg>
|
|
178
178
|
`,Xhe=wt(ut({__name:"item-table",props:{entityId:{},workspaceId:{}},setup(e,{expose:t}){const n=Zi,i=aC(),{setUserPermissions:o,setEntityPermissions:s}=i,{entityPermissions:r}=so(i),{addNotification:a}=Ud(),l=un,u=$(null),c={ROWS_PER_PAGE:50,ROW_HEIGHT:38,GRID_HEIGHT:"650px"},d=U(()=>{var Ae;const Fe=((Ae=r.value)==null?void 0:Ae.has_create_item_permission)===1;return[{label:"Create manually",value:"new_scene",icon:"Plus",type:"icon",id:"create_new_scene",hide:!Fe},{label:"Import from CSV or Excel",value:"import_scenes",icon:"FileImport",type:"icon",hide:!Fe,id:"import_scenes_option"},{label:"Update existing (CSV or Excel)",value:"overwrite_scenes",icon:"FilePen",type:"icon",hide:!Fe,id:"overwrite_scenes_option"}]}),h=e;nh.initialize({wrapVueCellRenderer:Cg,wrapVueCellEditor:uI});const f=$(null),p=$([]),m=pC(),{rowCount:y}=so(m),w=$(!1),S=$(""),_=CP(),{metricList:b}=so(_),E=$(""),R=$(!1),x=$(new Set),A=$(new Map),{apiServices:F}=ai(!1,h),{columnDefs:k,checkboxColumn:P,saveColumnConfig:O}=lde(b,h.entityId,f),I=$();nt(()=>k,()=>{var Fe;(Fe=I.value)==null||Fe.updateColumnDefs(k.value)},{deep:!0});const L=(Fe,Ae)=>{O(Fe,Ae)},{updateRowData:Z,setMetricValues:Q}=Ghe(f),Y=U(()=>({isSearching:S.value.length>0,isFiltering:Object.keys(vt.value||{}).length>0})),V=U(Id),H=U(()=>k.value.filter(Fe=>{var Ae;return((Ae=Fe.field)==null?void 0:Ae.startsWith("metric_"))&&!Fe.hide}).map(Fe=>{var Ae;return((Ae=Fe.field)==null?void 0:Ae.replace("metric_",""))||""}));Va("timezone",V);const K=U(()=>({autoFetch:!1,workspaceId:h.workspaceId,entityId:h.entityId,metricIds:H.value,updateItemData:Z})),{fetchItems:ve,getMetricList:Ce,cusorMap:ae,getMetricValues:ie}=$he(K),J=U(()=>{if(!f.value)return!1;const Fe=f.value.getSelectedRows().length;return Fe>0&&Fe>=y.value.total}),fe=U(()=>{var Fe;return((Fe=u.value)==null?void 0:Fe.name)||"Items"}),Ne=(Fe,Ae)=>{var Rt,pn,Ar;y.value.total=Fe.meta.total??0,(Rt=Fe.meta.next)!=null&&Rt.cursor&&(ae[Ae+1]=Fe.meta.next.cursor),E.value=Fe.meta["X-Tsr-signature"]||"",Fe.meta.total===0?(pn=f.value)==null||pn.showNoRowsOverlay():(Ar=f.value)==null||Ar.hideOverlay()},it=nI(),_e=$(null),{sortingAPIConfiguration:mt,isSortingRunning:bt}=so(it),vt=$({}),N=$([]),q=async({page:Fe,pageSize:Ae,filterText:Rt})=>{var Ll;(Ll=f.value)==null||Ll.hideOverlay();const pn=ae[Fe],Ar=!pn&&Fe>1?(Fe-1)*Ae:void 0,Ml=mt.value;Ml.length>0&&(bt.value=!0);try{const Kh={cursor:pn,size:Ae,searchQuery:Rt,offset:Ar,sort_by:Ml,...vt.value},Ho=await ve(Kh);if(!Ho)return{rows:[],total:0};const js=(bc=>{const Vm=bc.data.map(po=>sT(po,V.value));return Vm.forEach(po=>{x.value.add(String(po.id)),A.value.set(String(po.id),{})}),Vm})(Ho);return Ne(Ho,Fe),{rows:js,total:y.value.total}}catch(Kh){return console.error("Failed to fetch items:",Kh),{rows:[],total:0}}finally{bt.value=!1}},{isLoading:ue,toggleSidebar:Pe,onGridReady:De,handleUnSelect:Ie,onSearch:Be,firstLoad:Le}=Uhe({selectRowData:$([]),isSidebarOpen:w,quickFilterText:S,gridApi:f,perPage:c.ROWS_PER_PAGE,fetcher:q}),Me=$([]),xe=()=>{var Fe;Me.value=((Fe=f.value)==null?void 0:Fe.getSelectedRows())||[]},st=vo({columnsDisplay:[],rowsDisplay:{fromIndex:0,toIndex:0}}),Ue=U(()=>({blockLoadDebounceMillis:1e3,columnDefs:k.value,rowModelType:"infinite",cacheBlockSize:c.ROWS_PER_PAGE,infiniteInitialRowCount:20,popupParent:document.getElementById("item-table-layout-id")||void 0,rowSelection:{mode:"multiRow",checkboxes:!1,enableClickSelection:!1,enableSelectionWithoutKeys:!1},pagination:!1,rowHeight:c.ROW_HEIGHT,suppressHorizontalScroll:!1,suppressColumnVirtualisation:!1,debounceVerticalScrollbar:!1,animateRows:!1,suppressAnimationFrame:!1,suppressScrollOnNewData:!0,suppressScrollWhenPopupsAreOpen:!1,rowBuffer:20,enableCellTextSelection:!1,suppressDragLeaveHidesColumns:!0,suppressMaxRenderedRowRestriction:!1,height:c.GRID_HEIGHT,stopEditingWhenCellsLoseFocus:!0,onModelUpdated:ht,noRowsOverlayComponent:Cg(uK),noRowsOverlayComponentParams:()=>Y.value,defaultColDef:{editable:!1,filter:!1,sortable:!1,flex:1,minWidth:100,suppressNavigable:!1},getRowId:Fe=>Fe.data.id,getRowClass:Fe=>{if(!Fe.data)return["row-empty"];const Ae=["row-highlight"];return Fe.data.id||Ae.push("row-inactive"),Fe.data.isDeleted&&Ae.push("row-deleted"),Fe.data.isArchived&&Ae.push("row-archived"),Ae},suppressRowTransform:!1,singleClickEdit:!0,context:{workspaceId:h.workspaceId,entityId:h.entityId,apiServices:F.value,sorting:bt.value},suppressKeyboardEvent:Fe=>{const Ae=Fe.event.key;return Fe.editing&&Ae==="Enter"?!1:Ae==="Enter"?(Fe.event.preventDefault(),Fe.event.stopPropagation(),!0):Ae==="ArrowUp"||Ae==="ArrowDown"||Ae==="ArrowLeft"||Ae==="ArrowRight"||Ae==="Tab"||Ae==="Enter"},navigateToNextCell:()=>null,onBodyScroll:Fe=>{const Ae=Fe.api.getFirstDisplayedRowIndex(),Rt=Fe.api.getLastDisplayedRowIndex();console.log(`User is looking at rows: ${Ae} to ${Rt}`),st.rowsDisplay.fromIndex=Ae,st.rowsDisplay.toIndex=Rt,st.columnsDisplay=Fe.api.getAllDisplayedVirtualColumns().map(pn=>pn.getColId())},onViewportChanged:Fe=>{console.log("Viewport changed",Fe),st.columnsDisplay=Fe.api.getAllDisplayedVirtualColumns().map(Ae=>Ae.getColId())},suppressHeaderFocus:!0}));function ht(){if(!f.value)return;const Fe=f.value.getCacheBlockState();if(!Fe)return;const Ae=Object.values(Fe).reduce((Rt,pn)=>(pn==null?void 0:pn.pageStatus)==="loaded"?Rt+(pn.endRow-pn.startRow):Rt,0);y.value.loaded=Math.min(Ae,y.value.total)}nt(()=>mt,()=>{f.value&&(E.value="",x.value.clear(),f.value.deselectAll(),Object.keys(ae).forEach(Fe=>delete ae[Number(Fe)]),f.value.purgeInfiniteCache(),f.value.ensureIndexVisible(0),f.value.refreshCells({force:!0}))},{deep:!0});const Ct=$(),Ot=$(),Ht=()=>{var Fe;(Fe=Ot.value)==null||Fe.open()},Ut=()=>{var Fe;(Fe=Ct.value)==null||Fe.open()},cn=async()=>{Le.value=!0,f.value&&(E.value="",x.value.clear(),Object.keys(ae).forEach(Fe=>delete ae[Number(Fe)]),await f.value.deselectAll(),await f.value.ensureIndexVisible(0,"top"),await f.value.purgeInfiniteCache(),await f.value.refreshInfiniteCache())},fn=U(()=>Mn.getInstance().getItem("ITEM_TABLE_APP_VERSION")||""),Hn=$(),ni=U(()=>{var Fe;return(Fe=jhe(fn.value))==null?void 0:Fe.map(Ae=>`<div>• ${Ae}</div>`).join(`
|
|
179
|
-
`)});function Re(Fe){var Ae;Fe==="new_scene"?(Ae=Hn.value)==null||Ae.show():Fe==="import_scenes"?Ut():Fe==="overwrite_scenes"&&Ht()}const ke=Fe=>{p.value=Fe.api.getSelectedRows().map(Ae=>Ae.id)},dt=Fe=>{const Ae=De(Fe);return Ae&&(Ae.addEventListener("modelUpdated",ht),Ae.addEventListener("bodyScroll",()=>Ae.stopEditing()),Ae.addEventListener("selectionChanged",xe),Ae.addEventListener("columnMoved",pn=>L(pn,!0)),Ae.addEventListener("columnResized",pn=>L(pn,!0)),Ae.addEventListener("firstDataRendered",()=>{Le.value=!1}),!document.querySelector(".ag-body-viewport")),Ae},xt=(Fe,Ae)=>{if(!f.value)return;const Rt=f.value.getRowNode(Fe);Rt?(f.value.ensureIndexVisible(Number(Rt.rowIndex),"middle"),f.value.flashCells({rowNodes:[Rt],flashDuration:3e3,fadeDuration:1e3})):f.value.ensureIndexVisible(y.value.total-1,"bottom")},Mt=async Fe=>{var Rt;let Ae;if(!(!F.value||!Fe.trim())){ue.value=!0;try{Ae=await F.value.createNewScene({workspaceId:h.workspaceId,entityId:h.entityId,name:Fe}),y.value.total<50&&await cn()}catch(pn){console.error("Error creating new scene:",pn)}finally{ue.value=!1,Ae!=null&&Ae.id&&a({id:String(Ae==null?void 0:Ae.id),message:`${Fe} created successfully`,actions:[{label:"View",variant:"secondary",action:()=>{xt(String(Ae==null?void 0:Ae.id))}},{label:"Scene Hub",variant:"primary",action:()=>{const pn=to({type:"scene_hub",config:{ws_code:h.workspaceId,baseDomain:Mn.getInstance().getItem("BASE_URL")||"",scene_id:String(Ae==null?void 0:Ae.id)}}).url;window.open(pn,"_blank")},btnIcon:"CustomSceneHub"}],icon:Zhe,type:"interactive"}),(Rt=Hn.value)==null||Rt.hide()}}},We=Fe=>Fe.metric_type.code==="number"?"number":"default",ii=async()=>{if(h.entityId)try{const Fe=await Ce(h.entityId);b.value=Fe.data.map(Ae=>({...Ae,sortType:We(Ae)}))}catch(Fe){console.error("Failed to initialize metric list:",Fe),b.value=[]}},us=async()=>{if(F.value)try{const Fe=await F.value.getUserPermission(h.workspaceId);o(Fe)}catch(Fe){console.error("Failed to fetch user permissions:",Fe)}},ba=async()=>{if(F.value)try{const Fe=await F.value.getEntityDetail(h.workspaceId,h.entityId);s(Fe.permission),u.value=Fe}catch(Fe){console.error("Failed to fetch entity details:",Fe)}},fo=NC(),{setUser:Ir}=fo,Sa=async()=>{if(F.value)try{const Fe=await F.value.getMe();return Ir(Fe),Fe}catch(Fe){console.error("Failed to fetch user details:",Fe)}},Ws=async()=>{var Fe;if(F.value)try{const Ae=await F.value.getWorkspaces(h.workspaceId),Rt=(Fe=Ae.data[0])==null?void 0:Fe.ws_user_role_id;return Rt&&fo.setUserRoleId(Rt),Ae}catch(Ae){console.error("Failed to fetch workspace details:",Ae)}};nt(()=>[h.entityId,h.workspaceId],async([Fe,Ae])=>{!Fe||!Ae||(Sa(),Ws(),ii(),us(),ba())},{immediate:!0,deep:!0}),nt(H,(Fe,Ae)=>{const Rt=Fe.filter(pn=>!(Ae!=null&&Ae.includes(pn)));Rt.length>0&&ie(Array.from(x.value),Rt).then(pn=>{Q(pn,x.value,Rt)})},{immediate:!0,deep:!0}),nt(E,(Fe,Ae)=>{R.value=!!(Ae&&Fe&&Ae!==Fe)}),t({refreshTable:cn});const Us=Fe=>{vt.value=Fe,cn()},Bo=Fe=>{N.value=Fe,cn()},zs=Fe=>{k.value=Fe||[]};return(Fe,Ae)=>(W(),$e(z(r9),{"is-sidebar-open":w.value,onCloseSidebar:z(Pe),onSidebarClear:z(Pe),ref:"itemTableLayoutRef",id:"item-table-layout-id",onSidebarApply:z(Pe)},{"header-left":ge(()=>[he("h1",{class:j(Fe.$style.tableTitle)},"Scenes",2),he("div",{class:j(Fe.$style["beta-tag"])},"Beta",2),se(z(gC),{variant:["primary"],options:d.value,onSelect:Re,onHandleClick:Ae[1]||(Ae[1]=Rt=>Re("new_scene")),id:"create_scene_dropdown"},{prefix:ge(()=>[se(z(ft),{id:"create_new_scene",variant:["primary"],onClick:Ae[0]||(Ae[0]=Rt=>Re("new_scene")),label:"New"})]),_:1},8,["options"]),Ye((W(),le("span",Yhe,[at(yt(fn.value),1)])),[[z(l),ni.value||""]])]),"header-actions":ge(()=>[se(z(OK),{"onUpdate:assignees":Bo,onApplyFilter:Us,loading:z(Le)},null,8,["loading"]),Ye(se(z(hC),{modelValue:S.value,"onUpdate:modelValue":Ae[2]||(Ae[2]=Rt=>S.value=Rt),onSearch:z(Be),class:j(Fe.$style.itemSearchBox),onClear:Ae[3]||(Ae[3]=Rt=>z(Be)("")),id:"item_search_box"},null,8,["modelValue","onSearch","class"]),[[z(n),{isLoading:z(Le),fullwidth:!0}]]),Ye((W(),$e(z(pP),{status:z(ue)?"busy":"active",size:10,id:"refresh_table","status-tooltip":"Data has changed, please refresh the table",color:"var(--warning-color)","show-badge":R.value},{default:ge(()=>[se(z(ft),{variant:"secondary",disabled:z(ue),onClick:cn},{prefix:ge(()=>[se(z(ct),{src:"ArrowsRotate"})]),default:ge(()=>[Ae[5]||(Ae[5]=at(" Refresh ",-1))]),_:1},8,["disabled"])]),_:1},8,["status","show-badge"])),[[z(n),{isLoading:z(Le),fullwidth:!0}]]),Ye(se(z(iK),{"model-value":z(k),onChange:Ae[4]||(Ae[4]=Rt=>zs(Rt)),id:"table_customization",gridApi:f.value,ref_key:"tableCustomizationRef",ref:I,"checkbox-column":z(P)},null,8,["model-value","gridApi","checkbox-column"]),[[z(n),{isLoading:z(Le),fullwidth:!0}]])]),grid:ge(({availableHeight:Rt})=>[se(z(ide),qt({id:"item_table_main",ref_key:"agGrid",ref:_e},Ue.value,{height:Rt+"px",isSorting:z(bt),onOnGridReady:dt,onSelectionChanged:ke}),null,16,["height","isSorting"])]),footer:ge(()=>[he("div",{class:j(Fe.$style.tableFooter),id:"table_footer"},[he("span",null,[Ae[6]||(Ae[6]=at(" Showing ",-1)),he("b",null,yt(z(y).loaded)+" of "+yt(z(y).total),1)])],2)]),"new-row":ge(()=>[se(z(dK),{onCreateNewItem:Mt,ref_key:"createNewSceneRef",ref:Hn},null,512)]),"bulk-update-actions":ge(()=>[!w.value&&p.value.length>0?(W(),$e(z(J7),{key:0,selectRowData:Me.value,"workspace-id":h.workspaceId,"entity-id":h.entityId,"grid-api":f.value,onUnselect:z(Ie),"take-name":fe.value,"selected-all":J.value,onUpdated:xe},null,8,["selectRowData","workspace-id","entity-id","grid-api","onUnselect","take-name","selected-all"])):Ke("",!0)]),snackbar:ge(()=>[se(z(y9))]),popup:ge(()=>[se(VK,{ref_key:"popupCreateSceneRef",ref:Ct,"workspace-id":h.workspaceId,"entity-id":h.entityId,onImportSuccess:cn},null,8,["workspace-id","entity-id"]),se(qhe,{ref_key:"popupOverwriteScenesRef",ref:Ot,"workspace-id":h.workspaceId,"entity-id":h.entityId,onImportSuccess:cn},null,8,["workspace-id","entity-id"])]),_:1},8,["is-sidebar-open","onCloseSidebar","onSidebarClear","onSidebarApply"]))}}),[["__cssModules",{$style:{tableTitle:"_tableTitle_1lefh_1",tableFooter:"_tableFooter_1lefh_7",footerStart:"_footerStart_1lefh_17",newRow:"_newRow_1lefh_25","warning-text":"_warning-text_1lefh_44","has-error":"_has-error_1lefh_49",itemSearchBox:"_itemSearchBox_1lefh_53","beta-tag":"_beta-tag_1lefh_57"}}]]),wL="0.0.
|
|
179
|
+
`)});function Re(Fe){var Ae;Fe==="new_scene"?(Ae=Hn.value)==null||Ae.show():Fe==="import_scenes"?Ut():Fe==="overwrite_scenes"&&Ht()}const ke=Fe=>{p.value=Fe.api.getSelectedRows().map(Ae=>Ae.id)},dt=Fe=>{const Ae=De(Fe);return Ae&&(Ae.addEventListener("modelUpdated",ht),Ae.addEventListener("bodyScroll",()=>Ae.stopEditing()),Ae.addEventListener("selectionChanged",xe),Ae.addEventListener("columnMoved",pn=>L(pn,!0)),Ae.addEventListener("columnResized",pn=>L(pn,!0)),Ae.addEventListener("firstDataRendered",()=>{Le.value=!1}),!document.querySelector(".ag-body-viewport")),Ae},xt=(Fe,Ae)=>{if(!f.value)return;const Rt=f.value.getRowNode(Fe);Rt?(f.value.ensureIndexVisible(Number(Rt.rowIndex),"middle"),f.value.flashCells({rowNodes:[Rt],flashDuration:3e3,fadeDuration:1e3})):f.value.ensureIndexVisible(y.value.total-1,"bottom")},Mt=async Fe=>{var Rt;let Ae;if(!(!F.value||!Fe.trim())){ue.value=!0;try{Ae=await F.value.createNewScene({workspaceId:h.workspaceId,entityId:h.entityId,name:Fe}),y.value.total<50&&await cn()}catch(pn){console.error("Error creating new scene:",pn)}finally{ue.value=!1,Ae!=null&&Ae.id&&a({id:String(Ae==null?void 0:Ae.id),message:`${Fe} created successfully`,actions:[{label:"View",variant:"secondary",action:()=>{xt(String(Ae==null?void 0:Ae.id))}},{label:"Scene Hub",variant:"primary",action:()=>{const pn=to({type:"scene_hub",config:{ws_code:h.workspaceId,baseDomain:Mn.getInstance().getItem("BASE_URL")||"",scene_id:String(Ae==null?void 0:Ae.id)}}).url;window.open(pn,"_blank")},btnIcon:"CustomSceneHub"}],icon:Zhe,type:"interactive"}),(Rt=Hn.value)==null||Rt.hide()}}},We=Fe=>Fe.metric_type.code==="number"?"number":"default",ii=async()=>{if(h.entityId)try{const Fe=await Ce(h.entityId);b.value=Fe.data.map(Ae=>({...Ae,sortType:We(Ae)}))}catch(Fe){console.error("Failed to initialize metric list:",Fe),b.value=[]}},us=async()=>{if(F.value)try{const Fe=await F.value.getUserPermission(h.workspaceId);o(Fe)}catch(Fe){console.error("Failed to fetch user permissions:",Fe)}},ba=async()=>{if(F.value)try{const Fe=await F.value.getEntityDetail(h.workspaceId,h.entityId);s(Fe.permission),u.value=Fe}catch(Fe){console.error("Failed to fetch entity details:",Fe)}},fo=NC(),{setUser:Ir}=fo,Sa=async()=>{if(F.value)try{const Fe=await F.value.getMe();return Ir(Fe),Fe}catch(Fe){console.error("Failed to fetch user details:",Fe)}},Ws=async()=>{var Fe;if(F.value)try{const Ae=await F.value.getWorkspaces(h.workspaceId),Rt=(Fe=Ae.data[0])==null?void 0:Fe.ws_user_role_id;return Rt&&fo.setUserRoleId(Rt),Ae}catch(Ae){console.error("Failed to fetch workspace details:",Ae)}};nt(()=>[h.entityId,h.workspaceId],async([Fe,Ae])=>{!Fe||!Ae||(Sa(),Ws(),ii(),us(),ba())},{immediate:!0,deep:!0}),nt(H,(Fe,Ae)=>{const Rt=Fe.filter(pn=>!(Ae!=null&&Ae.includes(pn)));Rt.length>0&&ie(Array.from(x.value),Rt).then(pn=>{Q(pn,x.value,Rt)})},{immediate:!0,deep:!0}),nt(E,(Fe,Ae)=>{R.value=!!(Ae&&Fe&&Ae!==Fe)}),t({refreshTable:cn});const Us=Fe=>{vt.value=Fe,cn()},Bo=Fe=>{N.value=Fe,cn()},zs=Fe=>{k.value=Fe||[]};return(Fe,Ae)=>(W(),$e(z(r9),{"is-sidebar-open":w.value,onCloseSidebar:z(Pe),onSidebarClear:z(Pe),ref:"itemTableLayoutRef",id:"item-table-layout-id",onSidebarApply:z(Pe)},{"header-left":ge(()=>[he("h1",{class:j(Fe.$style.tableTitle)},"Scenes",2),he("div",{class:j(Fe.$style["beta-tag"])},"Beta",2),se(z(gC),{variant:["primary"],options:d.value,onSelect:Re,onHandleClick:Ae[1]||(Ae[1]=Rt=>Re("new_scene")),id:"create_scene_dropdown"},{prefix:ge(()=>[se(z(ft),{id:"create_new_scene",variant:["primary"],onClick:Ae[0]||(Ae[0]=Rt=>Re("new_scene")),label:"New"})]),_:1},8,["options"]),Ye((W(),le("span",Yhe,[at(yt(fn.value),1)])),[[z(l),ni.value||""]])]),"header-actions":ge(()=>[se(z(OK),{"onUpdate:assignees":Bo,onApplyFilter:Us,loading:z(Le)},null,8,["loading"]),Ye(se(z(hC),{modelValue:S.value,"onUpdate:modelValue":Ae[2]||(Ae[2]=Rt=>S.value=Rt),onSearch:z(Be),class:j(Fe.$style.itemSearchBox),onClear:Ae[3]||(Ae[3]=Rt=>z(Be)("")),id:"item_search_box"},null,8,["modelValue","onSearch","class"]),[[z(n),{isLoading:z(Le),fullwidth:!0}]]),Ye((W(),$e(z(pP),{status:z(ue)?"busy":"active",size:10,id:"refresh_table","status-tooltip":"Data has changed, please refresh the table",color:"var(--warning-color)","show-badge":R.value},{default:ge(()=>[se(z(ft),{variant:"secondary",disabled:z(ue),onClick:cn},{prefix:ge(()=>[se(z(ct),{src:"ArrowsRotate"})]),default:ge(()=>[Ae[5]||(Ae[5]=at(" Refresh ",-1))]),_:1},8,["disabled"])]),_:1},8,["status","show-badge"])),[[z(n),{isLoading:z(Le),fullwidth:!0}]]),Ye(se(z(iK),{"model-value":z(k),onChange:Ae[4]||(Ae[4]=Rt=>zs(Rt)),id:"table_customization",gridApi:f.value,ref_key:"tableCustomizationRef",ref:I,"checkbox-column":z(P)},null,8,["model-value","gridApi","checkbox-column"]),[[z(n),{isLoading:z(Le),fullwidth:!0}]])]),grid:ge(({availableHeight:Rt})=>[se(z(ide),qt({id:"item_table_main",ref_key:"agGrid",ref:_e},Ue.value,{height:Rt+"px",isSorting:z(bt),onOnGridReady:dt,onSelectionChanged:ke}),null,16,["height","isSorting"])]),footer:ge(()=>[he("div",{class:j(Fe.$style.tableFooter),id:"table_footer"},[he("span",null,[Ae[6]||(Ae[6]=at(" Showing ",-1)),he("b",null,yt(z(y).loaded)+" of "+yt(z(y).total),1)])],2)]),"new-row":ge(()=>[se(z(dK),{onCreateNewItem:Mt,ref_key:"createNewSceneRef",ref:Hn},null,512)]),"bulk-update-actions":ge(()=>[!w.value&&p.value.length>0?(W(),$e(z(J7),{key:0,selectRowData:Me.value,"workspace-id":h.workspaceId,"entity-id":h.entityId,"grid-api":f.value,onUnselect:z(Ie),"take-name":fe.value,"selected-all":J.value,onUpdated:xe},null,8,["selectRowData","workspace-id","entity-id","grid-api","onUnselect","take-name","selected-all"])):Ke("",!0)]),snackbar:ge(()=>[se(z(y9))]),popup:ge(()=>[se(VK,{ref_key:"popupCreateSceneRef",ref:Ct,"workspace-id":h.workspaceId,"entity-id":h.entityId,onImportSuccess:cn},null,8,["workspace-id","entity-id"]),se(qhe,{ref_key:"popupOverwriteScenesRef",ref:Ot,"workspace-id":h.workspaceId,"entity-id":h.entityId,onImportSuccess:cn},null,8,["workspace-id","entity-id"])]),_:1},8,["is-sidebar-open","onCloseSidebar","onSidebarClear","onSidebarApply"]))}}),[["__cssModules",{$style:{tableTitle:"_tableTitle_1lefh_1",tableFooter:"_tableFooter_1lefh_7",footerStart:"_footerStart_1lefh_17",newRow:"_newRow_1lefh_25","warning-text":"_warning-text_1lefh_44","has-error":"_has-error_1lefh_49",itemSearchBox:"_itemSearchBox_1lefh_53","beta-tag":"_beta-tag_1lefh_57"}}]]),wL="0.0.110",Jhe={key:0},Qhe=wt(ut({__name:"app",setup(e){const t=U(()=>n.id.length===0||n.workspaceId.length===0),n=vo({id:"",workspaceId:"",apiConfig:{}}),i=Ud(),{showMessage:o}=i,s=c=>{var d,h;c.success?o(c.apiCode,"success"):o(((h=(d=c.res)==null?void 0:d.data)==null?void 0:h.message)||c.apiCode,"error")},r=$(null),a=()=>{const c=Mn.getInstance().getItem("API_BASE_URL");return c!=null&&c.includes("v1")?c.slice(0,c.lastIndexOf("/v1")):String(c)};If(()=>{var c,d,h;sessionStorage.setItem("ITEM_TABLE_APP_VERSION",wL);try{if(r.value=si(),!r.value)throw new Error("Current instance is null");n.id=((c=r.value)==null?void 0:c.appContext.config.globalProperties.id)||"",n.workspaceId=((d=r.value)==null?void 0:d.appContext.config.globalProperties.workspaceId)||Mn.getInstance().getItem("ws.code");const f={domainApi:a(),wsCode:Mn.getInstance().getItem("ws.code"),entityId:n.id};if(n.apiConfig=(h=r.value)==null?void 0:h.appContext.config.globalProperties.apiConfig,!f.entityId||!f.wsCode||!f.domainApi)throw new Error("API configuration is missing in dashboardConfig");const p=new yL(n.apiConfig,f);p.on("call-api",s),r.value.appContext.config.globalProperties.apiServices=p}catch(f){console.error("Error getting current instance:",f)}}),Yn(()=>{r.value.appContext.config.globalProperties.apiServices.off("call-api",s)});const l=U(()=>n.id),u=U(()=>n.workspaceId);return Va("workspaceId",u),Va("entityId",l),(c,d)=>(W(),le("div",{class:j(c.$style.dashboardPluginWrapper)},[t.value?(W(),le("span",Jhe," There is no workspaceId or entityIds provided in global properties. Please set them to see the Item Table. ")):l.value?(W(),$e(z(Xhe),{key:1,entityId:l.value,workspaceId:u.value},null,8,["entityId","workspaceId"])):Ke("",!0)],2))}}),[["__cssModules",{$style:{dashboardPluginWrapper:"_dashboardPluginWrapper_1f1og_1"}}]]),i0=async(e={},t={})=>{const n=a_(Qhe),i=jj();n.use(i);const o=["apiConfig","workspaceId","id"],s={};return Object.entries(e).forEach(([r,a])=>{a!==void 0&&(n.config.globalProperties[r]=a,s[r]=a,o.includes(r)&&typeof a=="string"?sessionStorage.setItem(r,a):console.error(`[Config Error] Key "${r}" has an invalid value and will not be persisted.`))}),n.config.globalProperties.$arboConfig=s,Object.values(t).forEach(r=>{r&&typeof r.install=="function"&&n.use(r)}),n.config.errorHandler=(r,a,l)=>{console.error("[Vue Error]",r),l&&console.error("[Info]",l)},console.log(`%cArbo Dashboard Plugin v${wL}`,"color: #4CAF50; font-weight: bold;"),console.log(n.config.globalProperties),n.provide("switchInstance",n.config.globalProperties.$switchInstance),n};globalThis.window!==void 0&&(globalThis.window.arboDashboard=i0),yn.default=i0,yn.initDashboard=i0,Object.defineProperties(yn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|