bge-ui 1.8.2 → 1.8.4

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.
@@ -297,7 +297,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
297
297
  default: null;
298
298
  };
299
299
  placeholder: {
300
- type: PropType<string>;
300
+ type: PropType<string | string[]>;
301
301
  default: string;
302
302
  };
303
303
  hideInputIcon: {
@@ -755,7 +755,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
755
755
  default: null;
756
756
  };
757
757
  placeholder: {
758
- type: PropType<string>;
758
+ type: PropType<string | string[]>;
759
759
  default: string;
760
760
  };
761
761
  hideInputIcon: {
@@ -930,7 +930,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
930
930
  timePicker: boolean;
931
931
  locale: string;
932
932
  autocomplete: string;
933
- placeholder: string;
933
+ placeholder: string | string[];
934
934
  actionRow: ActionRowData;
935
935
  monthPicker: boolean;
936
936
  yearPicker: boolean;
@@ -303,7 +303,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
303
303
  default: null;
304
304
  };
305
305
  placeholder: {
306
- type: import("vue").PropType<string>;
306
+ type: import("vue").PropType<string | string[]>;
307
307
  default: string;
308
308
  };
309
309
  hideInputIcon: {
@@ -811,7 +811,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
811
811
  default: null;
812
812
  };
813
813
  placeholder: {
814
- type: import("vue").PropType<string>;
814
+ type: import("vue").PropType<string | string[]>;
815
815
  default: string;
816
816
  };
817
817
  hideInputIcon: {
@@ -996,7 +996,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
996
996
  timePicker: boolean;
997
997
  locale: string;
998
998
  autocomplete: string;
999
- placeholder: string;
999
+ placeholder: string | string[];
1000
1000
  actionRow: ActionRowData;
1001
1001
  monthPicker: boolean;
1002
1002
  yearPicker: boolean;
@@ -298,7 +298,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
298
298
  default: null;
299
299
  };
300
300
  placeholder: {
301
- type: PropType<string>;
301
+ type: PropType<string | string[]>;
302
302
  default: string;
303
303
  };
304
304
  hideInputIcon: {
@@ -770,7 +770,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
770
770
  default: null;
771
771
  };
772
772
  placeholder: {
773
- type: PropType<string>;
773
+ type: PropType<string | string[]>;
774
774
  default: string;
775
775
  };
776
776
  hideInputIcon: {
@@ -959,7 +959,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
959
959
  timePicker: boolean;
960
960
  locale: string;
961
961
  autocomplete: string;
962
- placeholder: string;
962
+ placeholder: string | string[];
963
963
  actionRow: ActionRowData;
964
964
  monthPicker: boolean;
965
965
  yearPicker: boolean;
@@ -298,7 +298,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
298
298
  default: null;
299
299
  };
300
300
  placeholder: {
301
- type: PropType<string>;
301
+ type: PropType<string | string[]>;
302
302
  default: string;
303
303
  };
304
304
  hideInputIcon: {
@@ -773,7 +773,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
773
773
  default: null;
774
774
  };
775
775
  placeholder: {
776
- type: PropType<string>;
776
+ type: PropType<string | string[]>;
777
777
  default: string;
778
778
  };
779
779
  hideInputIcon: {
@@ -963,7 +963,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
963
963
  timePicker: boolean;
964
964
  locale: string;
965
965
  autocomplete: string;
966
- placeholder: string;
966
+ placeholder: string | string[];
967
967
  actionRow: ActionRowData;
968
968
  monthPicker: boolean;
969
969
  yearPicker: boolean;
@@ -265,7 +265,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
265
265
  default: null;
266
266
  };
267
267
  placeholder: {
268
- type: PropType<string>;
268
+ type: PropType<string | string[]>;
269
269
  default: string;
270
270
  };
271
271
  hideInputIcon: {
@@ -703,7 +703,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
703
703
  default: null;
704
704
  };
705
705
  placeholder: {
706
- type: PropType<string>;
706
+ type: PropType<string | string[]>;
707
707
  default: string;
708
708
  };
709
709
  hideInputIcon: {
@@ -887,7 +887,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
887
887
  timePicker: boolean;
888
888
  locale: string;
889
889
  autocomplete: string;
890
- placeholder: string;
890
+ placeholder: string | string[];
891
891
  actionRow: ActionRowData;
892
892
  monthPicker: boolean;
893
893
  yearPicker: boolean;
@@ -294,7 +294,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
294
294
  default: null;
295
295
  };
296
296
  placeholder: {
297
- type: PropType<string>;
297
+ type: PropType<string | string[]>;
298
298
  default: string;
299
299
  };
300
300
  hideInputIcon: {
@@ -761,7 +761,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
761
761
  default: null;
762
762
  };
763
763
  placeholder: {
764
- type: PropType<string>;
764
+ type: PropType<string | string[]>;
765
765
  default: string;
766
766
  };
767
767
  hideInputIcon: {
@@ -945,7 +945,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
945
945
  timePicker: boolean;
946
946
  locale: string;
947
947
  autocomplete: string;
948
- placeholder: string;
948
+ placeholder: string | string[];
949
949
  actionRow: ActionRowData;
950
950
  monthPicker: boolean;
951
951
  yearPicker: boolean;
@@ -296,7 +296,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
296
296
  default: null;
297
297
  };
298
298
  placeholder: {
299
- type: import("vue").PropType<string>;
299
+ type: import("vue").PropType<string | string[]>;
300
300
  default: string;
301
301
  };
