@scalar/api-client 3.27.1 → 3.28.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/CHANGELOG.md +7 -0
- package/dist/style.css +93 -2
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue_vue_type_script_setup_true_lang.js +32 -6
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/v2/blocks/request-block/helpers/validate-parameter.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/validate-parameter.js +7 -1
- package/dist/v2/blocks/request-block/helpers/validate-parameter.js.map +1 -1
- package/dist/v2/components/date-picker/DatePicker.vue.d.ts +17 -0
- package/dist/v2/components/date-picker/DatePicker.vue.d.ts.map +1 -0
- package/dist/v2/components/date-picker/DatePicker.vue.js +6 -0
- package/dist/v2/components/date-picker/DatePicker.vue.js.map +1 -0
- package/dist/v2/components/date-picker/DatePicker.vue_vue_type_script_setup_true_lang.js +342 -0
- package/dist/v2/components/date-picker/DatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/v2/components/date-picker/date-parts.d.ts +68 -0
- package/dist/v2/components/date-picker/date-parts.d.ts.map +1 -0
- package/dist/v2/components/date-picker/date-parts.js +123 -0
- package/dist/v2/components/date-picker/date-parts.js.map +1 -0
- package/dist/v2/components/date-picker/index.d.ts +3 -0
- package/dist/v2/components/date-picker/index.d.ts.map +1 -0
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/localization/locales/ar.d.ts +21 -0
- package/dist/v2/features/localization/locales/ar.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/ar.js +21 -0
- package/dist/v2/features/localization/locales/ar.js.map +1 -1
- package/dist/v2/features/localization/locales/de.d.ts +21 -0
- package/dist/v2/features/localization/locales/de.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/de.js +21 -0
- package/dist/v2/features/localization/locales/de.js.map +1 -1
- package/dist/v2/features/localization/locales/es.d.ts +21 -0
- package/dist/v2/features/localization/locales/es.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/es.js +21 -0
- package/dist/v2/features/localization/locales/es.js.map +1 -1
- package/dist/v2/features/localization/locales/fr.d.ts +21 -0
- package/dist/v2/features/localization/locales/fr.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/fr.js +21 -0
- package/dist/v2/features/localization/locales/fr.js.map +1 -1
- package/dist/v2/features/localization/locales/pt.d.ts +21 -0
- package/dist/v2/features/localization/locales/pt.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/pt.js +21 -0
- package/dist/v2/features/localization/locales/pt.js.map +1 -1
- package/dist/v2/features/localization/locales/ru.d.ts +21 -0
- package/dist/v2/features/localization/locales/ru.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/ru.js +21 -0
- package/dist/v2/features/localization/locales/ru.js.map +1 -1
- package/dist/v2/features/localization/locales/zh-cn.d.ts +21 -0
- package/dist/v2/features/localization/locales/zh-cn.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/zh-cn.js +21 -0
- package/dist/v2/features/localization/locales/zh-cn.js.map +1 -1
- package/dist/v2/features/localization/locales/zh-tw.d.ts +21 -0
- package/dist/v2/features/localization/locales/zh-tw.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/zh-tw.js +21 -0
- package/dist/v2/features/localization/locales/zh-tw.js.map +1 -1
- package/dist/v2/features/localization/translations.d.ts +21 -0
- package/dist/v2/features/localization/translations.d.ts.map +1 -1
- package/dist/v2/features/localization/translations.js +21 -0
- package/dist/v2/features/localization/translations.js.map +1 -1
- package/package.json +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 3.28.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#11103](https://github.com/scalar/scalar/pull/11103): Support `x-scalar-token-prefix` on header API keys. Generated code examples and outgoing requests add the configured prefix while stored credentials remain unchanged.
|
|
8
|
+
- [#9778](https://github.com/scalar/scalar/pull/9778): Add a date and time picker for request fields with `format: date`, `date-time`, or `time`. A calendar/clock icon opens an accessible picker (built on radix-vue's Calendar) that writes a correctly formatted value back into the field. For `date-time` fields, the picker also offers shortcuts to insert faker variables like `{{$isoTimestamp}}` and `{{$randomDateFuture}}`. Free-text entry and `{{variables}}` keep working, so you can still type invalid data on purpose.
|
|
9
|
+
|
|
3
10
|
## 3.27.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/style.css
CHANGED
|
@@ -852,8 +852,8 @@
|
|
|
852
852
|
filter: brightness(1.1);
|
|
853
853
|
}
|
|
854
854
|
|
|
855
|
-
.scalar-icon[data-v-
|
|
856
|
-
stroke-width: var(--
|
|
855
|
+
.scalar-icon[data-v-6150d8b1], .scalar-icon[data-v-6150d8b1] * {
|
|
856
|
+
stroke-width: var(--scalar-icon-stroke-width);
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
:where(pre:has( > code.hljs)) {
|
|
@@ -3219,6 +3219,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
3219
3219
|
margin-inline: 8px;
|
|
3220
3220
|
}
|
|
3221
3221
|
|
|
3222
|
+
.scalar-app .mx-auto {
|
|
3223
|
+
margin-inline: auto;
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3222
3226
|
.scalar-app .mx-px {
|
|
3223
3227
|
margin-inline: 1px;
|
|
3224
3228
|
}
|
|
@@ -3263,6 +3267,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
3263
3267
|
margin-block: 48px;
|
|
3264
3268
|
}
|
|
3265
3269
|
|
|
3270
|
+
.scalar-app .ms-1 {
|
|
3271
|
+
margin-inline-start: 4px;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3266
3274
|
.scalar-app .ms-1\.25\! {
|
|
3267
3275
|
margin-inline-start: 5px !important;
|
|
3268
3276
|
}
|
|
@@ -3275,6 +3283,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
3275
3283
|
margin-inline-end: -5px !important;
|
|
3276
3284
|
}
|
|
3277
3285
|
|
|
3286
|
+
.scalar-app .me-1 {
|
|
3287
|
+
margin-inline-end: 4px;
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3278
3290
|
.scalar-app .me-1\.5 {
|
|
3279
3291
|
margin-inline-end: 6px;
|
|
3280
3292
|
}
|
|
@@ -3399,6 +3411,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
3399
3411
|
margin-bottom: -4px;
|
|
3400
3412
|
}
|
|
3401
3413
|
|
|
3414
|
+
.scalar-app .-mb-2 {
|
|
3415
|
+
margin-bottom: -8px;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3402
3418
|
.scalar-app .-mb-\[var\(--scalar-border-width\)\] {
|
|
3403
3419
|
margin-bottom: calc(var(--scalar-border-width) * -1);
|
|
3404
3420
|
}
|
|
@@ -3603,6 +3619,11 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
3603
3619
|
height: 24px;
|
|
3604
3620
|
}
|
|
3605
3621
|
|
|
3622
|
+
.scalar-app .size-7 {
|
|
3623
|
+
width: 28px;
|
|
3624
|
+
height: 28px;
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3606
3627
|
.scalar-app .size-8 {
|
|
3607
3628
|
width: 32px;
|
|
3608
3629
|
height: 32px;
|
|
@@ -3892,6 +3913,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
3892
3913
|
width: 224px;
|
|
3893
3914
|
}
|
|
3894
3915
|
|
|
3916
|
+
.scalar-app .w-64 {
|
|
3917
|
+
width: 256px;
|
|
3918
|
+
}
|
|
3919
|
+
|
|
3895
3920
|
.scalar-app .w-72 {
|
|
3896
3921
|
width: 288px;
|
|
3897
3922
|
}
|
|
@@ -4088,6 +4113,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
4088
4113
|
flex-basis: 0;
|
|
4089
4114
|
}
|
|
4090
4115
|
|
|
4116
|
+
.scalar-app .border-collapse {
|
|
4117
|
+
border-collapse: collapse;
|
|
4118
|
+
}
|
|
4119
|
+
|
|
4091
4120
|
.scalar-app .-translate-x-1\/2 {
|
|
4092
4121
|
--tw-translate-x: calc(calc(1 / 2 * 100%) * -1);
|
|
4093
4122
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
@@ -4244,6 +4273,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
4244
4273
|
grid-auto-rows: auto;
|
|
4245
4274
|
}
|
|
4246
4275
|
|
|
4276
|
+
.scalar-app .grid-cols-7 {
|
|
4277
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4247
4280
|
.scalar-app .grid-cols-\[44px_1fr_repeat\(3\,auto\)\] {
|
|
4248
4281
|
grid-template-columns: 44px 1fr repeat(3, auto);
|
|
4249
4282
|
}
|
|
@@ -4653,6 +4686,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
4653
4686
|
border-color: var(--scalar-header-border-color, var(--scalar-border-color));
|
|
4654
4687
|
}
|
|
4655
4688
|
|
|
4689
|
+
.scalar-app .border-c-3 {
|
|
4690
|
+
border-color: var(--scalar-color-3);
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4656
4693
|
.scalar-app .border-c-accent, .scalar-app .border-c-accent\/30 {
|
|
4657
4694
|
border-color: var(--scalar-color-accent);
|
|
4658
4695
|
}
|
|
@@ -5016,6 +5053,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
5016
5053
|
padding-inline: 10px;
|
|
5017
5054
|
}
|
|
5018
5055
|
|
|
5056
|
+
.scalar-app .px-2\.75 {
|
|
5057
|
+
padding-inline: 11px;
|
|
5058
|
+
}
|
|
5059
|
+
|
|
5019
5060
|
.scalar-app .px-3 {
|
|
5020
5061
|
padding-inline: 12px;
|
|
5021
5062
|
}
|
|
@@ -5036,6 +5077,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
5036
5077
|
padding-inline: 24px;
|
|
5037
5078
|
}
|
|
5038
5079
|
|
|
5080
|
+
.scalar-app .px-\[5px\] {
|
|
5081
|
+
padding-inline: 5px;
|
|
5082
|
+
}
|
|
5083
|
+
|
|
5039
5084
|
.scalar-app .py-0 {
|
|
5040
5085
|
padding-block: 0;
|
|
5041
5086
|
}
|
|
@@ -5092,6 +5137,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
5092
5137
|
padding-block: 1px;
|
|
5093
5138
|
}
|
|
5094
5139
|
|
|
5140
|
+
.scalar-app .ps-5\.5 {
|
|
5141
|
+
padding-inline-start: 22px;
|
|
5142
|
+
}
|
|
5143
|
+
|
|
5095
5144
|
.scalar-app .ps-8 {
|
|
5096
5145
|
padding-inline-start: 32px;
|
|
5097
5146
|
}
|
|
@@ -5104,6 +5153,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
5104
5153
|
padding-inline-start: var(--schema-gutter, 16px);
|
|
5105
5154
|
}
|
|
5106
5155
|
|
|
5156
|
+
.scalar-app .pe-2 {
|
|
5157
|
+
padding-inline-end: 8px;
|
|
5158
|
+
}
|
|
5159
|
+
|
|
5107
5160
|
.scalar-app .pe-6 {
|
|
5108
5161
|
padding-inline-end: 24px;
|
|
5109
5162
|
}
|
|
@@ -5256,6 +5309,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
5256
5309
|
text-align: start;
|
|
5257
5310
|
}
|
|
5258
5311
|
|
|
5312
|
+
.scalar-app .align-\[1px\] {
|
|
5313
|
+
vertical-align: 1px;
|
|
5314
|
+
}
|
|
5315
|
+
|
|
5259
5316
|
.scalar-app .font-code {
|
|
5260
5317
|
font-family: var(--scalar-font-code);
|
|
5261
5318
|
}
|
|
@@ -5368,6 +5425,11 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
5368
5425
|
line-height: 7px;
|
|
5369
5426
|
}
|
|
5370
5427
|
|
|
5428
|
+
.scalar-app .leading-\[14px\] {
|
|
5429
|
+
--tw-leading: 14px;
|
|
5430
|
+
line-height: 14px;
|
|
5431
|
+
}
|
|
5432
|
+
|
|
5371
5433
|
.scalar-app .leading-\[20px\] {
|
|
5372
5434
|
--tw-leading: 20px;
|
|
5373
5435
|
line-height: 20px;
|
|
@@ -6542,10 +6604,18 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
6542
6604
|
border-color: var(--scalar-background-1);
|
|
6543
6605
|
}
|
|
6544
6606
|
|
|
6607
|
+
.scalar-app .focus\:bg-b-btn:focus {
|
|
6608
|
+
background-color: var(--scalar-button-1);
|
|
6609
|
+
}
|
|
6610
|
+
|
|
6545
6611
|
.scalar-app .focus\:text-c-1:focus {
|
|
6546
6612
|
color: var(--scalar-color-1);
|
|
6547
6613
|
}
|
|
6548
6614
|
|
|
6615
|
+
.scalar-app .focus\:text-c-btn:focus {
|
|
6616
|
+
color: var(--scalar-button-1-color);
|
|
6617
|
+
}
|
|
6618
|
+
|
|
6549
6619
|
.scalar-app .focus\:outline-none:focus {
|
|
6550
6620
|
--tw-outline-style: none;
|
|
6551
6621
|
outline-style: none;
|
|
@@ -6648,6 +6718,23 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
6648
6718
|
margin-bottom: 6px !important;
|
|
6649
6719
|
}
|
|
6650
6720
|
|
|
6721
|
+
.scalar-app .data-\[outside-view\]\:text-c-3[data-outside-view], .scalar-app .data-\[placeholder\]\:text-c-3[data-placeholder] {
|
|
6722
|
+
color: var(--scalar-color-3);
|
|
6723
|
+
}
|
|
6724
|
+
|
|
6725
|
+
.scalar-app .data-\[selected\]\:bg-b-btn[data-selected] {
|
|
6726
|
+
background-color: var(--scalar-button-1);
|
|
6727
|
+
}
|
|
6728
|
+
|
|
6729
|
+
.scalar-app .data-\[selected\]\:text-c-btn[data-selected] {
|
|
6730
|
+
color: var(--scalar-button-1-color);
|
|
6731
|
+
}
|
|
6732
|
+
|
|
6733
|
+
.scalar-app .data-\[today\]\:font-bold[data-today] {
|
|
6734
|
+
--tw-font-weight: var(--scalar-bold);
|
|
6735
|
+
font-weight: var(--scalar-bold);
|
|
6736
|
+
}
|
|
6737
|
+
|
|
6651
6738
|
@media not all and (min-width: 1200px) {
|
|
6652
6739
|
.scalar-app .max-xl\:max-h-full {
|
|
6653
6740
|
max-height: 100%;
|
|
@@ -6869,6 +6956,10 @@ button.schema-card-title[data-v-86862f28]:hover {
|
|
|
6869
6956
|
}
|
|
6870
6957
|
}
|
|
6871
6958
|
|
|
6959
|
+
.scalar-app .rtl\:rotate-180:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) {
|
|
6960
|
+
rotate: 180deg;
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6872
6963
|
.scalar-app .dark\:bg-\(--bg-dark\):where(.dark-mode, .dark-mode *) {
|
|
6873
6964
|
background-color: var(--bg-dark);
|
|
6874
6965
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestTableRow.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestTableRow.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestTableRow.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestTableRow.vue"],"names":[],"mappings":"AAsgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAIxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAiBrE,OAA6B,EAC3B,KAAK,gBAAgB,EACtB,MAAM,4BAA4B,CAAA;AAEnC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,QAAQ,CAAA;IACd,iF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ACnC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC,CAAA;AA+3BD,QAAA,MAAM,YAAY;sBA17BA,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFA87BpB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -5,6 +5,7 @@ import DataTableCell_default from "../../../components/data-table/DataTableCell.
|
|
|
5
5
|
import DataTableCheckbox_default from "../../../components/data-table/DataTableCheckbox.vue.js";
|
|
6
6
|
import DataTableInputSelect_default from "../../../components/data-table/DataTableInputSelect.vue.js";
|
|
7
7
|
import DataTableRow_default from "../../../components/data-table/DataTableRow.vue.js";
|
|
8
|
+
import DatePicker_default from "../../../components/date-picker/DatePicker.vue.js";
|
|
8
9
|
import { useLocalization } from "../../../features/localization/index.js";
|
|
9
10
|
import RequestTableTooltip_default from "./RequestTableTooltip.vue.js";
|
|
10
11
|
import RequestTableFileList_default from "./RequestTableFileList.vue.js";
|
|
@@ -94,6 +95,20 @@ var RequestTableRow_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
94
95
|
return [];
|
|
95
96
|
});
|
|
96
97
|
const typeValue = computed(() => __props.data.schema && "type" in __props.data.schema ? __props.data.schema.type : void 0);
|
|
98
|
+
/**
|
|
99
|
+
* Which date/time picker (if any) this value should offer, based on the
|
|
100
|
+
* schema `format`. Free-text entry and `{{variables}}` keep working — the
|
|
101
|
+
* picker is an optional shortcut that writes a formatted value back into the
|
|
102
|
+
* same input.
|
|
103
|
+
*/
|
|
104
|
+
const dateFormat = computed(() => {
|
|
105
|
+
const format = __props.data.schema && "format" in __props.data.schema ? __props.data.schema.format : void 0;
|
|
106
|
+
return [
|
|
107
|
+
"date",
|
|
108
|
+
"date-time",
|
|
109
|
+
"time"
|
|
110
|
+
].includes(format) ? format : void 0;
|
|
111
|
+
});
|
|
97
112
|
const validationResult = computed(() => validateParameter(__props.data.schema, value.value));
|
|
98
113
|
/** Handle row updates while preserving existing properties */
|
|
99
114
|
const handleUpdateRow = (payload, options = {}) => {
|
|
@@ -233,8 +248,8 @@ var RequestTableRow_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
233
248
|
placeholder: unref(translate)("apiClient.requestTableRow.value"),
|
|
234
249
|
type: typeValue.value,
|
|
235
250
|
withFakeData: "",
|
|
236
|
-
onNavigate: _cache[
|
|
237
|
-
"onUpdate:modelValue": _cache[
|
|
251
|
+
onNavigate: _cache[11] || (_cache[11] = (route) => emit("navigate", route)),
|
|
252
|
+
"onUpdate:modelValue": _cache[12] || (_cache[12] = (v) => handleUpdateRow({ value: v }))
|
|
238
253
|
}, {
|
|
239
254
|
icon: withCtx(() => [
|
|
240
255
|
Boolean(__props.data.name || value.value) && !__props.data.isRequired && __props.data.isReadonly !== true ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
@@ -258,12 +273,23 @@ var RequestTableRow_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
258
273
|
variant: "ghost",
|
|
259
274
|
onClick: _cache[9] || (_cache[9] = ($event) => emit("navigate", __props.data.globalRoute))
|
|
260
275
|
}, null, 8, ["icon", "label"])) : createCommentVNode("", true),
|
|
261
|
-
__props.data.isReadonly ? (openBlock(), createBlock(
|
|
276
|
+
dateFormat.value && __props.data.isReadonly !== true ? (openBlock(), createBlock(unref(DatePicker_default), {
|
|
262
277
|
key: 2,
|
|
278
|
+
fieldName: __props.data.name || __props.label,
|
|
279
|
+
modelValue: displayValue.value,
|
|
280
|
+
type: dateFormat.value,
|
|
281
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = (v) => handleUpdateRow({ value: v }))
|
|
282
|
+
}, null, 8, [
|
|
283
|
+
"fieldName",
|
|
284
|
+
"modelValue",
|
|
285
|
+
"type"
|
|
286
|
+
])) : createCommentVNode("", true),
|
|
287
|
+
__props.data.isReadonly ? (openBlock(), createBlock(RequestTableTooltip_default, {
|
|
288
|
+
key: 3,
|
|
263
289
|
description: unref(translate)("apiClient.requestTableRow.readOnlyHint"),
|
|
264
290
|
value: null
|
|
265
291
|
}, null, 8, ["description"])) : __props.data.schema ? (openBlock(), createBlock(RequestTableTooltip_default, {
|
|
266
|
-
key:
|
|
292
|
+
key: 4,
|
|
267
293
|
description: __props.data.description,
|
|
268
294
|
schema: __props.data.schema,
|
|
269
295
|
value: value.value
|
|
@@ -299,7 +325,7 @@ var RequestTableRow_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
299
325
|
}, toDisplayString(displayValue.value), 9, _hoisted_2)]), createElementVNode("button", {
|
|
300
326
|
class: "bg-b-2 mt-1 block rounded p-0.5 text-center text-xs font-medium md:pointer-events-none md:absolute md:inset-x-1 md:top-1/2 md:mt-0 md:-translate-y-1/2 md:opacity-0 md:group-hover/upload:pointer-events-auto md:group-hover/upload:opacity-100",
|
|
301
327
|
type: "button",
|
|
302
|
-
onClick: _cache[
|
|
328
|
+
onClick: _cache[13] || (_cache[13] = ($event) => emit("removeFile"))
|
|
303
329
|
}, toDisplayString(unref(translate)("apiClient.requestTableRow.delete")), 1)], 64)) : canUploadFile.value ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(unref(ScalarButton), {
|
|
304
330
|
"aria-label": unref(translate)("apiClient.requestTableRow.uploadFor", {
|
|
305
331
|
action: fileUploadLabel.value,
|
|
@@ -308,7 +334,7 @@ var RequestTableRow_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
308
334
|
class: "bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none",
|
|
309
335
|
size: "sm",
|
|
310
336
|
variant: "outlined",
|
|
311
|
-
onClick: _cache[
|
|
337
|
+
onClick: _cache[14] || (_cache[14] = ($event) => emit("uploadFile"))
|
|
312
338
|
}, {
|
|
313
339
|
default: withCtx(() => [createElementVNode("span", null, toDisplayString(fileUploadLabel.value), 1), createVNode(unref(ScalarIcon), {
|
|
314
340
|
class: "ml-1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestTableRow.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","DataTableRow","_normalizeClass","_withCtx","_createVNode","DataTableCheckbox","DataTableCell","CodeInputLite","RequestTableFileList","RequestTableTooltip","DataTableInputSelect","_createElementBlock","_Fragment","_createElementVNode","_toDisplayString"],"sources":["../../../../../src/v2/blocks/request-block/components/RequestTableRow.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconGlobe, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport { isFileSchema } from '@scalar/workspace-store/helpers/is-file-schema'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n ParameterObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, ref, useTemplateRef, watch } from 'vue'\n\nimport { getFileName } from '@/v2/blocks/request-block/helpers/files'\nimport { validateParameter } from '@/v2/blocks/request-block/helpers/validate-parameter'\nimport { CodeInputLite } from '@/v2/components/code-input'\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableInputSelect,\n DataTableRow,\n} from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestTableTooltip from './RequestTableTooltip.vue'\nimport RequestTableFileList, {\n type RequestTableFile,\n} from './RequestTableFileList.vue'\n\nconst {\n data,\n environment,\n hasCheckboxDisabled,\n deferKeyUpdates,\n invalidParams,\n showUploadButton,\n allowUnknownFileUploads = true,\n} = defineProps<{\n data: TableRow\n /** Keep key edits local until blur when the row identity depends on its name. */\n deferKeyUpdates?: boolean\n hasCheckboxDisabled?: boolean\n invalidParams?: Set<string>\n label?: string\n environment: XScalarEnvironment\n showUploadButton?: boolean\n /** Unknown fields remain editable as files only in free-form multipart requests. */\n allowUnknownFileUploads?: boolean\n}>()\n\nconst emit = defineEmits<{\n (e: 'upsertRow', payload: TableRowUpsertPayload): void\n (e: 'deleteRow'): void\n (e: 'uploadFile'): void\n (e: 'removeFile', fileIndex?: number): void\n (e: 'updateFile', fileIndex: number, isDisabled: boolean): void\n (e: 'navigate', route: NonNullable<TableRow['globalRoute']>): void\n /** Select a value for a grouped global cookie preset. */\n (e: 'selectPreset', value: string): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst valueInput = useTemplateRef('valueInput')\nconst fileList = useTemplateRef('fileList')\ndefineExpose({\n focusValue: (): void => {\n if (data.files) {\n fileList.value?.focusUpload()\n } else {\n valueInput.value?.focus()\n }\n },\n})\n\nexport type TableRow = {\n /** The parameter or field name/key */\n name: string\n /** The parameter value, can be a string, file, or null */\n value: string | File | null\n /** Selected files grouped for display; source rows remain separate multipart parts. */\n files?: RequestTableFile[]\n /** Optional description for the parameter */\n description?: string\n /** Optional route for global parameters (e.g., cookies shared across workspace) */\n globalRoute?: ApiReferenceEvents['ui:navigate']\n /** Whether the parameter is disabled/inactive */\n isDisabled?: boolean\n /** Whether an optional parameter is disabled because it has no explicit x-disabled value */\n isDisabledByDefault?: boolean\n /** OpenAPI schema object with type, validation rules, examples, etc. */\n schema?: SchemaObject\n /** Explicit media type for this multipart field. */\n contentType?: string\n /** Preserve array values even while their JSON text is temporarily invalid. */\n isArray?: boolean\n /** Text representation used by array enum controls. */\n arrayEncoding?: 'json' | 'comma-separated'\n /** Whether the parameter is required */\n isRequired?: boolean\n /**\n * Whether the parameter is readonly and can not be modifies directly\n * User can still override the parameter which is going to show up with the linethrough style\n */\n isReadonly?: boolean\n /** Whether the parameter is overridden later on */\n isOverridden?: boolean\n /** Track the original parameter so we can update it */\n originalParameter?: ParameterObject\n /** Path to a value inside the original parameter example for expanded object parameters */\n sourceParameterValuePath?: string[]\n /**\n * Selectable values for a grouped global cookie preset. When set, the value cell renders a\n * dropdown to switch between predefined values (for example a `Culture` cookie with `PL`/`EN`)\n * instead of an editable input.\n */\n presetOptions?: string[]\n}\n\nexport type TableRowUpsertPayload = {\n name: string\n value: string | File\n isDisabled: boolean\n shouldRenameExpandedRow?: boolean\n}\n\n/**\n * Track local state for the row\n *\n * Now this is required because of the way we get default values from the schema.\n * If we have a default value in data.value, then we update isDisabled to true. We lose the default value since now\n * we have an example where value: ''. This is why we need to track the local state and update all of the params at the\n * same time.\n */\nconst name = ref<string>(data.name ?? '')\nconst value = ref<string | File>(unpackProxyObject(data.value) ?? '')\nconst isDisabled = ref<boolean>(data.isDisabled ?? false)\n\n// Keep the above state synced with the data prop\nwatch(\n () => data.name,\n (newName) => {\n // Do not overwrite a valid local name with an empty incoming prop — this\n // can happen when the placeholder row (appended by displayData) is briefly\n // mapped onto this component instance before Vue re-keys the list.\n if (!newName && name.value && !deferKeyUpdates) {\n return\n }\n name.value = newName ?? ''\n },\n)\nwatch(\n () => data.value,\n (newValue) => (value.value = unpackProxyObject(newValue) ?? ''),\n)\nwatch(\n () => data.isDisabled,\n (newIsDisabled) => (isDisabled.value = newIsDisabled ?? false),\n)\n\n/** Check if the value is a File instance */\nconst isFile = computed(() => value.value instanceof File)\n\n/** Whether this row’s schema accepts a file part. */\nconst canUploadFile = computed<boolean>(() =>\n data.schema\n ? isFileSchema(data.schema, true, data.contentType)\n : allowUnknownFileUploads,\n)\n\nconst fileUploadLabel = computed<string>(() =>\n translate(\n data.schema && isArraySchema(data.schema)\n ? 'apiClient.requestTableRow.selectFiles'\n : 'apiClient.requestTableRow.selectFile',\n ),\n)\n\nconst hasMixedFileSelection = computed<boolean>(() =>\n Boolean(\n data.files?.some((file) => file.isDisabled) &&\n data.files.some((file) => !file.isDisabled),\n ),\n)\n\n/** Display value handles File instances and shows filename instead */\nconst displayValue = computed(\n () =>\n (isFile.value\n ? getFileName(value.value as File)\n : (value.value as string)) ?? '',\n)\n\nconst defaultValue = computed(() => data.schema?.default as string)\n\n/** See if we can extract enum values from the schema */\nconst enumValue = computed<unknown[]>(() => {\n if (!data.schema) {\n return []\n }\n\n // Grab the enum from the schema\n if (data.schema.enum) {\n return data.schema.enum.map((item) => String(item))\n }\n\n // Grab the enum from the items schema\n if ('items' in data.schema) {\n const resolved = resolve.schema(data.schema.items)\n if (resolved?.enum) {\n return data.arrayEncoding === 'json'\n ? resolved.enum\n : resolved.enum.map((item) => String(item))\n }\n }\n\n return []\n})\n\nconst typeValue = computed(() =>\n data.schema && 'type' in data.schema ? data.schema.type : undefined,\n)\n\nconst validationResult = computed(() =>\n validateParameter(data.schema, value.value),\n)\n\n/** Handle row updates while preserving existing properties */\nconst handleUpdateRow = (\n payload: Partial<{ name: string; value: string; isDisabled: boolean }>,\n options: { shouldRenameExpandedRow?: boolean; commitKey?: boolean } = {},\n): void => {\n // Update our local state\n if (payload.name !== undefined) {\n name.value = payload.name\n }\n if (payload.value !== undefined) {\n value.value = payload.value\n\n // Optional parameters start unchecked, but entering a value expresses intent to send it.\n // Explicit x-disabled values stay unchanged so a deliberate opt-out is preserved.\n if (data.isDisabledByDefault) {\n isDisabled.value = false\n }\n }\n\n // Is disabled should only be updated when explicitly provided in the payload\n if (payload.isDisabled !== undefined) {\n isDisabled.value = payload.isDisabled\n }\n\n if (\n payload.name !== undefined &&\n (deferKeyUpdates || data.sourceParameterValuePath) &&\n !options.shouldRenameExpandedRow &&\n !options.commitKey\n ) {\n return\n }\n\n // Emit all of the local state\n emit('upsertRow', {\n name: name.value,\n value: value.value,\n isDisabled: isDisabled.value,\n ...(options.shouldRenameExpandedRow\n ? { shouldRenameExpandedRow: true }\n : {}),\n })\n}\n\n/**\n * Commit a key edit when the input loses focus. Body and expanded-object rows defer their rename to blur (see\n * handleUpdateRow), so we only emit when the key actually changed. Focusing and blurring the field\n * without typing should not re-emit the row or silently reset its disabled state. The current\n * disabled state is passed through so a renamed row keeps it.\n */\nconst handleKeyBlur = (newName: string): void => {\n if (newName === data.name) {\n return\n }\n // Do not emit an update that would blank the parameter name — this can fire\n // when CodeInputLite blurs before it has rendered its initial value.\n if (!newName && data.name && (!deferKeyUpdates || name.value !== '')) {\n return\n }\n\n handleUpdateRow(\n { name: newName, isDisabled: isDisabled.value },\n {\n shouldRenameExpandedRow: Boolean(data.sourceParameterValuePath),\n commitKey: true,\n },\n )\n}\n\n/** Save a pending body key before the send shortcut reaches the request handler. */\nconst handleKeydown = (event: KeyboardEvent): void => {\n if (\n deferKeyUpdates &&\n event.key === 'Enter' &&\n (event.metaKey || event.ctrlKey)\n ) {\n handleKeyBlur(name.value)\n }\n}\n</script>\n\n<template>\n <DataTableRow\n :id=\"data.name\"\n :class=\"{\n alert: validationResult.ok === false,\n error: validationResult.ok === false && invalidParams?.has(data.name),\n }\">\n <DataTableCheckbox\n :ariaLabel=\"\n translate('apiClient.requestTableRow.include', {\n name: data.name || translate('apiClient.requestTableRow.row'),\n })\n \"\n class=\"!border-r\"\n :class=\"{ 'max-h-none': data.files }\"\n :disabled=\"hasCheckboxDisabled ?? false\"\n :indeterminate=\"hasMixedFileSelection\"\n :modelValue=\"!isDisabled\"\n @update:modelValue=\"(v) => handleUpdateRow({ isDisabled: !v })\" />\n\n <!-- Name -->\n <DataTableCell :class=\"{ 'max-h-none': data.files }\">\n <CodeInputLite\n :aria-label=\"\n translate('apiClient.requestTableRow.keyLabel', { name: label ?? '' })\n \"\n :disabled=\"data.isReadonly\"\n :environment=\"environment\"\n :modelValue=\"name\"\n :placeholder=\"translate('apiClient.requestTableRow.key')\"\n :required=\"Boolean(data.isRequired)\"\n @blur=\"(v) => handleKeyBlur(v)\"\n @keydown.capture=\"handleKeydown\"\n @navigate=\"(route) => emit('navigate', route)\"\n @update:modelValue=\"(v) => handleUpdateRow({ name: v })\" />\n </DataTableCell>\n\n <!-- Value -->\n <DataTableCell\n v-if=\"data.files\"\n class=\"col-span-2 max-h-none\"\n :colspan=\"2\">\n <RequestTableFileList\n ref=\"fileList\"\n :disabled=\"data.isReadonly\"\n :files=\"data.files\"\n :name=\"name\"\n @removeFile=\"(index) => emit('removeFile', index)\"\n @updateFile=\"(index, disabled) => emit('updateFile', index, disabled)\"\n @uploadFile=\"emit('uploadFile')\">\n <RequestTableTooltip\n v-if=\"data.schema\"\n :description=\"data.description\"\n :schema=\"data.schema\"\n :value=\"value\" />\n </RequestTableFileList>\n </DataTableCell>\n <DataTableCell v-else>\n <!-- Preset switcher for grouped global cookies that share a name -->\n <DataTableInputSelect\n v-if=\"data.presetOptions?.length\"\n :canAddCustomValue=\"false\"\n :modelValue=\"displayValue\"\n :value=\"data.presetOptions\"\n @update:modelValue=\"(v) => emit('selectPreset', v)\" />\n <CodeInputLite\n v-else\n ref=\"valueInput\"\n :aria-label=\"\n translate('apiClient.requestTableRow.valueLabel', {\n name: label ?? '',\n })\n \"\n :arrayEncoding=\"data.arrayEncoding\"\n class=\"pr-6 group-hover:pr-10 group-has-[.code-input-lite__editor:focus]:pr-10\"\n :default=\"defaultValue\"\n :disabled=\"data.isReadonly\"\n :enum=\"enumValue\"\n :environment=\"environment\"\n :examples=\"\n data.schema?.examples?.map((example) => String(example)) ?? []\n \"\n :linethrough=\"data.isOverridden\"\n :modelValue=\"displayValue\"\n :placeholder=\"translate('apiClient.requestTableRow.value')\"\n :type=\"typeValue\"\n withFakeData\n @navigate=\"(route) => emit('navigate', route)\"\n @update:modelValue=\"(v) => handleUpdateRow({ value: v })\">\n <template #icon>\n <ScalarButton\n v-if=\"\n Boolean(data.name || value) &&\n !data.isRequired &&\n data.isReadonly !== true\n \"\n :aria-label=\"\n translate('apiClient.requestTableRow.deleteRow', {\n name: data.name || translate('apiClient.requestTableRow.row'),\n })\n \"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 hidden h-fit rounded p-1 group-hover:flex group-has-[.code-input-lite__editor:focus]:flex\"\n size=\"sm\"\n variant=\"ghost\"\n @click=\"emit('deleteRow')\">\n <ScalarIconTrash class=\"size-3.5\" />\n </ScalarButton>\n\n <ScalarIconButton\n v-if=\"data.globalRoute !== undefined\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 h-fit\"\n :icon=\"ScalarIconGlobe\"\n :label=\"translate('apiClient.requestTableRow.globalCookieHint')\"\n size=\"xs\"\n tooltip=\"top\"\n variant=\"ghost\"\n @click=\"emit('navigate', data.globalRoute)\" />\n\n <RequestTableTooltip\n v-if=\"data.isReadonly\"\n :description=\"translate('apiClient.requestTableRow.readOnlyHint')\"\n :value=\"null\" />\n <RequestTableTooltip\n v-else-if=\"data.schema\"\n :description=\"data.description\"\n :schema=\"data.schema\"\n :value />\n </template>\n </CodeInputLite>\n </DataTableCell>\n\n <!-- File upload -->\n <DataTableCell\n v-if=\"showUploadButton && !data.files\"\n class=\"group/upload flex items-center justify-center whitespace-nowrap\">\n <template v-if=\"isFile\">\n <div\n class=\"text-c-2 flex w-full max-w-[100%] items-center justify-center overflow-hidden p-1\">\n <span\n class=\"truncate\"\n :title=\"displayValue\"\n >{{ displayValue }}</span\n >\n </div>\n <button\n class=\"bg-b-2 mt-1 block rounded p-0.5 text-center text-xs font-medium md:pointer-events-none md:absolute md:inset-x-1 md:top-1/2 md:mt-0 md:-translate-y-1/2 md:opacity-0 md:group-hover/upload:pointer-events-auto md:group-hover/upload:opacity-100\"\n type=\"button\"\n @click=\"emit('removeFile')\">\n {{ translate('apiClient.requestTableRow.delete') }}\n </button>\n </template>\n <template v-else-if=\"canUploadFile\">\n <div class=\"p-0.5\">\n <ScalarButton\n :aria-label=\"\n translate('apiClient.requestTableRow.uploadFor', {\n action: fileUploadLabel,\n name: name || translate('apiClient.requestTableRow.row'),\n })\n \"\n class=\"bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"emit('uploadFile')\">\n <span>{{ fileUploadLabel }}</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </div>\n </template>\n </DataTableCell>\n </DataTableRow>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDA,MAAM,OAAO;EAWb,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,aAAa,eAAe,YAAY;EAC9C,MAAM,WAAW,eAAe,UAAU;EAC1C,SAAa,EACX,kBAAwB;GACtB,IAAI,QAAA,KAAK,OACP,SAAS,OAAO,YAAY;QAE5B,WAAW,OAAO,MAAM;EAE5B,EACF,CAAC;EA6DD,MAAM,OAAO,IAAY,QAAA,KAAK,QAAQ,EAAE;EACxC,MAAM,QAAQ,IAAmB,kBAAkB,QAAA,KAAK,KAAK,KAAK,EAAE;EACpE,MAAM,aAAa,IAAa,QAAA,KAAK,cAAc,KAAK;EAGxD,YACQ,QAAA,KAAK,OACV,YAAY;GAIX,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,QAAA,iBAC7B;GAEF,KAAK,QAAQ,WAAW;EAC1B,CACF;EACA,YACQ,QAAA,KAAK,QACV,aAAc,MAAM,QAAQ,kBAAkB,QAAQ,KAAK,EAC9D;EACA,YACQ,QAAA,KAAK,aACV,kBAAmB,WAAW,QAAQ,iBAAiB,KAC1D;;EAGA,MAAM,SAAS,eAAe,MAAM,iBAAiB,IAAI;;EAGzD,MAAM,gBAAgB,eACpB,QAAA,KAAK,SACD,aAAa,QAAA,KAAK,QAAQ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lBJP,YAiBeJ,MAAA,YAAA,GAAA;OAhBZ,cAA2BA,MAAA,SAAA,CAAS,CAAA,uCAAA;QAAkE,QAAA,gBAAA;QAAuC,MAAA,KAAA,SAAQA,MAAA,SAAA,CAAS,CAAA,+BAAA;;OAM/J,OAAM;OACN,MAAK;OACL,SAAQ;OACP,SAAK,OAAA,QAAA,OAAA,OAAA,WAAE,KAAI,YAAA;;OACZ,SAAAG,cAAkC,CAAlCU,mBAAkC,QAAA,MAAAC,gBAAzB,gBAAA,KAAe,GAAA,CAAA,GACxBV,YAIoBJ,MAAA,UAAA,GAAA;QAHlB,OAAM;QACN,MAAK;QACL,MAAK;QACL,WAAU"}
|
|
1
|
+
{"version":3,"file":"RequestTableRow.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","DataTableRow","_normalizeClass","_withCtx","_createVNode","DataTableCheckbox","DataTableCell","CodeInputLite","RequestTableFileList","RequestTableTooltip","DataTableInputSelect","DatePicker","_createElementBlock","_Fragment","_createElementVNode","_toDisplayString"],"sources":["../../../../../src/v2/blocks/request-block/components/RequestTableRow.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconGlobe, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport { isFileSchema } from '@scalar/workspace-store/helpers/is-file-schema'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n ParameterObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, ref, useTemplateRef, watch } from 'vue'\n\nimport { getFileName } from '@/v2/blocks/request-block/helpers/files'\nimport { validateParameter } from '@/v2/blocks/request-block/helpers/validate-parameter'\nimport { CodeInputLite } from '@/v2/components/code-input'\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableInputSelect,\n DataTableRow,\n} from '@/v2/components/data-table'\nimport { DatePicker, type DatePickerType } from '@/v2/components/date-picker'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestTableTooltip from './RequestTableTooltip.vue'\nimport RequestTableFileList, {\n type RequestTableFile,\n} from './RequestTableFileList.vue'\n\nconst {\n data,\n environment,\n hasCheckboxDisabled,\n deferKeyUpdates,\n invalidParams,\n showUploadButton,\n allowUnknownFileUploads = true,\n} = defineProps<{\n data: TableRow\n /** Keep key edits local until blur when the row identity depends on its name. */\n deferKeyUpdates?: boolean\n hasCheckboxDisabled?: boolean\n invalidParams?: Set<string>\n label?: string\n environment: XScalarEnvironment\n showUploadButton?: boolean\n /** Unknown fields remain editable as files only in free-form multipart requests. */\n allowUnknownFileUploads?: boolean\n}>()\n\nconst emit = defineEmits<{\n (e: 'upsertRow', payload: TableRowUpsertPayload): void\n (e: 'deleteRow'): void\n (e: 'uploadFile'): void\n (e: 'removeFile', fileIndex?: number): void\n (e: 'updateFile', fileIndex: number, isDisabled: boolean): void\n (e: 'navigate', route: NonNullable<TableRow['globalRoute']>): void\n /** Select a value for a grouped global cookie preset. */\n (e: 'selectPreset', value: string): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst valueInput = useTemplateRef('valueInput')\nconst fileList = useTemplateRef('fileList')\ndefineExpose({\n focusValue: (): void => {\n if (data.files) {\n fileList.value?.focusUpload()\n } else {\n valueInput.value?.focus()\n }\n },\n})\n\nexport type TableRow = {\n /** The parameter or field name/key */\n name: string\n /** The parameter value, can be a string, file, or null */\n value: string | File | null\n /** Selected files grouped for display; source rows remain separate multipart parts. */\n files?: RequestTableFile[]\n /** Optional description for the parameter */\n description?: string\n /** Optional route for global parameters (e.g., cookies shared across workspace) */\n globalRoute?: ApiReferenceEvents['ui:navigate']\n /** Whether the parameter is disabled/inactive */\n isDisabled?: boolean\n /** Whether an optional parameter is disabled because it has no explicit x-disabled value */\n isDisabledByDefault?: boolean\n /** OpenAPI schema object with type, validation rules, examples, etc. */\n schema?: SchemaObject\n /** Explicit media type for this multipart field. */\n contentType?: string\n /** Preserve array values even while their JSON text is temporarily invalid. */\n isArray?: boolean\n /** Text representation used by array enum controls. */\n arrayEncoding?: 'json' | 'comma-separated'\n /** Whether the parameter is required */\n isRequired?: boolean\n /**\n * Whether the parameter is readonly and can not be modifies directly\n * User can still override the parameter which is going to show up with the linethrough style\n */\n isReadonly?: boolean\n /** Whether the parameter is overridden later on */\n isOverridden?: boolean\n /** Track the original parameter so we can update it */\n originalParameter?: ParameterObject\n /** Path to a value inside the original parameter example for expanded object parameters */\n sourceParameterValuePath?: string[]\n /**\n * Selectable values for a grouped global cookie preset. When set, the value cell renders a\n * dropdown to switch between predefined values (for example a `Culture` cookie with `PL`/`EN`)\n * instead of an editable input.\n */\n presetOptions?: string[]\n}\n\nexport type TableRowUpsertPayload = {\n name: string\n value: string | File\n isDisabled: boolean\n shouldRenameExpandedRow?: boolean\n}\n\n/**\n * Track local state for the row\n *\n * Now this is required because of the way we get default values from the schema.\n * If we have a default value in data.value, then we update isDisabled to true. We lose the default value since now\n * we have an example where value: ''. This is why we need to track the local state and update all of the params at the\n * same time.\n */\nconst name = ref<string>(data.name ?? '')\nconst value = ref<string | File>(unpackProxyObject(data.value) ?? '')\nconst isDisabled = ref<boolean>(data.isDisabled ?? false)\n\n// Keep the above state synced with the data prop\nwatch(\n () => data.name,\n (newName) => {\n // Do not overwrite a valid local name with an empty incoming prop — this\n // can happen when the placeholder row (appended by displayData) is briefly\n // mapped onto this component instance before Vue re-keys the list.\n if (!newName && name.value && !deferKeyUpdates) {\n return\n }\n name.value = newName ?? ''\n },\n)\nwatch(\n () => data.value,\n (newValue) => (value.value = unpackProxyObject(newValue) ?? ''),\n)\nwatch(\n () => data.isDisabled,\n (newIsDisabled) => (isDisabled.value = newIsDisabled ?? false),\n)\n\n/** Check if the value is a File instance */\nconst isFile = computed(() => value.value instanceof File)\n\n/** Whether this row’s schema accepts a file part. */\nconst canUploadFile = computed<boolean>(() =>\n data.schema\n ? isFileSchema(data.schema, true, data.contentType)\n : allowUnknownFileUploads,\n)\n\nconst fileUploadLabel = computed<string>(() =>\n translate(\n data.schema && isArraySchema(data.schema)\n ? 'apiClient.requestTableRow.selectFiles'\n : 'apiClient.requestTableRow.selectFile',\n ),\n)\n\nconst hasMixedFileSelection = computed<boolean>(() =>\n Boolean(\n data.files?.some((file) => file.isDisabled) &&\n data.files.some((file) => !file.isDisabled),\n ),\n)\n\n/** Display value handles File instances and shows filename instead */\nconst displayValue = computed(\n () =>\n (isFile.value\n ? getFileName(value.value as File)\n : (value.value as string)) ?? '',\n)\n\nconst defaultValue = computed(() => data.schema?.default as string)\n\n/** See if we can extract enum values from the schema */\nconst enumValue = computed<unknown[]>(() => {\n if (!data.schema) {\n return []\n }\n\n // Grab the enum from the schema\n if (data.schema.enum) {\n return data.schema.enum.map((item) => String(item))\n }\n\n // Grab the enum from the items schema\n if ('items' in data.schema) {\n const resolved = resolve.schema(data.schema.items)\n if (resolved?.enum) {\n return data.arrayEncoding === 'json'\n ? resolved.enum\n : resolved.enum.map((item) => String(item))\n }\n }\n\n return []\n})\n\nconst typeValue = computed(() =>\n data.schema && 'type' in data.schema ? data.schema.type : undefined,\n)\n\n/**\n * Which date/time picker (if any) this value should offer, based on the\n * schema `format`. Free-text entry and `{{variables}}` keep working — the\n * picker is an optional shortcut that writes a formatted value back into the\n * same input.\n */\nconst dateFormat = computed<DatePickerType | undefined>(() => {\n const format =\n data.schema && 'format' in data.schema ? data.schema.format : undefined\n const pickerFormats: DatePickerType[] = ['date', 'date-time', 'time']\n return pickerFormats.includes(format as DatePickerType)\n ? (format as DatePickerType)\n : undefined\n})\n\nconst validationResult = computed(() =>\n validateParameter(data.schema, value.value),\n)\n\n/** Handle row updates while preserving existing properties */\nconst handleUpdateRow = (\n payload: Partial<{ name: string; value: string; isDisabled: boolean }>,\n options: { shouldRenameExpandedRow?: boolean; commitKey?: boolean } = {},\n): void => {\n // Update our local state\n if (payload.name !== undefined) {\n name.value = payload.name\n }\n if (payload.value !== undefined) {\n value.value = payload.value\n\n // Optional parameters start unchecked, but entering a value expresses intent to send it.\n // Explicit x-disabled values stay unchanged so a deliberate opt-out is preserved.\n if (data.isDisabledByDefault) {\n isDisabled.value = false\n }\n }\n\n // Is disabled should only be updated when explicitly provided in the payload\n if (payload.isDisabled !== undefined) {\n isDisabled.value = payload.isDisabled\n }\n\n if (\n payload.name !== undefined &&\n (deferKeyUpdates || data.sourceParameterValuePath) &&\n !options.shouldRenameExpandedRow &&\n !options.commitKey\n ) {\n return\n }\n\n // Emit all of the local state\n emit('upsertRow', {\n name: name.value,\n value: value.value,\n isDisabled: isDisabled.value,\n ...(options.shouldRenameExpandedRow\n ? { shouldRenameExpandedRow: true }\n : {}),\n })\n}\n\n/**\n * Commit a key edit when the input loses focus. Body and expanded-object rows defer their rename to blur (see\n * handleUpdateRow), so we only emit when the key actually changed. Focusing and blurring the field\n * without typing should not re-emit the row or silently reset its disabled state. The current\n * disabled state is passed through so a renamed row keeps it.\n */\nconst handleKeyBlur = (newName: string): void => {\n if (newName === data.name) {\n return\n }\n // Do not emit an update that would blank the parameter name — this can fire\n // when CodeInputLite blurs before it has rendered its initial value.\n if (!newName && data.name && (!deferKeyUpdates || name.value !== '')) {\n return\n }\n\n handleUpdateRow(\n { name: newName, isDisabled: isDisabled.value },\n {\n shouldRenameExpandedRow: Boolean(data.sourceParameterValuePath),\n commitKey: true,\n },\n )\n}\n\n/** Save a pending body key before the send shortcut reaches the request handler. */\nconst handleKeydown = (event: KeyboardEvent): void => {\n if (\n deferKeyUpdates &&\n event.key === 'Enter' &&\n (event.metaKey || event.ctrlKey)\n ) {\n handleKeyBlur(name.value)\n }\n}\n</script>\n\n<template>\n <DataTableRow\n :id=\"data.name\"\n :class=\"{\n alert: validationResult.ok === false,\n error: validationResult.ok === false && invalidParams?.has(data.name),\n }\">\n <DataTableCheckbox\n :ariaLabel=\"\n translate('apiClient.requestTableRow.include', {\n name: data.name || translate('apiClient.requestTableRow.row'),\n })\n \"\n class=\"!border-r\"\n :class=\"{ 'max-h-none': data.files }\"\n :disabled=\"hasCheckboxDisabled ?? false\"\n :indeterminate=\"hasMixedFileSelection\"\n :modelValue=\"!isDisabled\"\n @update:modelValue=\"(v) => handleUpdateRow({ isDisabled: !v })\" />\n\n <!-- Name -->\n <DataTableCell :class=\"{ 'max-h-none': data.files }\">\n <CodeInputLite\n :aria-label=\"\n translate('apiClient.requestTableRow.keyLabel', { name: label ?? '' })\n \"\n :disabled=\"data.isReadonly\"\n :environment=\"environment\"\n :modelValue=\"name\"\n :placeholder=\"translate('apiClient.requestTableRow.key')\"\n :required=\"Boolean(data.isRequired)\"\n @blur=\"(v) => handleKeyBlur(v)\"\n @keydown.capture=\"handleKeydown\"\n @navigate=\"(route) => emit('navigate', route)\"\n @update:modelValue=\"(v) => handleUpdateRow({ name: v })\" />\n </DataTableCell>\n\n <!-- Value -->\n <DataTableCell\n v-if=\"data.files\"\n class=\"col-span-2 max-h-none\"\n :colspan=\"2\">\n <RequestTableFileList\n ref=\"fileList\"\n :disabled=\"data.isReadonly\"\n :files=\"data.files\"\n :name=\"name\"\n @removeFile=\"(index) => emit('removeFile', index)\"\n @updateFile=\"(index, disabled) => emit('updateFile', index, disabled)\"\n @uploadFile=\"emit('uploadFile')\">\n <RequestTableTooltip\n v-if=\"data.schema\"\n :description=\"data.description\"\n :schema=\"data.schema\"\n :value=\"value\" />\n </RequestTableFileList>\n </DataTableCell>\n <DataTableCell v-else>\n <!-- Preset switcher for grouped global cookies that share a name -->\n <DataTableInputSelect\n v-if=\"data.presetOptions?.length\"\n :canAddCustomValue=\"false\"\n :modelValue=\"displayValue\"\n :value=\"data.presetOptions\"\n @update:modelValue=\"(v) => emit('selectPreset', v)\" />\n <CodeInputLite\n v-else\n ref=\"valueInput\"\n :aria-label=\"\n translate('apiClient.requestTableRow.valueLabel', {\n name: label ?? '',\n })\n \"\n :arrayEncoding=\"data.arrayEncoding\"\n class=\"pr-6 group-hover:pr-10 group-has-[.code-input-lite__editor:focus]:pr-10\"\n :default=\"defaultValue\"\n :disabled=\"data.isReadonly\"\n :enum=\"enumValue\"\n :environment=\"environment\"\n :examples=\"\n data.schema?.examples?.map((example) => String(example)) ?? []\n \"\n :linethrough=\"data.isOverridden\"\n :modelValue=\"displayValue\"\n :placeholder=\"translate('apiClient.requestTableRow.value')\"\n :type=\"typeValue\"\n withFakeData\n @navigate=\"(route) => emit('navigate', route)\"\n @update:modelValue=\"(v) => handleUpdateRow({ value: v })\">\n <template #icon>\n <ScalarButton\n v-if=\"\n Boolean(data.name || value) &&\n !data.isRequired &&\n data.isReadonly !== true\n \"\n :aria-label=\"\n translate('apiClient.requestTableRow.deleteRow', {\n name: data.name || translate('apiClient.requestTableRow.row'),\n })\n \"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 hidden h-fit rounded p-1 group-hover:flex group-has-[.code-input-lite__editor:focus]:flex\"\n size=\"sm\"\n variant=\"ghost\"\n @click=\"emit('deleteRow')\">\n <ScalarIconTrash class=\"size-3.5\" />\n </ScalarButton>\n\n <ScalarIconButton\n v-if=\"data.globalRoute !== undefined\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 h-fit\"\n :icon=\"ScalarIconGlobe\"\n :label=\"translate('apiClient.requestTableRow.globalCookieHint')\"\n size=\"xs\"\n tooltip=\"top\"\n variant=\"ghost\"\n @click=\"emit('navigate', data.globalRoute)\" />\n\n <DatePicker\n v-if=\"dateFormat && data.isReadonly !== true\"\n :fieldName=\"data.name || label\"\n :modelValue=\"displayValue\"\n :type=\"dateFormat\"\n @update:modelValue=\"(v) => handleUpdateRow({ value: v })\" />\n\n <RequestTableTooltip\n v-if=\"data.isReadonly\"\n :description=\"translate('apiClient.requestTableRow.readOnlyHint')\"\n :value=\"null\" />\n <RequestTableTooltip\n v-else-if=\"data.schema\"\n :description=\"data.description\"\n :schema=\"data.schema\"\n :value />\n </template>\n </CodeInputLite>\n </DataTableCell>\n\n <!-- File upload -->\n <DataTableCell\n v-if=\"showUploadButton && !data.files\"\n class=\"group/upload flex items-center justify-center whitespace-nowrap\">\n <template v-if=\"isFile\">\n <div\n class=\"text-c-2 flex w-full max-w-[100%] items-center justify-center overflow-hidden p-1\">\n <span\n class=\"truncate\"\n :title=\"displayValue\"\n >{{ displayValue }}</span\n >\n </div>\n <button\n class=\"bg-b-2 mt-1 block rounded p-0.5 text-center text-xs font-medium md:pointer-events-none md:absolute md:inset-x-1 md:top-1/2 md:mt-0 md:-translate-y-1/2 md:opacity-0 md:group-hover/upload:pointer-events-auto md:group-hover/upload:opacity-100\"\n type=\"button\"\n @click=\"emit('removeFile')\">\n {{ translate('apiClient.requestTableRow.delete') }}\n </button>\n </template>\n <template v-else-if=\"canUploadFile\">\n <div class=\"p-0.5\">\n <ScalarButton\n :aria-label=\"\n translate('apiClient.requestTableRow.uploadFor', {\n action: fileUploadLabel,\n name: name || translate('apiClient.requestTableRow.row'),\n })\n \"\n class=\"bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"emit('uploadFile')\">\n <span>{{ fileUploadLabel }}</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </div>\n </template>\n </DataTableCell>\n </DataTableRow>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDA,MAAM,OAAO;EAWb,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,aAAa,eAAe,YAAY;EAC9C,MAAM,WAAW,eAAe,UAAU;EAC1C,SAAa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,SAAQA,MAAA,SAAA,CAAS,CAAA,+BAAA;;OAM/J,OAAM;OACN,MAAK;OACL,SAAQ;OACP,SAAK,OAAA,QAAA,OAAA,OAAA,WAAE,KAAI,YAAA;;OACZ,SAAAG,cAAkC,CAAlCW,mBAAkC,QAAA,MAAAC,gBAAzB,gBAAA,KAAe,GAAA,CAAA,GACxBX,YAIoBJ,MAAA,UAAA,GAAA;QAHlB,OAAM;QACN,MAAK;QACL,MAAK;QACL,WAAU"}
|
|
@@ -2,8 +2,8 @@ import { validateParameter } from "../helpers/validate-parameter.js";
|
|
|
2
2
|
import { useLocalization } from "../../../features/localization/index.js";
|
|
3
3
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
|
|
4
4
|
import { ScalarIconInfo, ScalarIconWarning } from "@scalar/icons";
|
|
5
|
-
import { ScalarMarkdown } from "@scalar/components/markdown";
|
|
6
5
|
import { ScalarPopover } from "@scalar/components/popover";
|
|
6
|
+
import { ScalarMarkdown } from "@scalar/components/markdown";
|
|
7
7
|
// src/v2/blocks/request-block/components/RequestTableTooltip.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var _hoisted_1 = ["aria-label", "role"];
|
|
9
9
|
var _hoisted_2 = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-parameter.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/helpers/validate-parameter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-parameter.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/helpers/validate-parameter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,YAAY,EACrB,QAAQ,MAAM,GAAG,IAAI,GAAG,IAAI,KAC3B;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CA8D7C,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REGEX } from "@scalar/helpers/regex/regex-helpers";
|
|
1
2
|
// src/v2/blocks/request-block/helpers/validate-parameter.ts
|
|
2
3
|
/**
|
|
3
4
|
* Checks if the value of a example parameter is the expected type or format
|
|
@@ -24,14 +25,19 @@ var validateParameter = (schema, value) => {
|
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
if (schema.type === "string" && schema.format) {
|
|
28
|
+
if ((schema.format === "date" || schema.format === "date-time" || schema.format === "time") && [...value.matchAll(REGEX.VARIABLES)].some(([match, key]) => match === value && key?.trim())) return { ok: true };
|
|
27
29
|
if (schema.format === "date" && !/^\d{4}-\d{2}-\d{2}$/.test(value ?? "")) return {
|
|
28
30
|
ok: false,
|
|
29
31
|
message: "Please enter a valid date in YYYY-MM-DD format (e.g., 2024-03-20)"
|
|
30
32
|
};
|
|
31
|
-
if (schema.format === "date-time" && !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})
|
|
33
|
+
if (schema.format === "date-time" && !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i.test(value ?? "")) return {
|
|
32
34
|
ok: false,
|
|
33
35
|
message: "Please enter a valid date and time in RFC 3339 format (e.g., 2024-03-20T13:45:30Z)"
|
|
34
36
|
};
|
|
37
|
+
if (schema.format === "time" && !/^\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/i.test(value ?? "")) return {
|
|
38
|
+
ok: false,
|
|
39
|
+
message: "Please enter a valid time in HH:MM:SS format (e.g., 13:45:30)"
|
|
40
|
+
};
|
|
35
41
|
if (schema.format === "email" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value ?? "")) return {
|
|
36
42
|
ok: false,
|
|
37
43
|
message: "Please enter a valid email address (e.g., user@example.com)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-parameter.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/validate-parameter.ts"],"sourcesContent":["import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/**\n * Checks if the value of a example parameter is the expected type or format\n */\nexport const validateParameter = (\n schema?: SchemaObject,\n value?: string | File | null,\n): { ok: true } | { ok: false; message: string } => {\n if (!schema || !('type' in schema) || typeof value !== 'string') {\n return { ok: true }\n }\n\n // Numbers and integers validation\n if (schema.type === 'integer' || schema.type === 'number') {\n const numberValue = Number(value)\n\n if (isNaN(numberValue)) {\n return { ok: false, message: 'Value must be a number (e.g., 42.5)' }\n }\n\n if (schema.type === 'integer' && !Number.isInteger(numberValue)) {\n return { ok: false, message: 'Value must be a whole number (e.g., 42)' }\n }\n\n if (schema.minimum !== undefined && numberValue < schema.minimum) {\n return { ok: false, message: `Value must be ${schema.minimum} or greater` }\n }\n if (schema.maximum !== undefined && numberValue > schema.maximum) {\n return { ok: false, message: `Value must be ${schema.maximum} or less` }\n }\n }\n\n // string validations\n if (schema.type === 'string' && schema.format) {\n if (schema.format === 'date' && !/^\\d{4}-\\d{2}-\\d{2}$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid date in YYYY-MM-DD format (e.g., 2024-03-20)' }\n }\n if (\n schema.format === 'date-time' &&\n !/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})
|
|
1
|
+
{"version":3,"file":"validate-parameter.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/validate-parameter.ts"],"sourcesContent":["import { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/**\n * Checks if the value of a example parameter is the expected type or format\n */\nexport const validateParameter = (\n schema?: SchemaObject,\n value?: string | File | null,\n): { ok: true } | { ok: false; message: string } => {\n if (!schema || !('type' in schema) || typeof value !== 'string') {\n return { ok: true }\n }\n\n // Numbers and integers validation\n if (schema.type === 'integer' || schema.type === 'number') {\n const numberValue = Number(value)\n\n if (isNaN(numberValue)) {\n return { ok: false, message: 'Value must be a number (e.g., 42.5)' }\n }\n\n if (schema.type === 'integer' && !Number.isInteger(numberValue)) {\n return { ok: false, message: 'Value must be a whole number (e.g., 42)' }\n }\n\n if (schema.minimum !== undefined && numberValue < schema.minimum) {\n return { ok: false, message: `Value must be ${schema.minimum} or greater` }\n }\n if (schema.maximum !== undefined && numberValue > schema.maximum) {\n return { ok: false, message: `Value must be ${schema.maximum} or less` }\n }\n }\n\n // string validations\n if (schema.type === 'string' && schema.format) {\n // Environment and faker variables are resolved when the request is sent.\n if (\n (schema.format === 'date' || schema.format === 'date-time' || schema.format === 'time') &&\n [...value.matchAll(REGEX.VARIABLES)].some(([match, key]) => match === value && key?.trim())\n ) {\n return { ok: true }\n }\n\n if (schema.format === 'date' && !/^\\d{4}-\\d{2}-\\d{2}$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid date in YYYY-MM-DD format (e.g., 2024-03-20)' }\n }\n if (\n schema.format === 'date-time' &&\n !/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$/i.test(value ?? '')\n ) {\n return {\n ok: false,\n message: 'Please enter a valid date and time in RFC 3339 format (e.g., 2024-03-20T13:45:30Z)',\n }\n }\n if (schema.format === 'time' && !/^\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?$/i.test(value ?? '')) {\n return {\n ok: false,\n message: 'Please enter a valid time in HH:MM:SS format (e.g., 13:45:30)',\n }\n }\n if (schema.format === 'email' && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid email address (e.g., user@example.com)' }\n }\n if (schema.format === 'uri' && !/^[a-zA-Z][a-zA-Z0-9+.-]*:.+$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid URI (e.g., https://example.com)' }\n }\n }\n\n return { ok: true }\n}\n"],"mappings":";;;;;AAMA,IAAa,qBACX,QACA,UACkD;CAClD,IAAI,CAAC,UAAU,EAAE,UAAU,WAAW,OAAO,UAAU,UACrD,OAAO,EAAE,IAAI,KAAK;CAIpB,IAAI,OAAO,SAAS,aAAa,OAAO,SAAS,UAAU;EACzD,MAAM,cAAc,OAAO,KAAK;EAEhC,IAAI,MAAM,WAAW,GACnB,OAAO;GAAE,IAAI;GAAO,SAAS;EAAsC;EAGrE,IAAI,OAAO,SAAS,aAAa,CAAC,OAAO,UAAU,WAAW,GAC5D,OAAO;GAAE,IAAI;GAAO,SAAS;EAA0C;EAGzE,IAAI,OAAO,YAAY,KAAA,KAAa,cAAc,OAAO,SACvD,OAAO;GAAE,IAAI;GAAO,SAAS,iBAAiB,OAAO,QAAQ;EAAa;EAE5E,IAAI,OAAO,YAAY,KAAA,KAAa,cAAc,OAAO,SACvD,OAAO;GAAE,IAAI;GAAO,SAAS,iBAAiB,OAAO,QAAQ;EAAU;CAE3E;CAGA,IAAI,OAAO,SAAS,YAAY,OAAO,QAAQ;EAE7C,KACG,OAAO,WAAW,UAAU,OAAO,WAAW,eAAe,OAAO,WAAW,WAChF,CAAC,GAAG,MAAM,SAAS,MAAM,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,SAAS,UAAU,SAAS,KAAK,KAAK,CAAC,GAE1F,OAAO,EAAE,IAAI,KAAK;EAGpB,IAAI,OAAO,WAAW,UAAU,CAAC,sBAAsB,KAAK,SAAS,EAAE,GACrE,OAAO;GAAE,IAAI;GAAO,SAAS;EAAoE;EAEnG,IACE,OAAO,WAAW,eAClB,CAAC,oEAAoE,KAAK,SAAS,EAAE,GAErF,OAAO;GACL,IAAI;GACJ,SAAS;EACX;EAEF,IAAI,OAAO,WAAW,UAAU,CAAC,mDAAmD,KAAK,SAAS,EAAE,GAClG,OAAO;GACL,IAAI;GACJ,SAAS;EACX;EAEF,IAAI,OAAO,WAAW,WAAW,CAAC,6BAA6B,KAAK,SAAS,EAAE,GAC7E,OAAO;GAAE,IAAI;GAAO,SAAS;EAA8D;EAE7F,IAAI,OAAO,WAAW,SAAS,CAAC,+BAA+B,KAAK,SAAS,EAAE,GAC7E,OAAO;GAAE,IAAI;GAAO,SAAS;EAAuD;CAExF;CAEA,OAAO,EAAE,IAAI,KAAK;AACpB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type DatePickerType } from './date-parts.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** The current field value; may be a formatted value, free text, or a variable. */
|
|
4
|
+
modelValue: string;
|
|
5
|
+
/** Field name used to distinguish picker triggers in the request table. */
|
|
6
|
+
fieldName?: string;
|
|
7
|
+
/** Which OpenAPI string format this field carries. */
|
|
8
|
+
type: DatePickerType;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
11
|
+
"update:modelValue": (value: string) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=DatePicker.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/date-picker/DatePicker.vue"],"names":[],"mappings":"AAwcA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,cAAc,CAAA;AAErB,KAAK,WAAW,GAAG;IACjB,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAA;IAClB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sDAAsD;IACtD,IAAI,EAAE,cAAc,CAAA;CACrB,CAAC;AAu6BF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import DatePicker_vue_vue_type_script_setup_true_lang_default from "./DatePicker.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
// src/v2/components/date-picker/DatePicker.vue
|
|
3
|
+
var DatePicker_default = DatePicker_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
export { DatePicker_default as default };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=DatePicker.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.vue.js","names":[],"sources":[],"mappings":""}
|