@rancher/shell 0.5.0 → 0.5.2

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.
Files changed (51) hide show
  1. package/components/AsyncButton.vue +5 -17
  2. package/components/Certificates.vue +4 -4
  3. package/components/DraggableZone.vue +2 -2
  4. package/components/PodSecurityAdmission.vue +2 -2
  5. package/components/form/Error.vue +3 -3
  6. package/components/form/Footer.vue +2 -2
  7. package/components/form/GitPicker.vue +38 -83
  8. package/composables/useCompactInput.ts +2 -2
  9. package/core/types-provisioning.ts +7 -0
  10. package/edit/catalog.cattle.io.clusterrepo.vue +18 -0
  11. package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +2 -2
  12. package/edit/provisioning.cattle.io.cluster/index.vue +9 -3
  13. package/mixins/create-edit-view/index.js +2 -2
  14. package/models/management.cattle.io.kontainerdriver.js +2 -1
  15. package/package.json +1 -1
  16. package/rancher-components/Accordion/Accordion.vue +2 -3
  17. package/rancher-components/BadgeState/BadgeState.vue +3 -3
  18. package/rancher-components/Banner/Banner.vue +2 -2
  19. package/rancher-components/Card/Card.vue +3 -3
  20. package/rancher-components/Form/Checkbox/Checkbox.vue +3 -3
  21. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +1 -1
  22. package/rancher-components/Form/LabeledInput/LabeledInput.vue +23 -53
  23. package/rancher-components/Form/Radio/RadioButton.vue +7 -13
  24. package/rancher-components/Form/Radio/RadioGroup.vue +3 -4
  25. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +4 -6
  26. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +4 -7
  27. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +4 -9
  28. package/rancher-components/StringList/StringList.vue +8 -8
  29. package/rancher-components/components/Accordion/Accordion.vue +2 -3
  30. package/rancher-components/components/BadgeState/BadgeState.vue +3 -3
  31. package/rancher-components/components/Banner/Banner.vue +2 -2
  32. package/rancher-components/components/Card/Card.vue +3 -3
  33. package/rancher-components/components/Form/Checkbox/Checkbox.vue +3 -3
  34. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +1 -1
  35. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +23 -53
  36. package/rancher-components/components/Form/Radio/RadioButton.vue +7 -13
  37. package/rancher-components/components/Form/Radio/RadioGroup.vue +3 -4
  38. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +4 -6
  39. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +4 -7
  40. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +4 -9
  41. package/rancher-components/components/StringList/StringList.vue +8 -8
  42. package/scripts/extension/parse-tag-name +3 -3
  43. package/store/plugins.js +7 -6
  44. package/tsconfig.paths.json +1 -4
  45. package/types/shell/index.d.ts +20 -82
  46. package/utils/git.ts +1 -1
  47. package/composables/useCompactInput.test.ts +0 -36
  48. package/composables/useLabeledFormElement.test.ts +0 -135
  49. package/types/vue-shim.d.ts +0 -42
  50. /package/rancher-components/BadgeState/{BadgeState.test.ts → BadgeState.spec.ts} +0 -0
  51. /package/rancher-components/components/BadgeState/{BadgeState.test.ts → BadgeState.spec.ts} +0 -0
@@ -1,27 +1,21 @@
1
1
  <script lang="ts">
2
- import { defineComponent } from 'vue';
2
+ import Vue, { VueConstructor } from 'vue';
3
+ import CompactInput from '@shell/mixins/compact-input';
4
+ import LabeledFormElement from '@shell/mixins/labeled-form-element';
3
5
  import TextAreaAutoGrow from '@components/Form/TextArea/TextAreaAutoGrow.vue';
4
6
  import LabeledTooltip from '@components/LabeledTooltip/LabeledTooltip.vue';
5
7
  import { escapeHtml } from '@shell/utils/string';
6
8
  import cronstrue from 'cronstrue';
7
9
  import { isValidCron } from 'cron-validator';
8
10
  import { debounce } from 'lodash';