302
302
  hideInputIcon: {
@@ -776,7 +776,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
776
776
  default: null;
777
777
  };
778
778
  placeholder: {
779
- type: import("vue").PropType<string>;
779
+ type: import("vue").PropType<string | string[]>;
780
780
  default: string;
781
781
  };
782
782
  hideInputIcon: {
@@ -950,7 +950,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
950
950
  timePicker: boolean;
951
951
  locale: string;
952
952
  autocomplete: string;
953
- placeholder: string;
953
+ placeholder: string | string[];
954
954
  actionRow: ActionRowData;
955
955
  monthPicker: boolean;
956
956
  yearPicker: boolean;
@@ -296,7 +296,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
296
296
  default: null;
297
297
  };
298
298
  placeholder: {
299
- type: import("vue").PropType<string>;
299
+ type: import("vue").PropType<string | string[]>;
300
300
  default: string;
301
301
  };
302
302
  hideInputIcon: {
@@ -758,7 +758,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
758
758
  default: null;
759
759
  };
760
760
  placeholder: {
761
- type: import("vue").PropType<string>;
761
+ type: import("vue").PropType<string | string[]>;
762
762
  default: string;
763
763
  };
764
764
  hideInputIcon: {
@@ -929,7 +929,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
929
929
  timePicker: boolean;
930
930
  locale: string;
931
931
  autocomplete: string;
932
- placeholder: string;
932
+ placeholder: string | string[];
933
933
  actionRow: ActionRowData;
934
934
  monthPicker: boolean;
935
935
  yearPicker: boolean;
@@ -298,7 +298,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
298
298
  default: null;
299
299
  };
300
300
  placeholder: {
301
- type: PropType<string>;
301
+ type: PropType<string | string[]>;
302
302
  default: string;
303
303
  };
304
304
  hideInputIcon: {
@@ -784,7 +784,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
784
784
  default: null;
785
785
  };
786
786
  placeholder: {
787
- type: PropType<string>;
787
+ type: PropType<string | string[]>;
788
788
  default: string;
789
789
  };
790
790
  hideInputIcon: {
@@ -988,7 +988,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
988
988
  timePicker: boolean;
989
989
  locale: string;
990
990
  autocomplete: string;
991
- placeholder: string;
991
+ placeholder: string | string[];
992
992
  actionRow: ActionRowData;
993
993
  monthPicker: boolean;
994
994
  yearPicker: boolean;
@@ -298,7 +298,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
298
298
  default: null;
299
299
  };
300
300
  placeholder: {
301
- type: PropType<string>;
301
+ type: PropType<string | string[]>;
302
302
  default: string;
303
303
  };
304
304
  hideInputIcon: {
@@ -774,7 +774,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
774
774
  default: null;
775
775
  };
776
776
  placeholder: {
777
- type: PropType<string>;
777
+ type: PropType<string | string[]>;
778
778
  default: string;
779
779
  };
780
780
  hideInputIcon: {
@@ -968,7 +968,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
968
968
  timePicker: boolean;
969
969
  locale: string;
970
970
  autocomplete: string;
971
- placeholder: string;
971
+ placeholder: string | string[];
972
972
  actionRow: ActionRowData;
973
973
  monthPicker: boolean;
974
974
  yearPicker: boolean;
@@ -296,7 +296,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
296
296
  default: null;
297
297
  };
298
298
  placeholder: {
299
- type: import("vue").PropType<string>;
299
+ type: import("vue").PropType<string | string[]>;
300
300
  default: string;
301
301
  };
302
302
  hideInputIcon: {
@@ -760,7 +760,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
760
760
  default: null;
761
761
  };
762
762
  placeholder: {
763
- type: import("vue").PropType<string>;
763
+ type: import("vue").PropType<string | string[]>;
764
764
  default: string;
765
765
  };
766
766
  hideInputIcon: {
@@ -930,7 +930,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
930
930
  timePicker: boolean;
931
931
  locale: string;
932
932
  autocomplete: string;
933
- placeholder: string;
933
+ placeholder: string | string[];
934
934
  actionRow: ActionRowData;
935
935
  monthPicker: boolean;
936
936
  yearPicker: boolean;
@@ -296,7 +296,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
296
296
  default: null;
297
297
  };
298
298
  placeholder: {
299
- type: import("vue").PropType<string>;
299
+ type: import("vue").PropType<string | string[]>;
300
300
  default: string;
301
301
  };
302
302
  hideInputIcon: {
@@ -753,7 +753,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
753
753
  default: null;
754
754
  };
755
755
  placeholder: {
756
- type: import("vue").PropType<string>;
756
+ type: import("vue").PropType<string | string[]>;
757
757
  default: string;
758
758
  };
759
759
  hideInputIcon: {
@@ -922,7 +922,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
922
922
  timePicker: boolean;
923
923
  locale: string;
924
924
  autocomplete: string;
925
- placeholder: string;
925
+ placeholder: string | string[];
926
926
  actionRow: ActionRowData;
927
927
  monthPicker: boolean;
928
928
  yearPicker: boolean;
@@ -318,7 +318,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
318
318
  default: null;
319
319
  };
320
320
  placeholder: {
321
- type: PropType<string>;
321
+ type: PropType<string | string[]>;
322
322
  default: string;
323
323
  };
324
324
  hideInputIcon: {
@@ -787,7 +787,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
787
787
  default: null;
788
788
  };
