@baishuyun/ai-design 2.0.14 → 2.0.16
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/CHANGELOG.md +18 -0
- package/dist/ai-design.css +39 -61
- package/dist/ai-design.js +7263 -7195
- package/dist/ai-design.js.map +1 -1
- package/dist/ai-design.umd.cjs +56 -56
- package/dist/ai-design.umd.cjs.map +1 -1
- package/dist/src/components/agent-helper/app-select/index.d.ts +5 -1
- package/dist/src/components/agent-helper/app-select/index.d.ts.map +1 -1
- package/dist/src/components/agent-helper/date-picker/utils.d.ts.map +1 -1
- package/dist/src/components/agent-helper/field-select/index.d.ts +3 -2
- package/dist/src/components/agent-helper/field-select/index.d.ts.map +1 -1
- package/dist/src/components/agent-helper/field-value-input/inputs.d.ts +1 -1
- package/dist/src/components/agent-helper/field-value-input/inputs.d.ts.map +1 -1
- package/dist/src/components/agent-helper/form-select/index.d.ts +4 -0
- package/dist/src/components/agent-helper/form-select/index.d.ts.map +1 -1
- package/dist/src/components/bs-entry-select/bs-entry-select.d.ts.map +1 -1
- package/dist/src/components/bs-entry-select/scroll-slider.d.ts.map +1 -1
- package/dist/src/components/bs-entry-select/search-input.d.ts.map +1 -1
- package/dist/src/components/office-container.d.ts +2 -0
- package/dist/src/components/office-container.d.ts.map +1 -1
- package/dist/src/hooks/use-resizable-width.d.ts +3 -1
- package/dist/src/hooks/use-resizable-width.d.ts.map +1 -1
- package/dist/src/hooks/use-select-popover-position.d.ts +16 -0
- package/dist/src/hooks/use-select-popover-position.d.ts.map +1 -0
- package/dist/src/stories/AppSelect.stories.d.ts +3 -0
- package/dist/src/stories/AppSelect.stories.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/agent-helper/app-select/index.tsx +26 -1
- package/src/components/agent-helper/field-select/index.tsx +1 -1
- package/src/components/agent-helper/form-select/index.tsx +38 -3
- package/src/components/agent-helper/trigger-time-preference-select/index.tsx +1 -1
- package/src/components/office-container.tsx +21 -1
- package/src/stories/AppSelect.stories.tsx +13 -0
- package/src/stories/FormSelect.stories.tsx +16 -1
- package/style.css +46 -0
|
@@ -33,7 +33,11 @@ export interface AppSelectProps {
|
|
|
33
33
|
className?: string;
|
|
34
34
|
/** Show a "全部应用" (All Apps) item at the top. Only effective in single mode. */
|
|
35
35
|
showAll?: boolean;
|
|
36
|
+
/** Allow selecting an empty value as the first option. Only effective in single mode. */
|
|
37
|
+
allowEmpty?: boolean;
|
|
38
|
+
/** Label for the empty option. Default "无". */
|
|
39
|
+
emptyLabel?: string;
|
|
36
40
|
popoverContentOnly?: boolean;
|
|
37
41
|
}
|
|
38
|
-
export declare const AppSelect: ({ nodes, mode, popoverContentOnly, showAll, value: controlledValue, defaultValue, onChange, placeholder, searchPlaceholder, disabled, maxVisibleChips, className, }: AppSelectProps) => import("react").JSX.Element;
|
|
42
|
+
export declare const AppSelect: ({ nodes, mode, popoverContentOnly, showAll, allowEmpty, emptyLabel, value: controlledValue, defaultValue, onChange, placeholder, searchPlaceholder, disabled, maxVisibleChips, className, }: AppSelectProps) => import("react").JSX.Element;
|
|
39
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/agent-helper/app-select/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMjE,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAID,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,WAA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AED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAgBrE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
1
2
|
import { IField } from '@baishuyun/types';
|
|
2
3
|
export interface FieldSelectPopoverProps {
|
|
3
4
|
fields: IField[];
|
|
@@ -8,7 +9,7 @@ export interface FieldSelectPopoverProps {
|
|
|
8
9
|
width?: number;
|
|
9
10
|
className?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare const FieldSelectPopover: ({ fields, selectedKey, onSelect, searchPlaceholder, showTypeBadge, width, className, }: FieldSelectPopoverProps) =>
|
|
12
|
+
export declare const FieldSelectPopover: ({ fields, selectedKey, onSelect, searchPlaceholder, showTypeBadge, width, className, }: FieldSelectPopoverProps) => JSX.Element;
|
|
12
13
|
export interface FieldSelectProps {
|
|
13
14
|
fields: IField[];
|
|
14
15
|
value?: string;
|
|
@@ -20,5 +21,5 @@ export interface FieldSelectProps {
|
|
|
20
21
|
showTypeBadge?: boolean;
|
|
21
22
|
className?: string;
|
|
22
23
|
}
|
|
23
|
-
export declare const FieldSelect: ({ fields, value: controlledValue, defaultValue, onChange, placeholder, searchPlaceholder, disabled, showTypeBadge, className, }: FieldSelectProps) =>
|
|
24
|
+
export declare const FieldSelect: ({ fields, value: controlledValue, defaultValue, onChange, placeholder, searchPlaceholder, disabled, showTypeBadge, className, }: FieldSelectProps) => JSX.Element;
|
|
24
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/agent-helper/field-select/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/agent-helper/field-select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,GAAG,EAAE,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EAAE,MAAM,EAA4B,MAAM,kBAAkB,CAAC;AAmJzE,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB,GAAI,wFAQhC,uBAAuB,gBAwIzB,CAAC;AAmCF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,GAAI,iIAUzB,gBAAgB,gBAoGlB,CAAC"}
|
|
@@ -5,6 +5,6 @@ export declare function TextareaInput({ field, value, onChange, disabled, showLa
|
|
|
5
5
|
export declare function PasswordInput({ field, value, onChange, disabled, showLabel, showDescription }: FieldValueInputProps): import("react").JSX.Element;
|
|
6
6
|
export declare function DateTimeInput({ field, value, onChange, disabled, showLabel, showDescription }: FieldValueInputProps): import("react").JSX.Element;
|
|
7
7
|
export declare function RangeNumberInput({ value, onChange, disabled }: FieldValueInputProps): import("react").JSX.Element;
|
|
8
|
-
export declare function RangeDateTimeInput({ value, onChange, disabled }: FieldValueInputProps): import("react").JSX.Element;
|
|
8
|
+
export declare function RangeDateTimeInput({ value, onChange, disabled, field }: FieldValueInputProps): import("react").JSX.Element;
|
|
9
9
|
export declare function UploadInput({ field, value, onChange, disabled, service, showLabel, showDescription }: FieldValueInputProps): import("react").JSX.Element;
|
|
10
10
|
//# sourceMappingURL=inputs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../../../src/components/agent-helper/field-value-input/inputs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../../../src/components/agent-helper/field-value-input/inputs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAcpD,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,oBAAoB,+BAa/G;AAID,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,oBAAoB,+BAgBjH;AAID,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,oBAAoB,+BAanH;AAID,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,oBAAoB,+BAuBnH;AAID,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,oBAAoB,+BAcnH;AAID,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,oBAAoB,+BAgCnF;AAID,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,oBAAoB,+BA+B5F;AAID,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,oBAAoB,+BA6D1H"}
|
|
@@ -17,6 +17,10 @@ export interface FormSelectProps {
|
|
|
17
17
|
placeholder?: string;
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
className?: string;
|
|
20
|
+
/** Allow selecting an empty value as the first option. */
|
|
21
|
+
allowEmpty?: boolean;
|
|
22
|
+
/** Label for the empty option. Default "无". */
|
|
23
|
+
emptyLabel?: string;
|
|
20
24
|
}
|
|
21
25
|
export declare const FormSelect: import('react').ForwardRefExoticComponent<FormSelectProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
22
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/agent-helper/form-select/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/agent-helper/form-select/index.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAmSD,eAAO,MAAM,UAAU,4GAqQtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bs-entry-select.d.ts","sourceRoot":"","sources":["../../../../src/components/bs-entry-select/bs-entry-select.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"bs-entry-select.d.ts","sourceRoot":"","sources":["../../../../src/components/bs-entry-select/bs-entry-select.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAI7E,YAAY,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,CAAC;AAE9D,eAAO,MAAM,aAAa,+GA6PzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-slider.d.ts","sourceRoot":"","sources":["../../../../src/components/bs-entry-select/scroll-slider.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAEV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"scroll-slider.d.ts","sourceRoot":"","sources":["../../../../src/components/bs-entry-select/scroll-slider.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAEV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAcjB,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,yBAAiC,EACjC,OAAmB,GACpB,EAAE;IACD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,IAAI,CAAC;IACtD,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,0BAA0B,CAAC;CACtC,sCA6bA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-input.d.ts","sourceRoot":"","sources":["../../../../src/components/bs-entry-select/search-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE/F,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"search-input.d.ts","sourceRoot":"","sources":["../../../../src/components/bs-entry-select/search-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE/F,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,gCAAkD,CAAC"}
|
|
@@ -14,6 +14,8 @@ export interface IOfficeContainerProps {
|
|
|
14
14
|
fullscreenPart?: FullScreenPart;
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
onResize?: (leftColWid: number, rightColWid: number) => void;
|
|
17
|
+
/** localStorage 键名,用于持久化用户拖拽的列宽偏好 */
|
|
18
|
+
storageKey?: string;
|
|
17
19
|
className?: string;
|
|
18
20
|
}
|
|
19
21
|
export declare const OfficeContainer: FC<IOfficeContainerProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"office-container.d.ts","sourceRoot":"","sources":["../../../src/components/office-container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAkC,MAAM,OAAO,CAAC;AAK3D,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,qBAAqB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxC,sBAAsB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzC,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAE7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"office-container.d.ts","sourceRoot":"","sources":["../../../src/components/office-container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAkC,MAAM,OAAO,CAAC;AAK3D,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,qBAAqB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxC,sBAAsB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzC,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAE7D,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,qBAAqB,CAoOrD,CAAC"}
|
|
@@ -5,6 +5,8 @@ interface UseResizableWidthOptions {
|
|
|
5
5
|
initialWidth?: number;
|
|
6
6
|
/** 反转拖拽方向:拖拽鼠标向右时宽度减小而非增大 */
|
|
7
7
|
invertDrag?: boolean;
|
|
8
|
+
/** localStorage 键名,用于持久化用户拖拽偏好。提供后会在 mount 时读取、drag end 时保存 */
|
|
9
|
+
storageKey?: string;
|
|
8
10
|
}
|
|
9
11
|
interface UseResizableWidthResult {
|
|
10
12
|
/** 当前宽度 */
|
|
@@ -21,6 +23,6 @@ interface UseResizableWidthResult {
|
|
|
21
23
|
* @param options 配置项:宽度范围、初始宽度
|
|
22
24
|
* @returns 当前宽度、拖拽处理器、拖拽状态
|
|
23
25
|
*/
|
|
24
|
-
export declare const useResizableWidth: ({ range, initialWidth, invertDrag, }: UseResizableWidthOptions) => UseResizableWidthResult;
|
|
26
|
+
export declare const useResizableWidth: ({ range, initialWidth, invertDrag, storageKey, }: UseResizableWidthOptions) => UseResizableWidthResult;
|
|
25
27
|
export {};
|
|
26
28
|
//# sourceMappingURL=use-resizable-width.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-resizable-width.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-resizable-width.ts"],"names":[],"mappings":"AAEA,UAAU,wBAAwB;IAChC,4BAA4B;IAC5B,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,0BAA0B;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-resizable-width.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-resizable-width.ts"],"names":[],"mappings":"AAEA,UAAU,wBAAwB;IAChC,4BAA4B;IAC5B,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,0BAA0B;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,uBAAuB;IAC/B,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC/C,aAAa;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,qBAAqB;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,kDAK/B,wBAAwB,KAAG,uBA8F7B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface UseSelectPopoverPositionOptions {
|
|
2
|
+
estimatedHeight?: number;
|
|
3
|
+
gap?: number;
|
|
4
|
+
minWidth?: number;
|
|
5
|
+
zIndex?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function useSelectPopoverPosition(triggerRef: React.RefObject<HTMLElement | null>, options?: UseSelectPopoverPositionOptions): {
|
|
8
|
+
popoverStyle: React.CSSProperties;
|
|
9
|
+
updatePopoverPosition: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function useSelectPopoverPosition(getTrigger: () => HTMLElement | null, options?: UseSelectPopoverPositionOptions): {
|
|
12
|
+
popoverStyle: React.CSSProperties;
|
|
13
|
+
updatePopoverPosition: () => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=use-select-popover-position.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-select-popover-position.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-select-popover-position.ts"],"names":[],"mappings":"AAEA,UAAU,+BAA+B;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAC/C,OAAO,CAAC,EAAE,+BAA+B,GACxC;IACD,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,EACpC,OAAO,CAAC,EAAE,+BAA+B,GACxC;IACD,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC"}
|
|
@@ -5,6 +5,9 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const SingleSelected: Story;
|
|
8
|
+
export declare const AllowEmpty: Story;
|
|
9
|
+
export declare const AllowEmptyCustomLabel: Story;
|
|
10
|
+
export declare const AllowEmptyWithShowAll: Story;
|
|
8
11
|
export declare const MultiSelect: Story;
|
|
9
12
|
export declare const MultiSelectOverflow: Story;
|
|
10
13
|
export declare const EmptyGroups: Story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppSelect.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/AppSelect.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAwB,MAAM,uCAAuC,CAAC;AAmGxF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAiBhC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAInC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,cAAc,EAAE,KAE5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAKzB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAMjC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC;AAEF,eAAO,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E,KA2CzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baishuyun/ai-design",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
4
4
|
"description": "AI 功能 UI 组件库 - 所有 AI 功能的 UI 表现唯一真相来源",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"tw-animate-css": "^1.4.0",
|
|
61
61
|
"vaul": "^1.1.2",
|
|
62
62
|
"zod": "^4.1.13",
|
|
63
|
-
"@baishuyun/ai-feat-utils": "2.0.
|
|
64
|
-
"@baishuyun/types": "3.0.
|
|
63
|
+
"@baishuyun/ai-feat-utils": "2.0.16",
|
|
64
|
+
"@baishuyun/types": "3.0.16"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"react": "^19.0.0",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"typescript": "^5.5.0",
|
|
84
84
|
"vite": "^5.1.4",
|
|
85
85
|
"vite-plugin-dts": "^4.5.4",
|
|
86
|
+
"@baishuyun/types": "3.0.16",
|
|
86
87
|
"@baishuyun/tailwind-config": "3.0.9",
|
|
87
|
-
"@baishuyun/types": "3.0.14",
|
|
88
88
|
"@baishuyun/typescript-config": "2.0.9"
|
|
89
89
|
},
|
|
90
90
|
"keywords": [],
|
|
@@ -132,6 +132,10 @@ export interface AppSelectProps {
|
|
|
132
132
|
className?: string;
|
|
133
133
|
/** Show a "全部应用" (All Apps) item at the top. Only effective in single mode. */
|
|
134
134
|
showAll?: boolean;
|
|
135
|
+
/** Allow selecting an empty value as the first option. Only effective in single mode. */
|
|
136
|
+
allowEmpty?: boolean;
|
|
137
|
+
/** Label for the empty option. Default "无". */
|
|
138
|
+
emptyLabel?: string;
|
|
135
139
|
popoverContentOnly?: boolean; // for testing: render only the popover content without the trigger
|
|
136
140
|
}
|
|
137
141
|
|
|
@@ -157,6 +161,8 @@ export const AppSelect = ({
|
|
|
157
161
|
mode = 'single',
|
|
158
162
|
popoverContentOnly,
|
|
159
163
|
showAll = false,
|
|
164
|
+
allowEmpty = false,
|
|
165
|
+
emptyLabel = '无',
|
|
160
166
|
value: controlledValue,
|
|
161
167
|
defaultValue,
|
|
162
168
|
onChange,
|
|
@@ -410,6 +416,25 @@ export const AppSelect = ({
|
|
|
410
416
|
/>
|
|
411
417
|
</div>
|
|
412
418
|
|
|
419
|
+
{/* Empty option */}
|
|
420
|
+
{allowEmpty && mode === 'single' && !searchQuery.trim() && (
|
|
421
|
+
<button
|
|
422
|
+
type="button"
|
|
423
|
+
onClick={() => {
|
|
424
|
+
updateValue('');
|
|
425
|
+
setOpen(false);
|
|
426
|
+
}}
|
|
427
|
+
className={cn(
|
|
428
|
+
'flex items-center w-full h-[34px] rounded-[4px] text-left',
|
|
429
|
+
'px-[10px]',
|
|
430
|
+
transCls,
|
|
431
|
+
'text-[#030303] hover:bg-[#EFF0F6]'
|
|
432
|
+
)}
|
|
433
|
+
>
|
|
434
|
+
<span className="text-[14px] leading-[normal]">{emptyLabel}</span>
|
|
435
|
+
</button>
|
|
436
|
+
)}
|
|
437
|
+
|
|
413
438
|
{/* "全部应用" item */}
|
|
414
439
|
{showAll && mode === 'single' && !searchQuery.trim() && (
|
|
415
440
|
<button
|
|
@@ -512,7 +537,7 @@ export const AppSelect = ({
|
|
|
512
537
|
selectedAppLabel ? 'text-[#030303]' : 'text-[#999999]'
|
|
513
538
|
)}
|
|
514
539
|
>
|
|
515
|
-
{selectedAppLabel ?? placeholder}
|
|
540
|
+
{selectedAppLabel ?? (allowEmpty ? emptyLabel : placeholder)}
|
|
516
541
|
</span>
|
|
517
542
|
<DropdownChevron open={open} />
|
|
518
543
|
</>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useCallback, useMemo, useRef } from 'react';
|
|
1
|
+
import { useState, useCallback, useMemo, useRef, JSX } from 'react';
|
|
2
2
|
import { cn } from '../../../lib/utils';
|
|
3
3
|
import { transCls } from '../../../const/ui';
|
|
4
4
|
import { Popover, PopoverTrigger, PopoverContent } from '../../ui/popover';
|
|
@@ -31,7 +31,7 @@ export interface FormSelectItem {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface FormSelectChangeResult {
|
|
34
|
-
form
|
|
34
|
+
form?: FormSelectItem;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export interface FormSelectProps {
|
|
@@ -42,6 +42,10 @@ export interface FormSelectProps {
|
|
|
42
42
|
placeholder?: string;
|
|
43
43
|
disabled?: boolean;
|
|
44
44
|
className?: string;
|
|
45
|
+
/** Allow selecting an empty value as the first option. */
|
|
46
|
+
allowEmpty?: boolean;
|
|
47
|
+
/** Label for the empty option. Default "无". */
|
|
48
|
+
emptyLabel?: string;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
// ── Tree types ────────────────────────────────────────────────────
|
|
@@ -259,6 +263,9 @@ function FormPopover({
|
|
|
259
263
|
selectedFormId,
|
|
260
264
|
onSelect,
|
|
261
265
|
hasSearch,
|
|
266
|
+
allowEmpty,
|
|
267
|
+
emptyLabel,
|
|
268
|
+
onEmptySelect,
|
|
262
269
|
}: {
|
|
263
270
|
searchQuery: string;
|
|
264
271
|
onSearchChange: (v: string) => void;
|
|
@@ -266,6 +273,9 @@ function FormPopover({
|
|
|
266
273
|
selectedFormId: string | undefined;
|
|
267
274
|
onSelect: (result: FormSelectChangeResult) => void;
|
|
268
275
|
hasSearch: boolean;
|
|
276
|
+
allowEmpty: boolean;
|
|
277
|
+
emptyLabel: string;
|
|
278
|
+
onEmptySelect: () => void;
|
|
269
279
|
}) {
|
|
270
280
|
return (
|
|
271
281
|
<div
|
|
@@ -286,6 +296,20 @@ function FormPopover({
|
|
|
286
296
|
/>
|
|
287
297
|
</div>
|
|
288
298
|
|
|
299
|
+
{/* Empty option */}
|
|
300
|
+
{allowEmpty && !hasSearch && (
|
|
301
|
+
<div
|
|
302
|
+
className={cn(
|
|
303
|
+
'flex items-center h-[34px] px-[10px] cursor-pointer rounded-[4px] shrink-0',
|
|
304
|
+
!selectedFormId ? 'bg-[#F0F6FF] text-[#0265FF]' : 'text-[#030303] hover:bg-[#EFF0F6]',
|
|
305
|
+
transCls,
|
|
306
|
+
)}
|
|
307
|
+
onClick={onEmptySelect}
|
|
308
|
+
>
|
|
309
|
+
<span className="text-[14px] leading-[normal] truncate">{emptyLabel}</span>
|
|
310
|
+
</div>
|
|
311
|
+
)}
|
|
312
|
+
|
|
289
313
|
{/* Form list */}
|
|
290
314
|
<div className="flex flex-col gap-0 max-h-[400px] overflow-y-auto">
|
|
291
315
|
{tree.length > 0 ? (
|
|
@@ -323,6 +347,8 @@ export const FormSelect = forwardRef<HTMLDivElement, FormSelectProps>(
|
|
|
323
347
|
placeholder = '请选择表单',
|
|
324
348
|
disabled = false,
|
|
325
349
|
className,
|
|
350
|
+
allowEmpty = false,
|
|
351
|
+
emptyLabel = '无',
|
|
326
352
|
},
|
|
327
353
|
ref,
|
|
328
354
|
) => {
|
|
@@ -400,13 +426,19 @@ export const FormSelect = forwardRef<HTMLDivElement, FormSelectProps>(
|
|
|
400
426
|
|
|
401
427
|
const handleSelect = useCallback(
|
|
402
428
|
(result: FormSelectChangeResult) => {
|
|
403
|
-
setInternalValue(result.form
|
|
429
|
+
setInternalValue(result.form?.id || '');
|
|
404
430
|
onChange?.(result);
|
|
405
431
|
handleClose();
|
|
406
432
|
},
|
|
407
433
|
[onChange, handleClose],
|
|
408
434
|
);
|
|
409
435
|
|
|
436
|
+
const handleEmptySelect = useCallback(() => {
|
|
437
|
+
setInternalValue('');
|
|
438
|
+
onChange?.({});
|
|
439
|
+
handleClose();
|
|
440
|
+
}, [onChange, handleClose]);
|
|
441
|
+
|
|
410
442
|
// ── Event listeners ───────────────────────────────────────────
|
|
411
443
|
|
|
412
444
|
// Click-outside: close popover when clicking outside both the trigger and popover.
|
|
@@ -531,7 +563,7 @@ export const FormSelect = forwardRef<HTMLDivElement, FormSelectProps>(
|
|
|
531
563
|
</>
|
|
532
564
|
) : (
|
|
533
565
|
<span className="text-[14px] text-[#999999] leading-[normal] truncate">
|
|
534
|
-
{placeholder}
|
|
566
|
+
{allowEmpty ? emptyLabel : placeholder}
|
|
535
567
|
</span>
|
|
536
568
|
)}
|
|
537
569
|
</span>
|
|
@@ -557,6 +589,9 @@ export const FormSelect = forwardRef<HTMLDivElement, FormSelectProps>(
|
|
|
557
589
|
selectedFormId={selectedFormId}
|
|
558
590
|
onSelect={handleSelect}
|
|
559
591
|
hasSearch={hasSearch}
|
|
592
|
+
allowEmpty={allowEmpty}
|
|
593
|
+
emptyLabel={emptyLabel}
|
|
594
|
+
onEmptySelect={handleEmptySelect}
|
|
560
595
|
/>
|
|
561
596
|
</div>,
|
|
562
597
|
portalContainer || document.body,
|
|
@@ -92,7 +92,7 @@ export function TriggerTimePreferenceSelect({
|
|
|
92
92
|
const handleFormChange = useCallback(
|
|
93
93
|
(result: FormSelectChangeResult) => {
|
|
94
94
|
const payload = buildDateFieldPayload(
|
|
95
|
-
{ formId: result.form
|
|
95
|
+
{ formId: result.form?.id || '' },
|
|
96
96
|
dateFieldPayload,
|
|
97
97
|
);
|
|
98
98
|
onChange?.({ type: 'date_field', customTriggerTimePayload: payload });
|
|
@@ -56,6 +56,7 @@ export const OfficeContainer: FC<IOfficeContainerProps> = ({
|
|
|
56
56
|
|
|
57
57
|
const transitioningRef = useRef(false);
|
|
58
58
|
const mountRef = useRef(true);
|
|
59
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
59
60
|
|
|
60
61
|
const { width, handleMouseDown, isDragging } = useResizableWidth({
|
|
61
62
|
range: activeRange,
|
|
@@ -161,6 +162,25 @@ export const OfficeContainer: FC<IOfficeContainerProps> = ({
|
|
|
161
162
|
};
|
|
162
163
|
}, [fullscreenPart, hideLeftCol, onResize]);
|
|
163
164
|
|
|
165
|
+
// Fire onResize on browser zoom / window resize
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
if (!onResize) return;
|
|
168
|
+
const el = containerRef.current;
|
|
169
|
+
if (!el) return;
|
|
170
|
+
|
|
171
|
+
const observer = new ResizeObserver(() => {
|
|
172
|
+
if (transitioningRef.current) return;
|
|
173
|
+
requestAnimationFrame(() => {
|
|
174
|
+
const leftW = leftColRef.current?.offsetWidth ?? 0;
|
|
175
|
+
const rightW = rightColRef.current?.offsetWidth ?? 0;
|
|
176
|
+
onResize(leftW, rightW);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
observer.observe(el);
|
|
181
|
+
return () => observer.disconnect();
|
|
182
|
+
}, [onResize]);
|
|
183
|
+
|
|
164
184
|
const borderColorCls = 'border-[#0265fc]';
|
|
165
185
|
|
|
166
186
|
// 全屏时补全 shrink-0,确保 width: 100% 或 width: 0 不会被 flex 容器挤压
|
|
@@ -180,7 +200,7 @@ export const OfficeContainer: FC<IOfficeContainerProps> = ({
|
|
|
180
200
|
const contentStyle: React.CSSProperties = { /*scrollbarGutter: 'stable' */};
|
|
181
201
|
|
|
182
202
|
return (
|
|
183
|
-
<div className={classNames("relative h-full w-full flex overflow-hidden", className)}>
|
|
203
|
+
<div ref={containerRef} className={classNames("relative h-full w-full flex overflow-hidden", className)}>
|
|
184
204
|
{/* fullscreen overlay */}
|
|
185
205
|
{children && (
|
|
186
206
|
<div>
|
|
@@ -129,6 +129,19 @@ export const SingleSelected: Story = {
|
|
|
129
129
|
args: { defaultValue: 'app2' },
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
+
export const AllowEmpty: Story = {
|
|
133
|
+
args: { allowEmpty: true },
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const AllowEmptyCustomLabel: Story = {
|
|
137
|
+
args: { allowEmpty: true, emptyLabel: '不限' },
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const AllowEmptyWithShowAll: Story = {
|
|
141
|
+
name: 'Allow Empty + Show All',
|
|
142
|
+
args: { allowEmpty: true, showAll: true },
|
|
143
|
+
};
|
|
144
|
+
|
|
132
145
|
export const MultiSelect: Story = {
|
|
133
146
|
args: {
|
|
134
147
|
mode: 'multiple',
|
|
@@ -60,6 +60,21 @@ export const WithSelection: Story = {
|
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
export const AllowEmpty: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
items: mockFormItems,
|
|
66
|
+
allowEmpty: true,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const AllowEmptyCustomLabel: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
items: mockFormItems,
|
|
73
|
+
allowEmpty: true,
|
|
74
|
+
emptyLabel: '不限',
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
63
78
|
export const Disabled: Story = {
|
|
64
79
|
args: {
|
|
65
80
|
items: mockFormItems,
|
|
@@ -97,7 +112,7 @@ export const Interactive: Story = {
|
|
|
97
112
|
return (
|
|
98
113
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
99
114
|
<FormSelect {...args} onChange={setSelected} />
|
|
100
|
-
{selected && (
|
|
115
|
+
{selected?.form && (
|
|
101
116
|
<div
|
|
102
117
|
style={{
|
|
103
118
|
padding: 12,
|
package/style.css
CHANGED
|
@@ -1148,6 +1148,9 @@
|
|
|
1148
1148
|
.items-center {
|
|
1149
1149
|
align-items: center;
|
|
1150
1150
|
}
|
|
1151
|
+
.items-end {
|
|
1152
|
+
align-items: flex-end;
|
|
1153
|
+
}
|
|
1151
1154
|
.items-start {
|
|
1152
1155
|
align-items: flex-start;
|
|
1153
1156
|
}
|
|
@@ -1260,6 +1263,9 @@
|
|
|
1260
1263
|
.overflow-y-auto {
|
|
1261
1264
|
overflow-y: auto;
|
|
1262
1265
|
}
|
|
1266
|
+
.overflow-y-hidden {
|
|
1267
|
+
overflow-y: hidden;
|
|
1268
|
+
}
|
|
1263
1269
|
.rounded {
|
|
1264
1270
|
border-radius: 0.625rem;
|
|
1265
1271
|
}
|
|
@@ -1314,6 +1320,10 @@
|
|
|
1314
1320
|
.rounded-sm {
|
|
1315
1321
|
border-radius: calc(var(--radius) - 4px);
|
|
1316
1322
|
}
|
|
1323
|
+
.rounded-t-\[8px\] {
|
|
1324
|
+
border-top-left-radius: 8px;
|
|
1325
|
+
border-top-right-radius: 8px;
|
|
1326
|
+
}
|
|
1317
1327
|
.rounded-t-\[10px\] {
|
|
1318
1328
|
border-top-left-radius: 10px;
|
|
1319
1329
|
border-top-right-radius: 10px;
|
|
@@ -1419,6 +1429,9 @@
|
|
|
1419
1429
|
.border-transparent {
|
|
1420
1430
|
border-color: transparent;
|
|
1421
1431
|
}
|
|
1432
|
+
.border-b-\[\#e0e0e0\] {
|
|
1433
|
+
border-bottom-color: #e0e0e0;
|
|
1434
|
+
}
|
|
1422
1435
|
.\!bg-\[\#E5E6EB\] {
|
|
1423
1436
|
background-color: #E5E6EB !important;
|
|
1424
1437
|
}
|
|
@@ -1488,6 +1501,9 @@
|
|
|
1488
1501
|
.bg-\[\#f5f7fa\] {
|
|
1489
1502
|
background-color: #f5f7fa;
|
|
1490
1503
|
}
|
|
1504
|
+
.bg-\[\#f6f7fa\] {
|
|
1505
|
+
background-color: #f6f7fa;
|
|
1506
|
+
}
|
|
1491
1507
|
.bg-\[\#fafafa\] {
|
|
1492
1508
|
background-color: #fafafa;
|
|
1493
1509
|
}
|
|
@@ -2437,24 +2453,54 @@
|
|
|
2437
2453
|
right: calc(var(--spacing) * 0);
|
|
2438
2454
|
}
|
|
2439
2455
|
}
|
|
2456
|
+
.before\:bottom-\[0px\] {
|
|
2457
|
+
&::before {
|
|
2458
|
+
content: var(--tw-content);
|
|
2459
|
+
bottom: 0px;
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2440
2462
|
.before\:left-0 {
|
|
2441
2463
|
&::before {
|
|
2442
2464
|
content: var(--tw-content);
|
|
2443
2465
|
left: calc(var(--spacing) * 0);
|
|
2444
2466
|
}
|
|
2445
2467
|
}
|
|
2468
|
+
.before\:left-\[-200px\] {
|
|
2469
|
+
&::before {
|
|
2470
|
+
content: var(--tw-content);
|
|
2471
|
+
left: -200px;
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2446
2474
|
.before\:z-0 {
|
|
2447
2475
|
&::before {
|
|
2448
2476
|
content: var(--tw-content);
|
|
2449
2477
|
z-index: 0;
|
|
2450
2478
|
}
|
|
2451
2479
|
}
|
|
2480
|
+
.before\:h-\[1px\] {
|
|
2481
|
+
&::before {
|
|
2482
|
+
content: var(--tw-content);
|
|
2483
|
+
height: 1px;
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2452
2486
|
.before\:h-\[28px\] {
|
|
2453
2487
|
&::before {
|
|
2454
2488
|
content: var(--tw-content);
|
|
2455
2489
|
height: 28px;
|
|
2456
2490
|
}
|
|
2457
2491
|
}
|
|
2492
|
+
.before\:w-\[100vw\] {
|
|
2493
|
+
&::before {
|
|
2494
|
+
content: var(--tw-content);
|
|
2495
|
+
width: 100vw;
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
.before\:bg-\[\#e0e0e0\] {
|
|
2499
|
+
&::before {
|
|
2500
|
+
content: var(--tw-content);
|
|
2501
|
+
background-color: #e0e0e0;
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2458
2504
|
.before\:bg-\[\#f3f3f3\] {
|
|
2459
2505
|
&::before {
|
|
2460
2506
|
content: var(--tw-content);
|