Skip to content

Commit

Permalink
feat: code review 问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
yx376642000 committed Jul 26, 2023
1 parent 9f4344f commit eabf8c6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 11 deletions.
20 changes: 18 additions & 2 deletions packages/quark-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import CountDown from "./count-down";
import Dialog from "./dialog";
import Empty from "./empty";
import Field, { FieldRef } from "./field";
import Form, { FormRef } from "./form";
import Form, { FormRef, FormProps, FormType, Rules } from "./form";
import FormItem from "./form-item";
import Grid from "./grid";
import GridItem from "./grid-item";
Expand Down Expand Up @@ -45,7 +45,14 @@ import StepItem from "./step-item";
import Sticky from "./sticky";
import Swipe from "./swipe";
import SwipeItem from "./swipe-item";
import SwipeCell from "./swipe-cell";
import SwipeCell, {
SwipeCellRef,
SwipeCellSide,
SwipeCellPosition,
SwipeCellProps,
SwipeCellType,
SwipeCellBeforeClose,
} from "./swipe-cell";
import Switch from "./switch";
import Tabs from "./tabs";
import TabContent from "./tab-content";
Expand Down Expand Up @@ -76,6 +83,9 @@ export {
FieldRef,
Form,
FormRef,
FormProps,
FormType,
Rules,
FormItem,
Grid,
GridItem,
Expand Down Expand Up @@ -114,6 +124,12 @@ export {
Swipe,
SwipeItem,
SwipeCell,
SwipeCellRef,
SwipeCellSide,
SwipeCellPosition,
SwipeCellProps,
SwipeCellType,
SwipeCellBeforeClose,
Switch,
Tabs,
TabContent,
Expand Down
6 changes: 3 additions & 3 deletions packages/quark-react/src/swipe-cell/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Props,
SwipeCellSide,
SwipeCellPosition,
BeforeCloseFunc,
BeforeCloseFunc as SwipeCellBeforeClose,
} from "quarkd/lib/swipecell/type";
import { componentBaseInterface, ReactifyProps } from "../type";

Expand All @@ -17,7 +17,7 @@ type SwipeCellType = FC<SwipeCellProps>;
interface Ref {
open(side: SwipeCellPosition): void;
close(position: SwipeCellPosition): void;
setBeforeClose(fn: BeforeCloseFunc): void;
setBeforeClose(fn: SwipeCellBeforeClose): void;
}

type SwipeCellRef = Ref & HTMLElement;
Expand All @@ -28,7 +28,7 @@ export {
SwipeCellRef,
SwipeCellSide,
SwipeCellPosition,
BeforeCloseFunc,
SwipeCellBeforeClose,
SwipeCellProps,
SwipeCellType,
};
2 changes: 1 addition & 1 deletion packages/quarkd/src/checkbox/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:host {
font-size: var(--checkbox-font-size, 14px);
font-size: var(--checkbox-font-size, 16px);
color: var(--checkbox-color, #242729);
display: inline-flex;
justify-content: center;
Expand Down
5 changes: 4 additions & 1 deletion packages/quarkd/src/form/form-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AsyncValidator from "async-validator";
import style from "./form-item.css";
import { formTagNamesMap, getPropByPath, noop } from "./utils";
import { debounce } from "../../utils/index";
import { slotAssignedElements } from "../../utils/public";
import { IFormProps, Rules } from "./type";

@customElement({
Expand Down Expand Up @@ -176,7 +177,9 @@ class QuarkFormItem extends QuarkElement {

defaultSlotChange = () => {
if (!this.defaultSlotRef.current) return;
const slotNodes = this.defaultSlotRef.current.assignedNodes();
const slotNodes = slotAssignedElements(
this.defaultSlotRef.current?.assignedNodes()
);
if (slotNodes.length > 0) {
const formNode = slotNodes.find((node) => {
return !!formTagNamesMap[node.tagName];
Expand Down
7 changes: 4 additions & 3 deletions packages/quarkd/src/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import style from "./style.css";
import QuarkFormItem from "./form-item";
import { Rules, labelPosition } from "./type";
import { getPropByPath } from "./utils";
import { slotAssignedElements } from "../../utils/public";

@customElement({
tag: "quark-form",
Expand Down Expand Up @@ -47,9 +48,9 @@ class QuarkForm extends QuarkElement {

onSlotChange = () => {
if (this.slotRef.current) {
const allFormItes = this.slotRef.current
.assignedNodes()
.filter((item) => item.tagName === "QUARK-FORM-ITEM");
const allFormItes = slotAssignedElements(
this.slotRef.current.assignedNodes()
).filter((item) => item.tagName === "QUARK-FORM-ITEM");

this.formItems = allFormItes.filter((item) => item.prop);

Expand Down
2 changes: 1 addition & 1 deletion packages/quarkd/src/radio/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:host([radiogrouphost]) {
font-size: var(--radio-font-size, 16px);
color: var(--radio-color, #333);
color: var(--radio-color, #242729);
display: block;
}

Expand Down

0 comments on commit eabf8c6

Please sign in to comment.