@sia.soul/sia-react-ui 0.1.21 → 0.1.22
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/core.css +11 -4
- package/dist/index.cjs +39 -4
- package/dist/index.css +11 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +39 -4
- package/package.json +1 -1
package/dist/core.css
CHANGED
|
@@ -4757,15 +4757,22 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4757
4757
|
display: flex;
|
|
4758
4758
|
flex-wrap: wrap;
|
|
4759
4759
|
align-items: center;
|
|
4760
|
-
gap: 12px;
|
|
4760
|
+
gap: var(--sia-query-field-gap, 12px);
|
|
4761
4761
|
padding-top: 8px;
|
|
4762
4762
|
}
|
|
4763
4763
|
.sia-query-form__field {
|
|
4764
|
-
|
|
4765
|
-
|
|
4764
|
+
--sia-query-item-width: var(--sia-query-field-width, 220px);
|
|
4765
|
+
flex: 0 1 var(--sia-query-item-width);
|
|
4766
|
+
width: var(--sia-query-item-width);
|
|
4766
4767
|
min-width: 0;
|
|
4767
4768
|
max-width: 100%;
|
|
4768
4769
|
}
|
|
4770
|
+
.sia-query-form__field:has(.sia-picker-range-control, .sia-time-range, .sia-select-date-range, .sia-space-compact:not(.sia-space-compact--vertical) > :nth-child(2)) {
|
|
4771
|
+
--sia-query-item-width: calc(var(--sia-query-field-width, 220px) + var(--sia-query-field-width, 220px) + var(--sia-query-field-gap, 12px));
|
|
4772
|
+
}
|
|
4773
|
+
.sia-query-form__field :is(.sia-picker-range-control, .sia-time-range, .sia-select-date-range, .sia-space-compact:not(.sia-space-compact--vertical)) {
|
|
4774
|
+
width: 100%;
|
|
4775
|
+
}
|
|
4769
4776
|
.sia-query-form__field[hidden] {
|
|
4770
4777
|
display: none;
|
|
4771
4778
|
}
|
|
@@ -4848,7 +4855,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4848
4855
|
@media (max-width: 600px) {
|
|
4849
4856
|
.sia-query-form__fields.is-collapsed > .sia-query-form__field {
|
|
4850
4857
|
flex-basis: auto !important;
|
|
4851
|
-
width: var(--sia-query-
|
|
4858
|
+
width: var(--sia-query-item-width) !important;
|
|
4852
4859
|
}
|
|
4853
4860
|
}
|
|
4854
4861
|
.sia-query-form__quick > .sia-badge:has(.sia-badge__count) {
|
package/dist/index.cjs
CHANGED
|
@@ -11061,6 +11061,7 @@ function isInteractiveTableTarget(target) {
|
|
|
11061
11061
|
function createCellSelectionPlugin(options = {}) {
|
|
11062
11062
|
let dragMode = null;
|
|
11063
11063
|
let dragAnchor = null;
|
|
11064
|
+
let textCell = null;
|
|
11064
11065
|
let headerDragAnchorKey = null;
|
|
11065
11066
|
let snapshotCache = null;
|
|
11066
11067
|
let latestContext = null;
|
|
@@ -11362,12 +11363,17 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11362
11363
|
return;
|
|
11363
11364
|
}
|
|
11364
11365
|
if (!isSelectable(row, column, context)) return;
|
|
11365
|
-
event.preventDefault();
|
|
11366
11366
|
window.getSelection()?.removeAllRanges();
|
|
11367
11367
|
focusTable(event.currentTarget);
|
|
11368
11368
|
const address = { rowKey: row.key, columnKey: column.key };
|
|
11369
|
-
|
|
11370
|
-
|
|
11369
|
+
const extendRange = event.shiftKey && context.state.range;
|
|
11370
|
+
dragAnchor = extendRange ? extendRange.anchor : address;
|
|
11371
|
+
dragMode = extendRange ? "cells" : "text";
|
|
11372
|
+
textCell = extendRange ? null : event.currentTarget;
|
|
11373
|
+
if (extendRange) {
|
|
11374
|
+
event.preventDefault();
|
|
11375
|
+
window.getSelection()?.removeAllRanges();
|
|
11376
|
+
}
|
|
11371
11377
|
setSelection(context, { anchor: dragAnchor, focus: address });
|
|
11372
11378
|
},
|
|
11373
11379
|
onCellPointerMove(row, column, event, context) {
|
|
@@ -11375,6 +11381,7 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11375
11381
|
if ((event.buttons & 1) === 0) {
|
|
11376
11382
|
dragMode = null;
|
|
11377
11383
|
dragAnchor = null;
|
|
11384
|
+
textCell = null;
|
|
11378
11385
|
return;
|
|
11379
11386
|
}
|
|
11380
11387
|
if (dragMode === "rows") {
|
|
@@ -11384,6 +11391,12 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11384
11391
|
return;
|
|
11385
11392
|
}
|
|
11386
11393
|
if (!isSelectable(row, column, context)) return;
|
|
11394
|
+
if (dragMode === "text") {
|
|
11395
|
+
if (sameCellAddress(dragAnchor, { rowKey: row.key, columnKey: column.key })) return;
|
|
11396
|
+
dragMode = "cells";
|
|
11397
|
+
textCell = null;
|
|
11398
|
+
focusTable(event.currentTarget);
|
|
11399
|
+
}
|
|
11387
11400
|
event.preventDefault();
|
|
11388
11401
|
window.getSelection()?.removeAllRanges();
|
|
11389
11402
|
setSelection(context, {
|
|
@@ -11417,14 +11430,29 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11417
11430
|
},
|
|
11418
11431
|
onMount() {
|
|
11419
11432
|
const stopDragging = () => {
|
|
11433
|
+
constrainTextSelection();
|
|
11420
11434
|
dragMode = null;
|
|
11421
11435
|
dragAnchor = null;
|
|
11436
|
+
textCell = null;
|
|
11422
11437
|
headerDragAnchorKey = null;
|
|
11423
11438
|
};
|
|
11439
|
+
const constrainTextSelection = () => {
|
|
11440
|
+
if (!dragMode) return;
|
|
11441
|
+
const selection = window.getSelection();
|
|
11442
|
+
if (!selection || selection.isCollapsed) return;
|
|
11443
|
+
if (dragMode !== "text" || !textCell?.contains(selection.anchorNode) || !textCell.contains(selection.focusNode)) {
|
|
11444
|
+
selection.removeAllRanges();
|
|
11445
|
+
}
|
|
11446
|
+
};
|
|
11447
|
+
const handleSelectStart = (event) => {
|
|
11448
|
+
if (dragMode && dragMode !== "text") event.preventDefault();
|
|
11449
|
+
};
|
|
11424
11450
|
const handleCopy = (event) => {
|
|
11425
11451
|
const context = latestContext;
|
|
11426
11452
|
if (options.copyable === false || !context || !activeRoot || !activeRoot.contains(document.activeElement) || isInteractiveTableTarget(document.activeElement))
|
|
11427
11453
|
return;
|
|
11454
|
+
const selection = window.getSelection();
|
|
11455
|
+
if (selection && !selection.isCollapsed && selection.toString()) return;
|
|
11428
11456
|
const text = copyText(context);
|
|
11429
11457
|
if (!text) return;
|
|
11430
11458
|
event.preventDefault();
|
|
@@ -11432,11 +11460,18 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11432
11460
|
options.onCopy?.(text, selectedCells(context));
|
|
11433
11461
|
};
|
|
11434
11462
|
window.addEventListener("pointerup", stopDragging);
|
|
11463
|
+
window.addEventListener("pointercancel", stopDragging);
|
|
11435
11464
|
window.addEventListener("blur", stopDragging);
|
|
11465
|
+
document.addEventListener("selectionchange", constrainTextSelection);
|
|
11466
|
+
document.addEventListener("selectstart", handleSelectStart);
|
|
11436
11467
|
document.addEventListener("copy", handleCopy);
|
|
11437
11468
|
return () => {
|
|
11469
|
+
stopDragging();
|
|
11438
11470
|
window.removeEventListener("pointerup", stopDragging);
|
|
11471
|
+
window.removeEventListener("pointercancel", stopDragging);
|
|
11439
11472
|
window.removeEventListener("blur", stopDragging);
|
|
11473
|
+
document.removeEventListener("selectionchange", constrainTextSelection);
|
|
11474
|
+
document.removeEventListener("selectstart", handleSelectStart);
|
|
11440
11475
|
document.removeEventListener("copy", handleCopy);
|
|
11441
11476
|
};
|
|
11442
11477
|
},
|
|
@@ -22145,7 +22180,7 @@ function QueryForm({
|
|
|
22145
22180
|
{
|
|
22146
22181
|
className: "sia-query-form__field",
|
|
22147
22182
|
hidden: collapsed && index >= Math.min(limit, fittingCount),
|
|
22148
|
-
style: entry.width !== void 0 ? {
|
|
22183
|
+
style: entry.width !== void 0 ? { "--sia-query-item-width": typeof entry.width === "number" ? `${entry.width}px` : entry.width } : void 0,
|
|
22149
22184
|
children: entry.content
|
|
22150
22185
|
},
|
|
22151
22186
|
entry.key
|
package/dist/index.css
CHANGED
|
@@ -4757,15 +4757,22 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4757
4757
|
display: flex;
|
|
4758
4758
|
flex-wrap: wrap;
|
|
4759
4759
|
align-items: center;
|
|
4760
|
-
gap: 12px;
|
|
4760
|
+
gap: var(--sia-query-field-gap, 12px);
|
|
4761
4761
|
padding-top: 8px;
|
|
4762
4762
|
}
|
|
4763
4763
|
.sia-query-form__field {
|
|
4764
|
-
|
|
4765
|
-
|
|
4764
|
+
--sia-query-item-width: var(--sia-query-field-width, 220px);
|
|
4765
|
+
flex: 0 1 var(--sia-query-item-width);
|
|
4766
|
+
width: var(--sia-query-item-width);
|
|
4766
4767
|
min-width: 0;
|
|
4767
4768
|
max-width: 100%;
|
|
4768
4769
|
}
|
|
4770
|
+
.sia-query-form__field:has(.sia-picker-range-control, .sia-time-range, .sia-select-date-range, .sia-space-compact:not(.sia-space-compact--vertical) > :nth-child(2)) {
|
|
4771
|
+
--sia-query-item-width: calc(var(--sia-query-field-width, 220px) + var(--sia-query-field-width, 220px) + var(--sia-query-field-gap, 12px));
|
|
4772
|
+
}
|
|
4773
|
+
.sia-query-form__field :is(.sia-picker-range-control, .sia-time-range, .sia-select-date-range, .sia-space-compact:not(.sia-space-compact--vertical)) {
|
|
4774
|
+
width: 100%;
|
|
4775
|
+
}
|
|
4769
4776
|
.sia-query-form__field[hidden] {
|
|
4770
4777
|
display: none;
|
|
4771
4778
|
}
|
|
@@ -4848,7 +4855,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4848
4855
|
@media (max-width: 600px) {
|
|
4849
4856
|
.sia-query-form__fields.is-collapsed > .sia-query-form__field {
|
|
4850
4857
|
flex-basis: auto !important;
|
|
4851
|
-
width: var(--sia-query-
|
|
4858
|
+
width: var(--sia-query-item-width) !important;
|
|
4852
4859
|
}
|
|
4853
4860
|
}
|
|
4854
4861
|
.sia-query-form__quick > .sia-badge:has(.sia-badge__count) {
|
package/dist/index.d.cts
CHANGED
|
@@ -3003,7 +3003,7 @@ declare const InputSelect: react.ForwardRefExoticComponent<InputSelectProps & re
|
|
|
3003
3003
|
interface QueryFormField extends FormItemProps {
|
|
3004
3004
|
/** 字段布局的稳定唯一标识;用于 React 渲染,不替代 Form.Item 的 name 字段路径。 */
|
|
3005
3005
|
key: string;
|
|
3006
|
-
/**
|
|
3006
|
+
/** 字段占用宽度,优先于自动布局。未指定时普通控件占一列,日期/时间区间及横向组合控件占两列(含列间距)。 */
|
|
3007
3007
|
width?: number | string;
|
|
3008
3008
|
}
|
|
3009
3009
|
/** 预设或已保存的快捷查询,包含名称、条件、颜色和可选数量徽标。 */
|
|
@@ -3046,7 +3046,7 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
|
|
|
3046
3046
|
*/
|
|
3047
3047
|
loading?: boolean;
|
|
3048
3048
|
/**
|
|
3049
|
-
*
|
|
3049
|
+
* 单列查询字段的默认宽度,数值单位为像素,可传 CSS 尺寸字符串。区间及横向组合控件默认为两倍此宽度加列间距;列间距可通过 --sia-query-field-gap 调整(默认 12px)。
|
|
3050
3050
|
* @defaultValue 220
|
|
3051
3051
|
*/
|
|
3052
3052
|
fieldWidth?: number | string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3003,7 +3003,7 @@ declare const InputSelect: react.ForwardRefExoticComponent<InputSelectProps & re
|
|
|
3003
3003
|
interface QueryFormField extends FormItemProps {
|
|
3004
3004
|
/** 字段布局的稳定唯一标识;用于 React 渲染,不替代 Form.Item 的 name 字段路径。 */
|
|
3005
3005
|
key: string;
|
|
3006
|
-
/**
|
|
3006
|
+
/** 字段占用宽度,优先于自动布局。未指定时普通控件占一列,日期/时间区间及横向组合控件占两列(含列间距)。 */
|
|
3007
3007
|
width?: number | string;
|
|
3008
3008
|
}
|
|
3009
3009
|
/** 预设或已保存的快捷查询,包含名称、条件、颜色和可选数量徽标。 */
|
|
@@ -3046,7 +3046,7 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
|
|
|
3046
3046
|
*/
|
|
3047
3047
|
loading?: boolean;
|
|
3048
3048
|
/**
|
|
3049
|
-
*
|
|
3049
|
+
* 单列查询字段的默认宽度,数值单位为像素,可传 CSS 尺寸字符串。区间及横向组合控件默认为两倍此宽度加列间距;列间距可通过 --sia-query-field-gap 调整(默认 12px)。
|
|
3050
3050
|
* @defaultValue 220
|
|
3051
3051
|
*/
|
|
3052
3052
|
fieldWidth?: number | string;
|
package/dist/index.js
CHANGED
|
@@ -4838,6 +4838,7 @@ function isInteractiveTableTarget(target) {
|
|
|
4838
4838
|
function createCellSelectionPlugin(options = {}) {
|
|
4839
4839
|
let dragMode = null;
|
|
4840
4840
|
let dragAnchor = null;
|
|
4841
|
+
let textCell = null;
|
|
4841
4842
|
let headerDragAnchorKey = null;
|
|
4842
4843
|
let snapshotCache = null;
|
|
4843
4844
|
let latestContext = null;
|
|
@@ -5139,12 +5140,17 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5139
5140
|
return;
|
|
5140
5141
|
}
|
|
5141
5142
|
if (!isSelectable(row, column, context)) return;
|
|
5142
|
-
event.preventDefault();
|
|
5143
5143
|
window.getSelection()?.removeAllRanges();
|
|
5144
5144
|
focusTable(event.currentTarget);
|
|
5145
5145
|
const address = { rowKey: row.key, columnKey: column.key };
|
|
5146
|
-
|
|
5147
|
-
|
|
5146
|
+
const extendRange = event.shiftKey && context.state.range;
|
|
5147
|
+
dragAnchor = extendRange ? extendRange.anchor : address;
|
|
5148
|
+
dragMode = extendRange ? "cells" : "text";
|
|
5149
|
+
textCell = extendRange ? null : event.currentTarget;
|
|
5150
|
+
if (extendRange) {
|
|
5151
|
+
event.preventDefault();
|
|
5152
|
+
window.getSelection()?.removeAllRanges();
|
|
5153
|
+
}
|
|
5148
5154
|
setSelection(context, { anchor: dragAnchor, focus: address });
|
|
5149
5155
|
},
|
|
5150
5156
|
onCellPointerMove(row, column, event, context) {
|
|
@@ -5152,6 +5158,7 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5152
5158
|
if ((event.buttons & 1) === 0) {
|
|
5153
5159
|
dragMode = null;
|
|
5154
5160
|
dragAnchor = null;
|
|
5161
|
+
textCell = null;
|
|
5155
5162
|
return;
|
|
5156
5163
|
}
|
|
5157
5164
|
if (dragMode === "rows") {
|
|
@@ -5161,6 +5168,12 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5161
5168
|
return;
|
|
5162
5169
|
}
|
|
5163
5170
|
if (!isSelectable(row, column, context)) return;
|
|
5171
|
+
if (dragMode === "text") {
|
|
5172
|
+
if (sameCellAddress(dragAnchor, { rowKey: row.key, columnKey: column.key })) return;
|
|
5173
|
+
dragMode = "cells";
|
|
5174
|
+
textCell = null;
|
|
5175
|
+
focusTable(event.currentTarget);
|
|
5176
|
+
}
|
|
5164
5177
|
event.preventDefault();
|
|
5165
5178
|
window.getSelection()?.removeAllRanges();
|
|
5166
5179
|
setSelection(context, {
|
|
@@ -5194,14 +5207,29 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5194
5207
|
},
|
|
5195
5208
|
onMount() {
|
|
5196
5209
|
const stopDragging = () => {
|
|
5210
|
+
constrainTextSelection();
|
|
5197
5211
|
dragMode = null;
|
|
5198
5212
|
dragAnchor = null;
|
|
5213
|
+
textCell = null;
|
|
5199
5214
|
headerDragAnchorKey = null;
|
|
5200
5215
|
};
|
|
5216
|
+
const constrainTextSelection = () => {
|
|
5217
|
+
if (!dragMode) return;
|
|
5218
|
+
const selection = window.getSelection();
|
|
5219
|
+
if (!selection || selection.isCollapsed) return;
|
|
5220
|
+
if (dragMode !== "text" || !textCell?.contains(selection.anchorNode) || !textCell.contains(selection.focusNode)) {
|
|
5221
|
+
selection.removeAllRanges();
|
|
5222
|
+
}
|
|
5223
|
+
};
|
|
5224
|
+
const handleSelectStart = (event) => {
|
|
5225
|
+
if (dragMode && dragMode !== "text") event.preventDefault();
|
|
5226
|
+
};
|
|
5201
5227
|
const handleCopy = (event) => {
|
|
5202
5228
|
const context = latestContext;
|
|
5203
5229
|
if (options.copyable === false || !context || !activeRoot || !activeRoot.contains(document.activeElement) || isInteractiveTableTarget(document.activeElement))
|
|
5204
5230
|
return;
|
|
5231
|
+
const selection = window.getSelection();
|
|
5232
|
+
if (selection && !selection.isCollapsed && selection.toString()) return;
|
|
5205
5233
|
const text = copyText(context);
|
|
5206
5234
|
if (!text) return;
|
|
5207
5235
|
event.preventDefault();
|
|
@@ -5209,11 +5237,18 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5209
5237
|
options.onCopy?.(text, selectedCells(context));
|
|
5210
5238
|
};
|
|
5211
5239
|
window.addEventListener("pointerup", stopDragging);
|
|
5240
|
+
window.addEventListener("pointercancel", stopDragging);
|
|
5212
5241
|
window.addEventListener("blur", stopDragging);
|
|
5242
|
+
document.addEventListener("selectionchange", constrainTextSelection);
|
|
5243
|
+
document.addEventListener("selectstart", handleSelectStart);
|
|
5213
5244
|
document.addEventListener("copy", handleCopy);
|
|
5214
5245
|
return () => {
|
|
5246
|
+
stopDragging();
|
|
5215
5247
|
window.removeEventListener("pointerup", stopDragging);
|
|
5248
|
+
window.removeEventListener("pointercancel", stopDragging);
|
|
5216
5249
|
window.removeEventListener("blur", stopDragging);
|
|
5250
|
+
document.removeEventListener("selectionchange", constrainTextSelection);
|
|
5251
|
+
document.removeEventListener("selectstart", handleSelectStart);
|
|
5217
5252
|
document.removeEventListener("copy", handleCopy);
|
|
5218
5253
|
};
|
|
5219
5254
|
},
|
|
@@ -8341,7 +8376,7 @@ function QueryForm({
|
|
|
8341
8376
|
{
|
|
8342
8377
|
className: "sia-query-form__field",
|
|
8343
8378
|
hidden: collapsed && index >= Math.min(limit, fittingCount),
|
|
8344
|
-
style: entry.width !== void 0 ? {
|
|
8379
|
+
style: entry.width !== void 0 ? { "--sia-query-item-width": typeof entry.width === "number" ? `${entry.width}px` : entry.width } : void 0,
|
|
8345
8380
|
children: entry.content
|
|
8346
8381
|
},
|
|
8347
8382
|
entry.key
|