@bagelink/vue 1.1.33 → 1.1.35-beta.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 (84) hide show
  1. package/dist/components/DataPreview.vue.d.ts +3 -1
  2. package/dist/components/DataPreview.vue.d.ts.map +1 -1
  3. package/dist/components/Spreadsheet/Index.vue.d.ts +5 -61
  4. package/dist/components/Spreadsheet/Index.vue.d.ts.map +1 -1
  5. package/dist/components/Spreadsheet/SpreadsheetTable.vue.d.ts +3 -1
  6. package/dist/components/Spreadsheet/SpreadsheetTable.vue.d.ts.map +1 -1
  7. package/dist/components/dataTable/DataTable.vue.d.ts +3 -1
  8. package/dist/components/dataTable/DataTable.vue.d.ts.map +1 -1
  9. package/dist/components/dataTable/tableTypes.d.ts +5 -1
  10. package/dist/components/dataTable/tableTypes.d.ts.map +1 -1
  11. package/dist/components/dataTable/useTableData.d.ts +7 -3
  12. package/dist/components/dataTable/useTableData.d.ts.map +1 -1
  13. package/dist/components/dataTable/useTableSelection.d.ts +3 -1
  14. package/dist/components/dataTable/useTableSelection.d.ts.map +1 -1
  15. package/dist/components/form/BagelForm.vue.d.ts +1 -1
  16. package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
  17. package/dist/components/form/inputs/DatePick.vue.d.ts.map +1 -1
  18. package/dist/components/form/inputs/PhoneInput.vue.d.ts +2 -60
  19. package/dist/components/form/inputs/PhoneInput.vue.d.ts.map +1 -1
  20. package/dist/components/form/inputs/RadioGroup.vue.d.ts +3 -1
  21. package/dist/components/form/inputs/RadioGroup.vue.d.ts.map +1 -1
  22. package/dist/components/form/inputs/RichText/utils/debug.d.ts +3 -1
  23. package/dist/components/form/inputs/RichText/utils/debug.d.ts.map +1 -1
  24. package/dist/components/form/inputs/RichText/utils/media.d.ts +10 -4
  25. package/dist/components/form/inputs/RichText/utils/media.d.ts.map +1 -1
  26. package/dist/components/form/inputs/SelectInput.vue.d.ts +4 -120
  27. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  28. package/dist/components/form/inputs/TextInput.vue.d.ts +5 -5
  29. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  30. package/dist/components/form/useBagelFormState.d.ts +1 -1
  31. package/dist/components/form/useBagelFormState.d.ts.map +1 -1
  32. package/dist/composables/index.d.ts +1 -0
  33. package/dist/composables/index.d.ts.map +1 -1
  34. package/dist/composables/useFormField.d.ts +1 -1
  35. package/dist/composables/useFormField.d.ts.map +1 -1
  36. package/dist/composables/useSchemaField.d.ts +1 -1
  37. package/dist/composables/useSchemaField.d.ts.map +1 -1
  38. package/dist/composables/useValidateFieldValue.d.ts +4 -0
  39. package/dist/composables/useValidateFieldValue.d.ts.map +1 -0
  40. package/dist/index.cjs +78 -19
  41. package/dist/index.mjs +78 -19
  42. package/dist/plugins/modal.d.ts +4 -2
  43. package/dist/plugins/modal.d.ts.map +1 -1
  44. package/dist/plugins/modalTypes.d.ts +6 -4
  45. package/dist/plugins/modalTypes.d.ts.map +1 -1
  46. package/dist/style.css +162 -150
  47. package/dist/types/BagelForm.d.ts +22 -10
  48. package/dist/types/BagelForm.d.ts.map +1 -1
  49. package/dist/types/TableSchema.d.ts +5 -1
  50. package/dist/types/TableSchema.d.ts.map +1 -1
  51. package/dist/utils/BagelFormUtils.d.ts +21 -50
  52. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  53. package/dist/utils/index.d.ts +1 -1
  54. package/dist/utils/index.d.ts.map +1 -1
  55. package/package.json +1 -1
  56. package/src/components/Btn.vue +1 -1
  57. package/src/components/DataPreview.vue +2 -2
  58. package/src/components/ListItem.vue +1 -1
  59. package/src/components/Spreadsheet/Index.vue +10 -10
  60. package/src/components/Spreadsheet/SpreadsheetTable.vue +1 -1
  61. package/src/components/calendar/language/index.ts +1 -1
  62. package/src/components/dataTable/DataTable.vue +2 -2
  63. package/src/components/dataTable/tableTypes.ts +1 -1
  64. package/src/components/dataTable/useTableData.ts +4 -4
  65. package/src/components/dataTable/useTableSelection.ts +1 -1
  66. package/src/components/form/BagelForm.vue +4 -4
  67. package/src/components/form/inputs/DatePick.vue +0 -1
  68. package/src/components/form/inputs/RadioGroup.vue +1 -1
  69. package/src/components/form/inputs/RichText/utils/debug.ts +1 -1
  70. package/src/components/form/inputs/RichText/utils/media.ts +19 -10
  71. package/src/components/form/inputs/TextInput.vue +39 -33
  72. package/src/components/form/useBagelFormState.ts +1 -1
  73. package/src/composables/index.ts +1 -0
  74. package/src/composables/useFormField.ts +1 -1
  75. package/src/composables/useSchemaField.ts +11 -6
  76. package/src/composables/useValidateFieldValue.ts +26 -0
  77. package/src/plugins/modal.ts +6 -5
  78. package/src/plugins/modalTypes.ts +4 -4
  79. package/src/styles/appearance.css +16 -0
  80. package/src/styles/buttons.css +2 -2
  81. package/src/types/BagelForm.ts +33 -11
  82. package/src/types/TableSchema.ts +1 -1
  83. package/src/utils/BagelFormUtils.ts +23 -22
  84. package/src/utils/index.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  export declare const FORM_STATE_KEY: unique symbol;