789
789
  placeholder: {
790
- type: PropType<string>;
790
+ type: PropType<string | string[]>;
791
791
  default: string;
792
792
  };
793
793
  hideInputIcon: {
@@ -954,7 +954,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
954
954
  timePicker: boolean;
955
955
  locale: string;
956
956
  autocomplete: string;
957
- placeholder: string;
957
+ placeholder: string | string[];
958
958
  actionRow: ActionRowData;
959
959
  monthPicker: boolean;
960
960
  yearPicker: boolean;
@@ -265,7 +265,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
265
265
  default: null;
266
266
  };
267
267
  placeholder: {
268
- type: import("vue").PropType<string>;
268
+ type: import("vue").PropType<string | string[]>;
269
269
  default: string;
270
270
  };
271
271
  hideInputIcon: {
@@ -365,7 +365,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
365
365
  default: boolean;
366
366
  };
367
367
  actionRow: {
368
- type: import("vue").PropType<ActionRowData>;
368
+ type: import("vue").PropType<ActionRowData>; /**
369
+ * Called when select button is clicked, emit update for the modelValue
370
+ */
369
371
  default: () => {};
370
372
  };
371
373
  focusStartDate: {
@@ -719,7 +721,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
719
721
  default: null;
720
722
  };
721
723
  placeholder: {
722
- type: import("vue").PropType<string>;
724
+ type: import("vue").PropType<string | string[]>;
723
725
  default: string;
724
726
  };
725
727
  hideInputIcon: {
@@ -819,7 +821,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
819
821
  default: boolean;
820
822
  };
821
823
  actionRow: {
822
- type: import("vue").PropType<ActionRowData>;
824
+ type: import("vue").PropType<ActionRowData>; /**
825
+ * Called when select button is clicked, emit update for the modelValue
826
+ */
823
827
  default: () => {};
824
828
  };
