Skip to content

Commit

Permalink
* proj: share react components.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Dec 6, 2023
1 parent d313d1a commit 30d0c58
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/list/src/component/share.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {registerReactComponent} from '@zui/core';
import * as components from './index';

registerReactComponent(components);
3 changes: 2 additions & 1 deletion lib/list/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './types';
export * from './vanilla';
export * from './style';
import './component/share';
import './style';
4 changes: 4 additions & 0 deletions lib/menu/src/component/share.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {registerReactComponent} from '@zui/core';
import * as components from './index';

registerReactComponent(components);
1 change: 1 addition & 0 deletions lib/menu/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './vanilla';
export * from './types';
import './component/share';
import './style';
1 change: 1 addition & 0 deletions lib/modal/src/types/modal-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type ModalOptions = ModalBaseOptions & {
key?: string;
loadingText?: string;
loadTimeout?: number;
loadingClass?: string;
failedTip?: string;
timeoutTip?: string;
title?: string;
Expand Down
6 changes: 3 additions & 3 deletions lib/modal/src/vanilla/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ export class Modal<T extends ModalOptions = ModalOptions> extends ModalBase<T> {

const {modalElement, options} = this;
const $modal = $(modalElement);
const {type, loadTimeout, loadingText = null} = options;
const {type, loadTimeout, loadingClass = LOADING_CLASS, loadingText = null} = options;
const build = builders[type];

if (!build) {
console.warn(`Modal: Cannot build modal with type "${type}"`);
return false;
}
$modal.attr('data-loading', loadingText).addClass(LOADING_CLASS);
$modal.attr('data-loading', loadingText).addClass(loadingClass);

if (loadTimeout) {
this.#loadingTimer = window.setTimeout(() => {
Expand All @@ -242,7 +242,7 @@ export class Modal<T extends ModalOptions = ModalOptions> extends ModalBase<T> {

await delay(100);

$modal.removeClass(LOADING_CLASS);
$modal.removeClass(loadingClass);

return true;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/nav/src/component/share.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {registerReactComponent} from '@zui/core';
import * as components from './index';

registerReactComponent(components);
1 change: 1 addition & 0 deletions lib/nav/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './types';
export * from './vanilla';
import './component/share';
import './style';
4 changes: 4 additions & 0 deletions lib/pager/src/component/share.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {registerReactComponent} from '@zui/core';
import * as components from './index';

registerReactComponent(components);
1 change: 1 addition & 0 deletions lib/pager/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './vanilla';
export * from './types';
import './component/share';
import './style';
4 changes: 4 additions & 0 deletions lib/progress/src/components/share.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {registerReactComponent} from '@zui/core';
import * as components from './index';

registerReactComponent(components);
1 change: 1 addition & 0 deletions lib/progress/src/main.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './components/share';
import './style';
4 changes: 4 additions & 0 deletions lib/search-box/src/components/share.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {registerReactComponent} from '@zui/core';
import * as components from './index';

registerReactComponent(components);
1 change: 1 addition & 0 deletions lib/search-box/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './vanilla';
export * from './types';
import './components/share';
import './style';
4 changes: 4 additions & 0 deletions lib/tree/src/components/share.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {registerReactComponent} from '@zui/core';
import * as components from './index';

registerReactComponent(components);
1 change: 1 addition & 0 deletions lib/tree/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './types';
export * from './vanilla';
import './components/share';
import './style';

0 comments on commit 30d0c58

Please sign in to comment.