Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(permission-share): support permission share #2416

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/protocol": "^0.1.35",
"@univerjs/protocol": "^0.1.36",
"nanoid": "5.0.7",
"numeral": "^2.0.6",
"ot-json1": "^1.0.2"
Expand Down
22 changes: 18 additions & 4 deletions packages/core/src/shared/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@

type debounceFn<T extends (...args: any[]) => any> = (this: ThisParameterType<T>, ...args: Parameters<T>) => void;

export function debounce<T extends (...args: any[]) => any>(func: T, wait: number): debounceFn<T> {
/**
* Creates a debounced function that delays invoking the provided function until after `wait` milliseconds have elapsed since the last time the debounced function was invoked.
* @template T - The type of the function to be debounced.
* @param {T} func - The function to be debounced.
* @param {number} wait - The number of milliseconds to wait before invoking the function.
* @returns {debounceFn<T> & { cancel: () => void }} - The debounced function, which also has a `cancel` method to cancel the scheduled function call.
*/
export function debounce<T extends (...args: any[]) => any>(func: T, wait: number) {
let timeout: NodeJS.Timeout | null;

return function (this: ThisParameterType<T>, ...args: Parameters<T>) {
function run(this: ThisParameterType<T>, ...args: Parameters<T>) {
const context = this;

const later = function () {
Expand All @@ -29,5 +35,13 @@ export function debounce<T extends (...args: any[]) => any>(func: T, wait: numbe

clearTimeout(timeout as NodeJS.Timeout);
timeout = setTimeout(later, wait);
};
}
Object.defineProperty(run, 'cancel', {
value: () => {
clearTimeout(timeout as NodeJS.Timeout);
},
enumerable: false,
writable: false,
});
return run as debounceFn<T> & { cancel: () => void };
}
2 changes: 1 addition & 1 deletion packages/data-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/protocol": "^0.1.35"
"@univerjs/protocol": "^0.1.36"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-conditional-formatting-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
},
"dependencies": {
"@univerjs/icons": "^0.1.56",
"@univerjs/protocol": "^0.1.35",
"@univerjs/protocol": "^0.1.36",
"@univerjs/sheets-conditional-formatting": "workspace:*",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-conditional-formatting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/protocol": "^0.1.35"
"@univerjs/protocol": "^0.1.36"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-data-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
},
"dependencies": {
"@univerjs/icons": "^0.1.56",
"@univerjs/protocol": "^0.1.35"
"@univerjs/protocol": "^0.1.36"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-find-replace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/protocol": "0.1.34"
"@univerjs/protocol": "0.1.36"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-hyper-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"devDependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/protocol": "^0.1.35",
"@univerjs/protocol": "^0.1.36",
"@univerjs/shared": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@wendellhu/redi": "^0.15.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
},
"dependencies": {
"@univerjs/icons": "^0.1.56",
"@univerjs/protocol": "^0.1.35"
"@univerjs/protocol": "^0.1.36"
},
"devDependencies": {
"@types/react": "^18.3.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/protocol": "^0.1.35"
"@univerjs/protocol": "^0.1.36"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/thread-comment-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"dependencies": {
"@univerjs/icons": "^0.1.56",
"@univerjs/protocol": "^0.1.35",
"@univerjs/protocol": "^0.1.36",
"@univerjs/thread-comment": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/thread-comment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/protocol": "^0.1.35"
"@univerjs/protocol": "^0.1.36"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/services/parts/parts.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class UIPartsService extends Disposable implements IUIPartsService {
if (components.size === 0) {
this._componentsByPart.delete(part);
}
this._componentRegistered$.next(part);
});
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/views/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export function App(props: IUniverAppProps) {

const uiPartsService = useDependency(IUIPartsService);

const [updateTrigger, setUpdateTrigger] = useState(false);
const [updateTrigger, setUpdateTrigger] = useState({});

useEffect(() => {
const updateSubscription = uiPartsService.componentRegistered$.subscribe(() => {
setUpdateTrigger((prev) => !prev);
setUpdateTrigger({});
});

return () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/umd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@univerjs/facade": "workspace:*",
"@univerjs/find-replace": "workspace:*",
"@univerjs/network": "workspace:*",
"@univerjs/protocol": "^0.1.35",
"@univerjs/protocol": "^0.1.36",
"@univerjs/rpc": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-conditional-formatting": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/uniscript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/protocol": "^0.1.35",
"@univerjs/protocol": "^0.1.36",
"@univerjs/sheets": "workspace:*"
},
"devDependencies": {
Expand Down
Loading
Loading