@fe-free/core 3.0.4 → 3.0.6

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 3.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: pro component
8
+ - @fe-free/tool@3.0.6
9
+
10
+ ## 3.0.5
11
+
12
+ ### Patch Changes
13
+
14
+ - feat: tree
15
+ - @fe-free/tool@3.0.5
16
+
3
17
  ## 3.0.4
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -41,7 +41,7 @@
41
41
  "safe-stable-stringify": "^2.5.0",
42
42
  "vanilla-jsoneditor": "^0.23.1",
43
43
  "zustand": "^4.5.4",
44
- "@fe-free/tool": "3.0.4"
44
+ "@fe-free/tool": "3.0.6"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@ant-design/pro-components": "2.8.9",
@@ -99,7 +99,7 @@ const PRESET_FILE_ICONS: {
99
99
  {
100
100
  key: 'folder',
101
101
  icon: <FolderFilled />,
102
- color: '#FFDC00',
102
+ color: '#FFD93B',
103
103
  ext: [],
104
104
  },
105
105
  ];
package/src/style.scss CHANGED
@@ -12,3 +12,9 @@
12
12
 
13
13
  /* stylelint-disable-next-line at-rule-no-unknown */
14
14
  @tailwind utilities;
15
+
16
+ // fix
17
+ // ant-pro-card-border 有个 transition 导致颜色会变化,所以就写死个。
18
+ .ant-pro-card-border {
19
+ border: 1px solid #e2e7f0;
20
+ }
@@ -8,7 +8,7 @@ const meta: Meta<typeof FileTree> = {
8
8
  decorators: [
9
9
  (Story) => {
10
10
  return (
11
- <div className="w-[200px] overflow-y-auto border border-01">
11
+ <div className="w-[300px] overflow-y-auto border border-01">
12
12
  <Story />
13
13
  </div>
14
14
  );
@@ -119,7 +119,7 @@ export const Default: Story = {
119
119
  },
120
120
 
121
121
  renderTitleRight: () => {
122
- return <div className="text-03">right</div>;
122
+ return <div className="text-03">10</div>;
123
123
  },
124
124
  },
125
125
  };
@@ -19,7 +19,6 @@ interface FileTreeProps<D extends DataNode> extends TreeProps<D> {
19
19
  /** 注意,没法控制 title 区域的添加(由 actions 来控制) */
20
20
  createProps?: {
21
21
  operateIsDisabled?: (nodeData: D) => boolean;
22
-
23
22
  operateIsHidden?: (nodeData: D) => boolean;
24
23
  };
25
24
  updateProps?: {
@@ -166,8 +165,20 @@ function More({
166
165
  }
167
166
 
168
167
  function FileTree<D extends DataNode>(props: FileTreeProps<D>) {
168
+ const {
169
+ actions,
170
+ requestCreateByValues,
171
+ requestUpdateByValues,
172
+ requestDeleteByRecord,
173
+ createProps,
174
+ updateProps,
175
+ deleteProps,
176
+ renderTitleRight,
177
+ treeProps,
178
+ } = props;
179
+
169
180
  const titleExtra = useMemo(() => {
170
- if (!props.actions?.includes('create')) {
181
+ if (!actions?.includes('create')) {
171
182
  return null;
172
183
  }
173
184
 
@@ -175,16 +186,16 @@ function FileTree<D extends DataNode>(props: FileTreeProps<D>) {
175
186
  <Detail
176
187
  action="create"
177
188
  trigger={<PlusOutlined />}
178
- requestCreateByValues={props.requestCreateByValues}
189
+ requestCreateByValues={requestCreateByValues}
179
190
  />
180
191
  );
181
- }, [props.actions, props.requestCreateByValues]);
192
+ }, [actions, requestCreateByValues]);
182
193
 
183
194
  const titleRender = useCallback(
184
195
  (nodeData) => {
185
- const hasMore = props.actions?.includes('update') || props.actions?.includes('delete');
196
+ const hasMore = actions?.includes('update') || actions?.includes('delete');
186
197
  return (
187
- <div className="group flex gap-1">
198
+ <div className="group flex items-center gap-2">
188
199
  {nodeData.children ? (
189
200
  <FileCard.FileIcon isDirectory className="text-base" />
190
201
  ) : (
@@ -195,19 +206,19 @@ function FileTree<D extends DataNode>(props: FileTreeProps<D>) {
195
206
  )}
196
207
  <div className="flex-1 truncate">{nodeData.title}</div>
197
208
  <div className={classNames({ 'group-hover:hidden': hasMore })}>
198
- {props.renderTitleRight?.(nodeData)}
209
+ {renderTitleRight?.(nodeData)}
199
210
  </div>
200
211
  {hasMore && (
201
212
  <div className="hidden group-hover:block">
202
213
  <More
203
- actions={props.actions}
214
+ actions={actions}
204
215
  nodeData={nodeData}
205
- requestCreateByValues={props.requestCreateByValues}
206
- requestUpdateByValues={props.requestUpdateByValues}
207
- requestDeleteByRecord={props.requestDeleteByRecord}
208
- createProps={props.createProps}
209
- updateProps={props.updateProps}
210
- deleteProps={props.deleteProps}
216
+ requestCreateByValues={requestCreateByValues}
217
+ requestUpdateByValues={requestUpdateByValues}
218
+ requestDeleteByRecord={requestDeleteByRecord}
219
+ createProps={createProps}
220
+ updateProps={updateProps}
221
+ deleteProps={deleteProps}
211
222
  />
212
223
  </div>
213
224
  )}
@@ -215,24 +226,26 @@ function FileTree<D extends DataNode>(props: FileTreeProps<D>) {
215
226
  );
216
227
  },
217
228
  [
218
- props.actions,
219
- props.requestCreateByValues,
220
- props.requestDeleteByRecord,
221
- props.requestUpdateByValues,
222
- props.createProps,
223
- props.updateProps,
224
- props.deleteProps,
229
+ actions,
230
+ createProps,
231
+ deleteProps,
232
+ renderTitleRight,
233
+ requestCreateByValues,
234
+ requestDeleteByRecord,
235
+ requestUpdateByValues,
236
+ updateProps,
225
237
  ],
226
238
  );
227
239
 
228
240
  return (
229
241
  <Tree
230
242
  titleExtra={titleExtra}
243
+ size="large"
231
244
  {...props}
232
245
  treeProps={{
233
246
  titleRender,
234
- ...props.treeProps,
235
- className: classNames('fec-file-tree', props.treeProps?.className),
247
+ ...treeProps,
248
+ className: classNames('fec-file-tree', treeProps?.className),
236
249
  }}
237
250
  />
238
251
  );
@@ -8,12 +8,25 @@
8
8
  .ant-tree-switcher {
9
9
  margin-inline-end: 0 !important;
10
10
  }
11
+
12
+ &.fec-tree-large {
13
+ .ant-tree-treenode {
14
+ line-height: 32px;
15
+ }
16
+ }
11
17
  }
12
18
 
13
19
  .fec-file-tree {
14
20
  .ant-tree-node-content-wrapper {
15
21
  overflow: hidden;
16
- padding-inline-start: 0 !important;
22
+ }
23
+
24
+ .ant-tree-switcher {
25
+ &:hover {
26
+ &::before {
27
+ background-color: transparent !important;
28
+ }
29
+ }
17
30
  }
18
31
 
19
32
  &.fec-tree-all-leaf {
package/src/tree/tree.tsx CHANGED
@@ -20,6 +20,8 @@ interface TreeProps<T extends DataNode> {
20
20
  enableSearch?: boolean;
21
21
  /** Antd 树的 props */
22
22
  treeProps?: AntdTreeProps<T>;
23
+ /** 更宽松的布局 */
24
+ size?: 'large';
23
25
  }
24
26
 
25
27
  function useHighLightTreeData({ treeData, search }) {
@@ -167,6 +169,7 @@ function Tree<T extends DataNode>(props: TreeProps<T>) {
167
169
  'fec-tree fec-tree-no-wrap',
168
170
  {
169
171
  'fec-tree-all-leaf': isAllLeaf,
172
+ 'fec-tree-large': props.size === 'large',
170
173
  },
171
174
  treeProps?.className,
172
175
  )}