3
- export interface BagelFormState<T = any> {
3
+ export interface BagelFormState<T> {
4
4
  data: Ref<T>;
5
5
  getFieldData: (path?: string) => any;
6
6
  updateField: (path: string, value: any) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useBagelFormState.d.ts","sourceRoot":"","sources":["../../../src/components/form/useBagelFormState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAI9B,eAAO,MAAM,cAAc,eAA2B,CAAA;AAEtD,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,GAAG;IACtC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;IACZ,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;IACpC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IAC/C,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACrB;AAkBD,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,qBAwCtD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,YAAY,GAAE,OAAO,cAA+B,GAAG,cAAc,CAAC,CAAC,CAAC,CAI5G"}
1
+ {"version":3,"file":"useBagelFormState.d.ts","sourceRoot":"","sources":["../../../src/components/form/useBagelFormState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAI9B,eAAO,MAAM,cAAc,eAA2B,CAAA;AAEtD,MAAM,WAAW,cAAc,CAAC,CAAC;IAChC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;IACZ,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;IACpC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IAC/C,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACrB;AAkBD,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,qBAwCtD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,YAAY,GAAE,OAAO,cAA+B,GAAG,cAAc,CAAC,CAAC,CAAC,CAI5G"}
@@ -1,6 +1,7 @@
1
1
  import { BglFormSchemaFnT, BglFormSchemaT, IfAny } from '..';
2
2
  import { Ref, UnwrapRef } from 'vue';
3
3
  export { useDevice } from './useDevice';
4
+ export { useValidateFieldValue } from './useValidateFieldValue';
4
5
  interface UseBglSchemaParamsT<T> {
5
6
  schema?: BglFormSchemaFnT<T>;
6
7
  columns?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,E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yB,CAAA;AAE/D,UAAU,mBAAmB,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;CACZ;AAED,wBAAgB,YAAY,CAAC,CAAC,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAC1D,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAE,mBAAmB,CAAC,CAAC,CAAM,GACpD,cAAc,CAAC,CAAC,CAAC,CAanB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EACzB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,CAAC,GACb,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAC5B,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,GACtB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAUpC;AAED,eAAO,MAAM,eAAe,iBAAW,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Field } from '..';
2
2
  import { BagelFormState } from '../components/form/useBagelFormState';
3
- export declare function useFormField<T = any>(props: {
3
+ export declare function useFormField<T>(props: {
4
4
  field: Field<T>;
5
5
  fieldID?: string;
6
6
  modelValue?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"useFormField.d.ts","sourceRoot":"","sources":["../../src/composables/useFormField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAI1E,wBAAgB,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE;IAC5C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,GAAG,CAAA;CAChB;;;EA0BA"}
1
+ {"version":3,"file":"useFormField.d.ts","sourceRoot":"","sources":["../../src/composables/useFormField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAI1E,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE;IACtC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,GAAG,CAAA;CAChB;;;EA0BA"}
@@ -2,7 +2,7 @@ import { VNode } from 'vue';
2
2
  import { BaseBagelField, BglFormSchemaT } from '../types/BagelForm';
3
3
  export interface UseSchemaFieldOptions<T> {
4
4
  mode?: 'form' | 'preview' | 'table';
5
- getRowData?: () => T;
5
+ getFormData?: () => T;
6
6
  onUpdate?: (field: BaseBagelField<T>, value: any) => void;
7
7
  includeUnset?: boolean;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useSchemaField.d.ts","sourceRoot":"","sources":["../../src/composables/useSchemaField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AA2BxE,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAA;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IACzD,YAAY,CA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,CAAC,CAAC,CAAA;CAAE;AAC3D,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,CAAA;AACnD,KAAK,aAAa,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;AAEnE,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC;yBAoEvF,cAAc,CAAC,CAAC,CAAC,UAChB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,KACtC,KAAK,GAAG,IAAI;0BApCc,cAAc,CAAC,CAAC,CAAC;EAsN9C"}
@@ -0,0 +1,4 @@
1
+ import { ValidateInputBaseT } from '..';
2
+ import { WatchSource } from 'vue';
3
+ export declare function useValidateFieldValue(inputVal: WatchSource, getInput?: () => HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | undefined, validateFn?: ValidateInputBaseT['validate'], getFormData?: ValidateInputBaseT['getFormData']): void;
4
+ //# sourceMappingURL=useValidateFieldValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useValidateFieldValue.d.ts","sourceRoot":"","sources":["../../src/composables/useValidateFieldValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAGtC,wBAAgB,qBAAqB,CACpC,QAAQ,EAAE,WAAW,EACrB,QAAQ,CAAC,EAAE,MAAM,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,GAAG,SAAS,EACvF,UAAU,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,EAC3C,WAAW,CAAC,EAAE,kBAAkB,CAAC,aAAa,CAAC,QAiB/C"}
package/dist/index.cjs CHANGED
@@ -275,7 +275,7 @@ const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
275
275
  };
276
276
  }
277
277
  });
278
- const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-bfc435b3"]]);
278
+ const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-5a91aa12"]]);
279
279
  const _hoisted_1$18 = ["dismissable"];
280
280
  const _hoisted_2$S = { class: "m-0" };
281
281
  const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
@@ -10529,7 +10529,7 @@ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
10529
10529
  const SLOT_VALUE_COMPONENTS$1 = /* @__PURE__ */ new Set(["div", "span", "p"]);
10530
10530
  const SRC_VALUE_COMPONENTS$1 = /* @__PURE__ */ new Set(["img", "iframe"]);
10531
10531
  function useSchemaField(optns) {
10532
- const { mode = "form", getRowData, onUpdate, includeUnset = false } = optns;
10532
+ const { mode = "form", getFormData, onUpdate, includeUnset = false } = optns;
10533
10533
  function renderObject(obj, depth = 0) {
10534
10534
  if (obj === null || obj === void 0) return "";
10535
10535
  if (typeof obj !== "object") return String(obj);
@@ -10581,7 +10581,7 @@ ${indent}}`;
10581
10581
  function renderField(field, slots) {
10582
10582
  const Component = getComponent(field);
10583
10583
  if (!Component) return null;
10584
- const rowData = (getRowData == null ? void 0 : getRowData()) || {};
10584
+ const rowData = (getFormData == null ? void 0 : getFormData()) || {};
10585
10585
  const condition = field.vIf ?? field["v-if"];
10586
10586
  if (condition !== void 0) {
10587
10587
  if (typeof condition === "function") {
@@ -10604,6 +10604,7 @@ ${indent}}`;
10604
10604
  class: fieldClass,
10605
10605
  id,
10606
10606
  transform,
10607
+ validate,
10607
10608
  slots: fieldSlots,
10608
10609
  required: required2,
10609
10610
  label,
@@ -10621,7 +10622,10 @@ ${indent}}`;
10621
10622
  required: required2,
10622
10623
  label,
10623
10624
  placeholder,
10624
- disabled
10625
+ disabled,
10626
+ validate,
10627
+ id,
10628
+ getFormData
10625
10629
  };
10626
10630
  if (mode === "form") {
10627
10631
  props2.modelValue = currentValue;
@@ -10891,7 +10895,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
10891
10895
  });
10892
10896
  const { renderField } = useSchemaField({
10893
10897
  mode: "preview",
10894
- getRowData: () => firstItem.value,
10898
+ getFormData: () => firstItem.value,
10895
10899
  includeUnset: props2.includeUnset
10896
10900
  });
10897
10901
  return (_ctx, _cache) => {
@@ -10905,7 +10909,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
10905
10909
  };
10906
10910
  }
10907
10911
  });
10908
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-2a466c93"]]);
10912
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-3a662018"]]);
10909
10913
  function useTableSelection(options) {
10910
10914
  const allSelectorEl = vue.ref();
10911
10915
  const computedSelectedItems = vue.computed(() => options.selectedItems.value);
@@ -10986,6 +10990,9 @@ function createFilterWrapper(filter3, fn) {
10986
10990
  }
10987
10991
  return wrapper;
10988
10992
  }
10993
+ const bypassFilter = (invoke) => {
10994
+ return invoke();
10995
+ };
10989
10996
  function debounceFilter(ms, options = {}) {
10990
10997
  let timer;
10991
10998
  let maxTimer;
@@ -11049,6 +11056,20 @@ function useDebounceFn(fn, ms = 200, options = {}) {
11049
11056
  fn
11050
11057
  );
11051
11058
  }
11059
+ function watchWithFilter(source, cb, options = {}) {
11060
+ const {
11061
+ eventFilter = bypassFilter,
11062
+ ...watchOptions
11063
+ } = options;
11064
+ return vue.watch(
11065
+ source,
11066
+ createFilterWrapper(
11067
+ eventFilter,
11068
+ cb
11069
+ ),
11070
+ watchOptions
11071
+ );
11072
+ }
11052
11073
  function tryOnMounted(fn, sync = true, target) {
11053
11074
  const instance = getLifeCycleTarget();
11054
11075
  if (instance)
@@ -11182,6 +11203,21 @@ function createUntil(r2, isNot = false) {
11182
11203
  function until(r2) {
11183
11204
  return createUntil(r2);
11184
11205
  }
11206
+ function watchDebounced(source, cb, options = {}) {
11207
+ const {
11208
+ debounce: debounce2 = 0,
11209
+ maxWait = void 0,
11210
+ ...watchOptions
11211
+ } = options;
11212
+ return watchWithFilter(
11213
+ source,
11214
+ cb,
11215
+ {
11216
+ ...watchOptions,
11217
+ eventFilter: debounceFilter(debounce2, { maxWait })
11218
+ }
11219
+ );
11220
+ }
11185
11221
  function watchImmediate(source, cb, options) {
11186
11222
  return vue.watch(
11187
11223
  source,
@@ -11748,7 +11784,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11748
11784
  emits: /* @__PURE__ */ vue.mergeModels(["orderBy", "select", "lastItemVisible"], ["update:loading", "update:itemHeight", "update:selectedItems"]),
11749
11785
  setup(__props, { emit: __emit }) {
11750
11786
  vue.useCssVars((_ctx) => ({
11751
- "5e326637": vue.unref(computedItemHeight)
11787
+ "140ab2e6": vue.unref(computedItemHeight)
11752
11788
  }));
11753
11789
  const props2 = __props;
11754
11790
  const emit2 = __emit;
@@ -11812,7 +11848,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11812
11848
  function renderFieldForRow(field, row) {
11813
11849
  const { renderField } = useSchemaField({
11814
11850
  mode: "table",
11815
- getRowData: () => {
11851
+ getFormData: () => {
11816
11852
  if (field.id) {
11817
11853
  return { [field.id]: getNestedValue(row, field.id) };
11818
11854
  }
@@ -11936,7 +11972,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11936
11972
  };
11937
11973
  }
11938
11974
  });
11939
- const DataTable = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-642a5cfe"]]);
11975
+ const DataTable = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-9b6d2a47"]]);
11940
11976
  function useDraggable(options = {}) {
11941
11977
  const isDragging = vue.ref(false);
11942
11978
  const dragElement = vue.ref(null);
@@ -15200,6 +15236,7 @@ function txtField(id, label, options) {
15200
15236
  disabled: options == null ? void 0 : options.disabled,
15201
15237
  placeholder: options == null ? void 0 : options.placeholder,
15202
15238
  defaultValue: options == null ? void 0 : options.defaultValue,
15239
+ validate: options == null ? void 0 : options.validate,
15203
15240
  attrs: {
15204
15241
  type: options == null ? void 0 : options.type,
15205
15242
  pattern: options == null ? void 0 : options.pattern,
@@ -15697,7 +15734,7 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
15697
15734
  var _a;
15698
15735
  return ((_a = form.value) == null ? void 0 : _a.reportValidity()) ?? false;
15699
15736
  };
15700
- let formError = vue.ref();
15737
+ const formError = vue.ref();
15701
15738
  async function handleSubmit() {
15702
15739
  var _a;
15703
15740
  try {
@@ -15717,7 +15754,7 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
15717
15754
  }
15718
15755
  const { renderField } = useSchemaField({
15719
15756
  mode: "form",
15720
- getRowData: () => ({
15757
+ getFormData: () => ({
15721
15758
  ...formData.value,
15722
15759
  get: (path) => getNestedValue(formData.value, path, "")
15723
15760
  }),
@@ -15783,7 +15820,7 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
15783
15820
  formState.value === "success" ? vue.renderSlot(_ctx.$slots, "success", { key: 1 }) : vue.createCommentVNode("", true),
15784
15821
  formState.value === "error" ? vue.renderSlot(_ctx.$slots, "error", {
15785
15822
  key: 2,
15786
- error: vue.unref(formError)
15823
+ error: formError.value
15787
15824
  }) : vue.createCommentVNode("", true)
15788
15825
  ], 64);
15789
15826
  };
@@ -16838,7 +16875,6 @@ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
16838
16875
  const time = new Time(props2.firstDayOfWeek, props2.locale);
16839
16876
  function formatDisplayDate(date2) {
16840
16877
  if (!date2) return "";
16841
- console.log("date", date2);
16842
16878
  return formatDate(date2, props2.enableTime ? "DD.MM.YY HH:mm" : "DD.MM.YY", props2.locale);
16843
16879
  }
16844
16880
  const formattedDisplayValue = vue.computed(() => formatDisplayDate(props2.modelValue));
@@ -17153,7 +17189,7 @@ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
17153
17189
  };
17154
17190
  }
17155
17191
  });
17156
- const DatePick = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-43cb2e62"]]);
17192
+ const DatePick = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-8b1c2495"]]);
17157
17193
  const _hoisted_1$E = { class: "datetime-wrap" };
17158
17194
  const _hoisted_2$s = {
17159
17195
  key: 0,
@@ -22957,7 +22993,7 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
22957
22993
  };
22958
22994
  }
22959
22995
  });
22960
- const RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-a692c596"]]);
22996
+ const RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-29cff93d"]]);
22961
22997
  const _hoisted_1$w = { class: "bagel-input" };
22962
22998
  const _hoisted_2$l = { class: "pb-025" };
22963
22999
  const _hoisted_3$i = { class: "flex gap-05 flex-wrap" };
@@ -28655,7 +28691,9 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
28655
28691
  autocomplete: {},
28656
28692
  autofocus: { type: Boolean },
28657
28693
  onFocusout: {},
28658
- onFocus: {}
28694
+ onFocus: {},
28695
+ validate: {},
28696
+ getFormData: {}
28659
28697
  },
28660
28698
  emits: ["update:modelValue", "debounce"],
28661
28699
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -28663,6 +28701,12 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
28663
28701
  const emit2 = __emit;
28664
28702
  let inputVal = vue.ref();
28665
28703
  const input = vue.ref();
28704
+ useValidateFieldValue(
28705
+ () => inputVal.value,
28706
+ () => input.value,
28707
+ props2.validate,
28708
+ props2.getFormData
28709
+ );
28666
28710
  const inputRows = vue.computed(() => {
28667
28711
  let rows = Number(props2.rows) || 1;
28668
28712
  if (props2.autoheight) rows = Math.max(rows, String(inputVal.value).split("\n").length);
@@ -28775,7 +28819,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
28775
28819
  };
28776
28820
  }
28777
28821
  });
28778
- const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-dbcf2010"]]);
28822
+ const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-6dfc73c3"]]);
28779
28823
  const _hoisted_1$n = ["title"];
28780
28824
  const _hoisted_2$d = ["id", "required"];
28781
28825
  const _hoisted_3$b = ["for"];
@@ -35345,7 +35389,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
35345
35389
  };
35346
35390
  }
35347
35391
  });
35348
- const SpreadsheetTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-5386c509"]]);
35392
+ const SpreadsheetTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-ad70b6cd"]]);
35349
35393
  const _hoisted_1$3 = { class: "flex gap-05 py-05 justify-content-end m_flex-wrap" };
35350
35394
  const _hoisted_2$1 = {
35351
35395
  key: 0,
@@ -35992,7 +36036,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
35992
36036
  };
35993
36037
  }
35994
36038
  });
35995
- const Index = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-42b4475d"]]);
36039
+ const Index = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-1e744d43"]]);
35996
36040
  const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
35997
36041
  __name: "Title",
35998
36042
  props: {
@@ -36528,6 +36572,20 @@ function useDevice() {
36528
36572
  isMobile
36529
36573
  };
36530
36574
  }
36575
+ function useValidateFieldValue(inputVal, getInput, validateFn, getFormData) {
36576
+ watchDebounced(
36577
+ inputVal,
36578
+ (newVal, oldVal) => {
36579
+ var _a, _b;
36580
+ (_a = getInput == null ? void 0 : getInput()) == null ? void 0 : _a.setCustomValidity("");
36581
+ console.log({ validateFn, getFormData, input: getInput });
36582
+ if (!validateFn || newVal === oldVal || !newVal) return;
36583
+ const isValid = validateFn(newVal, getFormData == null ? void 0 : getFormData());
36584
+ if (typeof isValid === "string") (_b = getInput == null ? void 0 : getInput()) == null ? void 0 : _b.setCustomValidity(isValid);
36585
+ },
36586
+ { debounce: 500 }
36587
+ );
36588
+ }
36531
36589
  function useBglSchema({ schema, columns, data: data2 } = {}) {
36532
36590
  let _schema = schema;
36533
36591
  if (typeof _schema === "function") {
@@ -38039,4 +38097,5 @@ exports.useI18nT = useI18nT;
38039
38097
  exports.useLang = useLang;
38040
38098
  exports.useLocalStorage = useLocalStorage;
38041
38099
  exports.useModal = useModal;
38100
+ exports.useValidateFieldValue = useValidateFieldValue;
38042
38101
  exports.vDraggable = vDraggable;
package/dist/index.mjs CHANGED
@@ -273,7 +273,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
273
273
  };
274
274
  }
275
275
  });
276
- const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-bfc435b3"]]);
276
+ const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-5a91aa12"]]);
277
277
  const _hoisted_1$18 = ["dismissable"];
278
278
  const _hoisted_2$S = { class: "m-0" };
279
279
  const _sfc_main$1j = /* @__PURE__ */ defineComponent({
@@ -10527,7 +10527,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10527
10527
  const SLOT_VALUE_COMPONENTS$1 = /* @__PURE__ */ new Set(["div", "span", "p"]);
10528
10528
  const SRC_VALUE_COMPONENTS$1 = /* @__PURE__ */ new Set(["img", "iframe"]);
10529
10529
  function useSchemaField(optns) {
10530
- const { mode = "form", getRowData, onUpdate, includeUnset = false } = optns;
10530
+ const { mode = "form", getFormData, onUpdate, includeUnset = false } = optns;
10531
10531
  function renderObject(obj, depth = 0) {
10532
10532
  if (obj === null || obj === void 0) return "";
10533
10533
  if (typeof obj !== "object") return String(obj);
@@ -10579,7 +10579,7 @@ ${indent}}`;
10579
10579
  function renderField(field, slots) {
10580
10580
  const Component = getComponent(field);
10581
10581
  if (!Component) return null;
10582
- const rowData = (getRowData == null ? void 0 : getRowData()) || {};
10582
+ const rowData = (getFormData == null ? void 0 : getFormData()) || {};
10583
10583
  const condition = field.vIf ?? field["v-if"];
10584
10584
  if (condition !== void 0) {
10585
10585
  if (typeof condition === "function") {
@@ -10602,6 +10602,7 @@ ${indent}}`;
10602
10602
  class: fieldClass,
10603
10603
  id,
10604
10604
  transform,
10605
+ validate,
10605
10606
  slots: fieldSlots,
10606
10607
  required: required2,
10607
10608
  label,
@@ -10619,7 +10620,10 @@ ${indent}}`;
10619
10620
  required: required2,
10620
10621
  label,
10621
10622
  placeholder,
10622
- disabled
10623
+ disabled,
10624
+ validate,
10625
+ id,
10626
+ getFormData
10623
10627
  };
10624
10628
  if (mode === "form") {
10625
10629
  props2.modelValue = currentValue;
@@ -10889,7 +10893,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
10889
10893
  });
10890
10894
  const { renderField } = useSchemaField({
10891
10895
  mode: "preview",
10892
- getRowData: () => firstItem.value,
10896
+ getFormData: () => firstItem.value,
10893
10897
  includeUnset: props2.includeUnset
10894
10898
  });
10895
10899
  return (_ctx, _cache) => {
@@ -10903,7 +10907,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
10903
10907
  };
10904
10908
  }
10905
10909
  });
10906
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-2a466c93"]]);
10910
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-3a662018"]]);
10907
10911
  function useTableSelection(options) {
10908
10912
  const allSelectorEl = ref();
10909
10913
  const computedSelectedItems = computed(() => options.selectedItems.value);
@@ -10984,6 +10988,9 @@ function createFilterWrapper(filter3, fn) {
10984
10988
  }
10985
10989
  return wrapper;
10986
10990
  }
10991
+ const bypassFilter = (invoke) => {
10992
+ return invoke();
10993
+ };
10987
10994
  function debounceFilter(ms, options = {}) {
10988
10995
  let timer;
10989
10996
  let maxTimer;
@@ -11047,6 +11054,20 @@ function useDebounceFn(fn, ms = 200, options = {}) {
11047
11054
  fn
11048
11055
  );
11049
11056
  }
11057
+ function watchWithFilter(source, cb, options = {}) {
11058
+ const {
11059
+ eventFilter = bypassFilter,
11060
+ ...watchOptions
11061
+ } = options;
11062
+ return watch(
11063
+ source,
11064
+ createFilterWrapper(
11065
+ eventFilter,
11066
+ cb
11067
+ ),
11068
+ watchOptions
11069
+ );
11070
+ }
11050
11071
  function tryOnMounted(fn, sync = true, target) {
11051
11072
  const instance = getLifeCycleTarget();
11052
11073
  if (instance)
@@ -11180,6 +11201,21 @@ function createUntil(r2, isNot = false) {
11180
11201
  function until(r2) {
11181
11202
  return createUntil(r2);
11182
11203
  }
11204
+ function watchDebounced(source, cb, options = {}) {
11205
+ const {
11206
+ debounce: debounce2 = 0,
11207
+ maxWait = void 0,
11208
+ ...watchOptions
11209
+ } = options;
11210
+ return watchWithFilter(
11211
+ source,
11212
+ cb,
11213
+ {
11214
+ ...watchOptions,
11215
+ eventFilter: debounceFilter(debounce2, { maxWait })
11216
+ }
11217
+ );
11218
+ }
11183
11219
  function watchImmediate(source, cb, options) {
11184
11220
  return watch(
11185
11221
  source,
@@ -11746,7 +11782,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
11746
11782
  emits: /* @__PURE__ */ mergeModels(["orderBy", "select", "lastItemVisible"], ["update:loading", "update:itemHeight", "update:selectedItems"]),
11747
11783
  setup(__props, { emit: __emit }) {
11748
11784
  useCssVars((_ctx) => ({
11749
- "5e326637": unref(computedItemHeight)
11785
+ "140ab2e6": unref(computedItemHeight)
11750
11786
  }));
11751
11787
  const props2 = __props;
11752
11788
  const emit2 = __emit;
@@ -11810,7 +11846,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
11810
11846
  function renderFieldForRow(field, row) {
11811
11847
  const { renderField } = useSchemaField({
11812
11848
  mode: "table",
11813
- getRowData: () => {
11849
+ getFormData: () => {
11814
11850
  if (field.id) {
11815
11851
  return { [field.id]: getNestedValue(row, field.id) };
11816
11852
  }
@@ -11934,7 +11970,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
11934
11970
  };
11935
11971
  }
11936
11972
  });
11937
- const DataTable = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-642a5cfe"]]);
11973
+ const DataTable = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-9b6d2a47"]]);
11938
11974
  function useDraggable(options = {}) {
11939
11975
  const isDragging = ref(false);
11940
11976
  const dragElement = ref(null);
@@ -15198,6 +15234,7 @@ function txtField(id, label, options) {
15198
15234
  disabled: options == null ? void 0 : options.disabled,
15199
15235
  placeholder: options == null ? void 0 : options.placeholder,
15200
15236
  defaultValue: options == null ? void 0 : options.defaultValue,
15237
+ validate: options == null ? void 0 : options.validate,
15201
15238
  attrs: {
15202
15239
  type: options == null ? void 0 : options.type,
15203
15240
  pattern: options == null ? void 0 : options.pattern,
@@ -15695,7 +15732,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15695
15732
  var _a;
15696
15733
  return ((_a = form.value) == null ? void 0 : _a.reportValidity()) ?? false;
15697
15734
  };
15698
- let formError = ref();
15735
+ const formError = ref();
15699
15736
  async function handleSubmit() {
15700
15737
  var _a;
15701
15738
  try {
@@ -15715,7 +15752,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15715
15752
  }
15716
15753
  const { renderField } = useSchemaField({
15717
15754
  mode: "form",
15718
- getRowData: () => ({
15755
+ getFormData: () => ({
15719
15756
  ...formData.value,
15720
15757
  get: (path) => getNestedValue(formData.value, path, "")
15721
15758
  }),
@@ -15781,7 +15818,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15781
15818
  formState.value === "success" ? renderSlot(_ctx.$slots, "success", { key: 1 }) : createCommentVNode("", true),
15782
15819
  formState.value === "error" ? renderSlot(_ctx.$slots, "error", {
15783
15820
  key: 2,
15784
- error: unref(formError)
15821
+ error: formError.value
15785
15822
  }) : createCommentVNode("", true)
15786
15823
  ], 64);
15787
15824
  };
@@ -16836,7 +16873,6 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
16836
16873
  const time = new Time(props2.firstDayOfWeek, props2.locale);
16837
16874
  function formatDisplayDate(date2) {
16838
16875
  if (!date2) return "";
16839
- console.log("date", date2);
16840
16876
  return formatDate(date2, props2.enableTime ? "DD.MM.YY HH:mm" : "DD.MM.YY", props2.locale);
16841
16877
  }
16842
16878
  const formattedDisplayValue = computed(() => formatDisplayDate(props2.modelValue));
@@ -17151,7 +17187,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
17151
17187
  };
17152
17188
  }
17153
17189
  });
17154
- const DatePick = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-43cb2e62"]]);
17190
+ const DatePick = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-8b1c2495"]]);
17155
17191
  const _hoisted_1$E = { class: "datetime-wrap" };
17156
17192
  const _hoisted_2$s = {
17157
17193
  key: 0,
@@ -22955,7 +22991,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
22955
22991
  };
22956
22992
  }
22957
22993
  });
22958
- const RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-a692c596"]]);
22994
+ const RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-29cff93d"]]);
22959
22995
  const _hoisted_1$w = { class: "bagel-input" };
22960
22996
  const _hoisted_2$l = { class: "pb-025" };
22961
22997
  const _hoisted_3$i = { class: "flex gap-05 flex-wrap" };
@@ -28653,7 +28689,9 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
28653
28689
  autocomplete: {},
28654
28690
  autofocus: { type: Boolean },
28655
28691
  onFocusout: {},
28656
- onFocus: {}
28692
+ onFocus: {},
28693
+ validate: {},
28694
+ getFormData: {}
28657
28695
  },
28658
28696
  emits: ["update:modelValue", "debounce"],
28659
28697
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -28661,6 +28699,12 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
28661
28699
  const emit2 = __emit;
28662
28700
  let inputVal = ref();
28663
28701
  const input = ref();
28702
+ useValidateFieldValue(
28703
+ () => inputVal.value,
28704
+ () => input.value,
28705
+ props2.validate,
28706
+ props2.getFormData
28707
+ );
28664
28708
  const inputRows = computed(() => {
28665
28709
  let rows = Number(props2.rows) || 1;
28666
28710
  if (props2.autoheight) rows = Math.max(rows, String(inputVal.value).split("\n").length);
@@ -28773,7 +28817,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
28773
28817
  };
28774
28818
  }
28775
28819
  });
28776
- const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-dbcf2010"]]);
28820
+ const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-6dfc73c3"]]);
28777
28821
  const _hoisted_1$n = ["title"];
28778
28822
  const _hoisted_2$d = ["id", "required"];
28779
28823
  const _hoisted_3$b = ["for"];
@@ -35343,7 +35387,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
35343
35387
  };
35344
35388
  }