825
829
  focusStartDate: {
@@ -908,7 +912,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
908
912
  timePicker: boolean;
909
913
  locale: string;
910
914
  autocomplete: string;
911
- placeholder: string;
915
+ placeholder: string | string[];
912
916
  actionRow: ActionRowData;
913
917
  monthPicker: boolean;
914
918
  yearPicker: boolean;
@@ -296,7 +296,7 @@ declare const _default: import("vue").DefineComponent<{
296
296
  default: null;
297
297
  };
298
298
  placeholder: {
299
- type: import("vue").PropType<string>;
299
+ type: import("vue").PropType<string | string[]>;
300
300
  default: string;
301
301
  };
302
302
  hideInputIcon: {
@@ -745,7 +745,7 @@ declare const _default: import("vue").DefineComponent<{
745
745
  default: null;
746
746
  };
747
747
  placeholder: {
748
- type: import("vue").PropType<string>;
748
+ type: import("vue").PropType<string | string[]>;
749
749
  default: string;
750
750
  };
751
751
  hideInputIcon: {
@@ -911,7 +911,7 @@ declare const _default: import("vue").DefineComponent<{
911
911
  timePicker: boolean;
912
912
  locale: string;
913
913
  autocomplete: string;
914
- placeholder: string;
914
+ placeholder: string | string[];
915
915
  actionRow: ActionRowData;
916
916
  monthPicker: boolean;
917
917
  yearPicker: boolean;
@@ -267,7 +267,7 @@ export declare const AllProps: {
267
267
  default: null;
268
268
  };
269
269
  placeholder: {
270
- type: PropType<string>;
270
+ type: PropType<string | string[]>;
271
271
  default: string;
272
272
  };
273
273
  hideInputIcon: {
@@ -713,7 +713,7 @@ export declare const PickerBaseProps: {
713
713
  default: null;
714
714
  };
715
715
  placeholder: {
716
- type: PropType<string>;
716
+ type: PropType<string | string[]>;
717
717
  default: string;
718
718
  };
719
719
  hideInputIcon: {
@@ -1,6 +1,6 @@
1
1
  declare function validate(callback: any): Promise<any>;
2
- declare function resetFields(): void;
3
- declare function clearValidate(): void;
2
+ declare function resetFields(): Promise<void>;
3
+ declare function clearValidate(): Promise<void>;
4
4
  declare function validateField(): void;
5
5
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
6
6
  inline: BooleanConstructor;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { defineComponent, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, renderSlot, normalizeStyle, createStaticVNode, provide, reactive, toRefs, ref, watch, unref, getCurrentScope, onScopeDispose, readonly, computed, getCurrentInstance, onMounted, useSlots, inject, createTextVNode, toDisplayString, createCommentVNode, TransitionGroup, withCtx, createBlock, withModifiers, withDirectives, cloneVNode, Fragment, Text, Comment, onUnmounted, h, Transition, vShow, onBeforeMount, nextTick, Teleport, resolveDynamicComponent, shallowReactive, render as render$7, isVNode, vModelCheckbox, renderList, toRef, useAttrs, normalizeProps, mergeProps, onBeforeUpdate, withKeys, createSlots, guardReactiveProps, isRef } from "vue";
7
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, renderSlot, normalizeStyle, createStaticVNode, provide, reactive, toRefs, ref, watch, unref, getCurrentScope, onScopeDispose, readonly, computed, getCurrentInstance, onMounted, useSlots, inject, createTextVNode, toDisplayString, createCommentVNode, TransitionGroup, withCtx, nextTick, createBlock, withModifiers, withDirectives, cloneVNode, Fragment, Text, Comment, onUnmounted, h, Transition, vShow, onBeforeMount, Teleport, resolveDynamicComponent, shallowReactive, render as render$7, isVNode, vModelCheckbox, renderList, toRef, useAttrs, normalizeProps, mergeProps, onBeforeUpdate, withKeys, createSlots, guardReactiveProps, isRef } from "vue";
8
8
  const _hoisted_1$2e = ["disabled"];
9
9
  const _hoisted_2$1U = { class: "loading-icon" };
10
10
  const _sfc_main$2o = /* @__PURE__ */ defineComponent({
@@ -4891,11 +4891,24 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
4891
4891
  return callback && callback(true, validationErrors);
4892
4892
  return callback(false, validationErrors);
4893
4893
  }
4894
- function resetFields() {
4895
- console.log("resetFields");
4894
+ async function resetFields() {
4895
+ if (!props.model) {
4896
+ return;
4897
+ }
4898
+ for (const field of fields) {
4899
+ try {
4900
+ await field.resetField();
4901
+ } catch (errors2) {
4902
+ }
4903
+ }
4896
4904
  }
4897
- function clearValidate() {
4898
- console.log("clearValidate");
4905
+ async function clearValidate() {
4906
+ for (const field of fields) {
4907
+ try {
4908
+ await field.clearValidate();
4909
+ } catch (errors2) {
4910
+ }
4911
+ }
4899
4912
  }
4900
4913
  function validateField() {
4901
4914
  console.log("validateField");
@@ -6288,6 +6301,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6288
6301
  },
6289
6302
  setup(__props) {
6290
6303
  const props = __props;
6304
+ let initialValue = void 0;
6291
6305
  const labelSlot = useSlots().label;
6292
6306
  const isShowLabel = computed(() => {
6293
6307
  return !!labelSlot || props.label;
@@ -6302,6 +6316,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6302
6316
  const validateMessage = ref("");
6303
6317
  const validateState = ref("");
6304
6318
  const formItemRef = ref();
6319
+ let isResettingField = false;
6305
6320
  const fieldValue = computed(() => {
6306
6321
  const model = formContext == null ? void 0 : formContext.model;
6307
6322
  if (!model || !props.prop) {
@@ -6373,7 +6388,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6373
6388
  }).map(({ trigger: trigger2, ...rule }) => rule);
6374
6389
  };
6375
6390
  const validate = async (trigger, callback) => {
6376
- if (!props.prop) {
6391
+ if (isResettingField || !props.prop) {
6377
6392
  return false;
6378
6393
  }
6379
6394
  const hasCallback = isFunction2(callback);
@@ -6396,11 +6411,26 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6396
6411
  return hasCallback ? false : Promise.reject(fields);
6397
6412
  });
6398
6413
  };
6414
+ const clearValidate = async () => {
6415
+ setValidationState("");
6416
+ validateMessage.value = "";
6417
+ isResettingField = false;
6418
+ };
6419
+ const resetField = async () => {
6420
+ const model = formContext == null ? void 0 : formContext.model;
6421
+ if (!model || !props.prop)
6422
+ return;
6423
+ isResettingField = true;
6424
+ model[props.prop] = JSON.parse(JSON.stringify(initialValue));
6425
+ await nextTick();
6426
+ clearValidate();
6427
+ isResettingField = false;
6428
+ };
6399
6429
  const context = reactive({
6400
6430
  ...toRefs(props),
6401
6431
  $el: formItemRef,
6402
6432
  validateState,
6403
- // resetField,
6433
+ resetField,
6404
6434
  // clearValidate,
6405
6435
  validate
6406
6436
  });
@@ -6414,6 +6444,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6414
6444
  );
6415
6445
  onMounted(() => {
6416
6446
  formContext == null ? void 0 : formContext.addField(context);
6447
+ initialValue = fieldValue.value ? JSON.parse(JSON.stringify(fieldValue.value)) : "";
6417
6448
  });
6418
6449
  return (_ctx, _cache) => {
6419
6450
  return openBlock(), createElementBlock("div", {
@@ -17434,7 +17465,7 @@ const AllProps = {
17434
17465
  minTime: { type: Object, default: null },
17435
17466
  maxTime: { type: Object, default: null },
17436
17467
  name: { type: String, default: null },
17437
- placeholder: { type: String, default: "" },
17468
+ placeholder: { type: [String, Array], default: "" },
17438
17469
  hideInputIcon: { type: Boolean, default: false },
17439
17470
  clearable: { type: Boolean, default: true },
17440
17471
  state: { type: Boolean, default: null },
@@ -22923,15 +22954,29 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
22923
22954
  props: {
22924
22955
  ...PickerBaseProps
22925
22956
  },
22926
- emits: [
22927
- "input",
22928
- "change",
22929
- "update:modelValue"
22930
- ],
22957
+ emits: ["input", "change", "update:modelValue"],
22931
22958
  setup(__props, { emit: __emit }) {
22932
22959
  const props = __props;
22933
22960
  const datePickerRef = ref();
22934
22961
  const date4 = ref();
22962
+ const rangePlaceholders = computed(() => {
22963
+ if (Array.isArray(props.placeholder)) {
22964
+ return [
22965
+ props.placeholder[0] || "开始日期",
22966
+ props.placeholder[1] || "结束日期"
22967
+ ];
22968
+ }
22969
+ if (props.placeholder) {
22970
+ return [props.placeholder, props.placeholder];
22971
+ }
22972
+ return ["开始日期", "结束日期"];
22973
+ });
22974
+ const singlePlaceholder = computed(() => {
22975
+ if (Array.isArray(props.placeholder)) {
22976
+ return props.placeholder[0] || "选择日期";
22977
+ }
22978
+ return props.placeholder || "选择日期";
22979
+ });
22935
22980
  const isStartFocus = ref(false);
22936
22981
  const isEndFocus = ref(false);
22937
22982
  function toggle(type4) {
@@ -22949,10 +22994,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
22949
22994
  function inputValueCallback(val) {
22950
22995
  inputValue.value = val.split(" - ");
22951
22996
  }
22952
- watch(() => props.modelValue, (val) => {
22953
- date4.value = val;
22954
- formItemContext && formItemContext.validate && formItemContext.validate().catch((err) => err);
22955
- });
22997
+ watch(
22998
+ () => props.modelValue,
22999
+ (val) => {
23000
+ date4.value = val;
23001
+ formItemContext && formItemContext.validate && formItemContext.validate().catch((err) => err);
23002
+ }
23003
+ );
22956
23004
  watch(date4, (val) => {
22957
23005
  emit("input", val);
22958
23006
  emit("change", val);
@@ -22988,7 +23036,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
22988
23036
  class: normalizeClass(["bge-datepicker__input", { focus: isStartFocus.value, inputed: !!(date4.value && date4.value[0]) }]),
22989
23037
  onClick: _cache[1] || (_cache[1] = ($event) => isStartFocus.value = true)
22990
23038
  }, [
22991
- createTextVNode(toDisplayString(inputValue.value && inputValue.value[0] || "结束日期") + " ", 1),
23039
+ createTextVNode(toDisplayString(inputValue.value && inputValue.value[0] || rangePlaceholders.value[0]) + " ", 1),
22992
23040
  createVNode(_component_MonoClose, {
22993
23041
  class: "bge-datepicker__close",
22994
23042
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => close(), ["stop"]))
@@ -23000,7 +23048,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23000
23048
  class: normalizeClass(["bge-datepicker__input", { focus: isEndFocus.value, inputed: !!(date4.value && date4.value[1]) }]),
23001
23049
  onClick: _cache[3] || (_cache[3] = ($event) => isEndFocus.value = true)
23002
23050
  }, [
23003
- createTextVNode(toDisplayString(inputValue.value && inputValue.value[1] || "结束日期") + " ", 1),
23051
+ createTextVNode(toDisplayString(inputValue.value && inputValue.value[1] || rangePlaceholders.value[1]) + " ", 1),
23004
23052
  createVNode(_component_MonoClose, {
23005
23053
  class: "bge-datepicker__close",
23006
23054
  onClick: _cache[2] || (_cache[2] = withModifiers(($event) => close(), ["stop"]))
@@ -23012,7 +23060,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23012
23060
  class: normalizeClass(["bge-datepicker__input", { focus: isStartFocus.value, inputed: !!date4.value }]),
23013
23061
  onClick: _cache[5] || (_cache[5] = ($event) => isStartFocus.value = true)
23014
23062
  }, [
23015
- createTextVNode(toDisplayString(inputValue.value && inputValue.value[0] || "选择日期") + " ", 1),
23063
+ createTextVNode(toDisplayString(inputValue.value && inputValue.value[0] || singlePlaceholder.value) + " ", 1),
23016
23064
  createVNode(_component_MonoClose, {
23017
23065
  class: "bge-datepicker__close",
23018
23066
  onClick: _cache[4] || (_cache[4] = withModifiers(($event) => close(), ["stop"]))
@@ -23026,7 +23074,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23026
23074
  };
23027
23075
  }
23028
23076
  });
23029
- const UiDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-a163f1fb"]]);
23077
+ const UiDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-a817b926"]]);
23030
23078
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23031
23079
  __name: "index",
23032
23080
  props: {
package/dist/style.css CHANGED
@@ -1746,7 +1746,7 @@ to {
1746
1746
  }
1747
1747
  .bge-option.active[data-v-8a6e1228] {
1748
1748
  color: var(--tc-title);
1749
- }.bge-datepicker[data-v-a163f1fb] {
1749
+ }.bge-datepicker[data-v-a817b926] {
1750
1750
  width: 100%;
1751
1751
  display: flex;
1752
1752
  align-items: center;
@@ -1757,7 +1757,7 @@ to {
1757
1757
  font-weight: 500;
1758
1758
  cursor: pointer;
1759
1759
  }
1760
- .bge-datepicker .bge-datepicker__input[data-v-a163f1fb] {
1760
+ .bge-datepicker .bge-datepicker__input[data-v-a817b926] {
1761
1761
  font-size: 12px;
1762
1762
  line-height: 20px;
1763
1763
  font-weight: 500;
@@ -1771,32 +1771,32 @@ to {
1771
1771
  flex: 1;
1772
1772
  border-radius: var(--radius-small, 4px);
1773
1773
  }
1774
- .bge-datepicker .bge-datepicker__input .bge-datepicker__icon[data-v-a163f1fb],
1775
- .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a163f1fb] {
1774
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__icon[data-v-a817b926],
1775
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a817b926] {
1776
1776
  font-size: 16px !important;
1777
1777
  color: var(--tc-quaternary);
1778
1778
  }
1779
- .bge-datepicker .bge-datepicker__input .bge-datepicker__icon[data-v-a163f1fb]:hover,
1780
- .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a163f1fb]:hover {
1779
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__icon[data-v-a817b926]:hover,
1780
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a817b926]:hover {
1781
1781
  color: var(--tc-title);
1782
1782
  }
1783
- .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a163f1fb] {
1783
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a817b926] {
1784
1784
  display: none;
1785
1785
  }
1786
- .bge-datepicker .bge-datepicker__input[data-v-a163f1fb]:hover {
1786
+ .bge-datepicker .bge-datepicker__input[data-v-a817b926]:hover {
1787
1787
  background: var(--bg-opacity-hover);
1788
1788
  border: solid 1px transparent;
1789
1789
  }
1790
- .bge-datepicker .bge-datepicker__input.focus[data-v-a163f1fb] {
1790
+ .bge-datepicker .bge-datepicker__input.focus[data-v-a817b926] {
1791
1791
  border: solid 1px var(--tc-theme);
1792
1792
  }
1793
- .bge-datepicker .bge-datepicker__input.inputed[data-v-a163f1fb] {
1793
+ .bge-datepicker .bge-datepicker__input.inputed[data-v-a817b926] {
1794
1794
  color: var(--tc-title);
1795
1795
  }
1796
- .bge-datepicker .bge-datepicker__input.inputed:hover .bge-datepicker__close[data-v-a163f1fb] {
1796
+ .bge-datepicker .bge-datepicker__input.inputed:hover .bge-datepicker__close[data-v-a817b926] {
1797
1797
  display: block;
1798
1798
  }
1799
- .bge-datepicker .bge-datepicker__input.inputed:hover .bge-datepicker__icon[data-v-a163f1fb] {
1799
+ .bge-datepicker .bge-datepicker__input.inputed:hover .bge-datepicker__icon[data-v-a817b926] {
1800
1800
  display: none;
1801
1801
  }.bge-switch[data-v-e973c7de] {
1802
1802
  width: 38px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bge-ui",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,25 +1,56 @@
1
1
  <template>
2
- <DatePicker ref="datePickerRef" v-model="date" :range="props.range" :multi-calendars="props.range" :enableTimePicker="false" :clearable="false" @open="() => toggle('open')" locale="zh-CN" @closed="() => toggle('close')" @input-value="inputValueCallback" dark auto-apply>
2
+ <DatePicker
3
+ ref="datePickerRef"
4
+ v-model="date"
5
+ :range="props.range"
6
+ :multi-calendars="props.range"
7
+ :enableTimePicker="false"
8
+ :clearable="false"
9
+ @open="() => toggle('open')"
10
+ locale="zh-CN"
11
+ @closed="() => toggle('close')"
12
+ @input-value="inputValueCallback"
13
+ dark
14
+ auto-apply
15
+ >
3
16
  <template #dp-input>
4
17
  <template v-if="props.range">
5
18
  <div class="bge-datepicker">
6
- <div class="bge-datepicker__input" :class="{focus: isStartFocus, inputed: !!(date && date[0])}" @click="isStartFocus = true">
7
- {{inputValue && inputValue[0] || '结束日期'}}
8
- <MonoClose class="bge-datepicker__close" @click.stop="close('start')" />
19
+ <div
20
+ class="bge-datepicker__input"
21
+ :class="{ focus: isStartFocus, inputed: !!(date && date[0]) }"
22
+ @click="isStartFocus = true"
23
+ >
24
+ {{ (inputValue && inputValue[0]) || rangePlaceholders[0] }}
25
+ <MonoClose
26
+ class="bge-datepicker__close"
27
+ @click.stop="close('start')"
28
+ />
9
29
  <MonoCalendar class="bge-datepicker__icon" />
10
30
  </div>
11
31
  -
12
- <div class="bge-datepicker__input" :class="{focus: isEndFocus, inputed: !!(date && date[1])}" @click="isEndFocus = true">
13
- {{inputValue && inputValue[1] || '结束日期'}}
14
- <MonoClose class="bge-datepicker__close" @click.stop="close('end')" />
32
+ <div
33
+ class="bge-datepicker__input"
34
+ :class="{ focus: isEndFocus, inputed: !!(date && date[1]) }"
35
+ @click="isEndFocus = true"
36
+ >
37
+ {{ (inputValue && inputValue[1]) || rangePlaceholders[1] }}
38
+ <MonoClose
39
+ class="bge-datepicker__close"
40
+ @click.stop="close('end')"
41
+ />
15
42
  <MonoCalendar class="bge-datepicker__icon" />
16
43
  </div>
17
44
  </div>
18
45
  </template>
19
46
  <template v-else>
20
47
  <div class="bge-datepicker">
21
- <div class="bge-datepicker__input" :class="{focus: isStartFocus, inputed: !!(date)}" @click="isStartFocus = true">
22
- {{inputValue && inputValue[0] || '选择日期'}}
48
+ <div
49
+ class="bge-datepicker__input"
50
+ :class="{ focus: isStartFocus, inputed: !!date }"
51
+ @click="isStartFocus = true"
52
+ >
53
+ {{ (inputValue && inputValue[0]) || singlePlaceholder }}
23
54
  <MonoClose class="bge-datepicker__close" @click.stop="close()" />
24
55
  <MonoCalendar class="bge-datepicker__icon" />
25
56
  </div>
@@ -29,27 +60,46 @@
29
60
  </DatePicker>
30
61
  </template>
31
62
  <script lang="ts" setup>
32
- import DatePicker from './datePicker.vue'
33
- import { PickerBaseProps } from './props'
34
- import { ref, onMounted, watch, inject } from 'vue'
63
+ import DatePicker from "./datePicker.vue";
64
+ import { PickerBaseProps } from "./props";
65
+ import { ref, onMounted, watch, inject, computed } from "vue";
35
66
  const props = defineProps({
36
- ...PickerBaseProps,
67
+ ...PickerBaseProps,
37
68
  });
38
69
 
39
- const datePickerRef = ref()
70
+ const datePickerRef = ref();
40
71
  const date = ref<any>();
41
- const isStartFocus = ref(false)
42
- const isEndFocus = ref(false)
72
+ const rangePlaceholders = computed(() => {
73
+ if (Array.isArray(props.placeholder)) {
74
+ return [
75
+ props.placeholder[0] || "开始日期",
76
+ props.placeholder[1] || "结束日期",
77
+ ];
78
+ }
79
+ if (props.placeholder) {
80
+ return [props.placeholder, props.placeholder];
81
+ }
82
+ return ["开始日期", "结束日期"];
83
+ });
84
+
85
+ const singlePlaceholder = computed(() => {
86
+ if (Array.isArray(props.placeholder)) {
87
+ return props.placeholder[0] || "选择日期";
88
+ }
89
+ return props.placeholder || "选择日期";
90
+ });
91
+ const isStartFocus = ref(false);
92
+ const isEndFocus = ref(false);
43
93
 
44
94
  function toggle(type: string) {
45
- if (type === 'close') {
46
- isStartFocus.value = false
47
- isEndFocus.value = false
95
+ if (type === "close") {
96
+ isStartFocus.value = false;
97
+ isEndFocus.value = false;
48
98
  }
49
99
  }
50
100
 
51
101
  function close(type?: string) {
52
- date.value = undefined
102
+ date.value = undefined;
53
103
  // if (type === 'start') {
54
104
  // date.value[0] = undefined
55
105
  // } else if (type === 'end') {
@@ -59,100 +109,101 @@ function close(type?: string) {
59
109
  // }
60
110
  }
61
111
 
62
- const emit = defineEmits([
63
- 'input',
64
- 'change',
65
- 'update:modelValue'
66
- ])
112
+ const emit = defineEmits(["input", "change", "update:modelValue"]);
67
113
 
68
- const inputValue = ref()
114
+ const inputValue = ref();
69
115
 
70
- const formItemContextKey = 'bge-form-item-context'
116
+ const formItemContextKey = "bge-form-item-context";
71
117
 
72
- const formItemContext: any = inject(formItemContextKey, undefined)
118
+ const formItemContext: any = inject(formItemContextKey, undefined);
73
119
 
74
120
  function inputValueCallback(val: string) {
75
- inputValue.value = val.split(' - ')
121
+ inputValue.value = val.split(" - ");
76
122
  }
77
123
 
78
- watch(() => props.modelValue, (val) => {
79
- date.value = val
80
- formItemContext && formItemContext.validate && formItemContext.validate().catch((err: any) => (err))
81
- })
124
+ watch(
125
+ () => props.modelValue,
126
+ (val) => {
127
+ date.value = val;
128
+ formItemContext &&
129
+ formItemContext.validate &&
130
+ formItemContext.validate().catch((err: any) => err);
131
+ }
132
+ );
82
133
 
83
134
  watch(date, (val) => {
84
- emit('input', val)
85
- emit('change', val)
86
- emit('update:modelValue', val)
87
- })
135
+ emit("input", val);
136
+ emit("change", val);
137
+ emit("update:modelValue", val);
138
+ });
88
139
 
89
140
  onMounted(() => {
90
141
  if (props.modelValue) {
91
- date.value = props.modelValue
92
- }
93
- })
142
+ date.value = props.modelValue;
143
+ }
144
+ });
94
145
  </script>
95
146
  <style lang="scss" scoped>
96
- .bge-datepicker {
97
- width: 100%;
147
+ .bge-datepicker {
148
+ width: 100%;
149
+ display: flex;
150
+ align-items: center;
151
+ gap: 4px;
152
+ color: var(--tc-quaternary);
153
+ font-size: 14px;
154
+ line-height: 24px;
155
+ font-weight: 500;
156
+ cursor: pointer;
157
+
158
+ .bge-datepicker__input {
159
+ font-size: 12px;
160
+ line-height: 20px;
161
+ font-weight: 500;
162
+ padding: 4px 12px;
98
163
  display: flex;
99
164
  align-items: center;
100
- gap: 4px;
101
- color: var(--tc-quaternary);
102
- font-size: 14px;
103
- line-height: 24px;
104
- font-weight: 500;
105
- cursor: pointer;
106
-
107
- .bge-datepicker__input {
108
- font-size: 12px;
109
- line-height: 20px;
110
- font-weight: 500;
111
- padding: 4px 12px;
112
- display: flex;
113
- align-items: center;
114
- justify-content: space-between;
115
- gap: 8px;
116
- background: var(--bg-opacity);
117
- border: solid 1px transparent;
118
- flex: 1;
119
- border-radius: var(--radius-small, 4px);
120
-
121
- .bge-datepicker__icon,
122
- .bge-datepicker__close {
123
- font-size: 16px !important;
124
- color: var(--tc-quaternary);
165
+ justify-content: space-between;
166
+ gap: 8px;
167
+ background: var(--bg-opacity);
168
+ border: solid 1px transparent;
169
+ flex: 1;
170
+ border-radius: var(--radius-small, 4px);
171
+
172
+ .bge-datepicker__icon,
173
+ .bge-datepicker__close {
174
+ font-size: 16px !important;
175
+ color: var(--tc-quaternary);
125
176
 
126
- &:hover {
127
- color: var(--tc-title);
128
- }
177
+ &:hover {
178
+ color: var(--tc-title);
129
179
  }
180
+ }
130
181
 
131
- .bge-datepicker__close {
132
- display: none;
133
- }
182
+ .bge-datepicker__close {
183
+ display: none;
184
+ }
134
185
 
135
- &:hover {
136
- background: var(--bg-opacity-hover);
137
- border: solid 1px transparent;
138
- }
186
+ &:hover {
187
+ background: var(--bg-opacity-hover);
188
+ border: solid 1px transparent;
189
+ }
139
190
 
140
- &.focus {
141
- border: solid 1px var(--tc-theme);
142
- }
191
+ &.focus {
192
+ border: solid 1px var(--tc-theme);
193
+ }
143
194
 
144
- &.inputed {
145
- color: var(--tc-title);
195
+ &.inputed {
196
+ color: var(--tc-title);
146
197
 
147
- &:hover {
148
- .bge-datepicker__close {
149
- display: block;
150
- }
151
- .bge-datepicker__icon {
152
- display: none;
153
- }
198
+ &:hover {
199
+ .bge-datepicker__close {
200
+ display: block;
201
+ }
202
+ .bge-datepicker__icon {
203
+ display: none;
154
204
  }
155
205
  }
156
206
  }
157
- }
158
- </style>
207
+ }
208
+ }
209
+ </style>
@@ -118,7 +118,7 @@ export const AllProps = {
118
118
  minTime: { type: Object as PropType<Partial<TimeModel>>, default: null },
119
119
  maxTime: { type: Object as PropType<Partial<TimeModel>>, default: null },
120
120
  name: { type: String as PropType<string>, default: null },
121
- placeholder: { type: String as PropType<string>, default: '' },
121
+ placeholder: { type: [String, Array] as PropType<string | string[]>, default: '' },
122
122
  hideInputIcon: { type: Boolean as PropType<boolean>, default: false },
123
123
  clearable: { type: Boolean as PropType<boolean>, default: true },
124
124
  state: { type: Boolean as PropType<boolean | null>, default: null },
@@ -19,7 +19,7 @@
19
19
  </div>
20
20
  </template>
21
21
  <script setup lang="ts">
22
- import { computed, inject, onMounted, provide, reactive, ref, toRefs, useSlots } from 'vue'
22
+ import { computed, inject, nextTick, onMounted, provide, reactive, ref, toRefs, useSlots } from 'vue'
23
23
  import { refDebounced } from '@vueuse/core'
24
24
  import AsyncValidator from 'async-validator'
25
25
 
@@ -31,7 +31,7 @@ const props = defineProps({
31
31
  required: Boolean,
32
32
  rules: [Array, Object]
33
33
  })
34
-
34
+ let initialValue: any = undefined
35
35
  const labelSlot = useSlots().label
36
36
  const isShowLabel = computed(() => {
37
37
  return !!labelSlot || props.label
@@ -179,11 +179,32 @@ const validate: any = async (trigger: any, callback: any) => {
179
179
  })
180
180
  }
181
181
 
182
+ const clearValidate = async () => {
183
+ setValidationState('')
184
+ validateMessage.value = ''
185
+ isResettingField = false
186
+ }
187
+
188
+ const resetField = async () => {
189
+ const model = formContext?.model
190
+ if (!model || !props.prop) return
191
+
192
+ // prevent validation from being triggered
193
+ isResettingField = true
194
+
195
+ model[props.prop as any] = JSON.parse(JSON.stringify(initialValue))
196
+
197
+ await nextTick()
198
+ clearValidate()
199
+
200
+ isResettingField = false
201
+ }
202
+
182
203
  const context: any = reactive({
183
204
  ...toRefs(props),
184
205
  $el: formItemRef,
185
206
  validateState,
186
- // resetField,
207
+ resetField,
187
208
  // clearValidate,
188
209
  validate,
189
210
  })
@@ -205,6 +226,7 @@ const shouldShowError = computed(
205
226
 
206
227
  onMounted(() => {
207
228
  formContext?.addField(context)
229
+ initialValue = fieldValue.value ? JSON.parse(JSON.stringify(fieldValue.value)) : ''
208
230
  })
209
231
  </script>
210
232
  <style lang="scss">
@@ -41,12 +41,25 @@ async function validate(callback: any) {
41
41
 
42
42
  return callback(false, validationErrors)
43
43
  }
44
- function resetFields() {
45
- console.log('resetFields')
44
+ async function resetFields() {
45
+ if (!props.model) {
46
+ return
47
+ }
48
+ for (const field of fields) {
49
+ try {
50
+ await field.resetField()
51
+ } catch (errors) {
52
+ }
53
+ }
46
54
  }
47
55
 
48
- function clearValidate() {
49
- console.log('clearValidate')
56
+ async function clearValidate() {
57
+ for (const field of fields) {
58
+ try {
59
+ await field.clearValidate()
60
+ } catch (errors) {
61
+ }
62
+ }
50
63
  }
51
64
 
52
65
  function validateField() {