@rainbow-oh/yee-c 0.7.0 → 0.8.0
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/dist/cjs/Form/form-store.d.ts +2 -1
- package/dist/cjs/Form/form-store.js +32 -17
- package/dist/cjs/Table/hooks/useColumns.js +1 -1
- package/dist/cjs/Table/style/index.less +35 -11
- package/dist/cjs/Table/table.js +57 -7
- package/dist/cjs/Table/tbody/cell.js +1 -1
- package/dist/cjs/Table/util/header.d.ts +3 -1
- package/dist/cjs/Table/util/header.js +30 -3
- package/dist/cjs/style/color.css +2 -0
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +3 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Form/form-store.d.ts +2 -1
- package/dist/esm/Form/form-store.js +40 -19
- package/dist/esm/Table/hooks/useColumns.js +1 -1
- package/dist/esm/Table/style/index.less +35 -11
- package/dist/esm/Table/table.js +54 -2
- package/dist/esm/Table/tbody/cell.js +1 -1
- package/dist/esm/Table/util/header.d.ts +3 -1
- package/dist/esm/Table/util/header.js +30 -2
- package/dist/esm/style/color.css +2 -0
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +3 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +3 -3
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +1 -1
- package/src/Form/form-store.ts +42 -15
- package/src/Table/hooks/useColumns.ts +1 -1
- package/src/Table/style/index.less +35 -11
- package/src/Table/table.tsx +60 -1
- package/src/Table/tbody/cell.tsx +1 -1
- package/src/Table/util/header.ts +48 -2
- package/src/style/color.css +2 -0
- package/src/version.ts +1 -1
|
@@ -28,7 +28,8 @@ export declare class FormStore {
|
|
|
28
28
|
clearFields: (name?: Name[]) => void;
|
|
29
29
|
validateField: (name: Name, trigger?: TRIGGER) => Promise<ValidateMessage[]>;
|
|
30
30
|
validateFields: (names?: string[], trigger?: TRIGGER) => Promise<ValidateMessage[]>;
|
|
31
|
-
|
|
31
|
+
private getRelatedFieldNames;
|
|
32
|
+
refreshField: (newStore?: Store, relatedFieldNames?: Name[]) => void;
|
|
32
33
|
subscribe: (namePath?: NamePath, callback?: () => void) => (() => void);
|
|
33
34
|
private notifyWatchers;
|
|
34
35
|
registerGroupEntity: (id: string, entity: GroupEntity) => (() => void);
|
|
@@ -80,6 +80,7 @@ function move(array, from, to) {
|
|
|
80
80
|
return result;
|
|
81
81
|
}
|
|
82
82
|
var GLOBAL_WATCH_KEY = "__ALL__";
|
|
83
|
+
var isRelatedNamePath = (first, second) => first === second || first.startsWith(`${second}.`) || second.startsWith(`${first}.`);
|
|
83
84
|
var FormStore = class {
|
|
84
85
|
constructor() {
|
|
85
86
|
this.store = {};
|
|
@@ -170,10 +171,12 @@ var FormStore = class {
|
|
|
170
171
|
}
|
|
171
172
|
});
|
|
172
173
|
}
|
|
174
|
+
const changedKeys = Object.keys(newStore);
|
|
175
|
+
const relatedFieldNames = this.getRelatedFieldNames(changedKeys);
|
|
173
176
|
if (trigger === "onChange" || trigger === "onBlur" || trigger === "onSubmit") {
|
|
174
|
-
void this.validateFields(
|
|
177
|
+
void this.validateFields(relatedFieldNames, trigger);
|
|
175
178
|
}
|
|
176
|
-
this.refreshField(newStore);
|
|
179
|
+
this.refreshField(newStore, relatedFieldNames);
|
|
177
180
|
};
|
|
178
181
|
this.resetFields = (name) => {
|
|
179
182
|
var _a, _b;
|
|
@@ -281,16 +284,20 @@ var FormStore = class {
|
|
|
281
284
|
});
|
|
282
285
|
return err;
|
|
283
286
|
});
|
|
284
|
-
this.
|
|
287
|
+
this.getRelatedFieldNames = (changedKeys) => Array.from(this.fieldMap.keys()).filter(
|
|
288
|
+
(fieldName) => changedKeys.some(
|
|
289
|
+
(changedKey) => isRelatedNamePath(String(fieldName), changedKey)
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
this.refreshField = (newStore, relatedFieldNames) => {
|
|
285
293
|
if (newStore) {
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
this.notifyWatchers(key);
|
|
294
|
+
const changedKeys = Object.keys(newStore);
|
|
295
|
+
const fieldNames = relatedFieldNames != null ? relatedFieldNames : this.getRelatedFieldNames(changedKeys);
|
|
296
|
+
fieldNames.forEach((fieldName) => {
|
|
297
|
+
var _a;
|
|
298
|
+
(_a = this.fieldMap.get(fieldName)) == null ? void 0 : _a.onStoreChange();
|
|
293
299
|
});
|
|
300
|
+
this.notifyWatchers(changedKeys);
|
|
294
301
|
} else {
|
|
295
302
|
this.fieldEntities.forEach((entity) => {
|
|
296
303
|
entity == null ? void 0 : entity.onStoreChange();
|
|
@@ -308,15 +315,23 @@ var FormStore = class {
|
|
|
308
315
|
}
|
|
309
316
|
this.watchers.get(key).add(callback);
|
|
310
317
|
return () => {
|
|
311
|
-
|
|
312
|
-
|
|
318
|
+
const watchers = this.watchers.get(key);
|
|
319
|
+
watchers == null ? void 0 : watchers.delete(callback);
|
|
320
|
+
if ((watchers == null ? void 0 : watchers.size) === 0) {
|
|
321
|
+
this.watchers.delete(key);
|
|
322
|
+
}
|
|
313
323
|
};
|
|
314
324
|
};
|
|
315
|
-
this.notifyWatchers = (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
325
|
+
this.notifyWatchers = (changedKeys) => {
|
|
326
|
+
if (changedKeys) {
|
|
327
|
+
const keys = Array.isArray(changedKeys) ? changedKeys : [changedKeys];
|
|
328
|
+
const callbacks = /* @__PURE__ */ new Set();
|
|
329
|
+
this.watchers.forEach((watchers, watchedKey) => {
|
|
330
|
+
if (watchedKey === GLOBAL_WATCH_KEY || keys.some((changedKey) => isRelatedNamePath(watchedKey, changedKey))) {
|
|
331
|
+
watchers.forEach((callback) => callbacks.add(callback));
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
callbacks.forEach((callback) => callback());
|
|
320
335
|
} else {
|
|
321
336
|
this.watchers.forEach((set) => set.forEach((cb) => cb()));
|
|
322
337
|
}
|
|
@@ -76,7 +76,7 @@ function useColumns({
|
|
|
76
76
|
const tree = (0, import_header.injectSelectionExpand)(base, rowSelection, expandable);
|
|
77
77
|
const leaves = (0, import_header.flattenLeafColumns)(tree);
|
|
78
78
|
const wraped = (0, import_util.handleColumns)(leaves);
|
|
79
|
-
const rows = (0, import_header.parseHeaderRows)(tree);
|
|
79
|
+
const rows = (0, import_header.parseHeaderRows)(tree, wraped);
|
|
80
80
|
return { wrapedColumns: wraped, headerRows: rows };
|
|
81
81
|
}, [childColumns, columns, shouldRenderSelection, shouldRenderExpand]);
|
|
82
82
|
return {
|
|
@@ -49,6 +49,12 @@
|
|
|
49
49
|
background-color: var(--yee-table-head-cell-split-line-color, #eee);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
&-fixed-left,
|
|
54
|
+
&-fixed-right {
|
|
55
|
+
position: sticky;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
&-cell {
|
|
@@ -84,6 +90,16 @@
|
|
|
84
90
|
&-wrapper {
|
|
85
91
|
overflow: auto;
|
|
86
92
|
width: 100%;
|
|
93
|
+
|
|
94
|
+
&-scroll-left @{pls}-cell-fixed-left-last {
|
|
95
|
+
box-shadow: 6px 0 6px -4px
|
|
96
|
+
var(--yee-table-fixed-left-after-bs-color);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&-scroll-right @{pls}-cell-fixed-right-first {
|
|
100
|
+
box-shadow: -6px 0 6px -4px
|
|
101
|
+
var(--yee-table-fixed-right-after-bs-color);
|
|
102
|
+
}
|
|
87
103
|
}
|
|
88
104
|
|
|
89
105
|
> table {
|
|
@@ -101,10 +117,18 @@
|
|
|
101
117
|
}
|
|
102
118
|
}
|
|
103
119
|
|
|
120
|
+
&-row {
|
|
121
|
+
background-color: var(--yee-table-row-bg-color);
|
|
122
|
+
}
|
|
123
|
+
|
|
104
124
|
&-even-row {
|
|
105
125
|
background-color: var(--yee-table-even-row-bg-color);
|
|
106
126
|
}
|
|
107
127
|
|
|
128
|
+
&-odd-row {
|
|
129
|
+
background-color: var(--yee-table-odd-row-bg-color);
|
|
130
|
+
}
|
|
131
|
+
|
|
108
132
|
&-column-sorters {
|
|
109
133
|
display: inline-flex;
|
|
110
134
|
align-items: center;
|
|
@@ -137,7 +161,7 @@
|
|
|
137
161
|
&-fixed-left,
|
|
138
162
|
&-fixed-right {
|
|
139
163
|
position: sticky;
|
|
140
|
-
background-color:
|
|
164
|
+
background-color: var(--yee-table-fixed-column-bg-color);
|
|
141
165
|
}
|
|
142
166
|
}
|
|
143
167
|
|
|
@@ -163,17 +187,17 @@
|
|
|
163
187
|
}
|
|
164
188
|
}
|
|
165
189
|
|
|
166
|
-
&-odd-row {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
190
|
+
// &-odd-row {
|
|
191
|
+
// > @{pls}-cell {
|
|
192
|
+
// background-color: var(--yee-table-odd-row-bg-color);
|
|
193
|
+
// }
|
|
194
|
+
// }
|
|
171
195
|
|
|
172
|
-
&-even-row {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
196
|
+
// &-even-row {
|
|
197
|
+
// > @{pls}-cell {
|
|
198
|
+
// background-color: var(--yee-table-even-row-bg-color);
|
|
199
|
+
// }
|
|
200
|
+
// }
|
|
177
201
|
|
|
178
202
|
&-footer {
|
|
179
203
|
display: flex;
|
package/dist/cjs/Table/table.js
CHANGED
|
@@ -189,6 +189,28 @@ var Table = import_react.default.forwardRef((baseprops, ref) => {
|
|
|
189
189
|
onChange: onSelectionChange
|
|
190
190
|
} = (0, import_useSelection.default)({ pageData, dataSource, getRowKey, rowSelection, allKeys });
|
|
191
191
|
const prevSortersRef = (0, import_react.useRef)({});
|
|
192
|
+
const contentWrapperRef = (0, import_react.useRef)(null);
|
|
193
|
+
const contentRef = (0, import_react.useRef)(null);
|
|
194
|
+
const [horizontalScroll, setHorizontalScroll] = import_react.default.useState({
|
|
195
|
+
left: false,
|
|
196
|
+
right: false
|
|
197
|
+
});
|
|
198
|
+
const updateHorizontalScroll = import_react.default.useCallback(() => {
|
|
199
|
+
const wrapper = contentWrapperRef.current;
|
|
200
|
+
const content = contentRef.current;
|
|
201
|
+
if (!wrapper || !content)
|
|
202
|
+
return;
|
|
203
|
+
const scrollContainer = content.scrollWidth - content.clientWidth > 1 ? content : wrapper;
|
|
204
|
+
const maxScrollLeft = scrollContainer.scrollWidth - scrollContainer.clientWidth;
|
|
205
|
+
const hasHorizontalScroll = maxScrollLeft > 1;
|
|
206
|
+
const next = {
|
|
207
|
+
left: hasHorizontalScroll && scrollContainer.scrollLeft > 1,
|
|
208
|
+
right: hasHorizontalScroll && scrollContainer.scrollLeft < maxScrollLeft - 1
|
|
209
|
+
};
|
|
210
|
+
setHorizontalScroll(
|
|
211
|
+
(current2) => current2.left === next.left && current2.right === next.right ? current2 : next
|
|
212
|
+
);
|
|
213
|
+
}, []);
|
|
192
214
|
const onFilter = import_react.default.useCallback(
|
|
193
215
|
(...args) => {
|
|
194
216
|
onFilterInternal(...args);
|
|
@@ -229,6 +251,21 @@ var Table = import_react.default.forwardRef((baseprops, ref) => {
|
|
|
229
251
|
return;
|
|
230
252
|
}
|
|
231
253
|
}, [sorters, current, pageSize, pageData, sortedData, onChange]);
|
|
254
|
+
(0, import_react.useEffect)(() => {
|
|
255
|
+
updateHorizontalScroll();
|
|
256
|
+
const wrapper = contentWrapperRef.current;
|
|
257
|
+
const content = contentRef.current;
|
|
258
|
+
if (!wrapper || !content)
|
|
259
|
+
return void 0;
|
|
260
|
+
if (typeof ResizeObserver === "undefined") {
|
|
261
|
+
window.addEventListener("resize", updateHorizontalScroll);
|
|
262
|
+
return () => window.removeEventListener("resize", updateHorizontalScroll);
|
|
263
|
+
}
|
|
264
|
+
const resizeObserver = new ResizeObserver(updateHorizontalScroll);
|
|
265
|
+
resizeObserver.observe(wrapper);
|
|
266
|
+
resizeObserver.observe(content);
|
|
267
|
+
return () => resizeObserver.disconnect();
|
|
268
|
+
}, [updateHorizontalScroll, wrapedColumns, pageData, scroll == null ? void 0 : scroll.x]);
|
|
232
269
|
const renderHeader = () => {
|
|
233
270
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
234
271
|
import_header.default,
|
|
@@ -305,17 +342,30 @@ var Table = import_react.default.forwardRef((baseprops, ref) => {
|
|
|
305
342
|
},
|
|
306
343
|
/* @__PURE__ */ import_react.default.createElement("table", __spreadValues({}, tableProps), /* @__PURE__ */ import_react.default.createElement(import_col_group.default, { columns: wrapedColumns }), renderTHeader(), renderTBody(), renderTFooter())
|
|
307
344
|
);
|
|
308
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
345
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
309
346
|
"div",
|
|
310
347
|
{
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
[`${prefixCls}-
|
|
348
|
+
ref: contentWrapperRef,
|
|
349
|
+
className: (0, import_clsx.default)(`${prefixCls}-content-wrapper`, {
|
|
350
|
+
[`${prefixCls}-content-wrapper-scroll-left`]: horizontalScroll.left,
|
|
351
|
+
[`${prefixCls}-content-wrapper-scroll-right`]: horizontalScroll.right
|
|
314
352
|
}),
|
|
315
|
-
|
|
353
|
+
onScroll: updateHorizontalScroll
|
|
316
354
|
},
|
|
317
|
-
|
|
318
|
-
|
|
355
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
356
|
+
"div",
|
|
357
|
+
{
|
|
358
|
+
ref: contentRef,
|
|
359
|
+
className: (0, import_clsx.default)(`${prefixCls}-content`, {
|
|
360
|
+
[`${prefixCls}-${size}-size`]: size,
|
|
361
|
+
[`${prefixCls}-fixed-header`]: scroll == null ? void 0 : scroll.y
|
|
362
|
+
}),
|
|
363
|
+
style: { height: scroll == null ? void 0 : scroll.y, width: scroll == null ? void 0 : scroll.x },
|
|
364
|
+
onScroll: updateHorizontalScroll
|
|
365
|
+
},
|
|
366
|
+
table2
|
|
367
|
+
)
|
|
368
|
+
);
|
|
319
369
|
};
|
|
320
370
|
const renderFooter = () => {
|
|
321
371
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -95,7 +95,7 @@ var TableCell = (props) => {
|
|
|
95
95
|
{
|
|
96
96
|
[`${prefixCls}-cell-fixed-${fixed}`]: fixed,
|
|
97
97
|
[`${prefixCls}-cell-fixed-${fixed}-first`]: isFixedRightFirst,
|
|
98
|
-
[`${prefixCls}-fixed-${fixed}-last`]: isFixedLeftLast
|
|
98
|
+
[`${prefixCls}-cell-fixed-${fixed}-last`]: isFixedLeftLast
|
|
99
99
|
},
|
|
100
100
|
className
|
|
101
101
|
);
|
|
@@ -11,10 +11,12 @@ export declare function flattenLeafColumns(columns: WrapedColumnProps[], parentF
|
|
|
11
11
|
*
|
|
12
12
|
* - Pass 1 (DFS): place each column into the row matching its depth; a group's
|
|
13
13
|
* colSpan equals the sum of its children's colSpans.
|
|
14
|
+
* - Fixed metadata from the resolved leaf columns is reused by leaf cells and
|
|
15
|
+
* aggregated for group cells whose descendants share the same fixed side.
|
|
14
16
|
* - Pass 2: leaf cells (no sub-columns) get rowSpan = rowCount - rowIndex so
|
|
15
17
|
* they stretch down to the last header row; group cells keep rowSpan = 1.
|
|
16
18
|
*/
|
|
17
|
-
export declare function parseHeaderRows(rootColumns: WrapedColumnProps[]): HeaderCell[][];
|
|
19
|
+
export declare function parseHeaderRows(rootColumns: WrapedColumnProps[], resolvedLeafColumns?: WrapedColumnProps[]): HeaderCell[][];
|
|
18
20
|
/**
|
|
19
21
|
* Inject selection / expand columns into the top level of the column tree.
|
|
20
22
|
* `index` is a 1-based position among the top-level columns.
|
|
@@ -52,21 +52,48 @@ function flattenLeafColumns(columns, parentFixed) {
|
|
|
52
52
|
return [...list, __spreadProps(__spreadValues({}, column), { fixed })];
|
|
53
53
|
}, []);
|
|
54
54
|
}
|
|
55
|
-
function parseHeaderRows(rootColumns) {
|
|
55
|
+
function parseHeaderRows(rootColumns, resolvedLeafColumns = flattenLeafColumns(rootColumns)) {
|
|
56
56
|
const rows = [];
|
|
57
|
+
let leafIndex = 0;
|
|
57
58
|
const fillRowCells = (columns, rowIndex) => {
|
|
58
59
|
rows[rowIndex] = rows[rowIndex] || [];
|
|
59
60
|
let colSpanTotal = 0;
|
|
60
|
-
columns.filter(Boolean).forEach((
|
|
61
|
+
columns.filter(Boolean).forEach((sourceColumn) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
let column = sourceColumn;
|
|
64
|
+
const subColumns = sourceColumn.children;
|
|
65
|
+
const leafStartIndex = leafIndex;
|
|
61
66
|
const cell = {
|
|
62
67
|
column,
|
|
63
68
|
colSpan: 1,
|
|
64
69
|
rowSpan: 1
|
|
65
70
|
};
|
|
66
|
-
const subColumns = column.children;
|
|
67
71
|
if (subColumns && subColumns.length > 0) {
|
|
68
72
|
cell.colSpan = fillRowCells(subColumns, rowIndex + 1);
|
|
69
73
|
cell.hasSubColumns = true;
|
|
74
|
+
const groupLeaves = resolvedLeafColumns.slice(
|
|
75
|
+
leafStartIndex,
|
|
76
|
+
leafIndex
|
|
77
|
+
);
|
|
78
|
+
const fixed = (_a = groupLeaves[0]) == null ? void 0 : _a.fixed;
|
|
79
|
+
const isFixedGroup = (fixed === "left" || fixed === "right") && groupLeaves.every((leaf) => leaf.fixed === fixed);
|
|
80
|
+
if (isFixedGroup) {
|
|
81
|
+
const offsetLeaf = fixed === "left" ? groupLeaves[0] : groupLeaves[groupLeaves.length - 1];
|
|
82
|
+
const boundaryLeaf = fixed === "left" ? groupLeaves[groupLeaves.length - 1] : groupLeaves[0];
|
|
83
|
+
column = __spreadProps(__spreadValues({}, sourceColumn), {
|
|
84
|
+
fixed,
|
|
85
|
+
style: __spreadProps(__spreadValues({}, sourceColumn.style), {
|
|
86
|
+
[fixed]: (_b = offsetLeaf.style) == null ? void 0 : _b[fixed]
|
|
87
|
+
}),
|
|
88
|
+
isFixedLeftLast: fixed === "left" && boundaryLeaf.isFixedLeftLast,
|
|
89
|
+
isFixedRightFirst: fixed === "right" && boundaryLeaf.isFixedRightFirst
|
|
90
|
+
});
|
|
91
|
+
cell.column = column;
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
column = resolvedLeafColumns[leafIndex] || sourceColumn;
|
|
95
|
+
cell.column = column;
|
|
96
|
+
leafIndex += 1;
|
|
70
97
|
}
|
|
71
98
|
rows[rowIndex].push(cell);
|
|
72
99
|
colSpanTotal += cell.colSpan;
|
package/dist/cjs/style/color.css
CHANGED
|
@@ -848,6 +848,7 @@
|
|
|
848
848
|
--yee-table-thead-stripe-borderbottom-color: var(
|
|
849
849
|
--yee-table-thead-borderbottom-color
|
|
850
850
|
);
|
|
851
|
+
--yee-table-row-bg-color: var(--yee-color-bg-container);
|
|
851
852
|
--yee-table-odd-row-bg-color: var(--yee-color-bg-container);
|
|
852
853
|
--yee-table-even-row-bg-color: var(--yee-color-bg-head);
|
|
853
854
|
--yee-table-elevated-thead-stripe-borderbottom-color: var(
|
|
@@ -870,6 +871,7 @@
|
|
|
870
871
|
--yee-table-head-filter-active-color: var(--yee-primary-color);
|
|
871
872
|
--yee-table-fixed-left-after-bs-color: var(--yee-box-shadow-color);
|
|
872
873
|
--yee-table-fixed-right-after-bs-color: var(--yee-box-shadow-color);
|
|
874
|
+
--yee-table-fixed-column-bg-color: inherit;
|
|
873
875
|
--yee-table-filter-list-bg-color: var(--yee-color-bg-elevated);
|
|
874
876
|
--yee-table-tbody-tr-expanded-bg-color: var(--yee-color-bg-container);
|
|
875
877
|
--yee-table-elevated-tbody-tr-expanded-bg-color: var(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @rainbow-oh/yee-c CSS Variables
|
|
3
3
|
* Auto-generated, do not edit manually
|
|
4
|
-
* Generated on 2026-07-
|
|
4
|
+
* Generated on 2026-07-22T03:22:12.652Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/* ========== color.css ========== */
|
|
@@ -855,6 +855,7 @@
|
|
|
855
855
|
--yee-table-thead-stripe-borderbottom-color: var(
|
|
856
856
|
--yee-table-thead-borderbottom-color
|
|
857
857
|
);
|
|
858
|
+
--yee-table-row-bg-color: var(--yee-color-bg-container);
|
|
858
859
|
--yee-table-odd-row-bg-color: var(--yee-color-bg-container);
|
|
859
860
|
--yee-table-even-row-bg-color: var(--yee-color-bg-head);
|
|
860
861
|
--yee-table-elevated-thead-stripe-borderbottom-color: var(
|
|
@@ -877,6 +878,7 @@
|
|
|
877
878
|
--yee-table-head-filter-active-color: var(--yee-primary-color);
|
|
878
879
|
--yee-table-fixed-left-after-bs-color: var(--yee-box-shadow-color);
|
|
879
880
|
--yee-table-fixed-right-after-bs-color: var(--yee-box-shadow-color);
|
|
881
|
+
--yee-table-fixed-column-bg-color: inherit;
|
|
880
882
|
--yee-table-filter-list-bg-color: var(--yee-color-bg-elevated);
|
|
881
883
|
--yee-table-tbody-tr-expanded-bg-color: var(--yee-color-bg-container);
|
|
882
884
|
--yee-table-elevated-tbody-tr-expanded-bg-color: var(
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -28,7 +28,8 @@ export declare class FormStore {
|
|
|
28
28
|
clearFields: (name?: Name[]) => void;
|
|
29
29
|
validateField: (name: Name, trigger?: TRIGGER) => Promise<ValidateMessage[]>;
|
|
30
30
|
validateFields: (names?: string[], trigger?: TRIGGER) => Promise<ValidateMessage[]>;
|
|
31
|
-
|
|
31
|
+
private getRelatedFieldNames;
|
|
32
|
+
refreshField: (newStore?: Store, relatedFieldNames?: Name[]) => void;
|
|
32
33
|
subscribe: (namePath?: NamePath, callback?: () => void) => (() => void);
|
|
33
34
|
private notifyWatchers;
|
|
34
35
|
registerGroupEntity: (id: string, entity: GroupEntity) => (() => void);
|
|
@@ -34,6 +34,9 @@ function _move(array, from, to) {
|
|
|
34
34
|
return result;
|
|
35
35
|
}
|
|
36
36
|
var GLOBAL_WATCH_KEY = '__ALL__';
|
|
37
|
+
var isRelatedNamePath = function isRelatedNamePath(first, second) {
|
|
38
|
+
return first === second || first.startsWith("".concat(second, ".")) || second.startsWith("".concat(first, "."));
|
|
39
|
+
};
|
|
37
40
|
export var FormStore = /*#__PURE__*/function () {
|
|
38
41
|
function FormStore() {
|
|
39
42
|
var _this = this;
|
|
@@ -136,13 +139,15 @@ export var FormStore = /*#__PURE__*/function () {
|
|
|
136
139
|
}
|
|
137
140
|
});
|
|
138
141
|
}
|
|
142
|
+
var changedKeys = Object.keys(newStore);
|
|
143
|
+
var relatedFieldNames = _this.getRelatedFieldNames(changedKeys);
|
|
139
144
|
|
|
140
145
|
// Validate on onChange and onBlur (async — fire-and-forget so setFieldsValue
|
|
141
146
|
// stays synchronous for its callers; results surface via onStoreChange).
|
|
142
147
|
if (trigger === 'onChange' || trigger === 'onBlur' || trigger === 'onSubmit') {
|
|
143
|
-
void _this.validateFields(
|
|
148
|
+
void _this.validateFields(relatedFieldNames, trigger);
|
|
144
149
|
}
|
|
145
|
-
_this.refreshField(newStore);
|
|
150
|
+
_this.refreshField(newStore, relatedFieldNames);
|
|
146
151
|
});
|
|
147
152
|
_defineProperty(this, "resetFields", function (name) {
|
|
148
153
|
var _this$callbacks4, _this$callbacks4$onRe;
|
|
@@ -322,16 +327,22 @@ export var FormStore = /*#__PURE__*/function () {
|
|
|
322
327
|
}
|
|
323
328
|
}, _callee2);
|
|
324
329
|
})));
|
|
325
|
-
_defineProperty(this, "
|
|
330
|
+
_defineProperty(this, "getRelatedFieldNames", function (changedKeys) {
|
|
331
|
+
return Array.from(_this.fieldMap.keys()).filter(function (fieldName) {
|
|
332
|
+
return changedKeys.some(function (changedKey) {
|
|
333
|
+
return isRelatedNamePath(String(fieldName), changedKey);
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
_defineProperty(this, "refreshField", function (newStore, relatedFieldNames) {
|
|
326
338
|
if (newStore) {
|
|
327
|
-
var
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
_this.notifyWatchers(key);
|
|
339
|
+
var changedKeys = Object.keys(newStore);
|
|
340
|
+
var fieldNames = relatedFieldNames !== null && relatedFieldNames !== void 0 ? relatedFieldNames : _this.getRelatedFieldNames(changedKeys);
|
|
341
|
+
fieldNames.forEach(function (fieldName) {
|
|
342
|
+
var _this$fieldMap$get;
|
|
343
|
+
(_this$fieldMap$get = _this.fieldMap.get(fieldName)) === null || _this$fieldMap$get === void 0 || _this$fieldMap$get.onStoreChange();
|
|
334
344
|
});
|
|
345
|
+
_this.notifyWatchers(changedKeys);
|
|
335
346
|
} else {
|
|
336
347
|
_this.fieldEntities.forEach(function (entity) {
|
|
337
348
|
entity === null || entity === void 0 || entity.onStoreChange();
|
|
@@ -347,18 +358,28 @@ export var FormStore = /*#__PURE__*/function () {
|
|
|
347
358
|
}
|
|
348
359
|
_this.watchers.get(key).add(callback);
|
|
349
360
|
return function () {
|
|
350
|
-
var _this
|
|
351
|
-
|
|
361
|
+
var watchers = _this.watchers.get(key);
|
|
362
|
+
watchers === null || watchers === void 0 || watchers.delete(callback);
|
|
363
|
+
if ((watchers === null || watchers === void 0 ? void 0 : watchers.size) === 0) {
|
|
364
|
+
_this.watchers.delete(key);
|
|
365
|
+
}
|
|
352
366
|
};
|
|
353
367
|
});
|
|
354
|
-
_defineProperty(this, "notifyWatchers", function (
|
|
355
|
-
if (
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
368
|
+
_defineProperty(this, "notifyWatchers", function (changedKeys) {
|
|
369
|
+
if (changedKeys) {
|
|
370
|
+
var keys = Array.isArray(changedKeys) ? changedKeys : [changedKeys];
|
|
371
|
+
var callbacks = new Set();
|
|
372
|
+
_this.watchers.forEach(function (watchers, watchedKey) {
|
|
373
|
+
if (watchedKey === GLOBAL_WATCH_KEY || keys.some(function (changedKey) {
|
|
374
|
+
return isRelatedNamePath(watchedKey, changedKey);
|
|
375
|
+
})) {
|
|
376
|
+
watchers.forEach(function (callback) {
|
|
377
|
+
return callbacks.add(callback);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
359
380
|
});
|
|
360
|
-
|
|
361
|
-
return
|
|
381
|
+
callbacks.forEach(function (callback) {
|
|
382
|
+
return callback();
|
|
362
383
|
});
|
|
363
384
|
} else {
|
|
364
385
|
_this.watchers.forEach(function (set) {
|
|
@@ -37,7 +37,7 @@ export default function useColumns(_ref) {
|
|
|
37
37
|
var tree = injectSelectionExpand(base, rowSelection, expandable);
|
|
38
38
|
var leaves = flattenLeafColumns(tree);
|
|
39
39
|
var wraped = handleColumns(leaves);
|
|
40
|
-
var rows = parseHeaderRows(tree);
|
|
40
|
+
var rows = parseHeaderRows(tree, wraped);
|
|
41
41
|
return {
|
|
42
42
|
wrapedColumns: wraped,
|
|
43
43
|
headerRows: rows
|
|
@@ -49,6 +49,12 @@
|
|
|
49
49
|
background-color: var(--yee-table-head-cell-split-line-color, #eee);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
&-fixed-left,
|
|
54
|
+
&-fixed-right {
|
|
55
|
+
position: sticky;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
&-cell {
|
|
@@ -84,6 +90,16 @@
|
|
|
84
90
|
&-wrapper {
|
|
85
91
|
overflow: auto;
|
|
86
92
|
width: 100%;
|
|
93
|
+
|
|
94
|
+
&-scroll-left @{pls}-cell-fixed-left-last {
|
|
95
|
+
box-shadow: 6px 0 6px -4px
|
|
96
|
+
var(--yee-table-fixed-left-after-bs-color);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&-scroll-right @{pls}-cell-fixed-right-first {
|
|
100
|
+
box-shadow: -6px 0 6px -4px
|
|
101
|
+
var(--yee-table-fixed-right-after-bs-color);
|
|
102
|
+
}
|
|
87
103
|
}
|
|
88
104
|
|
|
89
105
|
> table {
|
|
@@ -101,10 +117,18 @@
|
|
|
101
117
|
}
|
|
102
118
|
}
|
|
103
119
|
|
|
120
|
+
&-row {
|
|
121
|
+
background-color: var(--yee-table-row-bg-color);
|
|
122
|
+
}
|
|
123
|
+
|
|
104
124
|
&-even-row {
|
|
105
125
|
background-color: var(--yee-table-even-row-bg-color);
|
|
106
126
|
}
|
|
107
127
|
|
|
128
|
+
&-odd-row {
|
|
129
|
+
background-color: var(--yee-table-odd-row-bg-color);
|
|
130
|
+
}
|
|
131
|
+
|
|
108
132
|
&-column-sorters {
|
|
109
133
|
display: inline-flex;
|
|
110
134
|
align-items: center;
|
|
@@ -137,7 +161,7 @@
|
|
|
137
161
|
&-fixed-left,
|
|
138
162
|
&-fixed-right {
|
|
139
163
|
position: sticky;
|
|
140
|
-
background-color:
|
|
164
|
+
background-color: var(--yee-table-fixed-column-bg-color);
|
|
141
165
|
}
|
|
142
166
|
}
|
|
143
167
|
|
|
@@ -163,17 +187,17 @@
|
|
|
163
187
|
}
|
|
164
188
|
}
|
|
165
189
|
|
|
166
|
-
&-odd-row {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
190
|
+
// &-odd-row {
|
|
191
|
+
// > @{pls}-cell {
|
|
192
|
+
// background-color: var(--yee-table-odd-row-bg-color);
|
|
193
|
+
// }
|
|
194
|
+
// }
|
|
171
195
|
|
|
172
|
-
&-even-row {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
196
|
+
// &-even-row {
|
|
197
|
+
// > @{pls}-cell {
|
|
198
|
+
// background-color: var(--yee-table-even-row-bg-color);
|
|
199
|
+
// }
|
|
200
|
+
// }
|
|
177
201
|
|
|
178
202
|
&-footer {
|
|
179
203
|
display: flex;
|