35345
35389
  });
35346
- const SpreadsheetTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-5386c509"]]);
35390
+ const SpreadsheetTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-ad70b6cd"]]);
35347
35391
  const _hoisted_1$3 = { class: "flex gap-05 py-05 justify-content-end m_flex-wrap" };
35348
35392
  const _hoisted_2$1 = {
35349
35393
  key: 0,
@@ -35990,7 +36034,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
35990
36034
  };
35991
36035
  }
35992
36036
  });
35993
- const Index = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-42b4475d"]]);
36037
+ const Index = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-1e744d43"]]);
35994
36038
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
35995
36039
  __name: "Title",
35996
36040
  props: {
@@ -36526,6 +36570,20 @@ function useDevice() {
36526
36570
  isMobile
36527
36571
  };
36528
36572
  }
36573
+ function useValidateFieldValue(inputVal, getInput, validateFn, getFormData) {
36574
+ watchDebounced(
36575
+ inputVal,
36576
+ (newVal, oldVal) => {
36577
+ var _a, _b;
36578
+ (_a = getInput == null ? void 0 : getInput()) == null ? void 0 : _a.setCustomValidity("");
36579
+ console.log({ validateFn, getFormData, input: getInput });
36580
+ if (!validateFn || newVal === oldVal || !newVal) return;
36581
+ const isValid = validateFn(newVal, getFormData == null ? void 0 : getFormData());
36582
+ if (typeof isValid === "string") (_b = getInput == null ? void 0 : getInput()) == null ? void 0 : _b.setCustomValidity(isValid);
36583
+ },
36584
+ { debounce: 500 }
36585
+ );
36586
+ }
36529
36587
  function useBglSchema({ schema, columns, data: data2 } = {}) {
36530
36588
  let _schema = schema;
36531
36589
  if (typeof _schema === "function") {
@@ -38038,5 +38096,6 @@ export {
38038
38096
  useLang,
38039
38097
  useLocalStorage,
38040
38098
  useModal,
38099
+ useValidateFieldValue,
38041
38100
  vDraggable
38042
38101
  };
@@ -1,9 +1,11 @@
1
1
  import { InjectionKey, Plugin } from 'vue';
2
2
  import { ConfirmModalUserOptions, ModalComponentProps, ModalFormComponentProps, ModalFormOptions, ModalOptions } from './modalTypes';
3
3
  export interface ModalApi {
4
- showModal: (options: ModalOptions, slots?: {
4
+ showModal: <T extends {
5
5
  [key: string]: any;
6
- }) => ModalComponentProps | undefined;
6
+ }>(options: ModalOptions, slots?: {
7
+ [key: string]: any;
8
+ }) => ModalComponentProps<T> | undefined;
7
9
  showModalForm: <T extends {
8
10
  [key: string]: any;
9
11
  }>(options: ModalFormOptions<T>, slots?: {
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/plugins/modal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAuB,uBAAuB,EAAE,gBAAgB,EAAE,YAAY,EAAa,MAAM,cAAc,CAAA;AAIzK,MAAM,WAAW,QAAQ;IACxB,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,KAAK,mBAAmB,GAAG,SAAS,CAAA;IACrG,aAAa,EAAE,CAAC,CAAC,SAAS;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,KAAK,uBAAuB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IACzJ,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,YAAY,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CACpE;AAED,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAmB,CAAA;AAElE,wBAAgB,QAAQ,IAAI,QAAQ,CAInC;AAED,eAAO,MAAM,WAAW,EAAE,MAsEzB,CAAA"}
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/plugins/modal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAA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