Skip to content

Commit

Permalink
Fixed CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mantou132 committed Dec 12, 2023
1 parent d9ae37b commit df19821
Show file tree
Hide file tree
Showing 22 changed files with 215 additions and 193 deletions.
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// flat config: https://eslint.org/docs/latest/use/configure/configuration-files-new
// https://github.com/antfu/eslint-config-flat-gitignore
const { readGitignoreFiles } = require('eslint-gitignore');

module.exports = {
ignorePatterns: readGitignoreFiles({ cwd: __dirname }),
parser: '@typescript-eslint/parser',
extends: [
'plugin:import/errors',
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"name": "root",
"version": "1.6.5",
"scripts": {
"lint": "lerna exec -- tsc --noEmit && eslint --ext .ts,.js",
"test": "lerna exec --scope @mantou/gem --scope gem-book --scope duoyun-ui -- yarn test",
"lint": "lerna exec -- tsc --noEmit && eslint . --ext .ts,.js",
"test": "lerna exec --concurrency=1 --scope '{@mantou/gem,gem-book,duoyun-ui}' -- yarn test",
"release": "lerna version",
"prepare": "husky install && yarn --cwd packages/gem build && yarn --cwd packages/gem-analyzer build && yarn --cwd packages/gem-book build && yarn --cwd packages/gem-book link && yarn --cwd packages/gem-port build && yarn --cwd packages/gem-port link"
"prepare:build": "yarn --cwd packages/gem build && lerna exec --scope '{gem-analyzer,duoyun-ui,gem-book,gem-port}' -- yarn build",
"prepare:link": "lerna exec --scope '{gem-book,gem-port}' -- yarn link",
"prepare": "husky install && yarn prepare:build && yarn prepare:link"
},
"devDependencies": {
"@types/node": "^20.10.0",
Expand All @@ -16,6 +18,7 @@
"cross-env": "^7.0.3",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-gitignore": "^0.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
Expand Down
1 change: 0 additions & 1 deletion packages/duoyun-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
"@gemjs/config": "^1.6.11",
"@mantou/gem": "^1.7.1",
"@open-wc/testing": "^2.5.33",
"@types/d3-geo": "^3.0.1",
"@web/dev-server-esbuild": "^0.2.16",
Expand Down
9 changes: 5 additions & 4 deletions packages/duoyun-ui/src/elements/carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ export class DuoyunCarouselElement extends GemElement<State> {
};

#oMouseEnter = (evt: Event) => {
this.#waitLeave = new Promise((res) =>
evt.target?.addEventListener('mouseleave', () => res(), {
once: true,
}),
this.#waitLeave = new Promise(
(res) =>
evt.target?.addEventListener('mouseleave', () => res(), {
once: true,
}),
);
};

Expand Down
4 changes: 2 additions & 2 deletions packages/duoyun-ui/src/elements/cascader-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ export class DuoyunCascaderPickElement extends GemElement implements BasePickerE
${isEmpty
? this.placeholder
: this.multiple
? this.#renderMultipleValue(this.value as OptionValue[][])
: this.#renderValue(this.value as OptionValue[])}
? this.#renderMultipleValue(this.value as OptionValue[][])
: this.#renderValue(this.value as OptionValue[])}
</div>
<dy-use class="icon" .element=${icons.expand}></dy-use>
`;
Expand Down
216 changes: 108 additions & 108 deletions packages/duoyun-ui/src/elements/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,119 +368,119 @@ export class DuoyunFormItemElement extends GemElement<FormItemState> {
></dy-select>
`
: this.#type === 'date'
? html`
<dy-date-picker
class="input"
@change=${this.#onChange}
@clear=${(evt: any) => evt.target.change(undefined)}
?disabled=${this.disabled}
.value=${this.value}
.time=${this.time}
.placeholder=${this.placeholder}
.clearable=${!this.required}
>
</dy-date-picker>
`
: this.#type === 'date-range'
? html`
<dy-date-range-picker
class="input"
@change=${this.#onChange}
@clear=${(evt: any) => evt.target.change(undefined)}
?disabled=${this.disabled}
.value=${this.value}
.placeholder=${this.placeholder}
.clearable=${!this.required}
>
</dy-date-range-picker>
`
: this.#type === 'picker'
? html`
<dy-picker
?disabled=${this.disabled}
class="input"
part=${DuoyunFormItemElement.input}
@change=${this.#onChange}
.multiple=${this.multiple}
.value=${this.value}
.fit=${true}
.placeholder=${this.placeholder}
.options=${this.#options}
></dy-picker>
`
: this.#type === 'checkbox'
? html`
<dy-checkbox
@change=${this.#onCheckboxChange}
?checked=${this.checked}
?disabled=${this.disabled}
.value=${this.value as string}
>
${this.label}
</dy-checkbox>
`
: this.#type === 'radio-group'
? html`
<dy-radio-group
@change=${this.#onChange}
?disabled=${this.disabled}
.options=${this.#options}
.value=${this.value}
>
</dy-radio-group>
`
: this.#type === 'checkbox-group'
? html`
<dy-checkbox-group
@change=${this.#onChange}
?disabled=${this.disabled}
.options=${this.#options}
.value=${this.value}
>
</dy-checkbox-group>
`
: this.name && this.#type !== 'slot'
? this.multiple
? html`
${(this.value as string[])?.map(
(value, index) => html`
<dy-input
class="input"
part=${DuoyunFormItemElement.input}
?disabled=${this.disabled}
.placeholder=${this.placeholder}
@change=${(evt: CustomEvent<string>) => this.#onTextChangeWithIndex(evt, index)}
@clear=${() => this.#onTextCleanWithIndex(index)}
.autofocus=${this.autofocus}
.clearable=${true}
.alwayclearable=${true}
.dataList=${this.#options}
.value=${value}
></dy-input>
`,
)}
<div class="footer" part=${DuoyunFormItemElement.add}>
<dy-button .color=${'cancel'} @click=${this.#onTextAdd}>+</dy-button>
</div>
`
: html`
<dy-input
<dy-date-picker
class="input"
part=${DuoyunFormItemElement.input}
name=${this.name}
type=${this.#type}
?disabled=${this.disabled}
@change=${this.#onChange}
@clear=${(evt: any) => evt.target.change('')}
.autofocus=${this.autofocus}
.clearable=${this.clearable}
.value=${this.value as string}
@clear=${(evt: any) => evt.target.change(undefined)}
?disabled=${this.disabled}
.value=${this.value}
.time=${this.time}
.placeholder=${this.placeholder}
.required=${this.required}
.dataList=${this.#options}
></dy-input>
.clearable=${!this.required}
>
</dy-date-picker>
`
: ''}
: this.#type === 'date-range'
? html`
<dy-date-range-picker
class="input"
@change=${this.#onChange}
@clear=${(evt: any) => evt.target.change(undefined)}
?disabled=${this.disabled}
.value=${this.value}
.placeholder=${this.placeholder}
.clearable=${!this.required}
>
</dy-date-range-picker>
`
: this.#type === 'picker'
? html`
<dy-picker
?disabled=${this.disabled}
class="input"
part=${DuoyunFormItemElement.input}
@change=${this.#onChange}
.multiple=${this.multiple}
.value=${this.value}
.fit=${true}
.placeholder=${this.placeholder}
.options=${this.#options}
></dy-picker>
`
: this.#type === 'checkbox'
? html`
<dy-checkbox
@change=${this.#onCheckboxChange}
?checked=${this.checked}
?disabled=${this.disabled}
.value=${this.value as string}
>
${this.label}
</dy-checkbox>
`
: this.#type === 'radio-group'
? html`
<dy-radio-group
@change=${this.#onChange}
?disabled=${this.disabled}
.options=${this.#options}
.value=${this.value}
>
</dy-radio-group>
`
: this.#type === 'checkbox-group'
? html`
<dy-checkbox-group
@change=${this.#onChange}
?disabled=${this.disabled}
.options=${this.#options}
.value=${this.value}
>
</dy-checkbox-group>
`
: this.name && this.#type !== 'slot'
? this.multiple
? html`
${(this.value as string[])?.map(
(value, index) => html`
<dy-input
class="input"
part=${DuoyunFormItemElement.input}
?disabled=${this.disabled}
.placeholder=${this.placeholder}
@change=${(evt: CustomEvent<string>) => this.#onTextChangeWithIndex(evt, index)}
@clear=${() => this.#onTextCleanWithIndex(index)}
.autofocus=${this.autofocus}
.clearable=${true}
.alwayclearable=${true}
.dataList=${this.#options}
.value=${value}
></dy-input>
`,
)}
<div class="footer" part=${DuoyunFormItemElement.add}>
<dy-button .color=${'cancel'} @click=${this.#onTextAdd}>+</dy-button>
</div>
`
: html`
<dy-input
class="input"
part=${DuoyunFormItemElement.input}
name=${this.name}
type=${this.#type}
?disabled=${this.disabled}
@change=${this.#onChange}
@clear=${(evt: any) => evt.target.change('')}
.autofocus=${this.autofocus}
.clearable=${this.clearable}
.value=${this.value as string}
.placeholder=${this.placeholder}
.required=${this.required}
.dataList=${this.#options}
></dy-input>
`
: ''}
<slot ref=${this.slotRef.ref}></slot>
${invalidMessage
? html`
Expand Down
4 changes: 2 additions & 2 deletions packages/duoyun-ui/src/elements/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ export class DuoyunMenuElement extends GemElement {
maxHeight: openTop
? '20em'
: maxHeight && index === 0
? `${maxHeight}`
: `calc(100vh - 0.8em - ${y - this.#offset}px)`,
? `${maxHeight}`
: `calc(100vh - 0.8em - ${y - this.#offset}px)`,
[openTop ? 'bottom' : 'top']: `${y + this.#offset}px`,
left: `min(${x}px, calc(100vw - ${calcWidth} - ${2 * this.#offset}px))`,
})}
Expand Down
4 changes: 2 additions & 2 deletions packages/duoyun-ui/src/elements/popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export class DuoyunPopoverElement extends GemElement<PopoverState> {
const { left, right, top, bottom } = element
? element.getBoundingClientRect()
: firstArg instanceof Array
? { left: firstArg[0], right: firstArg[0] + firstArg[2], top: firstArg[1], bottom: firstArg[1] + firstArg[3] }
: { left: firstArg, right: firstArg, top: args[1], bottom: args[1] };
? { left: firstArg[0], right: firstArg[0] + firstArg[2], top: firstArg[1], bottom: firstArg[1] + firstArg[3] }
: { left: firstArg, right: firstArg, top: args[1], bottom: args[1] };

toggleActiveState(element, true);
const popover = new DuoyunPopoverElement(options);
Expand Down
8 changes: 4 additions & 4 deletions packages/duoyun-ui/src/elements/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ export class DuoyunSelectElement extends GemElement<State> implements BasePicker
return this.multiple && Array.isArray(this.value)
? this.value
: isNotNullish(this.value)
? [this.value]
: undefined;
? [this.value]
: undefined;
}

constructor() {
Expand Down Expand Up @@ -420,8 +420,8 @@ export class DuoyunSelectElement extends GemElement<State> implements BasePicker
</dy-tag>
`
: this.renderTag
? this.renderTag(this.#valueOptions![index])
: label,
? this.renderTag(this.#valueOptions![index])
: label,
)}
`
: this.#valueOptions![0].label}
Expand Down
38 changes: 19 additions & 19 deletions packages/duoyun-ui/src/elements/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,23 +378,23 @@ export class DuoyunTableElement extends GemElement {
${!record
? html`<dy-placeholder ?center=${style.textAlign === 'center'}></dy-placeholder>`
: render
? render(record)
: getActions
? html`
<dy-use
class="action"
tabindex="0"
role="button"
aria-label="Actions"
.element=${icons.more}
@keydown=${commonHandle}
@click=${(evt: PointerEvent) =>
this.#openActions(evt, getActions(record, evt.target as HTMLElement))}
></dy-use>
`
: dataIndex
? readProp(record, dataIndex)
: ''}
? render(record)
: getActions
? html`
<dy-use
class="action"
tabindex="0"
role="button"
aria-label="Actions"
.element=${icons.more}
@keydown=${commonHandle}
@click=${(evt: PointerEvent) =>
this.#openActions(evt, getActions(record, evt.target as HTMLElement))}
></dy-use>
`
: dataIndex
? readProp(record, dataIndex)
: ''}
</td>
`
: '',
Expand All @@ -416,8 +416,8 @@ export class DuoyunTableElement extends GemElement {
${!this.data
? html`<div class="side" part=${DuoyunTableElement.side}><dy-loading></dy-loading></div>`
: this.data.length === 0
? html`<div class="side" part=${DuoyunTableElement.side}>${this.noData || html`<dy-empty></dy-empty>`}</div>`
: ''}
? html`<div class="side" part=${DuoyunTableElement.side}>${this.noData || html`<dy-empty></dy-empty>`}</div>`
: ''}
`;
};

Expand Down
Loading

0 comments on commit df19821

Please sign in to comment.