@univerjs/sheets-source-binding 0.5.4-nightly.202501151606 → 0.5.4-nightly.202501160704
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/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +22 -13
- package/lib/es/index.js +383 -255
- package/lib/types/controllers/binding-manager.d.ts +11 -4
- package/lib/types/controllers/source-manager.d.ts +4 -1
- package/lib/types/facade/f-workbook.d.ts +29 -3
- package/lib/types/index.d.ts +2 -1
- package/lib/types/model/binding-model.d.ts +4 -4
- package/lib/types/model/source-model.d.ts +7 -4
- package/lib/types/services/source-binding-service.d.ts +7 -1
- package/lib/types/types.d.ts +15 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +3 -3
@@ -1,5 +1,6 @@
|
|
1
|
-
import { ICellBindingNode, ICellBindingNodeParam, BindingSourceChangeTypeEnum } from '../types';
|
2
|
-
import { Disposable } from '@univerjs/core';
|
1
|
+
import { ICellBindingJSON, ICellBindingNode, ICellBindingNodeParam, BindingSourceChangeTypeEnum } from '../types';
|
2
|
+
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
3
|
+
import { SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';
|
3
4
|
import { SheetBindingModel } from '../model/binding-model';
|
4
5
|
interface IBindingNodeInfo {
|
5
6
|
unitId: string;
|
@@ -10,20 +11,26 @@ interface IBindingNodeInfo {
|
|
10
11
|
column: number;
|
11
12
|
}
|
12
13
|
export declare class SheetsBindingManager extends Disposable {
|
14
|
+
private readonly _univerInstanceService;
|
15
|
+
private readonly _sheetInterceptorService;
|
16
|
+
private readonly _sheetsSelectionsService;
|
13
17
|
modelMap: Map<string, Map<string, SheetBindingModel>>;
|
14
18
|
private _cellBindInfoUpdate$;
|
15
19
|
cellBindInfoUpdate$: import('rxjs').Observable<IBindingNodeInfo & {
|
16
20
|
changeType: BindingSourceChangeTypeEnum;
|
17
21
|
oldSourceId?: string;
|
18
22
|
}>;
|
19
|
-
constructor();
|
23
|
+
constructor(_univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _sheetsSelectionsService: SheetsSelectionsService);
|
24
|
+
private _initRemoveCommand;
|
20
25
|
getBindingModelBySourceId(sourceId: string): IBindingNodeInfo[];
|
21
26
|
addModel(unitId: string, subunitId: string, model: SheetBindingModel): void;
|
22
27
|
getModel(unitId: string, subunitId: string): SheetBindingModel | undefined;
|
23
28
|
setBindingNode(unitId: string, subunitId: string, node: ICellBindingNodeParam): void;
|
24
29
|
removeBindingNode(unitId: string, subunitId: string, row: number, column: number): void;
|
25
30
|
getBindingNode(unitId: string, subunitId: string, row: number, column: number): ICellBindingNode | undefined;
|
26
|
-
createModel(unitId: string, subunitId: string, json?:
|
31
|
+
createModel(unitId: string, subunitId: string, json?: ICellBindingNode[]): SheetBindingModel;
|
32
|
+
toJSON(unitId: string): ICellBindingJSON;
|
33
|
+
fromJSON(unitId: string, json: ICellBindingJSON): void;
|
27
34
|
dispose(): void;
|
28
35
|
}
|
29
36
|
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ISourceEvent, DataBindingNodeTypeEnum } from '../types';
|
1
|
+
import { ISourceEvent, ISourceJSON, DataBindingNodeTypeEnum } from '../types';
|
2
2
|
import { Disposable } from '@univerjs/core';
|
3
3
|
import { SourceModelBase } from '../model/source-model';
|
4
4
|
export declare class SheetsSourceManager extends Disposable {
|
@@ -12,4 +12,7 @@ export declare class SheetsSourceManager extends Disposable {
|
|
12
12
|
createSource(unitId: string, type: DataBindingNodeTypeEnum, isListObject?: boolean, id?: string): SourceModelBase;
|
13
13
|
updateSourceData(unitId: string, idOrInstance: string | SourceModelBase, data: any): void;
|
14
14
|
removeSource(unitId: string, id: string): void;
|
15
|
+
toJSON(unitId: string): ISourceJSON[];
|
16
|
+
fromJSON(unitId: string, sources: ISourceJSON[]): void;
|
17
|
+
dispose(): void;
|
15
18
|
}
|
@@ -1,13 +1,14 @@
|
|
1
|
-
import { DataBindingNodeTypeEnum, SourceModelBase } from '@univerjs/sheets-source-binding';
|
1
|
+
import { DataBindingNodeTypeEnum, ISourceBindingInfo, SourceModelBase } from '@univerjs/sheets-source-binding';
|
2
2
|
import { FWorkbook } from '@univerjs/sheets/facade';
|
3
3
|
export interface IFWorkbookSourceBindingMixin {
|
4
4
|
/**
|
5
5
|
* Create a source model with the specified type.
|
6
6
|
* @param {DataBindingNodeTypeEnum} type The source type.
|
7
7
|
* @param {boolean} [isListObject] Whether the source is a list object.
|
8
|
+
* @param {string} [id] The source id.
|
8
9
|
* @returns {SourceModelBase} The source data of sheet.
|
9
10
|
*/
|
10
|
-
createSource(type: DataBindingNodeTypeEnum, isListObject?: boolean): SourceModelBase;
|
11
|
+
createSource(type: DataBindingNodeTypeEnum, isListObject?: boolean, id?: string | undefined): SourceModelBase;
|
11
12
|
/**
|
12
13
|
* Switch to path mode.In this mode, the path will show in cell.
|
13
14
|
*/
|
@@ -21,12 +22,37 @@ export interface IFWorkbookSourceBindingMixin {
|
|
21
22
|
* @param {string} sourceId The source id.
|
22
23
|
*/
|
23
24
|
getSource(sourceId: string): SourceModelBase | undefined;
|
25
|
+
/**
|
26
|
+
* Set the source data by the specified source id.
|
27
|
+
* @param {string} sourceId - The source id which you want to set data.
|
28
|
+
* @param data - The source data. If the source is a list object, the data should be an array of objects.
|
29
|
+
* If the isListObject is false, the data should look like below:
|
30
|
+
* ```typescript
|
31
|
+
* {
|
32
|
+
* fields: ['name', 'age'],
|
33
|
+
* records: [['Tom', 18], ['Jerry', 20]]
|
34
|
+
* }
|
35
|
+
* ```
|
36
|
+
* If the isListObject is true, the data should look like below:
|
37
|
+
* ```typescript
|
38
|
+
* {
|
39
|
+
* fields: ['name', 'age'],
|
40
|
+
* records: [{name: 'Tom', age: 18}, {name: 'Jerry', age: 20}]
|
41
|
+
* }
|
42
|
+
* ```
|
43
|
+
*/
|
44
|
+
setSourceData(sourceId: string, data: any): void;
|
45
|
+
loadSourceBindingPathInfo(obj: ISourceBindingInfo): void;
|
46
|
+
saveSourceBindingPathInfo(): ISourceBindingInfo;
|
24
47
|
}
|
25
48
|
export declare class FWorkbookSourceBinding extends FWorkbook implements IFWorkbookSourceBindingMixin {
|
26
|
-
createSource(type: DataBindingNodeTypeEnum, isListObject?: boolean): SourceModelBase;
|
49
|
+
createSource(type: DataBindingNodeTypeEnum, isListObject?: boolean, id?: string | undefined): SourceModelBase;
|
27
50
|
getSource(sourceId: string): SourceModelBase | undefined;
|
51
|
+
setSourceData(sourceId: string, data: any): void;
|
28
52
|
usePathMode(): void;
|
29
53
|
useValueMode(): void;
|
54
|
+
loadSourceBindingPathInfo(obj: ISourceBindingInfo): void;
|
55
|
+
saveSourceBindingPathInfo(): ISourceBindingInfo;
|
30
56
|
}
|
31
57
|
declare module '@univerjs/sheets/facade' {
|
32
58
|
interface FWorkbook extends IFWorkbookSourceBindingMixin {
|
package/lib/types/index.d.ts
CHANGED
@@ -18,4 +18,5 @@ export { SourceModelBase } from './model/source-model';
|
|
18
18
|
export { UniverSheetsBindingSourcePlugin } from './plugin';
|
19
19
|
export { BindModeEnum, DataBindingNodeTypeEnum } from './types';
|
20
20
|
export { SheetsSourceBindService } from './services/source-binding-service';
|
21
|
-
export
|
21
|
+
export { SheetsSourceManager } from './controllers/source-manager';
|
22
|
+
export type { ICellBindingNode, ICellBindingNodeParam, ISourceBindingInfo } from './types';
|
@@ -3,13 +3,13 @@ export declare class SheetBindingModel {
|
|
3
3
|
private _matrix;
|
4
4
|
private _nodeMap;
|
5
5
|
private _sourceIdMap;
|
6
|
-
constructor(json?:
|
7
|
-
_init(json:
|
6
|
+
constructor(json?: ICellBindingNode[]);
|
7
|
+
_init(json: ICellBindingNode[]): void;
|
8
8
|
getBindingNodesBySourceId(sourceId: string): ICellBindingNode[] | undefined;
|
9
9
|
setBindingNode(row: number, column: number, node: ICellBindingNode): void;
|
10
10
|
getBindingNode(row: number, column: number): ICellBindingNode;
|
11
11
|
removeBindingNode(row: number, column: number): void;
|
12
12
|
getBindingNodeById(nodeId: string): ICellBindingNode | undefined;
|
13
|
-
fromJSON(): void;
|
14
|
-
toJSON():
|
13
|
+
fromJSON(nodes: ICellBindingNode[]): void;
|
14
|
+
toJSON(): ICellBindingNode[];
|
15
15
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { ICellBindingNode, IListDataBindingNode, IListSourceData, IListSourceInfo, IObjectSourceInfo, DataBindingNodeTypeEnum } from '../types';
|
1
|
+
import { ICellBindingNode, IListDataBindingNode, IListSourceData, IListSourceInfo, IObjectSourceInfo, ISourceJSON, DataBindingNodeTypeEnum } from '../types';
|
2
|
+
import { ICellData } from '@univerjs/core';
|
2
3
|
export declare abstract class SourceModelBase {
|
3
4
|
protected _data: any;
|
4
5
|
readonly id: string;
|
@@ -9,8 +10,10 @@ export declare abstract class SourceModelBase {
|
|
9
10
|
getType(): DataBindingNodeTypeEnum;
|
10
11
|
hasData(): boolean;
|
11
12
|
setSourceData(data: any): void;
|
13
|
+
toJSON(): ISourceJSON;
|
14
|
+
fromJSON(info: ISourceJSON): void;
|
12
15
|
abstract getSourceInfo(): any;
|
13
|
-
abstract getData(node: ICellBindingNode, row: number, col: number):
|
16
|
+
abstract getData(node: ICellBindingNode, row: number, col: number): ICellData | null;
|
14
17
|
}
|
15
18
|
export declare class ListSourceModel extends SourceModelBase {
|
16
19
|
readonly type = DataBindingNodeTypeEnum.List;
|
@@ -24,13 +27,13 @@ export declare class ListSourceModel extends SourceModelBase {
|
|
24
27
|
* In the list array mode, the records is an array of arrays. Such as [['Tom', 20], ['Jerry', 18]].
|
25
28
|
*/
|
26
29
|
toggleListObject(isListObject: boolean): void;
|
27
|
-
getData(node: IListDataBindingNode, row: number):
|
30
|
+
getData(node: IListDataBindingNode, row: number): ICellData | null;
|
28
31
|
setSourceData(data: IListSourceData): void;
|
29
32
|
getSourceInfo(): IListSourceInfo;
|
30
33
|
}
|
31
34
|
export declare class ObjectSourceModel extends SourceModelBase {
|
32
35
|
readonly type = DataBindingNodeTypeEnum.Object;
|
33
36
|
constructor(id: string);
|
34
|
-
getData(node: ICellBindingNode):
|
37
|
+
getData(node: ICellBindingNode): ICellData | null;
|
35
38
|
getSourceInfo(): IObjectSourceInfo;
|
36
39
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ICellBindingNodeParam, BindModeEnum, DataBindingNodeTypeEnum } from '../types';
|
1
|
+
import { ICellBindingNodeParam, ISourceBindingInfo, BindModeEnum, DataBindingNodeTypeEnum } from '../types';
|
2
2
|
import { Disposable } from '@univerjs/core';
|
3
3
|
import { SheetInterceptorService } from '@univerjs/sheets';
|
4
4
|
import { SheetsBindingManager } from '../controllers/binding-manager';
|
@@ -29,10 +29,16 @@ export declare class SheetsSourceBindService extends Disposable {
|
|
29
29
|
getBindingNode(unitId: string, subUnitId: string, row: number, column: number): import('..').ICellBindingNode | undefined;
|
30
30
|
getSource(unitId: string, id: string): import('..').SourceModelBase | undefined;
|
31
31
|
createSource(unitId: string, type: DataBindingNodeTypeEnum, isListObject?: boolean, id?: string): import('..').SourceModelBase;
|
32
|
+
getSourceBindingPathInfo(unitId: string): {
|
33
|
+
source: import('../types').ISourceJSON[];
|
34
|
+
cellBinding: import('../types').ICellBindingJSON;
|
35
|
+
};
|
36
|
+
loadSourceBindingPathInfo(unitId: string, obj: ISourceBindingInfo): void;
|
32
37
|
private _ensureRTreeCollection;
|
33
38
|
private _getRTeeCollection;
|
34
39
|
private _registerSourceChange;
|
35
40
|
private _getPathModeCellValue;
|
36
41
|
private _getValueModeCellValue;
|
37
42
|
private _registerInterceptor;
|
43
|
+
dispose(): void;
|
38
44
|
}
|
package/lib/types/types.d.ts
CHANGED
@@ -89,6 +89,10 @@ export interface ICellBindingNodeParam {
|
|
89
89
|
* The target column of the binding node.
|
90
90
|
*/
|
91
91
|
column: number;
|
92
|
+
/**
|
93
|
+
* Whether treat the data as date.
|
94
|
+
*/
|
95
|
+
isDate?: boolean;
|
92
96
|
nodeId?: string;
|
93
97
|
}
|
94
98
|
export interface ICellBindingNode extends ICellBindingNodeParam {
|
@@ -144,3 +148,14 @@ export declare enum BindingSourceChangeTypeEnum {
|
|
144
148
|
Remove = "remove",
|
145
149
|
Update = "update"
|
146
150
|
}
|
151
|
+
export interface ISourceJSON {
|
152
|
+
id: string;
|
153
|
+
type: DataBindingNodeTypeEnum;
|
154
|
+
}
|
155
|
+
export interface ICellBindingJSON {
|
156
|
+
[subUnitId: string]: ICellBindingNode[];
|
157
|
+
}
|
158
|
+
export interface ISourceBindingInfo {
|
159
|
+
source: ISourceJSON[];
|
160
|
+
cellBinding: ICellBindingJSON;
|
161
|
+
}
|
package/lib/umd/facade.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(function(
|
1
|
+
(function(i,e){typeof exports=="object"&&typeof module<"u"?e(require("@univerjs/core"),require("@univerjs/sheets-source-binding"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-source-binding","@univerjs/sheets/facade"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i.UniverCore,i.UniverSheetsSourceBinding,i.UniverSheetsFacade))})(this,function(i,e,c){"use strict";class u extends i.FEnum{get DataBindingNodeTypeEnum(){return e.DataBindingNodeTypeEnum}get BindModeEnum(){return e.BindModeEnum}}i.FEnum.extend(u);class S extends c.FWorkbook{createSource(t,n,o){return this._injector.get(e.SheetsSourceBindService).createSource(this.getId(),t,n,o)}getSource(t){return this._injector.get(e.SheetsSourceBindService).getSource(this.getId(),t)}setSourceData(t,n){this._injector.get(e.SheetsSourceManager).updateSourceData(this.getId(),t,n)}usePathMode(){this._injector.get(e.SheetsSourceBindService).usePathMode()}useValueMode(){this._injector.get(e.SheetsSourceBindService).useValueMode()}loadSourceBindingPathInfo(t){this._injector.get(e.SheetsSourceBindService).loadSourceBindingPathInfo(this.getId(),t)}saveSourceBindingPathInfo(){return this._injector.get(e.SheetsSourceBindService).getSourceBindingPathInfo(this.getId())}}c.FWorkbook.extend(S);class h extends c.FWorksheet{setBindingNode(t){const o=this._injector.get(e.SheetsSourceBindService),r=this._workbook.getUnitId();o.setBindingNode(r,this.getSheetId(),t)}removeBindingNode(t,n){const r=this._injector.get(e.SheetsSourceBindService),s=this._workbook.getUnitId();r.removeBindingNode(s,this.getSheetId(),t,n)}getBindingNode(t,n){const r=this._injector.get(e.SheetsSourceBindService),s=this._workbook.getUnitId();return r.getBindingNode(s,this.getSheetId(),t,n)}}c.FWorksheet.extend(h)});
|
package/lib/umd/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(function(u,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("rxjs"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs","@univerjs/sheets"],a):(u=typeof globalThis<"u"?globalThis:u||self,a(u.UniverSheetsSourceBinding={},u.UniverCore,u.rxjs,u.UniverSheets))})(this,function(u,a,v,y){"use strict";var W=Object.defineProperty;var G=(u,a,v)=>a in u?W(u,a,{enumerable:!0,configurable:!0,writable:!0,value:v}):u[a]=v;var l=(u,a,v)=>G(u,typeof a!="symbol"?a+"":a,v);var b;class T{constructor(r){l(this,"_matrix",{});l(this,"_nodeMap",new Map);l(this,"_sourceIdMap",new Map);r&&this._init(r)}_init(r){this.fromJSON()}getBindingNodesBySourceId(r){const t=this._sourceIdMap.get(r);if(t)return t.map(e=>this._nodeMap.get(e))}setBindingNode(r,t,e){this._matrix[r]||(this._matrix[r]={}),this._matrix[r][t]||(this._matrix[r][t]=e),this._nodeMap.set(e.nodeId,e);const n=this._sourceIdMap.get(e.sourceId);n?n.push(e.nodeId):this._sourceIdMap.set(e.sourceId,[e.nodeId])}getBindingNode(r,t){var e;return(e=this._matrix[r])==null?void 0:e[t]}removeBindingNode(r,t){var n;const e=(n=this._matrix[r])==null?void 0:n[t];if(e){this._matrix[r][t]=void 0,this._nodeMap.delete(e.nodeId);const o=this._sourceIdMap.get(e.sourceId);if(o){const s=o.indexOf(e.nodeId);s>=0&&o.splice(s,1),o.length===0&&this._sourceIdMap.delete(e.sourceId)}}}getBindingNodeById(r){return this._nodeMap.get(r)}fromJSON(){}toJSON(){}}var I=(d=>(d.List="list",d.Object="object",d))(I||{}),C=(d=>(d.Path="path",d.Value="value",d))(C||{}),M=(d=>(d.Add="add",d.Remove="remove",d.Update="update",d))(M||{});class R{constructor(r){l(this,"_data");l(this,"id");l(this,"_hasData",!1);l(this,"type");this.id=r}getId(){return this.id}getType(){return this.type}hasData(){return this._hasData}setSourceData(r){this._data=r,this._hasData=!0}}class P extends R{constructor(t,e){super(t);l(this,"type",I.List);l(this,"_isListObject");l(this,"_fieldIndexMap",new Map);l(this,"_data",{fields:[],records:[]});this._isListObject=e!=null?e:!0}toggleListObject(t){this._isListObject=t}getData(t,e){const{path:n,row:o}=t,s=this._fieldIndexMap.get(n),i=e-o;return i===0?this._data.fields[s]:this._isListObject?this._data.records[i-1][n]:this._data.records[i-1][s]}setSourceData(t){super.setSourceData(t);const{fields:e}=t;this._fieldIndexMap.clear(),e.forEach((n,o)=>{this._fieldIndexMap.set(n,o)})}getSourceInfo(){return{sourceId:this.id,sourceType:this.type,fields:this._data.fields,recordCount:this._data.records.length}}}class O extends R{constructor(t){super(t);l(this,"type",I.Object)}getData(t){const n=t.path.split(".");let o=this._data;for(const s of n)if(o=o[s],o===void 0)return null;return o}getSourceInfo(){return{sourceId:this.id,sourceType:I.Object}}}class N extends a.Disposable{constructor(){super();l(this,"modelMap",new Map);l(this,"_cellBindInfoUpdate$",new v.Subject);l(this,"cellBindInfoUpdate$",this._cellBindInfoUpdate$.asObservable())}getBindingModelBySourceId(t){const e=[];return this.modelMap.forEach((n,o)=>{n.forEach((s,i)=>{const c=s.getBindingNodesBySourceId(t);if(c)for(const h of c)e.push({unitId:o,subunitId:i,sourceId:t,nodeId:h.nodeId,row:h.row,column:h.column})})}),e}addModel(t,e,n){var o;this.modelMap.has(t)||this.modelMap.set(t,new Map),(o=this.modelMap.get(t))==null||o.set(e,n)}getModel(t,e){var n;return(n=this.modelMap.get(t))==null?void 0:n.get(e)}setBindingNode(t,e,n){let o=this.getModel(t,e);o||(o=new T,this.addModel(t,e,o)),n.nodeId||(n.nodeId=a.generateRandomId());const{row:s,column:i}=n;if(s===void 0||i===void 0)throw new Error("row and column is required");const c=o.getBindingNode(s,i);o.setBindingNode(s,i,{...n,row:s,column:i}),this._cellBindInfoUpdate$.next({unitId:t,subunitId:e,sourceId:n.sourceId,nodeId:n.nodeId,row:s,column:i,changeType:c?M.Update:M.Add,oldSourceId:c==null?void 0:c.sourceId})}removeBindingNode(t,e,n,o){const s=this.getModel(t,e);if(s){const i=s.getBindingNode(n,o);i&&(s.removeBindingNode(n,o),this._cellBindInfoUpdate$.next({unitId:t,subunitId:e,sourceId:i.sourceId,nodeId:i.nodeId,row:n,column:o,changeType:M.Remove}))}}getBindingNode(t,e,n,o){const s=this.getModel(t,e);if(s)return s.getBindingNode(n,o)}createModel(t,e,n){const o=new T(n);return this.addModel(t,e,o),o}dispose(){this.modelMap.clear()}}class U extends a.Disposable{constructor(){super();l(this,"sourceMap",new Map);l(this,"_sourceDataUpdate$",new v.Subject);l(this,"sourceDataUpdate$",this._sourceDataUpdate$.asObservable())}_ensureUnitMap(t){let e=this.sourceMap.get(t);return e||(e=new Map,this.sourceMap.set(t,e)),e}_getUnitMap(t){return this.sourceMap.get(t)}getSource(t,e){const n=this._getUnitMap(t);return n==null?void 0:n.get(e)}createSource(t,e,n,o){const s=o===void 0?a.generateRandomId():o;let i;switch(e){case I.List:i=new P(s,n);break;case I.Object:i=new O(s);break;default:throw new Error(`Invalid source type: ${e}`)}return this._ensureUnitMap(t).set(s,i),i}updateSourceData(t,e,n){const o=this._getUnitMap(t),s=e instanceof R?e.getId():e,i=o==null?void 0:o.get(s);if(i)i.setSourceData(n),this._sourceDataUpdate$.next({...i.getSourceInfo(),unitId:t,changeType:M.Add});else throw new Error(`Source not found: ${s}`)}removeSource(t,e){const n=this._getUnitMap(t),o=n==null?void 0:n.get(e);o&&(n==null||n.delete(e),this._sourceDataUpdate$.next({...o.getSourceInfo(),unitId:t,changeType:M.Remove}))}}var $=Object.defineProperty,x=Object.getOwnPropertyDescriptor,E=(d,r,t,e)=>{for(var n=e>1?void 0:e?x(r,t):r,o=d.length-1,s;o>=0;o--)(s=d[o])&&(n=(e?s(r,t,n):s(n))||n);return e&&n&&$(r,t,n),n},D=(d,r)=>(t,e)=>r(t,e,d);u.SheetsSourceBindService=class extends a.Disposable{constructor(t,e,n){super();l(this,"_bindingModel",C.Value);l(this,"_bindModelRTreeCollection",new Map);this._sheetInterceptorService=t,this._sheetsBindingManager=e,this._sheetsSourceManager=n,this._registerInterceptor(),this._registerSourceChange()}usePathMode(){this._bindingModel=C.Path}useValueMode(){this._bindingModel=C.Value}getBindingModel(){return this._bindingModel}createBindModel(t,e){return this._sheetsBindingManager.createModel(t,e)}setBindingNode(t,e,n){this._sheetsBindingManager.setBindingNode(t,e,n)}removeBindingNode(t,e,n,o){this._sheetsBindingManager.removeBindingNode(t,e,n,o)}getBindingNode(t,e,n,o){return this._sheetsBindingManager.getBindingNode(t,e,n,o)}getSource(t,e){return this._sheetsSourceManager.getSource(t,e)}createSource(t,e,n,o){return this._sheetsSourceManager.createSource(t,e,n,o)}_ensureRTreeCollection(t){return this._bindModelRTreeCollection.has(t)||this._bindModelRTreeCollection.set(t,new a.RTree),this._bindModelRTreeCollection.get(t)}_getRTeeCollection(t){return this._bindModelRTreeCollection.get(t)}_registerSourceChange(){this.disposeWithMe(this._sheetsSourceManager.sourceDataUpdate$.subscribe(t=>{const{sourceId:e,sourceType:n,unitId:o,changeType:s}=t;if(n===I.List){if(s===M.Remove){const c=this._sheetsBindingManager.getBindingModelBySourceId(e),h=t.recordCount;for(const{unitId:g,subunitId:p,nodeId:f,row:S,column:_}of c){const B=this._getRTeeCollection(o);if(B){const m={startRow:S,startColumn:_,endRow:S+h,endColumn:_};B.remove({unitId:g,sheetId:p,id:f,range:m})}}return}if(s===M.Update){const c=t.oldRecordCount,h=this._sheetsBindingManager.getBindingModelBySourceId(e);for(const{unitId:g,subunitId:p,nodeId:f,row:S,column:_}of h){const B=this._getRTeeCollection(o);if(B){const m={startRow:S,startColumn:_,endRow:S+c,endColumn:_},w={startRow:S,startColumn:_,endRow:S+t.recordCount,endColumn:_};B.remove({unitId:g,sheetId:p,id:f,range:m}),B.insert({unitId:g,sheetId:p,id:f,range:w})}}return}const i=this._sheetsSourceManager.getSource(o,e);if(i&&i.hasData()){const h=i.getSourceInfo().recordCount,g=this._sheetsBindingManager.getBindingModelBySourceId(e);for(const{unitId:p,subunitId:f,nodeId:S,row:_,column:B}of g){const m=this._ensureRTreeCollection(p),w={startRow:_,startColumn:B,endRow:_+h,endColumn:B};m.insert({unitId:p,sheetId:f,id:S,range:w})}}}})),this.disposeWithMe(this._sheetsBindingManager.cellBindInfoUpdate$.subscribe(t=>{const{unitId:e,subunitId:n,sourceId:o,nodeId:s,row:i,column:c,changeType:h}=t,g=this._ensureRTreeCollection(e),p=this._sheetsSourceManager.getSource(e,o);if(p&&p.hasData()){const f=p.getSourceInfo();if(f.sourceType===I.List){const S=f.recordCount,_={startRow:i,startColumn:c,endRow:i+S,endColumn:c};if(h===M.Add)g.insert({unitId:e,sheetId:n,id:s,range:_});else if(h===M.Remove)g.remove({unitId:e,sheetId:n,id:s,range:_});else if(h===M.Update){const B=t.oldSourceId,m=this._sheetsSourceManager.getSource(e,B);if(m&&m.hasData()){const q=m.getSourceInfo().recordCount,J={startRow:i,startColumn:c,endRow:i+q,endColumn:c};g.remove({unitId:e,sheetId:n,id:s,range:J})}g.insert({unitId:e,sheetId:n,id:s,range:_})}}}}))}_getPathModeCellValue(t,e,n,o){const s=this._sheetsBindingManager.getModel(t,e),i=s==null?void 0:s.getBindingNode(n,o);if(i){const c=i.type;if(c===I.List)return{v:`#{${i.path}}`,s:{cl:{rgb:"blue"}}};if(c===I.Object)return{v:`[${i.path}]`,s:{cl:{rgb:"blue"}}}}}_getValueModeCellValue(t,e,n,o){const s=this._sheetsBindingManager.getModel(t,e);if(s){const c=s.getBindingNode(n,o);if(c){const{sourceId:h}=c,g=this._sheetsSourceManager.getSource(t,h);if(g&&g.hasData())return{v:(g==null?void 0:g.getData(c,n,o))||""}}}const i=this._getRTeeCollection(t);if(s&&i){const c={startRow:n,startColumn:o,endRow:n,endColumn:o},h=Array.from(i.bulkSearch([{unitId:t,sheetId:e,range:c}]));if(h.length>0){const g=s.getBindingNodeById(h[0]);if(g){const{sourceId:p}=g,f=this._sheetsSourceManager.getSource(t,p);if(f&&f.hasData())return{v:(f==null?void 0:f.getData(g,n,o))||""}}}}}_registerInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(y.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Value,handler:(t,e,n)=>{const{row:o,col:s,unitId:i,subUnitId:c}=e;let h=null;return this._bindingModel===C.Path?h=this._getPathModeCellValue(i,c,o,s):h=this._getValueModeCellValue(i,c,o,s),n(h!==null?{...t,...h}:t)}}))}},u.SheetsSourceBindService=E([D(0,a.Inject(y.SheetInterceptorService)),D(1,a.Inject(N)),D(2,a.Inject(U))],u.SheetsSourceBindService);var V=Object.defineProperty,L=Object.getOwnPropertyDescriptor,A=(d,r,t,e)=>{for(var n=e>1?void 0:e?L(r,t):r,o=d.length-1,s;o>=0;o--)(s=d[o])&&(n=(e?s(r,t,n):s(n))||n);return e&&n&&V(r,t,n),n},j=(d,r)=>(t,e)=>r(t,e,d);u.UniverSheetsBindingSourcePlugin=(b=class extends a.Plugin{constructor(r={},t,e){super(),this._config=r,this._injector=t,this._configService=e}onStarting(){[[N],[U],[u.SheetsSourceBindService]].forEach(r=>this._injector.add(r))}onReady(){a.touchDependencies(this._injector,[[N],[U],[u.SheetsSourceBindService]])}},l(b,"type",a.UniverInstanceType.UNIVER_SHEET),l(b,"pluginName","SHEET_BINDING_SOURCE_PLUGIN"),b),u.UniverSheetsBindingSourcePlugin=A([j(1,a.Inject(a.Injector)),j(2,a.IConfigService)],u.UniverSheetsBindingSourcePlugin),u.BindModeEnum=C,u.BindingModel=T,u.DataBindingNodeTypeEnum=I,u.SourceModelBase=R,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
1
|
+
(function(u,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","rxjs"],a):(u=typeof globalThis<"u"?globalThis:u||self,a(u.UniverSheetsSourceBinding={},u.UniverCore,u.UniverSheets,u.rxjs))})(this,function(u,a,M,O){"use strict";var Q=Object.defineProperty;var X=(u,a,M)=>a in u?Q(u,a,{enumerable:!0,configurable:!0,writable:!0,value:M}):u[a]=M;var l=(u,a,M)=>X(u,typeof a!="symbol"?a+"":a,M);var w;class D{constructor(o){l(this,"_matrix",{});l(this,"_nodeMap",new Map);l(this,"_sourceIdMap",new Map);o&&this._init(o)}_init(o){this.fromJSON(o)}getBindingNodesBySourceId(o){const e=this._sourceIdMap.get(o);if(e)return e.map(t=>this._nodeMap.get(t))}setBindingNode(o,e,t){this._matrix[o]||(this._matrix[o]={}),this._matrix[o][e]||(this._matrix[o][e]=t),this._nodeMap.set(t.nodeId,t);const n=this._sourceIdMap.get(t.sourceId);n?n.push(t.nodeId):this._sourceIdMap.set(t.sourceId,[t.nodeId])}getBindingNode(o,e){var t;return(t=this._matrix[o])==null?void 0:t[e]}removeBindingNode(o,e){var n;const t=(n=this._matrix[o])==null?void 0:n[e];if(t){this._matrix[o][e]=void 0,this._nodeMap.delete(t.nodeId);const s=this._sourceIdMap.get(t.sourceId);if(s){const r=s.indexOf(t.nodeId);r>=0&&s.splice(r,1),s.length===0&&this._sourceIdMap.delete(t.sourceId)}}}getBindingNodeById(o){return this._nodeMap.get(o)}fromJSON(o){o.forEach(e=>{this.setBindingNode(e.row,e.column,e)})}toJSON(){return Array.from(this._nodeMap.values())}}var S=(d=>(d.List="list",d.Object="object",d))(S||{}),C=(d=>(d.Path="path",d.Value="value",d))(C||{}),I=(d=>(d.Add="add",d.Remove="remove",d.Update="update",d))(I||{});function x(d){return d instanceof Date&&!isNaN(d.getTime())}function j(d){const o=new Date(d);if(!x(o))return d;const e=new Date(Date.UTC(1900,0,1,0,0,0)),t=new Date(Date.UTC(1900,1,28,0,0,0));let s=(o.getTime()-e.getTime())/(1e3*3600*24);return o>t&&(s+=1),s+1}class N{constructor(o){l(this,"_data");l(this,"id");l(this,"_hasData",!1);l(this,"type");this.id=o}getId(){return this.id}getType(){return this.type}hasData(){return this._hasData}setSourceData(o){this._data=o,this._hasData=!0}toJSON(){return{id:this.id,type:this.type}}fromJSON(o){this.id=o.id,this.type=o.type}}class P extends N{constructor(e,t){super(e);l(this,"type",S.List);l(this,"_isListObject");l(this,"_fieldIndexMap",new Map);l(this,"_data",{fields:[],records:[]});this._isListObject=t!=null?t:!0}toggleListObject(e){this._isListObject=e}getData(e,t){const{path:n,row:s}=e,r=this._fieldIndexMap.get(n),i=t-s;if(i===0)return{v:this._data.fields[r]};let c;return this._isListObject&&(c=this._data.records[i-1][n]),c=this._data.records[i-1][r],e.isDate===!0?{v:j(c),s:{n:{pattern:"yyyy-m-d am/pm h:mm"}},t:a.CellValueType.NUMBER}:{v:c}}setSourceData(e){super.setSourceData(e);const{fields:t}=e;this._fieldIndexMap.clear(),t.forEach((n,s)=>{this._fieldIndexMap.set(n,s)})}getSourceInfo(){return{sourceId:this.id,sourceType:this.type,fields:this._data.fields,recordCount:this._data.records.length}}}class $ extends N{constructor(e){super(e);l(this,"type",S.Object)}getData(e){const n=e.path.split(".");let s=this._data;for(const r of n)if(s=s[r],s===void 0)return null;return e.isDate===!0?{v:j(s),s:{n:{pattern:"yyyy-m-d am/pm h:mm"}},t:a.CellValueType.NUMBER}:{v:s}}getSourceInfo(){return{sourceId:this.id,sourceType:S.Object}}}var J=Object.defineProperty,V=Object.getOwnPropertyDescriptor,L=(d,o,e,t)=>{for(var n=t>1?void 0:t?V(o,e):o,s=d.length-1,r;s>=0;s--)(r=d[s])&&(n=(t?r(o,e,n):r(n))||n);return t&&n&&J(o,e,n),n},T=(d,o)=>(e,t)=>o(e,t,d);let y=class extends a.Disposable{constructor(o,e,t){super();l(this,"modelMap",new Map);l(this,"_cellBindInfoUpdate$",new O.Subject);l(this,"cellBindInfoUpdate$",this._cellBindInfoUpdate$.asObservable());this._univerInstanceService=o,this._sheetInterceptorService=e,this._sheetsSelectionsService=t,this._initRemoveCommand()}_initRemoveCommand(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:o=>{const e=[],t=[],n=this._sheetsSelectionsService.getCurrentSelections(),s=M.getSheetCommandTarget(this._univerInstanceService);if(!s||!n||n.length===0)return{redos:[],undos:[]};const{unitId:r,subUnitId:i}=s;return(o.id===M.ClearSelectionContentCommand.id||o.id===M.ClearSelectionAllCommand.id)&&n.forEach(({range:c})=>{a.Range.foreach(c,(g,h)=>{this.getBindingNode(r,i,g,h)&&this.removeBindingNode(r,i,g,h)})}),{redos:e,undos:t}}}))}getBindingModelBySourceId(o){const e=[];return this.modelMap.forEach((t,n)=>{t.forEach((s,r)=>{const i=s.getBindingNodesBySourceId(o);if(i)for(const c of i)e.push({unitId:n,subunitId:r,sourceId:o,nodeId:c.nodeId,row:c.row,column:c.column})})}),e}addModel(o,e,t){var n;this.modelMap.has(o)||this.modelMap.set(o,new Map),(n=this.modelMap.get(o))==null||n.set(e,t)}getModel(o,e){var t;return(t=this.modelMap.get(o))==null?void 0:t.get(e)}setBindingNode(o,e,t){let n=this.getModel(o,e);n||(n=new D,this.addModel(o,e,n)),t.nodeId||(t.nodeId=a.generateRandomId());const{row:s,column:r}=t;if(s===void 0||r===void 0)throw new Error("row and column is required");const i=n.getBindingNode(s,r);n.setBindingNode(s,r,{...t,row:s,column:r}),this._cellBindInfoUpdate$.next({unitId:o,subunitId:e,sourceId:t.sourceId,nodeId:t.nodeId,row:s,column:r,changeType:i?I.Update:I.Add,oldSourceId:i==null?void 0:i.sourceId})}removeBindingNode(o,e,t,n){const s=this.getModel(o,e);if(s){const r=s.getBindingNode(t,n);r&&(s.removeBindingNode(t,n),this._cellBindInfoUpdate$.next({unitId:o,subunitId:e,sourceId:r.sourceId,nodeId:r.nodeId,row:t,column:n,changeType:I.Remove}))}}getBindingNode(o,e,t,n){const s=this.getModel(o,e);if(s)return s.getBindingNode(t,n)}createModel(o,e,t){const n=new D(t);return this.addModel(o,e,n),n}toJSON(o){const e={},t=this.modelMap.get(o);return t&&t.forEach((n,s)=>{e[s]=n.toJSON()}),e}fromJSON(o,e){Object.entries(e).forEach(([t,n])=>{this.createModel(o,t,n)})}dispose(){this.modelMap.clear(),this._cellBindInfoUpdate$.complete()}};y=L([T(0,a.IUniverInstanceService),T(1,a.Inject(M.SheetInterceptorService)),T(2,a.Inject(M.SheetsSelectionsService))],y);class b extends a.Disposable{constructor(){super();l(this,"sourceMap",new Map);l(this,"_sourceDataUpdate$",new O.Subject);l(this,"sourceDataUpdate$",this._sourceDataUpdate$.asObservable())}_ensureUnitMap(e){let t=this.sourceMap.get(e);return t||(t=new Map,this.sourceMap.set(e,t)),t}_getUnitMap(e){return this.sourceMap.get(e)}getSource(e,t){const n=this._getUnitMap(e);return n==null?void 0:n.get(t)}createSource(e,t,n,s){const r=s===void 0?a.generateRandomId():s;let i;switch(t){case S.List:i=new P(r,n);break;case S.Object:i=new $(r);break;default:throw new Error(`Invalid source type: ${t}`)}return this._ensureUnitMap(e).set(r,i),i}updateSourceData(e,t,n){const s=this._getUnitMap(e),r=t instanceof N?t.getId():t,i=s==null?void 0:s.get(r);if(i)i.setSourceData(n),this._sourceDataUpdate$.next({...i.getSourceInfo(),unitId:e,changeType:I.Add});else throw new Error(`Source not found: ${r}`)}removeSource(e,t){const n=this._getUnitMap(e),s=n==null?void 0:n.get(t);s&&(n==null||n.delete(t),this._sourceDataUpdate$.next({...s.getSourceInfo(),unitId:e,changeType:I.Remove}))}toJSON(e){const t=[],n=this._getUnitMap(e);if(n)for(const s of n.values())t.push(s.toJSON());return t}fromJSON(e,t){const n=this._ensureUnitMap(e);for(const s of t){let r;switch(s.type){case S.List:r=new P(s.id);break;case S.Object:r=new $(s.id);break;default:throw new Error(`Invalid source type: ${s.type}`)}r.fromJSON(s),n.set(s.id,r)}}dispose(){this._sourceDataUpdate$.complete(),this.sourceMap.clear()}}var A=Object.defineProperty,q=Object.getOwnPropertyDescriptor,W=(d,o,e,t)=>{for(var n=t>1?void 0:t?q(o,e):o,s=d.length-1,r;s>=0;s--)(r=d[s])&&(n=(t?r(o,e,n):r(n))||n);return t&&n&&A(o,e,n),n},U=(d,o)=>(e,t)=>o(e,t,d);u.SheetsSourceBindService=class extends a.Disposable{constructor(e,t,n){super();l(this,"_bindingModel",C.Value);l(this,"_bindModelRTreeCollection",new Map);this._sheetInterceptorService=e,this._sheetsBindingManager=t,this._sheetsSourceManager=n,this._registerInterceptor(),this._registerSourceChange()}usePathMode(){this._bindingModel=C.Path}useValueMode(){this._bindingModel=C.Value}getBindingModel(){return this._bindingModel}createBindModel(e,t){return this._sheetsBindingManager.createModel(e,t)}setBindingNode(e,t,n){this._sheetsBindingManager.setBindingNode(e,t,n)}removeBindingNode(e,t,n,s){this._sheetsBindingManager.removeBindingNode(e,t,n,s)}getBindingNode(e,t,n,s){return this._sheetsBindingManager.getBindingNode(e,t,n,s)}getSource(e,t){return this._sheetsSourceManager.getSource(e,t)}createSource(e,t,n,s){return this._sheetsSourceManager.createSource(e,t,n,s)}getSourceBindingPathInfo(e){return{source:this._sheetsSourceManager.toJSON(e),cellBinding:this._sheetsBindingManager.toJSON(e)}}loadSourceBindingPathInfo(e,t){this._sheetsSourceManager.fromJSON(e,t.source),this._sheetsBindingManager.fromJSON(e,t.cellBinding)}_ensureRTreeCollection(e){return this._bindModelRTreeCollection.has(e)||this._bindModelRTreeCollection.set(e,new a.RTree),this._bindModelRTreeCollection.get(e)}_getRTeeCollection(e){return this._bindModelRTreeCollection.get(e)}_registerSourceChange(){this.disposeWithMe(this._sheetsSourceManager.sourceDataUpdate$.subscribe(e=>{const{sourceId:t,sourceType:n,unitId:s,changeType:r}=e;if(n===S.List){if(r===I.Remove){const c=this._sheetsBindingManager.getBindingModelBySourceId(t),g=e.recordCount;for(const{unitId:h,subunitId:p,nodeId:f,row:m,column:_}of c){const v=this._getRTeeCollection(s);if(v){const B={startRow:m,startColumn:_,endRow:m+g,endColumn:_};v.remove({unitId:h,sheetId:p,id:f,range:B})}}return}if(r===I.Update){const c=e.oldRecordCount,g=this._sheetsBindingManager.getBindingModelBySourceId(t);for(const{unitId:h,subunitId:p,nodeId:f,row:m,column:_}of g){const v=this._getRTeeCollection(s);if(v){const B={startRow:m,startColumn:_,endRow:m+c,endColumn:_},R={startRow:m,startColumn:_,endRow:m+e.recordCount,endColumn:_};v.remove({unitId:h,sheetId:p,id:f,range:B}),v.insert({unitId:h,sheetId:p,id:f,range:R})}}return}const i=this._sheetsSourceManager.getSource(s,t);if(i&&i.hasData()){const g=i.getSourceInfo().recordCount,h=this._sheetsBindingManager.getBindingModelBySourceId(t);for(const{unitId:p,subunitId:f,nodeId:m,row:_,column:v}of h){const B=this._ensureRTreeCollection(p),R={startRow:_,startColumn:v,endRow:_+g,endColumn:v};B.insert({unitId:p,sheetId:f,id:m,range:R})}}}})),this.disposeWithMe(this._sheetsBindingManager.cellBindInfoUpdate$.subscribe(e=>{const{unitId:t,subunitId:n,sourceId:s,nodeId:r,row:i,column:c,changeType:g}=e,h=this._ensureRTreeCollection(t),p=this._sheetsSourceManager.getSource(t,s);if(p&&p.hasData()){const f=p.getSourceInfo();if(f.sourceType===S.List){const m=f.recordCount,_={startRow:i,startColumn:c,endRow:i+m,endColumn:c};if(g===I.Add)h.insert({unitId:t,sheetId:n,id:r,range:_});else if(g===I.Remove)h.remove({unitId:t,sheetId:n,id:r,range:_});else if(g===I.Update){const v=e.oldSourceId,B=this._sheetsSourceManager.getSource(t,v);if(B&&B.hasData()){const F=B.getSourceInfo().recordCount,K={startRow:i,startColumn:c,endRow:i+F,endColumn:c};h.remove({unitId:t,sheetId:n,id:r,range:K})}h.insert({unitId:t,sheetId:n,id:r,range:_})}}}}))}_getPathModeCellValue(e,t,n,s){const r=this._sheetsBindingManager.getModel(e,t),i=r==null?void 0:r.getBindingNode(n,s);if(i){const c=i.type;if(c===S.List)return{v:`#{${i.path}}`,s:{cl:{rgb:"blue"}}};if(c===S.Object)return{v:`[${i.path}]`,s:{cl:{rgb:"blue"}}}}}_getValueModeCellValue(e,t,n,s){const r=this._sheetsBindingManager.getModel(e,t);if(r){const c=r.getBindingNode(n,s);if(c){const{sourceId:g}=c,h=this._sheetsSourceManager.getSource(e,g);if(h&&h.hasData())return(h==null?void 0:h.getData(c,n,s))||{v:""}}}const i=this._getRTeeCollection(e);if(r&&i){const c={startRow:n,startColumn:s,endRow:n,endColumn:s},g=Array.from(i.bulkSearch([{unitId:e,sheetId:t,range:c}]));if(g.length>0){const h=r.getBindingNodeById(g[0]);if(h){const{sourceId:p}=h,f=this._sheetsSourceManager.getSource(e,p);if(f&&f.hasData())return(f==null?void 0:f.getData(h,n,s))||{v:""}}}}}_registerInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(M.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Value|a.InterceptorEffectEnum.Style,priority:102,handler:(e,t,n)=>{const{row:s,col:r,unitId:i,subUnitId:c}=t;let g=null;return this._bindingModel===C.Path?g=this._getPathModeCellValue(i,c,s,r):g=this._getValueModeCellValue(i,c,s,r),n(g!==null?{...e,...g}:e)}}))}dispose(){this._bindModelRTreeCollection.clear()}},u.SheetsSourceBindService=W([U(0,a.Inject(M.SheetInterceptorService)),U(1,a.Inject(y)),U(2,a.Inject(b))],u.SheetsSourceBindService);var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,z=(d,o,e,t)=>{for(var n=t>1?void 0:t?H(o,e):o,s=d.length-1,r;s>=0;s--)(r=d[s])&&(n=(t?r(o,e,n):r(n))||n);return t&&n&&G(o,e,n),n},E=(d,o)=>(e,t)=>o(e,t,d);u.UniverSheetsBindingSourcePlugin=(w=class extends a.Plugin{constructor(o={},e,t){super(),this._config=o,this._injector=e,this._configService=t}onStarting(){[[y],[b],[u.SheetsSourceBindService]].forEach(o=>this._injector.add(o))}onReady(){a.touchDependencies(this._injector,[[y],[b],[u.SheetsSourceBindService]])}},l(w,"type",a.UniverInstanceType.UNIVER_SHEET),l(w,"pluginName","SHEET_BINDING_SOURCE_PLUGIN"),w),u.UniverSheetsBindingSourcePlugin=z([E(1,a.Inject(a.Injector)),E(2,a.IConfigService)],u.UniverSheetsBindingSourcePlugin),u.BindModeEnum=C,u.BindingModel=D,u.DataBindingNodeTypeEnum=S,u.SheetsSourceManager=b,u.SourceModelBase=N,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@univerjs/sheets-source-binding",
|
3
|
-
"version": "0.5.4-nightly.
|
3
|
+
"version": "0.5.4-nightly.202501160704",
|
4
4
|
"private": false,
|
5
5
|
"description": "A library for connect and bind data from other sources to Univer Sheets",
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
@@ -51,8 +51,8 @@
|
|
51
51
|
"rxjs": ">=7.0.0"
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
|
-
"@univerjs/core": "0.5.4-nightly.
|
55
|
-
"@univerjs/sheets": "0.5.4-nightly.
|
54
|
+
"@univerjs/core": "0.5.4-nightly.202501160704",
|
55
|
+
"@univerjs/sheets": "0.5.4-nightly.202501160704"
|
56
56
|
},
|
57
57
|
"devDependencies": {
|
58
58
|
"rxjs": "^7.8.1",
|