9
- import { useLabeledFormElement, labeledFormElementProps } from '@shell/composables/useLabeledFormElement';
10
- import { useCompactInput } from '@shell/composables/useCompactInput';
11
11
 
12
- declare module 'vue/types/vue' {
13
- interface Vue {
14
- onInput: (event: Event) => void | ((event: Event) => void);
15
- }
16
- }
17
-
18
- export default defineComponent({
12
+ export default (
13
+ Vue as VueConstructor<Vue & InstanceType<typeof LabeledFormElement> & InstanceType<typeof CompactInput>>
14
+ ).extend({
19
15
  components: { LabeledTooltip, TextAreaAutoGrow },
20
-
21
- inheritAttrs: false,
16
+ mixins: [LabeledFormElement, CompactInput],
22
17
 
23
18
  props: {
24
- ...labeledFormElementProps,
25
19
  /**
26
20
  * The type of the Labeled Input.
27
21
  * @values text, cron, multiline, multiline-password
@@ -99,36 +93,21 @@ export default defineComponent({
99
93
  },
100
94
  },
101
95
 
102
- setup(props, { emit }) {
103
- const {
104
- focused,
105
- onFocusLabeled,
106
- onBlurLabeled,
107
- isDisabled,
108
- validationMessage,
109
- requiredField
110
- } = useLabeledFormElement(props, emit);
111
- const { isCompact } = useCompactInput(props);
112
-
113
- return {
114
- focused,
115
- onFocusLabeled,
116
- onBlurLabeled,
117
- isDisabled,
118
- validationMessage,
119
- requiredField,
120
- isCompact,
121
- };
122
- },
123
-
124
96
  data() {
125
97
  return {
126
98
  updated: false,
127
- validationErrors: '',
99
+ validationErrors: ''
128
100
  };
129
101
  },
130
102
 
131
103
  computed: {
104
+ /**
105
+ * Determines if the Labeled Input @input event should be debounced.
106
+ */
107
+ onInput(): ((value: string) => void) | void {
108
+ return this.delay ? debounce(this.delayInput, this.delay) : this.delayInput;
109
+ },
110
+
132
111
  /**
133
112
  * Determines if the Labeled Input should display a label.
134
113
  */
@@ -143,7 +122,7 @@ export default defineComponent({
143
122
  return !!this.tooltip || !!this.tooltipKey;
144
123
  },
145
124
 
146
- tooltipValue(): string | Record<string, unknown> | undefined {
125
+ tooltipValue(): string | undefined {
147
126
  if (this.hasTooltip) {
148
127
  return this.tooltipKey ? this.t(this.tooltipKey) : this.tooltip;
149
128
  }
@@ -165,7 +144,7 @@ export default defineComponent({
165
144
  if (this.type !== 'cron' || !this.value) {
166
145
  return;
167
146
  }
168
- if (typeof this.value === 'string' && !isValidCron(this.value)) {
147
+ if (!isValidCron(this.value)) {
169
148
  return this.t('generic.invalidCron');
170
149
  }
171
150
  try {
@@ -194,22 +173,15 @@ export default defineComponent({
194
173
  /**
195
174
  * The max length for the Labeled Input.
196
175
  */
197
- _maxlength(): number | undefined {
176
+ _maxlength(): number | null {
198
177
  if (this.type === 'text' && this.maxlength) {
199
178
  return this.maxlength;
200
179
  }
201
180
 
202
- return undefined;
181
+ return null;
203
182
  },
204
183
  },
205
184
 
206
- created() {
207
- /**
208
- * Determines if the Labeled Input @input event should be debounced.
209
- */
210
- this.onInput = this.delay ? debounce(this.delayInput, this.delay) : this.delayInput;
211
- },
212
-
213
185
  methods: {
214
186
  /**
215
187
  * Attempts to give the Labeled Input focus.
@@ -248,9 +220,7 @@ export default defineComponent({
248
220
  * NOTE: In multiline, TextAreaAutoGrow emits a string with the value
249
221
  * https://github.com/rancher/dashboard/issues/10249
250
222
  */
251
- delayInput(val: string | Event): void {
252
- const value = typeof val === 'string' ? val : (val?.target as HTMLInputElement)?.value;
253
-
223
+ delayInput(value: string): void {
254
224
  this.$emit('input', value);
255
225
  },
256
226
 
@@ -267,7 +237,7 @@ export default defineComponent({
267
237
  * event.
268
238
  * @see labeled-form-element.ts mixin for onBlurLabeled()
269
239
  */
270
- onBlur(event: string | FocusEvent): void {
240
+ onBlur(event: string): void {
271
241
  this.$emit('blur', event);
272
242
  this.onBlurLabeled();
273
243
  },
@@ -319,7 +289,7 @@ export default defineComponent({
319
289
  :placeholder="_placeholder"
320
290
  autocapitalize="off"
321
291
  :class="{ conceal: type === 'multiline-password' }"
322
- @input="onInput"
292
+ @input="onInput($event)"
323
293
  @focus="onFocus"
324
294
  @blur="onBlur"
325
295
  />
@@ -336,7 +306,7 @@ export default defineComponent({
336
306
  autocomplete="off"
337
307
  autocapitalize="off"
338
308
  :data-lpignore="ignorePasswordManagers"
339
- @input="onInput"
309
+ @input="onInput($event.target.value)"
340
310
  @focus="onFocus"
341
311
  @blur="onBlur"
342
312
  @change="onChange"
@@ -1,9 +1,8 @@
1
1
  <script lang="ts">
2
- import { defineComponent } from 'vue';
2
+ import Vue from 'vue';
3
3
  import { _VIEW } from '@shell/config/query-params';
4
- import { randomStr } from '@shell/utils/string';
5
4
 
6
- export default defineComponent({
5
+ export default Vue.extend({
7
6
  props: {
8
7
  /**
9
8
  * The name of the input, for grouping.
@@ -72,10 +71,7 @@ export default defineComponent({
72
71
  },
73
72
 
74
73
  data() {
75
- return {
76
- isChecked: this.value === this.val,
77
- randomString: `${ randomStr() }-radio`,
78
- };
74
+ return { isChecked: this.value === this.val };
79
75
  },
80
76
 
81
77
  computed: {
@@ -119,15 +115,13 @@ export default defineComponent({
119
115
  /**
120
116
  * Emits the input event.
121
117
  */
122
- clicked(event: MouseEvent | KeyboardEvent) {
123
- const target = event.target;
124
-
125
- if (this.isDisabled || (target instanceof HTMLElement && target.tagName === 'A')) {
118
+ clicked({ target }: { target?: HTMLElement }) {
119
+ if (this.isDisabled || target?.tagName === 'A') {
126
120
  return;
127
121
  }
128
122
 
129
123
  this.$emit('input', this.val);
130
- },
124
+ }
131
125
  }
132
126
  });
133
127
  </script>
@@ -140,7 +134,7 @@ export default defineComponent({
140
134
  @click.stop="clicked($event)"
141
135
  >
142
136
  <input
143
- :id="randomString"
137
+ :id="_uid+'-radio'"
144
138
  :disabled="isDisabled"
145
139
  :name="name"
146
140
  :value="''+val"
@@ -1,15 +1,14 @@
1
1
  <script lang="ts">
2
- import { PropType, defineComponent } from 'vue';
2
+ import Vue, { PropType } from 'vue';
3
3
  import { _VIEW } from '@shell/config/query-params';
4
4
  import RadioButton from '@components/Form/Radio/RadioButton.vue';
5
5
 
6
6
  interface Option {
7
7
  value: unknown,
8
- label: string,
9
- description?: string,
8
+ label: string
10
9
  }
11
10
 
12
- export default defineComponent({
11
+ export default Vue.extend({
13
12
  components: { RadioButton },
14
13
  props: {
15
14
  /**
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { defineComponent } from 'vue';
2
+ import Vue from 'vue';
3
3
  import debounce from 'lodash/debounce';
4
4
  import { _EDIT, _VIEW } from '@shell/config/query-params';
5
5
 
@@ -10,7 +10,7 @@ declare module 'vue/types/vue' {
10
10
  }
11
11
  }
12
12
 
13
- export default defineComponent({
13
+ export default Vue.extend({
14
14
  inheritAttrs: false,
15
15
 
16
16
  props: {
@@ -115,9 +115,7 @@ export default defineComponent({
115
115
  /**
116
116
  * Emits the input event and resizes the Text Area.
117
117
  */
118
- onInput(event: Event): void {
119
- const val = (event?.target as HTMLInputElement)?.value;
120
-
118
+ onInput(val: string): void {
121
119
  this.$emit('input', val);
122
120
  this.queueResize();
123
121
  },
@@ -165,7 +163,7 @@ export default defineComponent({
165
163
  v-bind="$attrs"
166
164
  :spellcheck="spellcheck"
167
165
  @paste="$emit('paste', $event)"
168
- @input="onInput($event)"
166
+ @input="onInput($event.target.value)"
169
167
  @focus="$emit('focus', $event)"
170
168
  @blur="$emit('blur', $event)"
171
169
  />
@@ -1,9 +1,6 @@
1
1
  <script lang="ts">
2
- import { defineComponent } from 'vue';
3
-
4
- type StateType = boolean | 'true' | 'false' | undefined;
5
-
6
- export default defineComponent({
2
+ import Vue from 'vue';
3
+ export default Vue.extend({
7
4
  props: {
8
5
  value: {
9
6
  type: [Boolean, String, Number],
@@ -31,7 +28,7 @@ export default defineComponent({
31
28
  },
32
29
  },
33
30
  data() {
34
- return { state: false as StateType };
31
+ return { state: false as boolean | string | number };
35
32
  },
36
33
 
37
34
  watch: {
@@ -44,7 +41,7 @@ export default defineComponent({
44
41
  },
45
42
 
46
43
  methods: {
47
- toggle(neu: StateType | null) {
44
+ toggle(neu: boolean | string | number) {
48
45
  this.state = neu === null ? !this.state : neu;
49
46
  this.$emit('input', this.state ? this.onValue : this.offValue);
50
47
  }
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import { defineComponent } from 'vue';
2
+ import Vue from 'vue';
3
3
 
4
- export default defineComponent({
4
+ export default Vue.extend({
5
5
  props: {
6
6
  /**
7
7
  * The Labeled Tooltip value.
@@ -29,14 +29,9 @@ export default defineComponent({
29
29
  }
30
30
  },
31
31
  computed: {
32
- iconClass(): string {
32
+ iconClass() {
33
33
  return this.status === 'error' ? 'icon-warning' : 'icon-info';
34
34
  }
35
- },
36
- methods: {
37
- isObject(value: string | Record<string, unknown>): value is Record<string, unknown> {
38
- return typeof value === 'object' && value !== null && !!value.content;
39
- }
40
35
  }
41
36
  });
42
37
  </script>
@@ -49,7 +44,7 @@ export default defineComponent({
49
44
  >
50
45
  <template v-if="hover">
51
46
  <i
52
- v-clean-tooltip="isObject(value) ? { ...{content: value.content, classes: [`tooltip-${status}`]}, ...value } : value"
47
+ v-clean-tooltip="value.content ? { ...{content: value.content, classes: [`tooltip-${status}`]}, ...value } : value"
53
48
  :class="{'hover':!value, [iconClass]: true}"
54
49
  class="icon status-icon"
55
50
  />
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import Vue, { PropType, defineComponent } from 'vue';
2
+ import Vue, { PropType } from 'vue';
3
3
 
4
4
  import LabeledInput from '@components/Form/LabeledInput/LabeledInput.vue';
5
5
  import { findStringIndex, hasDuplicatedStrings } from '@shell/utils/array';
@@ -29,7 +29,7 @@ const CLASS = {
29
29
  /**
30
30
  * Manage a list of strings
31
31
  */
32
- export default defineComponent({
32
+ export default Vue.extend({
33
33
 
34
34
  name: 'StringList',
35
35
  components: { LabeledInput },
@@ -92,9 +92,9 @@ export default defineComponent({
92
92
  },
93
93
  data() {
94
94
  return {
95
- value: undefined as string | undefined,
95
+ value: null as string | null,
96
96
  selected: null as string | null,
97
- editedItem: undefined as string | undefined,
97
+ editedItem: null as string | null,
98
98
  isCreateItem: false,
99
99
  errors: { duplicate: false } as Record<Error, boolean>
100
100
  };
@@ -281,7 +281,7 @@ export default defineComponent({
281
281
  this.isCreateItem = true;
282
282
  this.setFocus(INPUT.create);
283
283
  } else {
284
- this.value = undefined;
284
+ this.value = null;
285
285
  this.toggleError('duplicate', false);
286
286
  this.onSelectLeave();
287
287
 
@@ -303,11 +303,11 @@ export default defineComponent({
303
303
  this.editedItem = item || '';
304
304
  this.setFocus(INPUT.edit);
305
305
  } else {
306
- this.value = undefined;
306
+ this.value = null;
307
307
  this.toggleError('duplicate', false);
308
308
  this.onSelectLeave();
309
309
 
310
- this.editedItem = undefined;
310
+ this.editedItem = null;
311
311
  }
312
312
  },
313
313
 
@@ -502,7 +502,7 @@ export default defineComponent({
502
502
  <button
503
503
  data-testid="button-add"
504
504
  class="btn btn-sm role-tertiary add-button"
505
- :disabled="!!isCreateItem || !!editedItem"
505
+ :disabled="isCreateItem || editedItem"
506
506
  @click.prevent="onClickPlusButton"
507
507
  >
508
508
  <span class="icon icon-plus icon-sm" />
@@ -1,8 +1,7 @@
1
1
  <script lang="ts">
2
- import { defineComponent } from 'vue';
2
+ import Vue from 'vue';
3
3
  import { mapGetters } from 'vuex';
4
-
5
- export default defineComponent({
4
+ export default Vue.extend({
6
5
  props: {
7
6
  title: {
8
7
  type: String,
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { PropType, defineComponent } from 'vue';
2
+ import Vue, { PropType } from 'vue';
3
3
 
4
4
  interface Badge {
5
5
  stateBackground: string;
@@ -11,7 +11,7 @@ interface Badge {
11
11
  * <p>Represents a badge whose label and color is either taken from the value property or
12
12
  * from the label and color properties. The state property takes precedence.</p>
13
13
  */
14
- export default defineComponent({
14
+ export default Vue.extend({
15
15
  props: {
16
16
  /**
17
17
  * A value having the properties `stateBackground` and `stateDisplay`
@@ -59,7 +59,7 @@ export default defineComponent({
59
59
  </script>
60
60
 
61
61
  <template>
62
- <span :class="['badge-state', bg]">
62
+ <span :class="{'badge-state': true, [bg]: true}">
63
63
  <i
64
64
  v-if="icon"
65
65
  class="icon"
@@ -1,9 +1,9 @@
1
1
  <script lang="ts">
2
- import { defineComponent } from 'vue';
2
+ import Vue from 'vue';
3
3
  import { nlToBr } from '@shell/utils/string';
4
4
  import { stringify } from '@shell/utils/error';
5
5
 
6
- export default defineComponent({
6
+ export default Vue.extend({
7
7
  props: {
8
8
  /**
9
9
  * A color class that represents the color of the banner.
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import { defineComponent, PropType } from 'vue';
2
+ import Vue from 'vue';
3
3
 
4
- export default defineComponent({
4
+ export default Vue.extend({
5
5
  name: 'Card',
6
6
  props: {
7
7
  /**
@@ -22,7 +22,7 @@ export default defineComponent({
22
22
  * The function to invoke when the default action button is clicked.
23
23
  */
24
24
  buttonAction: {
25
- type: Function as PropType<(event: MouseEvent) => void>,
25
+ type: Function,
26
26
  default: (): void => { }
27
27
  },
28
28
  /**
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
- import { PropType, defineComponent } from 'vue';
2
+ import Vue, { PropType } from 'vue';
3
3
  import { _EDIT, _VIEW } from '@shell/config/query-params';
4
4
  import { addObject, removeObject } from '@shell/utils/array';
5
5
  import cloneDeep from 'lodash/cloneDeep';
6
6
 
7
- export default defineComponent({
7
+ export default Vue.extend({
8
8
  name: 'Checkbox',
9
9
 
10
10
  props: {
@@ -140,7 +140,7 @@ export default defineComponent({
140
140
  /**
141
141
  * Toggles the checked state for the checkbox and emits an 'input' event.
142
142
  */
143
- clicked(event: MouseEvent | KeyboardEvent): boolean | void {
143
+ clicked(event: MouseEvent): boolean | void {
144
144
  if ((event.target as HTMLLinkElement).tagName === 'A' && (event.target as HTMLLinkElement).href) {
145
145
  // Ignore links inside the checkbox label so you can click them
146
146
  return true;
@@ -5,7 +5,7 @@ describe('component: LabeledInput', () => {
5
5
  it('should emit input only once', () => {
6
6
  const value = '2';
7
7
  const delay = 1;
8
- const wrapper = mount(LabeledInput, {
8
+ const wrapper = mount(LabeledInput as any, {
9
9
  propsData: { delay },
10
10
  mocks: { $store: { getters: { 'i18n/t': jest.fn() } } }
11
11
  });
@@ -1,27 +1,21 @@
1
1
  <script lang="ts">
2
- import { defineComponent } from 'vue';
2
+ import Vue, { VueConstructor } from 'vue';
3
+ import CompactInput from '@shell/mixins/compact-input';
4
+ import LabeledFormElement from '@shell/mixins/labeled-form-element';
3
5
  import TextAreaAutoGrow from '@components/Form/TextArea/TextAreaAutoGrow.vue';
4
6
  import LabeledTooltip from '@components/LabeledTooltip/LabeledTooltip.vue';
5
7
  import { escapeHtml } from '@shell/utils/string';
6
8
  import cronstrue from 'cronstrue';
7
9
  import { isValidCron } from 'cron-validator';
8
10
  import { debounce } from 'lodash';
9
- import { useLabeledFormElement, labeledFormElementProps } from '@shell/composables/useLabeledFormElement';
10
- import { useCompactInput } from '@shell/composables/useCompactInput';
11
11
 
12
- declare module 'vue/types/vue' {
13
- interface Vue {
14
- onInput: (event: Event) => void | ((event: Event) => void);
15
- }
16
- }
17
-
18
- export default defineComponent({
12
+ export default (
13
+ Vue as VueConstructor<Vue & InstanceType<typeof LabeledFormElement> & InstanceType<typeof CompactInput>>
14
+ ).extend({
19
15
  components: { LabeledTooltip, TextAreaAutoGrow },
20
-
21
- inheritAttrs: false,
16
+ mixins: [LabeledFormElement, CompactInput],
22
17
 
23
18
  props: {
24
- ...labeledFormElementProps,
25
19
  /**
26
20
  * The type of the Labeled Input.
27
21
  * @values text, cron, multiline, multiline-password
@@ -99,36 +93,21 @@ export default defineComponent({
99
93
  },
100
94
  },
101
95
 
102
- setup(props, { emit }) {
103
- const {
104
- focused,
105
- onFocusLabeled,
106
- onBlurLabeled,
107
- isDisabled,
108
- validationMessage,
109
- requiredField
110
- } = useLabeledFormElement(props, emit);
111
- const { isCompact } = useCompactInput(props);
112
-
113
- return {
114
- focused,
115
- onFocusLabeled,
116
- onBlurLabeled,
117
- isDisabled,
118
- validationMessage,
119
- requiredField,
120
- isCompact,
121
- };
122
- },
123
-
124
96
  data() {
125
97
  return {
126
98
  updated: false,
127
- validationErrors: '',
99
+ validationErrors: ''
128
100
  };
129
101
  },
130
102
 
131
103
  computed: {
104
+ /**
105
+ * Determines if the Labeled Input @input event should be debounced.
106
+ */
107
+ onInput(): ((value: string) => void) | void {
108
+ return this.delay ? debounce(this.delayInput, this.delay) : this.delayInput;
109
+ },
110
+
132
111
  /**
133
112
  * Determines if the Labeled Input should display a label.
134
113
  */
@@ -143,7 +122,7 @@ export default defineComponent({
143
122
  return !!this.tooltip || !!this.tooltipKey;
144
123
  },
145
124
 
146
- tooltipValue(): string | Record<string, unknown> | undefined {
125
+ tooltipValue(): string | undefined {
147
126
  if (this.hasTooltip) {
148
127
  return this.tooltipKey ? this.t(this.tooltipKey) : this.tooltip;
149
128
  }
@@ -165,7 +144,7 @@ export default defineComponent({
165
144
  if (this.type !== 'cron' || !this.value) {
166
145
  return;
167
146
  }
168
- if (typeof this.value === 'string' && !isValidCron(this.value)) {
147
+ if (!isValidCron(this.value)) {
169
148
  return this.t('generic.invalidCron');
170
149
  }
171
150
  try {
@@ -194,22 +173,15 @@ export default defineComponent({
194
173
  /**
195
174
  * The max length for the Labeled Input.
196
175
  */
197
- _maxlength(): number | undefined {
176
+ _maxlength(): number | null {
198
177
  if (this.type === 'text' && this.maxlength) {
199
178
  return this.maxlength;
200
179
  }
201
180
 
202
- return undefined;
181
+ return null;
203
182
  },
204
183
  },
205
184
 
206
- created() {
207
- /**
208
- * Determines if the Labeled Input @input event should be debounced.
209
- */
210
- this.onInput = this.delay ? debounce(this.delayInput, this.delay) : this.delayInput;
211
- },
212
-
213
185
  methods: {
214
186
  /**
215
187
  * Attempts to give the Labeled Input focus.
@@ -248,9 +220,7 @@ export default defineComponent({
248
220
  * NOTE: In multiline, TextAreaAutoGrow emits a string with the value
249
221
  * https://github.com/rancher/dashboard/issues/10249
250
222
  */
251
- delayInput(val: string | Event): void {
252
- const value = typeof val === 'string' ? val : (val?.target as HTMLInputElement)?.value;
253
-
223
+ delayInput(value: string): void {
254
224
  this.$emit('input', value);
255
225
  },
256
226
 
@@ -267,7 +237,7 @@ export default defineComponent({
267
237
  * event.
268
238
  * @see labeled-form-element.ts mixin for onBlurLabeled()
269
239
  */
270
- onBlur(event: string | FocusEvent): void {
240
+ onBlur(event: string): void {
271
241
  this.$emit('blur', event);
272
242
  this.onBlurLabeled();
273
243
  },
@@ -319,7 +289,7 @@ export default defineComponent({
319
289
  :placeholder="_placeholder"
320
290
  autocapitalize="off"
321
291
  :class="{ conceal: type === 'multiline-password' }"
322
- @input="onInput"
292
+ @input="onInput($event)"
323
293
  @focus="onFocus"
324
294
  @blur="onBlur"
325
295
  />
@@ -336,7 +306,7 @@ export default defineComponent({
336
306
  autocomplete="off"
337
307
  autocapitalize="off"
338
308
  :data-lpignore="ignorePasswordManagers"
339
- @input="onInput"
309
+ @input="onInput($event.target.value)"
340
310
  @focus="onFocus"
341
311
  @blur="onBlur"
342
312
  @change="onChange"