@macrostrat/data-sheet 4.0.0-dev3 → 4.0.1
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 +56 -0
- package/README.md +44 -0
- package/dist/actions/builtin.cjs +36 -5
- package/dist/actions/builtin.cjs.map +1 -1
- package/dist/actions/builtin.d.ts +3 -2
- package/dist/actions/builtin.js +36 -5
- package/dist/actions/builtin.js.map +1 -1
- package/dist/actions/column-controls.cjs +149 -0
- package/dist/actions/column-controls.cjs.map +1 -0
- package/dist/actions/column-controls.d.ts +11 -0
- package/dist/actions/column-controls.js +147 -0
- package/dist/actions/column-controls.js.map +1 -0
- package/dist/actions/column-filter.cjs +68 -0
- package/dist/actions/column-filter.cjs.map +1 -0
- package/dist/actions/column-filter.d.ts +11 -0
- package/dist/actions/column-filter.js +66 -0
- package/dist/actions/column-filter.js.map +1 -0
- package/dist/actions/edit-actions.cjs +42 -0
- package/dist/actions/edit-actions.cjs.map +1 -0
- package/dist/actions/edit-actions.d.ts +14 -0
- package/dist/actions/edit-actions.js +42 -0
- package/dist/actions/edit-actions.js.map +1 -0
- package/dist/actions/filters.cjs +39 -23
- package/dist/actions/filters.cjs.map +1 -1
- package/dist/actions/filters.d.ts +6 -3
- package/dist/actions/filters.js +41 -25
- package/dist/actions/filters.js.map +1 -1
- package/dist/actions/index.d.ts +4 -0
- package/dist/actions/selection.cjs +51 -32
- package/dist/actions/selection.cjs.map +1 -1
- package/dist/actions/selection.d.ts +3 -7
- package/dist/actions/selection.js +51 -32
- package/dist/actions/selection.js.map +1 -1
- package/dist/actions/table-controls.cjs +41 -0
- package/dist/actions/table-controls.cjs.map +1 -0
- package/dist/actions/table-controls.d.ts +4 -0
- package/dist/actions/table-controls.js +39 -0
- package/dist/actions/table-controls.js.map +1 -0
- package/dist/actions/toolbar.cjs +69 -10
- package/dist/actions/toolbar.cjs.map +1 -1
- package/dist/actions/toolbar.d.ts +9 -6
- package/dist/actions/toolbar.js +69 -10
- package/dist/actions/toolbar.js.map +1 -1
- package/dist/actions/toolbar.module.sass.cjs +12 -7
- package/dist/actions/toolbar.module.sass.cjs.map +1 -1
- package/dist/actions/toolbar.module.sass.js +12 -7
- package/dist/actions/toolbar.module.sass.js.map +1 -1
- package/dist/actions/types.d.ts +49 -4
- package/dist/cell-renderer.cjs +150 -14
- package/dist/cell-renderer.cjs.map +1 -1
- package/dist/cell-renderer.d.ts +1 -1
- package/dist/cell-renderer.js +151 -15
- package/dist/cell-renderer.js.map +1 -1
- package/dist/components/cell-detail.cjs +24 -0
- package/dist/components/cell-detail.cjs.map +1 -0
- package/dist/components/cell-detail.d.ts +12 -0
- package/dist/components/cell-detail.js +24 -0
- package/dist/components/cell-detail.js.map +1 -0
- package/dist/components/editor-popup.cjs +28 -24
- package/dist/components/editor-popup.cjs.map +1 -1
- package/dist/components/editor-popup.js +29 -25
- package/dist/components/editor-popup.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/text-areas.cjs +51 -7
- package/dist/components/text-areas.cjs.map +1 -1
- package/dist/components/text-areas.d.ts +4 -1
- package/dist/components/text-areas.js +51 -7
- package/dist/components/text-areas.js.map +1 -1
- package/dist/components/view-info.cjs +46 -9
- package/dist/components/view-info.cjs.map +1 -1
- package/dist/components/view-info.d.ts +5 -1
- package/dist/components/view-info.js +47 -10
- package/dist/components/view-info.js.map +1 -1
- package/dist/core.cjs +167 -73
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +53 -6
- package/dist/core.js +169 -75
- package/dist/core.js.map +1 -1
- package/dist/data-sheet.css +72 -123
- package/dist/filters/operators.cjs +91 -0
- package/dist/filters/operators.cjs.map +1 -0
- package/dist/filters/operators.d.ts +17 -0
- package/dist/filters/operators.js +91 -0
- package/dist/filters/operators.js.map +1 -0
- package/dist/index.cjs +38 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +44 -16
- package/dist/index.js.map +1 -1
- package/dist/main.module.sass.cjs +13 -12
- package/dist/main.module.sass.cjs.map +1 -1
- package/dist/main.module.sass.js +13 -12
- package/dist/main.module.sass.js.map +1 -1
- package/dist/postgrest-table/data-loaders.cjs +255 -146
- package/dist/postgrest-table/data-loaders.cjs.map +1 -1
- package/dist/postgrest-table/data-loaders.d.ts +144 -46
- package/dist/postgrest-table/data-loaders.js +259 -150
- package/dist/postgrest-table/data-loaders.js.map +1 -1
- package/dist/postgrest-table/index.cjs +58 -169
- package/dist/postgrest-table/index.cjs.map +1 -1
- package/dist/postgrest-table/index.d.ts +5 -2
- package/dist/postgrest-table/index.js +63 -174
- package/dist/postgrest-table/index.js.map +1 -1
- package/dist/postgrest-table/loading-utils.cjs +0 -4
- package/dist/postgrest-table/loading-utils.cjs.map +1 -1
- package/dist/postgrest-table/loading-utils.js +1 -5
- package/dist/postgrest-table/loading-utils.js.map +1 -1
- package/dist/postgrest-table/main.module.sass.cjs +14 -13
- package/dist/postgrest-table/main.module.sass.cjs.map +1 -1
- package/dist/postgrest-table/main.module.sass.js +14 -13
- package/dist/postgrest-table/main.module.sass.js.map +1 -1
- package/dist/provider.cjs +68 -11
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.ts +25 -0
- package/dist/provider.js +68 -11
- package/dist/provider.js.map +1 -1
- package/dist/renderers/column-header-cell.cjs +95 -75
- package/dist/renderers/column-header-cell.cjs.map +1 -1
- package/dist/renderers/column-header-cell.d.ts +3 -18
- package/dist/renderers/column-header-cell.js +98 -78
- package/dist/renderers/column-header-cell.js.map +1 -1
- package/dist/renderers/index.d.ts +0 -1
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +84 -1
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/column-spec.cjs.map +1 -1
- package/dist/utils/column-spec.d.ts +101 -1
- package/dist/utils/column-spec.js.map +1 -1
- package/dist/utils/debug-overlay.cjs +24 -0
- package/dist/utils/debug-overlay.cjs.map +1 -0
- package/dist/utils/debug-overlay.d.ts +4 -0
- package/dist/utils/debug-overlay.js +24 -0
- package/dist/utils/debug-overlay.js.map +1 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/key-handling.cjs +52 -6
- package/dist/utils/key-handling.cjs.map +1 -1
- package/dist/utils/key-handling.js +52 -6
- package/dist/utils/key-handling.js.map +1 -1
- package/dist/utils/validation.cjs +41 -0
- package/dist/utils/validation.cjs.map +1 -0
- package/dist/utils/validation.d.ts +26 -0
- package/dist/utils/validation.js +41 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/zustand-store.cjs +119 -61
- package/dist/zustand-store.cjs.map +1 -1
- package/dist/zustand-store.js +121 -63
- package/dist/zustand-store.js.map +1 -1
- package/package.json +3 -3
- package/src/actions/builtin.ts +62 -7
- package/src/actions/column-controls.ts +185 -0
- package/src/actions/column-filter.ts +104 -0
- package/src/actions/edit-actions.ts +67 -0
- package/src/actions/filters.ts +54 -28
- package/src/actions/index.ts +4 -0
- package/src/actions/selection.ts +73 -54
- package/src/actions/table-controls.ts +46 -0
- package/src/actions/toolbar.module.sass +22 -2
- package/src/actions/toolbar.ts +113 -16
- package/src/actions/types.ts +49 -4
- package/src/cell-renderer.ts +211 -16
- package/src/components/cell-detail.ts +30 -0
- package/src/components/editor-popup.ts +39 -25
- package/src/components/index.ts +2 -2
- package/src/components/text-areas.ts +80 -16
- package/src/components/view-info.ts +63 -4
- package/src/core.ts +321 -103
- package/src/filters/operators.ts +127 -0
- package/src/index.ts +2 -0
- package/src/main.module.sass +6 -0
- package/src/postgrest-table/data-loaders.ts +459 -209
- package/src/postgrest-table/index.ts +81 -254
- package/src/postgrest-table/main.module.sass +11 -0
- package/src/provider.ts +109 -12
- package/src/renderers/column-header-cell.ts +60 -272
- package/src/renderers/index.ts +0 -1
- package/src/types.ts +76 -2
- package/src/utils/column-spec.ts +112 -1
- package/src/utils/debug-overlay.ts +22 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/key-handling.ts +70 -6
- package/src/utils/validation.ts +72 -0
- package/src/zustand-store.ts +167 -60
- package/dist/components/actions.cjs +0 -12
- package/dist/components/actions.cjs.map +0 -1
- package/dist/components/actions.d.ts +0 -2
- package/dist/components/actions.js +0 -12
- package/dist/components/actions.js.map +0 -1
- package/dist/components/actions.module.sass.cjs +0 -12
- package/dist/components/actions.module.sass.cjs.map +0 -1
- package/dist/components/actions.module.sass.js +0 -11
- package/dist/components/actions.module.sass.js.map +0 -1
- package/dist/postgrest-table/lazy-loader-table.cjs +0 -27
- package/dist/postgrest-table/lazy-loader-table.cjs.map +0 -1
- package/dist/postgrest-table/lazy-loader-table.d.ts +0 -3
- package/dist/postgrest-table/lazy-loader-table.js +0 -27
- package/dist/postgrest-table/lazy-loader-table.js.map +0 -1
- package/dist/renderers/column-header-cell-postgrest.cjs +0 -216
- package/dist/renderers/column-header-cell-postgrest.cjs.map +0 -1
- package/dist/renderers/column-header-cell-postgrest.d.ts +0 -13
- package/dist/renderers/column-header-cell-postgrest.js +0 -216
- package/dist/renderers/column-header-cell-postgrest.js.map +0 -1
- package/dist/renderers/column-header-cell-postgrest.module.sass.cjs +0 -23
- package/dist/renderers/column-header-cell-postgrest.module.sass.cjs.map +0 -1
- package/dist/renderers/column-header-cell-postgrest.module.sass.js +0 -22
- package/dist/renderers/column-header-cell-postgrest.module.sass.js.map +0 -1
- package/src/components/actions.ts +0 -9
- package/src/postgrest-table/lazy-loader-table.ts +0 -25
- package/src/renderers/column-header-cell-postgrest.ts +0 -282
package/dist/data-sheet.css
CHANGED
|
@@ -1094,31 +1094,31 @@
|
|
|
1094
1094
|
.bp6-table-no-layout{
|
|
1095
1095
|
display:inline-block;
|
|
1096
1096
|
position:absolute;
|
|
1097
|
-
}._data-sheet-
|
|
1097
|
+
}._data-sheet-container_13hbc_1, ._data-sheet-holder_13hbc_1 {
|
|
1098
1098
|
flex: 1;
|
|
1099
1099
|
min-height: 0;
|
|
1100
1100
|
font-size: var(--data-sheet-font-size, 12px);
|
|
1101
1101
|
line-height: var(--data-sheet-row-height, 20px);
|
|
1102
1102
|
--data-sheet-cell-padding: 0px 8px;
|
|
1103
1103
|
}
|
|
1104
|
-
._data-sheet-
|
|
1104
|
+
._data-sheet-container_13hbc_1 .bp6-table-cell, ._data-sheet-holder_13hbc_1 .bp6-table-cell {
|
|
1105
1105
|
padding: var(--data-sheet-cell-padding);
|
|
1106
1106
|
}
|
|
1107
|
-
._data-sheet-
|
|
1107
|
+
._data-sheet-container_13hbc_1 .bp6-table-cell:not([class*=bp6-intent-]):not(.bp6-loading), ._data-sheet-holder_13hbc_1 .bp6-table-cell:not([class*=bp6-intent-]):not(.bp6-loading) {
|
|
1108
1108
|
color: var(--text-color);
|
|
1109
1109
|
}
|
|
1110
|
-
._data-sheet-
|
|
1110
|
+
._data-sheet-container_13hbc_1 .bp6-table-cell, ._data-sheet-container_13hbc_1 .bp6-table-row-name, ._data-sheet-holder_13hbc_1 .bp6-table-cell, ._data-sheet-holder_13hbc_1 .bp6-table-row-name {
|
|
1111
1111
|
font-size: var(--data-sheet-font-size);
|
|
1112
1112
|
line-height: var(--data-sheet-row-height);
|
|
1113
1113
|
}
|
|
1114
|
-
._data-sheet-
|
|
1114
|
+
._data-sheet-container_13hbc_1 .bp6-table-row-name, ._data-sheet-holder_13hbc_1 .bp6-table-row-name {
|
|
1115
1115
|
color: var(--secondary-color);
|
|
1116
1116
|
}
|
|
1117
|
-
._data-sheet-
|
|
1117
|
+
._data-sheet-container_13hbc_1 .bp6-table-column-name, ._data-sheet-holder_13hbc_1 .bp6-table-column-name {
|
|
1118
1118
|
font-size: 1.2em;
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
|
-
._data-sheet-
|
|
1121
|
+
._data-sheet-container_13hbc_1 {
|
|
1122
1122
|
display: flex;
|
|
1123
1123
|
position: relative;
|
|
1124
1124
|
height: 100%;
|
|
@@ -1127,14 +1127,14 @@
|
|
|
1127
1127
|
max-width: 100%;
|
|
1128
1128
|
}
|
|
1129
1129
|
|
|
1130
|
-
._data-
|
|
1130
|
+
._data-sheet_13hbc_1 {
|
|
1131
1131
|
height: 100%;
|
|
1132
1132
|
}
|
|
1133
|
-
._data-
|
|
1133
|
+
._data-sheet_13hbc_1 .bp6-table-quadrant {
|
|
1134
1134
|
background-color: var(--panel-secondary-background-color);
|
|
1135
1135
|
}
|
|
1136
1136
|
|
|
1137
|
-
._input-
|
|
1137
|
+
._input-cell_13hbc_41 input {
|
|
1138
1138
|
width: 100%;
|
|
1139
1139
|
height: 100%;
|
|
1140
1140
|
padding: 0;
|
|
@@ -1147,11 +1147,11 @@
|
|
|
1147
1147
|
font-family: inherit;
|
|
1148
1148
|
font-size: inherit;
|
|
1149
1149
|
}
|
|
1150
|
-
._input-
|
|
1150
|
+
._input-cell_13hbc_41 input:focus {
|
|
1151
1151
|
outline: none;
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
1154
|
-
._value-viewer-
|
|
1154
|
+
._value-viewer-cell_13hbc_58 .bp6-popover-target {
|
|
1155
1155
|
width: 100%;
|
|
1156
1156
|
height: var(--data-sheet-row-height);
|
|
1157
1157
|
position: relative;
|
|
@@ -1159,7 +1159,7 @@
|
|
|
1159
1159
|
margin: calc(var(--data-sheet-cell-padding) * -1);
|
|
1160
1160
|
}
|
|
1161
1161
|
|
|
1162
|
-
._editor-
|
|
1162
|
+
._editor-cell_13hbc_66 .bp6-popover-target {
|
|
1163
1163
|
position: absolute;
|
|
1164
1164
|
top: 0;
|
|
1165
1165
|
left: 0;
|
|
@@ -1167,20 +1167,20 @@
|
|
|
1167
1167
|
height: 100%;
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
|
-
._hidden-
|
|
1170
|
+
._hidden-input_13hbc_74 {
|
|
1171
1171
|
opacity: 0;
|
|
1172
1172
|
position: absolute;
|
|
1173
1173
|
width: 0;
|
|
1174
1174
|
}
|
|
1175
1175
|
|
|
1176
|
-
._data-editor-
|
|
1176
|
+
._data-editor-anchor_13hbc_80 {
|
|
1177
1177
|
width: 100%;
|
|
1178
1178
|
height: 100%;
|
|
1179
1179
|
margin: 0;
|
|
1180
1180
|
pointer-events: none;
|
|
1181
1181
|
}
|
|
1182
1182
|
|
|
1183
|
-
._corner-drag-
|
|
1183
|
+
._corner-drag-handle_13hbc_87 {
|
|
1184
1184
|
position: absolute;
|
|
1185
1185
|
bottom: 0;
|
|
1186
1186
|
right: 0;
|
|
@@ -1190,20 +1190,28 @@
|
|
|
1190
1190
|
background-color: dodgerblue;
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
1193
|
-
._data-sheet-
|
|
1193
|
+
._data-sheet-toolbar_13hbc_97 {
|
|
1194
1194
|
display: flex;
|
|
1195
1195
|
flex-direction: row;
|
|
1196
1196
|
margin-bottom: 4px;
|
|
1197
1197
|
}
|
|
1198
1198
|
|
|
1199
|
-
.
|
|
1199
|
+
._spacer_13hbc_103 {
|
|
1200
1200
|
flex-grow: 1;
|
|
1201
1201
|
}
|
|
1202
1202
|
|
|
1203
|
-
._table-
|
|
1203
|
+
._table-control_13hbc_107 {
|
|
1204
1204
|
display: flex;
|
|
1205
1205
|
flex-direction: row;
|
|
1206
1206
|
margin-bottom: 0.25em;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
._status-bar_13hbc_113 {
|
|
1210
|
+
display: flex;
|
|
1211
|
+
flex-direction: row;
|
|
1212
|
+
padding: 0.2em 0.5em;
|
|
1213
|
+
gap: 0.5em;
|
|
1214
|
+
background-color: var(--panel-secondary-background-color);
|
|
1207
1215
|
}._interaction-barrier_19ibd_1 {
|
|
1208
1216
|
pointer-events: all;
|
|
1209
1217
|
}
|
|
@@ -1269,67 +1277,77 @@
|
|
|
1269
1277
|
position: relative;
|
|
1270
1278
|
flex-grow: 1;
|
|
1271
1279
|
display: block;
|
|
1272
|
-
}._actions-
|
|
1280
|
+
}._actions-toolbar_hs7ht_1 {
|
|
1273
1281
|
display: flex;
|
|
1274
1282
|
flex-direction: row;
|
|
1275
|
-
gap:
|
|
1276
|
-
margin-bottom: 4px;
|
|
1283
|
+
gap: 8px;
|
|
1277
1284
|
align-items: center;
|
|
1285
|
+
min-height: 32px;
|
|
1286
|
+
padding: 4px 8px;
|
|
1287
|
+
background-color: var(--panel-secondary-background-color);
|
|
1278
1288
|
}
|
|
1279
1289
|
|
|
1280
|
-
.
|
|
1290
|
+
._toolbar-title_hs7ht_11 {
|
|
1291
|
+
font-weight: 600;
|
|
1292
|
+
white-space: nowrap;
|
|
1293
|
+
min-width: 100px;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
._spacer_hs7ht_17 {
|
|
1281
1297
|
flex-grow: 1;
|
|
1282
1298
|
}
|
|
1283
1299
|
|
|
1284
|
-
._action-popover-
|
|
1300
|
+
._action-popover-content_hs7ht_21, ._filter-config_hs7ht_21 {
|
|
1285
1301
|
padding: 12px;
|
|
1286
1302
|
max-width: 300px;
|
|
1287
1303
|
}
|
|
1288
|
-
._action-popover-
|
|
1304
|
+
._action-popover-content_hs7ht_21 p._description_hs7ht_25, ._filter-config_hs7ht_21 p._description_hs7ht_25 {
|
|
1289
1305
|
margin: 0 0 8px 0;
|
|
1290
1306
|
color: var(--secondary-color);
|
|
1291
1307
|
font-size: 0.9em;
|
|
1292
1308
|
}
|
|
1293
1309
|
|
|
1294
|
-
._run-
|
|
1310
|
+
._run-button_hs7ht_31 {
|
|
1295
1311
|
margin-top: 8px;
|
|
1296
1312
|
width: 100%;
|
|
1297
1313
|
}
|
|
1298
1314
|
|
|
1299
|
-
._filter-
|
|
1315
|
+
._filter-bar_hs7ht_36 {
|
|
1300
1316
|
display: flex;
|
|
1301
1317
|
flex-direction: row;
|
|
1302
1318
|
flex-wrap: wrap;
|
|
1303
1319
|
gap: 4px;
|
|
1304
1320
|
margin-bottom: 4px;
|
|
1305
1321
|
align-items: center;
|
|
1306
|
-
|
|
1322
|
+
justify-content: flex-start;
|
|
1323
|
+
}
|
|
1324
|
+
._filter-bar_hs7ht_36 > ._group_hs7ht_45 {
|
|
1307
1325
|
display: flex;
|
|
1308
1326
|
flex-direction: row;
|
|
1309
|
-
gap:
|
|
1327
|
+
gap: 4px;
|
|
1310
1328
|
}
|
|
1311
1329
|
|
|
1312
|
-
.
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
}.
|
|
1330
|
+
._filter-window_hs7ht_51 {
|
|
1331
|
+
opacity: 0.8;
|
|
1332
|
+
font-variant-numeric: tabular-nums;
|
|
1333
|
+
}._lithology_xp6ib_1 {
|
|
1316
1334
|
font-weight: bold;
|
|
1317
1335
|
display: inline-block;
|
|
1318
1336
|
padding: 0 0.5em;
|
|
1319
1337
|
border-radius: 0.5em;
|
|
1320
1338
|
}
|
|
1321
1339
|
|
|
1322
|
-
._inline-
|
|
1340
|
+
._inline-lithology_xp6ib_8 ._lithology_xp6ib_1 {
|
|
1323
1341
|
line-height: 1em;
|
|
1324
1342
|
}
|
|
1325
1343
|
|
|
1326
|
-
._basis-
|
|
1344
|
+
._basis-panel_xp6ib_12 .bp6-tag {
|
|
1327
1345
|
margin: 0 0.5em 0.5em 0;
|
|
1328
1346
|
}
|
|
1329
|
-
._basis-
|
|
1347
|
+
._basis-panel_xp6ib_12 td {
|
|
1330
1348
|
vertical-align: top;
|
|
1331
1349
|
}
|
|
1332
|
-
._basis-
|
|
1350
|
+
._basis-panel_xp6ib_12 th {
|
|
1333
1351
|
text-align: left;
|
|
1334
1352
|
font-weight: 400;
|
|
1335
1353
|
font-size: 0.9em;
|
|
@@ -1337,7 +1355,7 @@
|
|
|
1337
1355
|
color: var(--secondary-color);
|
|
1338
1356
|
}
|
|
1339
1357
|
|
|
1340
|
-
._basis-
|
|
1358
|
+
._basis-panel_xp6ib_12, ._long-text_xp6ib_26 {
|
|
1341
1359
|
max-width: 20em;
|
|
1342
1360
|
padding: 8px;
|
|
1343
1361
|
max-height: 30em;
|
|
@@ -1345,26 +1363,26 @@
|
|
|
1345
1363
|
pointer-events: all;
|
|
1346
1364
|
}
|
|
1347
1365
|
|
|
1348
|
-
.
|
|
1366
|
+
._description_xp6ib_34 {
|
|
1349
1367
|
font-style: italic;
|
|
1350
1368
|
}
|
|
1351
1369
|
|
|
1352
|
-
._tag-
|
|
1370
|
+
._tag-header_xp6ib_38 {
|
|
1353
1371
|
font-weight: bold;
|
|
1354
1372
|
text-transform: small-caps;
|
|
1355
1373
|
font-size: 0.8em;
|
|
1356
1374
|
color: var(--secondary-color);
|
|
1357
1375
|
}
|
|
1358
1376
|
|
|
1359
|
-
._basis-
|
|
1377
|
+
._basis-col_xp6ib_45 {
|
|
1360
1378
|
max-width: 15em;
|
|
1361
1379
|
}
|
|
1362
1380
|
|
|
1363
|
-
.
|
|
1381
|
+
._liths_xp6ib_49 > * {
|
|
1364
1382
|
margin-right: 0.5em;
|
|
1365
1383
|
}
|
|
1366
1384
|
|
|
1367
|
-
._data-sheet-
|
|
1385
|
+
._data-sheet-outer_xp6ib_53 {
|
|
1368
1386
|
position: relative;
|
|
1369
1387
|
flex: 1;
|
|
1370
1388
|
display: flex;
|
|
@@ -1372,7 +1390,7 @@
|
|
|
1372
1390
|
min-height: 0;
|
|
1373
1391
|
}
|
|
1374
1392
|
|
|
1375
|
-
.
|
|
1393
|
+
._toolbar_xp6ib_61, ._info-bar_xp6ib_61, ._server-filter-bar_xp6ib_61 {
|
|
1376
1394
|
display: flex;
|
|
1377
1395
|
flex-direction: row;
|
|
1378
1396
|
flex-wrap: wrap;
|
|
@@ -1380,91 +1398,22 @@
|
|
|
1380
1398
|
padding: var(--data-sheet-toolbar-gap, 4px) 0;
|
|
1381
1399
|
}
|
|
1382
1400
|
|
|
1383
|
-
._info-
|
|
1401
|
+
._info-bar_xp6ib_61 {
|
|
1384
1402
|
order: 10;
|
|
1385
1403
|
}
|
|
1386
1404
|
|
|
1387
|
-
.
|
|
1388
|
-
|
|
1389
|
-
}._column-header-cell_it1ds_1 {
|
|
1390
|
-
display: flex;
|
|
1391
|
-
align-items: center;
|
|
1392
|
-
width: 100%;
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
._column-name_it1ds_7 {
|
|
1396
|
-
flex: 1;
|
|
1397
|
-
overflow: hidden;
|
|
1398
|
-
text-overflow: ellipsis;
|
|
1399
|
-
white-space: nowrap;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
._column-indicators_it1ds_14 {
|
|
1405
|
+
._load-progress_xp6ib_73 {
|
|
1406
|
+
order: 11;
|
|
1403
1407
|
display: flex;
|
|
1408
|
+
flex-direction: row;
|
|
1404
1409
|
align-items: center;
|
|
1405
|
-
gap:
|
|
1406
|
-
|
|
1407
|
-
flex-shrink: 0;
|
|
1408
|
-
}
|
|
1409
|
-
._column-indicators_it1ds_14 .bp6-icon {
|
|
1410
|
-
opacity: 0.7;
|
|
1411
|
-
color: var(--text-color);
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
._sort-indicator_it1ds_26 .bp6-icon {
|
|
1415
|
-
color: var(--intent-primary, #2965cc);
|
|
1416
|
-
opacity: 1;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
._filter-indicator_it1ds_31 .bp6-icon {
|
|
1420
|
-
color: var(--intent-warning, #d99e0b);
|
|
1421
|
-
opacity: 1;
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
._column-actions-popover_it1ds_36 {
|
|
1425
|
-
padding: 12px;
|
|
1426
|
-
min-width: 220px;
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
._popover-section_it1ds_41 {
|
|
1430
|
-
margin-bottom: 12px;
|
|
1431
|
-
}
|
|
1432
|
-
._popover-section_it1ds_41:last-child {
|
|
1433
|
-
margin-bottom: 0;
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
._popover-section-title_it1ds_48 {
|
|
1437
|
-
font-weight: 600;
|
|
1410
|
+
gap: 0.4em;
|
|
1411
|
+
padding: 2px 4px;
|
|
1438
1412
|
font-size: 11px;
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
color: var(--secondary-color, #5c7080);
|
|
1442
|
-
margin-bottom: 6px;
|
|
1413
|
+
opacity: 0.75;
|
|
1414
|
+
font-variant-numeric: tabular-nums;
|
|
1443
1415
|
}
|
|
1444
1416
|
|
|
1445
|
-
.
|
|
1446
|
-
|
|
1447
|
-
gap: 4px;
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
._filter-row_it1ds_62 {
|
|
1451
|
-
display: flex;
|
|
1452
|
-
gap: 4px;
|
|
1453
|
-
align-items: center;
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
._filter-operator-select_it1ds_68 {
|
|
1457
|
-
flex-shrink: 0;
|
|
1458
|
-
width: 80px;
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
._filter-value-input_it1ds_73 {
|
|
1462
|
-
flex: 1;
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
._clear-section_it1ds_77 {
|
|
1466
|
-
display: flex;
|
|
1467
|
-
justify-content: flex-end;
|
|
1468
|
-
padding-top: 4px;
|
|
1469
|
-
border-top: 1px solid var(--divider-color, rgba(16, 22, 26, 0.15));
|
|
1417
|
+
._tag-cell-content_xp6ib_85 {
|
|
1418
|
+
line-height: 1;
|
|
1470
1419
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const OPERATOR_LABELS = {
|
|
4
|
+
eq: "=",
|
|
5
|
+
neq: "≠",
|
|
6
|
+
like: "like",
|
|
7
|
+
ilike: "contains",
|
|
8
|
+
gt: ">",
|
|
9
|
+
lt: "<",
|
|
10
|
+
gte: "≥",
|
|
11
|
+
lte: "≤",
|
|
12
|
+
is: "is"
|
|
13
|
+
};
|
|
14
|
+
const STRING_OPERATORS = ["eq", "neq", "ilike"];
|
|
15
|
+
const NUMERIC_OPERATORS = [
|
|
16
|
+
"eq",
|
|
17
|
+
"neq",
|
|
18
|
+
"gt",
|
|
19
|
+
"lt",
|
|
20
|
+
"gte",
|
|
21
|
+
"lte"
|
|
22
|
+
];
|
|
23
|
+
const BOOLEAN_OPERATORS = ["eq", "neq"];
|
|
24
|
+
const DEFAULT_FILTER_OPERATORS = [
|
|
25
|
+
"eq",
|
|
26
|
+
"neq",
|
|
27
|
+
"ilike",
|
|
28
|
+
"gt",
|
|
29
|
+
"lt",
|
|
30
|
+
"gte",
|
|
31
|
+
"lte"
|
|
32
|
+
];
|
|
33
|
+
const OPERATORS_BY_TYPE = {
|
|
34
|
+
string: STRING_OPERATORS,
|
|
35
|
+
number: NUMERIC_OPERATORS,
|
|
36
|
+
integer: NUMERIC_OPERATORS,
|
|
37
|
+
boolean: BOOLEAN_OPERATORS
|
|
38
|
+
};
|
|
39
|
+
function getOperatorsForColumn(col) {
|
|
40
|
+
if (typeof col.filterable === "object" && col.filterable.operators?.length) {
|
|
41
|
+
return col.filterable.operators;
|
|
42
|
+
}
|
|
43
|
+
if (col.dataType != null) {
|
|
44
|
+
return OPERATORS_BY_TYPE[col.dataType] ?? DEFAULT_FILTER_OPERATORS;
|
|
45
|
+
}
|
|
46
|
+
return DEFAULT_FILTER_OPERATORS;
|
|
47
|
+
}
|
|
48
|
+
function looseEq(a, b) {
|
|
49
|
+
if (a == null) return b == null || b === "";
|
|
50
|
+
const an = Number(a);
|
|
51
|
+
const bn = Number(b);
|
|
52
|
+
if (!Number.isNaN(an) && !Number.isNaN(bn) && String(a).trim() !== "") {
|
|
53
|
+
return an === bn;
|
|
54
|
+
}
|
|
55
|
+
return String(a).toLowerCase() === String(b).toLowerCase();
|
|
56
|
+
}
|
|
57
|
+
function testFilterOperator(cellValue, operator, filterValue) {
|
|
58
|
+
if (filterValue === "" || filterValue == null) return true;
|
|
59
|
+
switch (operator) {
|
|
60
|
+
case "eq":
|
|
61
|
+
return looseEq(cellValue, filterValue);
|
|
62
|
+
case "neq":
|
|
63
|
+
return !looseEq(cellValue, filterValue);
|
|
64
|
+
case "gt":
|
|
65
|
+
return Number(cellValue) > Number(filterValue);
|
|
66
|
+
case "lt":
|
|
67
|
+
return Number(cellValue) < Number(filterValue);
|
|
68
|
+
case "gte":
|
|
69
|
+
return Number(cellValue) >= Number(filterValue);
|
|
70
|
+
case "lte":
|
|
71
|
+
return Number(cellValue) <= Number(filterValue);
|
|
72
|
+
case "like":
|
|
73
|
+
return String(cellValue ?? "").includes(String(filterValue));
|
|
74
|
+
case "ilike":
|
|
75
|
+
return String(cellValue ?? "").toLowerCase().includes(String(filterValue).toLowerCase());
|
|
76
|
+
case "is": {
|
|
77
|
+
const v = String(filterValue).toLowerCase();
|
|
78
|
+
if (v === "null") return cellValue == null;
|
|
79
|
+
if (v === "true") return cellValue === true;
|
|
80
|
+
if (v === "false") return cellValue === false;
|
|
81
|
+
return looseEq(cellValue, filterValue);
|
|
82
|
+
}
|
|
83
|
+
default:
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.DEFAULT_FILTER_OPERATORS = DEFAULT_FILTER_OPERATORS;
|
|
88
|
+
exports.OPERATOR_LABELS = OPERATOR_LABELS;
|
|
89
|
+
exports.getOperatorsForColumn = getOperatorsForColumn;
|
|
90
|
+
exports.testFilterOperator = testFilterOperator;
|
|
91
|
+
//# sourceMappingURL=operators.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operators.cjs","sources":["../../src/filters/operators.ts"],"sourcesContent":["/**\n * The canonical column-filter operator vocabulary, shared by the client-side\n * predicate (in-memory tables) and the server-side descriptor (a provider\n * translates it to a query). Promoted to core from the PostgREST column header,\n * so there is one operator model, not two.\n */\nimport type { ColumnSpec } from \"../utils/column-spec\";\n\n/** Column-filter operators. A superset that covers both in-memory comparison\n * and common backend query operators (PostgREST maps onto these names). */\nexport type FilterOperator =\n | \"eq\"\n | \"neq\"\n | \"like\"\n | \"ilike\"\n | \"gt\"\n | \"lt\"\n | \"gte\"\n | \"lte\"\n | \"is\";\n\n/** Human-readable operator labels for menus and active-filter tags. */\nexport const OPERATOR_LABELS: Record<FilterOperator, string> = {\n eq: \"=\",\n neq: \"≠\",\n like: \"like\",\n ilike: \"contains\",\n gt: \">\",\n lt: \"<\",\n gte: \"≥\",\n lte: \"≤\",\n is: \"is\",\n};\n\nconst STRING_OPERATORS: FilterOperator[] = [\"eq\", \"neq\", \"ilike\"];\nconst NUMERIC_OPERATORS: FilterOperator[] = [\n \"eq\",\n \"neq\",\n \"gt\",\n \"lt\",\n \"gte\",\n \"lte\",\n];\nconst BOOLEAN_OPERATORS: FilterOperator[] = [\"eq\", \"neq\"];\n\n/** Fallback when the column has no type information. */\nexport const DEFAULT_FILTER_OPERATORS: FilterOperator[] = [\n \"eq\",\n \"neq\",\n \"ilike\",\n \"gt\",\n \"lt\",\n \"gte\",\n \"lte\",\n];\n\nconst OPERATORS_BY_TYPE: Record<string, FilterOperator[]> = {\n string: STRING_OPERATORS,\n number: NUMERIC_OPERATORS,\n integer: NUMERIC_OPERATORS,\n boolean: BOOLEAN_OPERATORS,\n};\n\n/** Resolve the operators offered for a column: explicit `filterable.operators`\n * first, else inferred from `dataType`, else the defaults. */\nexport function getOperatorsForColumn(col: ColumnSpec): FilterOperator[] {\n if (typeof col.filterable === \"object\" && col.filterable.operators?.length) {\n return col.filterable.operators as FilterOperator[];\n }\n if (col.dataType != null) {\n return OPERATORS_BY_TYPE[col.dataType] ?? DEFAULT_FILTER_OPERATORS;\n }\n return DEFAULT_FILTER_OPERATORS;\n}\n\nfunction looseEq(a: any, b: any): boolean {\n if (a == null) return b == null || b === \"\";\n // Compare numerically when both look numeric, else as strings.\n const an = Number(a);\n const bn = Number(b);\n if (!Number.isNaN(an) && !Number.isNaN(bn) && String(a).trim() !== \"\") {\n return an === bn;\n }\n return String(a).toLowerCase() === String(b).toLowerCase();\n}\n\n/**\n * The client-side predicate for a `{ operator, value }` column filter — the\n * in-memory equivalent of what a backend applies server-side. An empty filter\n * value is treated as \"no constraint\" (matches everything).\n */\nexport function testFilterOperator(\n cellValue: any,\n operator: FilterOperator,\n filterValue: any,\n): boolean {\n if (filterValue === \"\" || filterValue == null) return true;\n switch (operator) {\n case \"eq\":\n return looseEq(cellValue, filterValue);\n case \"neq\":\n return !looseEq(cellValue, filterValue);\n case \"gt\":\n return Number(cellValue) > Number(filterValue);\n case \"lt\":\n return Number(cellValue) < Number(filterValue);\n case \"gte\":\n return Number(cellValue) >= Number(filterValue);\n case \"lte\":\n return Number(cellValue) <= Number(filterValue);\n case \"like\":\n return String(cellValue ?? \"\").includes(String(filterValue));\n case \"ilike\":\n return String(cellValue ?? \"\")\n .toLowerCase()\n .includes(String(filterValue).toLowerCase());\n case \"is\": {\n const v = String(filterValue).toLowerCase();\n if (v === \"null\") return cellValue == null;\n if (v === \"true\") return cellValue === true;\n if (v === \"false\") return cellValue === false;\n return looseEq(cellValue, filterValue);\n }\n default:\n return true;\n }\n}\n"],"names":[],"mappings":";;AAsBO,MAAM,kBAAkD;AAAA,EAC7D,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,IAAI;AACN;AAEA,MAAM,mBAAqC,CAAC,MAAM,OAAO,OAAO;AAChE,MAAM,oBAAsC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,oBAAsC,CAAC,MAAM,KAAK;AAGjD,MAAM,2BAA6C;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,oBAAsD;AAAA,EAC1D,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AACX;AAIO,SAAS,sBAAsB,KAAmC;AACvE,MAAI,OAAO,IAAI,eAAe,YAAY,IAAI,WAAW,WAAW,QAAQ;AAC1E,WAAO,IAAI,WAAW;AAAA,EACxB;AACA,MAAI,IAAI,YAAY,MAAM;AACxB,WAAO,kBAAkB,IAAI,QAAQ,KAAK;AAAA,EAC5C;AACA,SAAO;AACT;AAEA,SAAS,QAAQ,GAAQ,GAAiB;AACxC,MAAI,KAAK,KAAM,QAAO,KAAK,QAAQ,MAAM;AAEzC,QAAM,KAAK,OAAO,CAAC;AACnB,QAAM,KAAK,OAAO,CAAC;AACnB,MAAI,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,OAAO,MAAM,EAAE,KAAK,OAAO,CAAC,EAAE,KAAA,MAAW,IAAI;AACrE,WAAO,OAAO;AAAA,EAChB;AACA,SAAO,OAAO,CAAC,EAAE,YAAA,MAAkB,OAAO,CAAC,EAAE,YAAA;AAC/C;AAOO,SAAS,mBACd,WACA,UACA,aACS;AACT,MAAI,gBAAgB,MAAM,eAAe,KAAM,QAAO;AACtD,UAAQ,UAAA;AAAA,IACN,KAAK;AACH,aAAO,QAAQ,WAAW,WAAW;AAAA,IACvC,KAAK;AACH,aAAO,CAAC,QAAQ,WAAW,WAAW;AAAA,IACxC,KAAK;AACH,aAAO,OAAO,SAAS,IAAI,OAAO,WAAW;AAAA,IAC/C,KAAK;AACH,aAAO,OAAO,SAAS,IAAI,OAAO,WAAW;AAAA,IAC/C,KAAK;AACH,aAAO,OAAO,SAAS,KAAK,OAAO,WAAW;AAAA,IAChD,KAAK;AACH,aAAO,OAAO,SAAS,KAAK,OAAO,WAAW;AAAA,IAChD,KAAK;AACH,aAAO,OAAO,aAAa,EAAE,EAAE,SAAS,OAAO,WAAW,CAAC;AAAA,IAC7D,KAAK;AACH,aAAO,OAAO,aAAa,EAAE,EAC1B,YAAA,EACA,SAAS,OAAO,WAAW,EAAE,aAAa;AAAA,IAC/C,KAAK,MAAM;AACT,YAAM,IAAI,OAAO,WAAW,EAAE,YAAA;AAC9B,UAAI,MAAM,OAAQ,QAAO,aAAa;AACtC,UAAI,MAAM,OAAQ,QAAO,cAAc;AACvC,UAAI,MAAM,QAAS,QAAO,cAAc;AACxC,aAAO,QAAQ,WAAW,WAAW;AAAA,IACvC;AAAA,IACA;AACE,aAAO;AAAA,EAAA;AAEb;;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ColumnSpec } from '../utils/column-spec';
|
|
2
|
+
/** Column-filter operators. A superset that covers both in-memory comparison
|
|
3
|
+
* and common backend query operators (PostgREST maps onto these names). */
|
|
4
|
+
export type FilterOperator = "eq" | "neq" | "like" | "ilike" | "gt" | "lt" | "gte" | "lte" | "is";
|
|
5
|
+
/** Human-readable operator labels for menus and active-filter tags. */
|
|
6
|
+
export declare const OPERATOR_LABELS: Record<FilterOperator, string>;
|
|
7
|
+
/** Fallback when the column has no type information. */
|
|
8
|
+
export declare const DEFAULT_FILTER_OPERATORS: FilterOperator[];
|
|
9
|
+
/** Resolve the operators offered for a column: explicit `filterable.operators`
|
|
10
|
+
* first, else inferred from `dataType`, else the defaults. */
|
|
11
|
+
export declare function getOperatorsForColumn(col: ColumnSpec): FilterOperator[];
|
|
12
|
+
/**
|
|
13
|
+
* The client-side predicate for a `{ operator, value }` column filter — the
|
|
14
|
+
* in-memory equivalent of what a backend applies server-side. An empty filter
|
|
15
|
+
* value is treated as "no constraint" (matches everything).
|
|
16
|
+
*/
|
|
17
|
+
export declare function testFilterOperator(cellValue: any, operator: FilterOperator, filterValue: any): boolean;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const OPERATOR_LABELS = {
|
|
2
|
+
eq: "=",
|
|
3
|
+
neq: "≠",
|
|
4
|
+
like: "like",
|
|
5
|
+
ilike: "contains",
|
|
6
|
+
gt: ">",
|
|
7
|
+
lt: "<",
|
|
8
|
+
gte: "≥",
|
|
9
|
+
lte: "≤",
|
|
10
|
+
is: "is"
|
|
11
|
+
};
|
|
12
|
+
const STRING_OPERATORS = ["eq", "neq", "ilike"];
|
|
13
|
+
const NUMERIC_OPERATORS = [
|
|
14
|
+
"eq",
|
|
15
|
+
"neq",
|
|
16
|
+
"gt",
|
|
17
|
+
"lt",
|
|
18
|
+
"gte",
|
|
19
|
+
"lte"
|
|
20
|
+
];
|
|
21
|
+
const BOOLEAN_OPERATORS = ["eq", "neq"];
|
|
22
|
+
const DEFAULT_FILTER_OPERATORS = [
|
|
23
|
+
"eq",
|
|
24
|
+
"neq",
|
|
25
|
+
"ilike",
|
|
26
|
+
"gt",
|
|
27
|
+
"lt",
|
|
28
|
+
"gte",
|
|
29
|
+
"lte"
|
|
30
|
+
];
|
|
31
|
+
const OPERATORS_BY_TYPE = {
|
|
32
|
+
string: STRING_OPERATORS,
|
|
33
|
+
number: NUMERIC_OPERATORS,
|
|
34
|
+
integer: NUMERIC_OPERATORS,
|
|
35
|
+
boolean: BOOLEAN_OPERATORS
|
|
36
|
+
};
|
|
37
|
+
function getOperatorsForColumn(col) {
|
|
38
|
+
if (typeof col.filterable === "object" && col.filterable.operators?.length) {
|
|
39
|
+
return col.filterable.operators;
|
|
40
|
+
}
|
|
41
|
+
if (col.dataType != null) {
|
|
42
|
+
return OPERATORS_BY_TYPE[col.dataType] ?? DEFAULT_FILTER_OPERATORS;
|
|
43
|
+
}
|
|
44
|
+
return DEFAULT_FILTER_OPERATORS;
|
|
45
|
+
}
|
|
46
|
+
function looseEq(a, b) {
|
|
47
|
+
if (a == null) return b == null || b === "";
|
|
48
|
+
const an = Number(a);
|
|
49
|
+
const bn = Number(b);
|
|
50
|
+
if (!Number.isNaN(an) && !Number.isNaN(bn) && String(a).trim() !== "") {
|
|
51
|
+
return an === bn;
|
|
52
|
+
}
|
|
53
|
+
return String(a).toLowerCase() === String(b).toLowerCase();
|
|
54
|
+
}
|
|
55
|
+
function testFilterOperator(cellValue, operator, filterValue) {
|
|
56
|
+
if (filterValue === "" || filterValue == null) return true;
|
|
57
|
+
switch (operator) {
|
|
58
|
+
case "eq":
|
|
59
|
+
return looseEq(cellValue, filterValue);
|
|
60
|
+
case "neq":
|
|
61
|
+
return !looseEq(cellValue, filterValue);
|
|
62
|
+
case "gt":
|
|
63
|
+
return Number(cellValue) > Number(filterValue);
|
|
64
|
+
case "lt":
|
|
65
|
+
return Number(cellValue) < Number(filterValue);
|
|
66
|
+
case "gte":
|
|
67
|
+
return Number(cellValue) >= Number(filterValue);
|
|
68
|
+
case "lte":
|
|
69
|
+
return Number(cellValue) <= Number(filterValue);
|
|
70
|
+
case "like":
|
|
71
|
+
return String(cellValue ?? "").includes(String(filterValue));
|
|
72
|
+
case "ilike":
|
|
73
|
+
return String(cellValue ?? "").toLowerCase().includes(String(filterValue).toLowerCase());
|
|
74
|
+
case "is": {
|
|
75
|
+
const v = String(filterValue).toLowerCase();
|
|
76
|
+
if (v === "null") return cellValue == null;
|
|
77
|
+
if (v === "true") return cellValue === true;
|
|
78
|
+
if (v === "false") return cellValue === false;
|
|
79
|
+
return looseEq(cellValue, filterValue);
|
|
80
|
+
}
|
|
81
|
+
default:
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
DEFAULT_FILTER_OPERATORS,
|
|
87
|
+
OPERATOR_LABELS,
|
|
88
|
+
getOperatorsForColumn,
|
|
89
|
+
testFilterOperator
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=operators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operators.js","sources":["../../src/filters/operators.ts"],"sourcesContent":["/**\n * The canonical column-filter operator vocabulary, shared by the client-side\n * predicate (in-memory tables) and the server-side descriptor (a provider\n * translates it to a query). Promoted to core from the PostgREST column header,\n * so there is one operator model, not two.\n */\nimport type { ColumnSpec } from \"../utils/column-spec\";\n\n/** Column-filter operators. A superset that covers both in-memory comparison\n * and common backend query operators (PostgREST maps onto these names). */\nexport type FilterOperator =\n | \"eq\"\n | \"neq\"\n | \"like\"\n | \"ilike\"\n | \"gt\"\n | \"lt\"\n | \"gte\"\n | \"lte\"\n | \"is\";\n\n/** Human-readable operator labels for menus and active-filter tags. */\nexport const OPERATOR_LABELS: Record<FilterOperator, string> = {\n eq: \"=\",\n neq: \"≠\",\n like: \"like\",\n ilike: \"contains\",\n gt: \">\",\n lt: \"<\",\n gte: \"≥\",\n lte: \"≤\",\n is: \"is\",\n};\n\nconst STRING_OPERATORS: FilterOperator[] = [\"eq\", \"neq\", \"ilike\"];\nconst NUMERIC_OPERATORS: FilterOperator[] = [\n \"eq\",\n \"neq\",\n \"gt\",\n \"lt\",\n \"gte\",\n \"lte\",\n];\nconst BOOLEAN_OPERATORS: FilterOperator[] = [\"eq\", \"neq\"];\n\n/** Fallback when the column has no type information. */\nexport const DEFAULT_FILTER_OPERATORS: FilterOperator[] = [\n \"eq\",\n \"neq\",\n \"ilike\",\n \"gt\",\n \"lt\",\n \"gte\",\n \"lte\",\n];\n\nconst OPERATORS_BY_TYPE: Record<string, FilterOperator[]> = {\n string: STRING_OPERATORS,\n number: NUMERIC_OPERATORS,\n integer: NUMERIC_OPERATORS,\n boolean: BOOLEAN_OPERATORS,\n};\n\n/** Resolve the operators offered for a column: explicit `filterable.operators`\n * first, else inferred from `dataType`, else the defaults. */\nexport function getOperatorsForColumn(col: ColumnSpec): FilterOperator[] {\n if (typeof col.filterable === \"object\" && col.filterable.operators?.length) {\n return col.filterable.operators as FilterOperator[];\n }\n if (col.dataType != null) {\n return OPERATORS_BY_TYPE[col.dataType] ?? DEFAULT_FILTER_OPERATORS;\n }\n return DEFAULT_FILTER_OPERATORS;\n}\n\nfunction looseEq(a: any, b: any): boolean {\n if (a == null) return b == null || b === \"\";\n // Compare numerically when both look numeric, else as strings.\n const an = Number(a);\n const bn = Number(b);\n if (!Number.isNaN(an) && !Number.isNaN(bn) && String(a).trim() !== \"\") {\n return an === bn;\n }\n return String(a).toLowerCase() === String(b).toLowerCase();\n}\n\n/**\n * The client-side predicate for a `{ operator, value }` column filter — the\n * in-memory equivalent of what a backend applies server-side. An empty filter\n * value is treated as \"no constraint\" (matches everything).\n */\nexport function testFilterOperator(\n cellValue: any,\n operator: FilterOperator,\n filterValue: any,\n): boolean {\n if (filterValue === \"\" || filterValue == null) return true;\n switch (operator) {\n case \"eq\":\n return looseEq(cellValue, filterValue);\n case \"neq\":\n return !looseEq(cellValue, filterValue);\n case \"gt\":\n return Number(cellValue) > Number(filterValue);\n case \"lt\":\n return Number(cellValue) < Number(filterValue);\n case \"gte\":\n return Number(cellValue) >= Number(filterValue);\n case \"lte\":\n return Number(cellValue) <= Number(filterValue);\n case \"like\":\n return String(cellValue ?? \"\").includes(String(filterValue));\n case \"ilike\":\n return String(cellValue ?? \"\")\n .toLowerCase()\n .includes(String(filterValue).toLowerCase());\n case \"is\": {\n const v = String(filterValue).toLowerCase();\n if (v === \"null\") return cellValue == null;\n if (v === \"true\") return cellValue === true;\n if (v === \"false\") return cellValue === false;\n return looseEq(cellValue, filterValue);\n }\n default:\n return true;\n }\n}\n"],"names":[],"mappings":"AAsBO,MAAM,kBAAkD;AAAA,EAC7D,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,IAAI;AACN;AAEA,MAAM,mBAAqC,CAAC,MAAM,OAAO,OAAO;AAChE,MAAM,oBAAsC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,oBAAsC,CAAC,MAAM,KAAK;AAGjD,MAAM,2BAA6C;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,oBAAsD;AAAA,EAC1D,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AACX;AAIO,SAAS,sBAAsB,KAAmC;AACvE,MAAI,OAAO,IAAI,eAAe,YAAY,IAAI,WAAW,WAAW,QAAQ;AAC1E,WAAO,IAAI,WAAW;AAAA,EACxB;AACA,MAAI,IAAI,YAAY,MAAM;AACxB,WAAO,kBAAkB,IAAI,QAAQ,KAAK;AAAA,EAC5C;AACA,SAAO;AACT;AAEA,SAAS,QAAQ,GAAQ,GAAiB;AACxC,MAAI,KAAK,KAAM,QAAO,KAAK,QAAQ,MAAM;AAEzC,QAAM,KAAK,OAAO,CAAC;AACnB,QAAM,KAAK,OAAO,CAAC;AACnB,MAAI,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,OAAO,MAAM,EAAE,KAAK,OAAO,CAAC,EAAE,KAAA,MAAW,IAAI;AACrE,WAAO,OAAO;AAAA,EAChB;AACA,SAAO,OAAO,CAAC,EAAE,YAAA,MAAkB,OAAO,CAAC,EAAE,YAAA;AAC/C;AAOO,SAAS,mBACd,WACA,UACA,aACS;AACT,MAAI,gBAAgB,MAAM,eAAe,KAAM,QAAO;AACtD,UAAQ,UAAA;AAAA,IACN,KAAK;AACH,aAAO,QAAQ,WAAW,WAAW;AAAA,IACvC,KAAK;AACH,aAAO,CAAC,QAAQ,WAAW,WAAW;AAAA,IACxC,KAAK;AACH,aAAO,OAAO,SAAS,IAAI,OAAO,WAAW;AAAA,IAC/C,KAAK;AACH,aAAO,OAAO,SAAS,IAAI,OAAO,WAAW;AAAA,IAC/C,KAAK;AACH,aAAO,OAAO,SAAS,KAAK,OAAO,WAAW;AAAA,IAChD,KAAK;AACH,aAAO,OAAO,SAAS,KAAK,OAAO,WAAW;AAAA,IAChD,KAAK;AACH,aAAO,OAAO,aAAa,EAAE,EAAE,SAAS,OAAO,WAAW,CAAC;AAAA,IAC7D,KAAK;AACH,aAAO,OAAO,aAAa,EAAE,EAC1B,YAAA,EACA,SAAS,OAAO,WAAW,EAAE,aAAa;AAAA,IAC/C,KAAK,MAAM;AACT,YAAM,IAAI,OAAO,WAAW,EAAE,YAAA;AAC9B,UAAI,MAAM,OAAQ,QAAO,aAAa;AACtC,UAAI,MAAM,OAAQ,QAAO,cAAc;AACvC,UAAI,MAAM,QAAS,QAAO,cAAc;AACxC,aAAO,QAAQ,WAAW,WAAW;AAAA,IACvC;AAAA,IACA;AACE,aAAO;AAAA,EAAA;AAEb;"}
|