@bagelink/vue 0.0.1206 → 0.0.1216

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.
@@ -1,6 +1,7 @@
1
1
  import { TableSchemaProps } from '../types/TableSchema';
2
2
  declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & (TableSchemaProps<T> & {
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & (Omit<TableSchemaProps<T>, "data"> & {
4
+ data: T;
4
5
  includeUnset?: boolean;
5
6
  }) & Partial<{}>> & import('vue').PublicProps;
6
7
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"DataPreview.vue.d.ts","sourceRoot":"","sources":["../../src/components/DataPreview.vue"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;yBAK3C,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,eAChC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAqF1D,mBAAmB,CAAC;uBAnF8B,OAAO;oBAmF6B,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;UAEJ,EAAE;OAGG,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA/FzE,wBA+F4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"DataPreview.vue.d.ts","sourceRoot":"","sources":["../../src/components/DataPreview.vue"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;yBAK3C,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,eAChC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAqF1D,mBAAmB,CAAC;cAnFmC,CAAC;uBAAiB,OAAO;oBAmFM,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;UAEJ,EAAE;OAGG,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA/FzE,wBA+F4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -1,19 +1,2 @@
1
- import { Component, Plugin } from 'vue';
2
- export interface DialogOptions {
3
- title?: string;
4
- content?: string | Component;
5
- dismissable?: boolean;
6
- width?: string;
7
- actions?: Array<{
8
- label: string;
9
- onClick: () => void;
10
- variant?: 'primary' | 'secondary' | 'danger';
11
- }>;
12
- }
13
- export interface DialogApi {
14
- show: (options: DialogOptions) => void;
15
- hide: () => void;
16
- }
17
- export declare function useDialog(): DialogApi;
18
- export declare const DialogPlugin: Plugin;
1
+ export {};
19
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,SAAS,EAAgB,MAAM,EAAY,MAAM,KAAK,CAAA;AAGzE,MAAM,WAAW,aAAa;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,KAAK,CAAC;QACf,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,IAAI,CAAA;QACnB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;KAC5C,CAAC,CAAA;CACF;AAED,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;IACtC,IAAI,EAAE,MAAM,IAAI,CAAA;CAChB;AAID,wBAAgB,SAAS,IAAI,SAAS,CAIrC;AAkDD,eAAO,MAAM,YAAY,EAAE,MAkC1B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/index.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/NumberInput.vue"],"names":[],"mappings":"AAkMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAI7C,KAAK,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAA;AAEzD,UAAU,gBAAgB;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,QAAQ,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;;;;;;AAuTD,wBAQG"}
1
+ {"version":3,"file":"NumberInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/NumberInput.vue"],"names":[],"mappings":"AA6NA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAI7C,KAAK,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAA;AAEzD,UAAU,gBAAgB;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,QAAQ,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;;;;;;AAmVD,wBAQG"}
package/dist/index.cjs CHANGED
@@ -7506,12 +7506,12 @@ const _hoisted_1$M = { class: "data-preview" };
7506
7506
  const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
7507
7507
  __name: "DataPreview",
7508
7508
  props: {
7509
- data: {},
7510
7509
  schema: { type: Function },
7511
7510
  showFields: {},
7512
7511
  useServerSort: { type: Boolean },
7513
7512
  selectable: { type: Boolean },
7514
7513
  onLastItemVisible: { type: Function },
7514
+ data: {},
7515
7515
  includeUnset: { type: Boolean }
7516
7516
  },
7517
7517
  setup(__props) {
@@ -7544,7 +7544,7 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
7544
7544
  };
7545
7545
  }
7546
7546
  });
7547
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__scopeId", "data-v-ff265953"]]);
7547
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__scopeId", "data-v-550fe546"]]);
7548
7548
  function useTableSelection(options) {
7549
7549
  const allSelectorEl = vue.ref();
7550
7550
  const computedSelectedItems = vue.computed(() => options.selectedItems.value);
@@ -21677,38 +21677,58 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
21677
21677
  helptext: {},
21678
21678
  layout: {},
21679
21679
  center: { type: Boolean },
21680
- padZero: {}
21680
+ padZero: { default: 1 }
21681
21681
  },
21682
21682
  emits: ["update:modelValue"],
21683
21683
  setup(__props, { emit: __emit }) {
21684
21684
  const emit2 = __emit;
21685
21685
  let numberValue = vue.ref(Number.parseFloat(`${__props.modelValue}`) || void 0);
21686
21686
  const btnLayouts = ["horizontal", "vertical"];
21687
- const canAdd = vue.computed(() => !(__props.max !== void 0 && (numberValue.value || 0) + __props.step > __props.max));
21688
- const canDecrement = vue.computed(() => !(__props.min !== void 0 && (numberValue.value || 0 - __props.step) < __props.min));
21687
+ function add2(...numbers) {
21688
+ var _a2;
21689
+ const numArr = numbers.map((n2) => n2 || 0);
21690
+ const precision = ((_a2 = __props.step.toString().split(".")[1]) == null ? void 0 : _a2.length) || 0;
21691
+ return Number.parseFloat(numArr.reduce((acc, curr) => acc + curr, 0).toFixed(precision));
21692
+ }
21693
+ function subtract(...numbers) {
21694
+ var _a2;
21695
+ const numArr = numbers.map((n2) => n2 || 0);
21696
+ const firstNum = numArr.shift() || 0;
21697
+ const precision = ((_a2 = __props.step.toString().split(".")[1]) == null ? void 0 : _a2.length) || 0;
21698
+ return Number.parseFloat(numArr.reduce((acc, curr) => acc - curr, firstNum).toFixed(precision));
21699
+ }
21700
+ const canAdd = vue.computed(() => !(__props.max !== void 0 && add2(numberValue.value, __props.step) <= __props.max));
21701
+ const canDecrement = vue.computed(() => __props.min === void 0 || subtract(numberValue.value, __props.step) >= __props.min);
21689
21702
  function increment() {
21690
21703
  if (!canAdd.value) return;
21691
- numberValue.value = (numberValue.value || 0) + __props.step;
21704
+ numberValue.value = add2(numberValue.value || 0, __props.step);
21692
21705
  emit2("update:modelValue", numberValue.value);
21693
21706
  }
21694
21707
  function decrement() {
21695
21708
  if (!canDecrement.value) return;
21696
- numberValue.value = (numberValue.value || 0) - __props.step;
21709
+ numberValue.value = subtract(numberValue.value || 0, __props.step);
21697
21710
  emit2("update:modelValue", numberValue.value);
21698
21711
  }
21699
21712
  function formatNumber2(num) {
21700
- let formatted = num.toString();
21701
- if (__props.padZero && __props.padZero > 0) {
21702
- formatted = formatted.padStart(__props.padZero, "0");
21703
- }
21704
- return formatted.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
21713
+ if (Number.isNaN(num)) return "";
21714
+ const formatter = new Intl.NumberFormat("en-US", {
21715
+ minimumFractionDigits: 0,
21716
+ maximumFractionDigits: 20,
21717
+ useGrouping: true
21718
+ });
21719
+ const formattedNum = formatter.format(num);
21720
+ const [integerPart, decimalPart] = formattedNum.split(".");
21721
+ const padding = __props.padZero && __props.padZero > integerPart.replace(/,/g, "").length ? "0".repeat(__props.padZero - integerPart.replace(/,/g, "").length) : "";
21722
+ return decimalPart ? `${padding}${integerPart}.${decimalPart}` : `${padding}${integerPart}`;
21705
21723
  }
21706
21724
  let formattedValue = vue.ref("");
21707
21725
  function inputHandler() {
21708
- const numeric = formattedValue.value.replace(/[^\d.-]/g, "");
21709
- if (numeric === "" || numeric === "-" || numeric === "." || numeric === "-." || numeric.endsWith(".")) return;
21726
+ let numeric = formattedValue.value.replace(/[^\d.-]/g, "");
21727
+ if (numeric === "-." || numeric.endsWith(".")) return;
21728
+ const emptyValue = ["", "-", "."].includes(numeric);
21729
+ if (emptyValue) numeric = `${__props.min}`;
21710
21730
  numberValue.value = Number.parseFloat(numeric);
21711
- formattedValue.value = formatNumber2(numberValue.value);
21731
+ formattedValue.value = emptyValue ? "" : formatNumber2(numberValue.value);
21712
21732
  emit2("update:modelValue", numberValue.value);
21713
21733
  }
21714
21734
  vue.watch(() => numberValue.value, () => {
@@ -21820,7 +21840,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
21820
21840
  };
21821
21841
  }
21822
21842
  });
21823
- const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-e3916f73"]]);
21843
+ const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-d8856711"]]);
21824
21844
  const _hoisted_1$y = ["value", "autofocus", "onKeydown", "onPaste"];
21825
21845
  const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
21826
21846
  __name: "OTP",
package/dist/index.mjs CHANGED
@@ -7504,12 +7504,12 @@ const _hoisted_1$M = { class: "data-preview" };
7504
7504
  const _sfc_main$X = /* @__PURE__ */ defineComponent({
7505
7505
  __name: "DataPreview",
7506
7506
  props: {
7507
- data: {},
7508
7507
  schema: { type: Function },
7509
7508
  showFields: {},
7510
7509
  useServerSort: { type: Boolean },
7511
7510
  selectable: { type: Boolean },
7512
7511
  onLastItemVisible: { type: Function },
7512
+ data: {},
7513
7513
  includeUnset: { type: Boolean }
7514
7514
  },
7515
7515
  setup(__props) {
@@ -7542,7 +7542,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
7542
7542
  };
7543
7543
  }
7544
7544
  });
7545
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__scopeId", "data-v-ff265953"]]);
7545
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__scopeId", "data-v-550fe546"]]);
7546
7546
  function useTableSelection(options) {
7547
7547
  const allSelectorEl = ref();
7548
7548
  const computedSelectedItems = computed(() => options.selectedItems.value);
@@ -21675,38 +21675,58 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
21675
21675
  helptext: {},
21676
21676
  layout: {},
21677
21677
  center: { type: Boolean },
21678
- padZero: {}
21678
+ padZero: { default: 1 }
21679
21679
  },
21680
21680
  emits: ["update:modelValue"],
21681
21681
  setup(__props, { emit: __emit }) {
21682
21682
  const emit2 = __emit;
21683
21683
  let numberValue = ref(Number.parseFloat(`${__props.modelValue}`) || void 0);
21684
21684
  const btnLayouts = ["horizontal", "vertical"];
21685
- const canAdd = computed(() => !(__props.max !== void 0 && (numberValue.value || 0) + __props.step > __props.max));
21686
- const canDecrement = computed(() => !(__props.min !== void 0 && (numberValue.value || 0 - __props.step) < __props.min));
21685
+ function add2(...numbers) {
21686
+ var _a2;
21687
+ const numArr = numbers.map((n2) => n2 || 0);
21688
+ const precision = ((_a2 = __props.step.toString().split(".")[1]) == null ? void 0 : _a2.length) || 0;
21689
+ return Number.parseFloat(numArr.reduce((acc, curr) => acc + curr, 0).toFixed(precision));
21690
+ }
21691
+ function subtract(...numbers) {
21692
+ var _a2;
21693
+ const numArr = numbers.map((n2) => n2 || 0);
21694
+ const firstNum = numArr.shift() || 0;
21695
+ const precision = ((_a2 = __props.step.toString().split(".")[1]) == null ? void 0 : _a2.length) || 0;
21696
+ return Number.parseFloat(numArr.reduce((acc, curr) => acc - curr, firstNum).toFixed(precision));
21697
+ }
21698
+ const canAdd = computed(() => !(__props.max !== void 0 && add2(numberValue.value, __props.step) <= __props.max));
21699
+ const canDecrement = computed(() => __props.min === void 0 || subtract(numberValue.value, __props.step) >= __props.min);
21687
21700
  function increment() {
21688
21701
  if (!canAdd.value) return;
21689
- numberValue.value = (numberValue.value || 0) + __props.step;
21702
+ numberValue.value = add2(numberValue.value || 0, __props.step);
21690
21703
  emit2("update:modelValue", numberValue.value);
21691
21704
  }
21692
21705
  function decrement() {
21693
21706
  if (!canDecrement.value) return;
21694
- numberValue.value = (numberValue.value || 0) - __props.step;
21707
+ numberValue.value = subtract(numberValue.value || 0, __props.step);
21695
21708
  emit2("update:modelValue", numberValue.value);
21696
21709
  }
21697
21710
  function formatNumber2(num) {
21698
- let formatted = num.toString();
21699
- if (__props.padZero && __props.padZero > 0) {
21700
- formatted = formatted.padStart(__props.padZero, "0");
21701
- }
21702
- return formatted.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
21711
+ if (Number.isNaN(num)) return "";
21712
+ const formatter = new Intl.NumberFormat("en-US", {
21713
+ minimumFractionDigits: 0,
21714
+ maximumFractionDigits: 20,
21715
+ useGrouping: true
21716
+ });
21717
+ const formattedNum = formatter.format(num);
21718
+ const [integerPart, decimalPart] = formattedNum.split(".");
21719
+ const padding = __props.padZero && __props.padZero > integerPart.replace(/,/g, "").length ? "0".repeat(__props.padZero - integerPart.replace(/,/g, "").length) : "";
21720
+ return decimalPart ? `${padding}${integerPart}.${decimalPart}` : `${padding}${integerPart}`;
21703
21721
  }
21704
21722
  let formattedValue = ref("");
21705
21723
  function inputHandler() {
21706
- const numeric = formattedValue.value.replace(/[^\d.-]/g, "");
21707
- if (numeric === "" || numeric === "-" || numeric === "." || numeric === "-." || numeric.endsWith(".")) return;
21724
+ let numeric = formattedValue.value.replace(/[^\d.-]/g, "");
21725
+ if (numeric === "-." || numeric.endsWith(".")) return;
21726
+ const emptyValue = ["", "-", "."].includes(numeric);
21727
+ if (emptyValue) numeric = `${__props.min}`;
21708
21728
  numberValue.value = Number.parseFloat(numeric);
21709
- formattedValue.value = formatNumber2(numberValue.value);
21729
+ formattedValue.value = emptyValue ? "" : formatNumber2(numberValue.value);
21710
21730
  emit2("update:modelValue", numberValue.value);
21711
21731
  }
21712
21732
  watch(() => numberValue.value, () => {
@@ -21818,7 +21838,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
21818
21838
  };
21819
21839
  }
21820
21840
  });
21821
- const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-e3916f73"]]);
21841
+ const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-d8856711"]]);
21822
21842
  const _hoisted_1$y = ["value", "autofocus", "onKeydown", "onPaste"];
21823
21843
  const _sfc_main$F = /* @__PURE__ */ defineComponent({
21824
21844
  __name: "OTP",
package/dist/style.css CHANGED
@@ -453,23 +453,23 @@ display: block;
453
453
  }
454
454
  }
455
455
 
456
- .data-preview[data-v-ff265953] {
456
+ .data-preview[data-v-550fe546] {
457
457
  display: flex;
458
458
  flex-direction: column;
459
459
  gap: 0.5rem;
460
460
  }
461
- .preview-field[data-v-ff265953] {
461
+ .preview-field[data-v-550fe546] {
462
462
  display: flex;
463
463
  flex-direction: row;
464
464
  align-items: center;
465
465
  gap: 0.5rem;
466
466
  }
467
- .field-label[data-v-ff265953] {
467
+ .field-label[data-v-550fe546] {
468
468
  font-size: 0.8rem;
469
469
  color: var(--bgl-black-tint);
470
470
  font-weight: 500;
471
471
  }
472
- .field-value[data-v-ff265953] {
472
+ .field-value[data-v-550fe546] {
473
473
  font-size: 0.95rem;
474
474
  }
475
475
 
@@ -1241,14 +1241,14 @@ pre code.hljs{
1241
1241
  direction: ltr;
1242
1242
  }
1243
1243
 
1244
- .txtInputIconStart .iconStart[data-v-e3916f73] {
1244
+ .txtInputIconStart .iconStart[data-v-d8856711] {
1245
1245
  color: var(--input-color);
1246
1246
  position: absolute;
1247
1247
  inset-inline-start:calc(var(--input-height) / 3 - 0.25rem);
1248
1248
  margin-top: calc(var(--input-height) / 2 );
1249
1249
  line-height: 0;
1250
1250
  }
1251
- .textInputSpinnerWrap .spinner[data-v-e3916f73] {
1251
+ .textInputSpinnerWrap .spinner[data-v-d8856711] {
1252
1252
  color: var(--input-color);
1253
1253
  position: absolute;
1254
1254
  inset-inline-end: 0;
@@ -1258,18 +1258,18 @@ pre code.hljs{
1258
1258
  flex-direction: column;
1259
1259
  gap: 0;
1260
1260
  }
1261
- .top-bgl-ctrl-num-btn[data-v-e3916f73]{
1261
+ .top-bgl-ctrl-num-btn[data-v-d8856711]{
1262
1262
  margin-top: calc(var(--input-height) / 10) !important;
1263
1263
  }
1264
- .bgl-ctrl-num-btn[data-v-e3916f73]{
1264
+ .bgl-ctrl-num-btn[data-v-d8856711]{
1265
1265
  height: calc(var(--input-height) / 2.5) !important;
1266
1266
  isolation: isolate;
1267
1267
  }
1268
- .bgl-big-ctrl-num-btn[data-v-e3916f73]{
1268
+ .bgl-big-ctrl-num-btn[data-v-d8856711]{
1269
1269
  width: 100% !important;
1270
1270
  isolation: isolate;
1271
1271
  }
1272
- .bgl-number-input[data-v-e3916f73]{
1272
+ .bgl-number-input[data-v-d8856711]{
1273
1273
  padding-inline-end: 1.75rem !important;
1274
1274
  }
1275
1275
 
@@ -5809,6 +5809,10 @@ to {
5809
5809
  }.w-auto,
5810
5810
  .w-a {
5811
5811
  width: auto !important;
5812
+ }.max-width-none {
5813
+ max-width: none !important;
5814
+ }.max-height-none {
5815
+ max-height: none !important;
5812
5816
  }.h-auto,
5813
5817
  .h-a {
5814
5818
  height: auto !important;
@@ -9523,6 +9527,14 @@ to {
9523
9527
  width: auto !important;
9524
9528
  }
9525
9529
 
9530
+ .m_max-width-none {
9531
+ max-width: none !important;
9532
+ }
9533
+
9534
+ .m_max-height-none {
9535
+ max-height: none !important;
9536
+ }
9537
+
9526
9538
  .m_h-auto,
9527
9539
  .m_h-a {
9528
9540
  height: auto !important;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.1206",
4
+ "version": "0.0.1216",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
File without changes
@@ -6,7 +6,7 @@ import { computed, useSlots } from 'vue'
6
6
  import { useSchemaField } from '../composables/useSchemaField'
7
7
  import { useTableData } from './DataTable/useTableData'
8
8
 
9
- const props = defineProps<TableSchemaProps<T> & { includeUnset?: boolean }>()
9
+ const props = defineProps<Omit<TableSchemaProps<T>, 'data'> & { data: T, includeUnset?: boolean }>()
10
10
  const slots = useSlots() as Slots & Record<string, (props: { row: T, field: BaseBagelField<T> }) => any>
11
11
 
12
12
  const data = computed(() => Array.isArray(props.data) ? props.data : [props.data])
@@ -0,0 +1,192 @@
1
+ // import type { App, Component, InjectionKey, Plugin, PropType } from 'vue'
2
+ // import { createApp, defineComponent, h, inject } from 'vue'
3
+
4
+ // export interface DialogOptions {
5
+ // title?: string
6
+ // content?: string | Component
7
+ // dismissable?: boolean
8
+ // width?: string
9
+ // actions?: Array<{
10
+ // label: string
11
+ // onClick: () => void
12
+ // variant?: 'primary' | 'secondary' | 'danger'
13
+ // }>
14
+ // }
15
+
16
+ // export interface DialogApi {
17
+ // show: (options: DialogOptions) => void
18
+ // hide: () => void
19
+ // }
20
+
21
+ // const DialogSymbol: InjectionKey<DialogApi> = Symbol('dialog')
22
+
23
+ // export function useDialog(): DialogApi {
24
+ // const api = inject(DialogSymbol)
25
+ // if (!api) throw new Error('Dialog plugin not installed')
26
+ // return api
27
+ // }
28
+
29
+ // const Dialog = defineComponent({
30
+ // props: {
31
+ // options: {
32
+ // type: Object as () => DialogOptions,
33
+ // required: true
34
+ // },
35
+ // onClose: {
36
+ // type: Function as PropType<(event?: MouseEvent) => void>,
37
+ // required: true
38
+ // }
39
+ // },
40
+ // setup(props) {
41
+ // return () => h('div', {
42
+ // class: 'dialog-overlay',
43
+ // onClick: (e: MouseEvent) => {
44
+ // if (props.options.dismissable && e.target === e.currentTarget) {
45
+ // props.onClose()
46
+ // }
47
+ // }
48
+ // }, [
49
+ // h('div', {
50
+ // class: ['dialog', props.options.width ? `w-${props.options.width}` : 'w-96']
51
+ // }, [
52
+ // h('div', { class: 'dialog-header' }, [
53
+ // h('h3', { class: 'dialog-title' }, props.options.title),
54
+ // props.options.dismissable && h('button', {
55
+ // class: 'dialog-close',
56
+ // onClick: props.onClose
57
+ // }, '×')
58
+ // ]),
59
+ // h('div', { class: 'dialog-content' }, [
60
+ // typeof props.options.content === 'string'
61
+ // ? props.options.content
62
+ // : h(props.options.content as any)
63
+ // ]),
64
+ // props.options.actions && h('div', { class: 'dialog-actions' }, props.options.actions.map(action => h('button', {
65
+ // class: ['dialog-btn', action.variant],
66
+ // onClick: () => {
67
+ // action.onClick()
68
+ // props.onClose()
69
+ // }
70
+ // }, action.label)
71
+ // ))
72
+ // ])
73
+ // ])
74
+ // }
75
+ // })
76
+
77
+ // export const DialogPlugin: Plugin = {
78
+ // install: (app: App) => {
79
+ // // Create a div to mount our dialog
80
+ // const dialogContainer = document.createElement('div')
81
+ // document.body.appendChild(dialogContainer)
82
+
83
+ // let currentDialog: any = null
84
+
85
+ // const api: DialogApi = {
86
+ // show: (options: DialogOptions) => {
87
+ // // Remove existing dialog if any
88
+ // if (currentDialog) {
89
+ // currentDialog.unmount()
90
+ // }
91
+
92
+ // // Create new dialog instance
93
+ // const dialogApp = createApp(Dialog, {
94
+ // options,
95
+ // onClose: () => { api.hide() }
96
+ // })
97
+
98
+ // // Mount it
99
+ // currentDialog = dialogApp.mount(dialogContainer)
100
+ // },
101
+ // hide: () => {
102
+ // if (currentDialog) {
103
+ // currentDialog.unmount()
104
+ // currentDialog = null
105
+ // }
106
+ // }
107
+ // }
108
+
109
+ // app.provide(DialogSymbol, api)
110
+ // }
111
+ // }
112
+
113
+ // // Add some basic styles
114
+ // const style = document.createElement('style')
115
+ // style.textContent = `
116
+ // .dialog-overlay {
117
+ // position: fixed;
118
+ // top: 0;
119
+ // left: 0;
120
+ // right: 0;
121
+ // bottom: 0;
122
+ // background: rgba(0, 0, 0, 0.5);
123
+ // display: flex;
124
+ // align-items: center;
125
+ // justify-content: center;
126
+ // z-index: 1000;
127
+ // }
128
+
129
+ // .dialog {
130
+ // background: white;
131
+ // border-radius: 0.5rem;
132
+ // box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
133
+ // max-width: 90vw;
134
+ // max-height: 90vh;
135
+ // overflow: auto;
136
+ // }
137
+
138
+ // .dialog-header {
139
+ // padding: 1rem;
140
+ // border-bottom: 1px solid #e5e7eb;
141
+ // display: flex;
142
+ // justify-content: space-between;
143
+ // align-items: center;
144
+ // }
145
+
146
+ // .dialog-title {
147
+ // margin: 0;
148
+ // font-size: 1.25rem;
149
+ // font-weight: 600;
150
+ // }
151
+
152
+ // .dialog-close {
153
+ // background: none;
154
+ // border: none;
155
+ // font-size: 1.5rem;
156
+ // cursor: pointer;
157
+ // padding: 0.25rem;
158
+ // }
159
+
160
+ // .dialog-content {
161
+ // padding: 1rem;
162
+ // }
163
+
164
+ // .dialog-actions {
165
+ // padding: 1rem;
166
+ // border-top: 1px solid #e5e7eb;
167
+ // display: flex;
168
+ // justify-content: flex-end;
169
+ // gap: 0.5rem;
170
+ // }
171
+
172
+ // .dialog-btn {
173
+ // padding: 0.5rem 1rem;
174
+ // border-radius: 0.375rem;
175
+ // border: 1px solid #e5e7eb;
176
+ // background: white;
177
+ // cursor: pointer;
178
+ // }
179
+
180
+ // .dialog-btn.primary {
181
+ // background: #3b82f6;
182
+ // color: white;
183
+ // border-color: #3b82f6;
184
+ // }
185
+
186
+ // .dialog-btn.danger {
187
+ // background: #ef4444;
188
+ // color: white;
189
+ // border-color: #ef4444;
190
+ // }
191
+ // `
192
+ // document.head.appendChild(style)
@@ -39,7 +39,7 @@ const {
39
39
  helptext,
40
40
  layout,
41
41
  id,
42
- padZero,
42
+ padZero = 1,
43
43
  } = defineProps<NumberInputProps>()
44
44
 
45
45
  const emit = defineEmits(['update:modelValue'])
@@ -48,38 +48,66 @@ let numberValue = $ref(Number.parseFloat(`${modelValue}`) || undefined)
48
48
 
49
49
  const btnLayouts: NumberLayout[] = ['horizontal', 'vertical']
50
50
 
51
- const canAdd = $computed(() => !(max !== undefined && ((numberValue || 0) + step) > max))
52
- const canDecrement = $computed(() => !(min !== undefined && (numberValue || 0 - step) < min))
51
+ function add(...numbers: (number | undefined)[]) {
52
+ const numArr: number[] = numbers.map(n => n || 0)
53
+ const precision = step.toString().split('.')[1]?.length || 0
54
+ return Number.parseFloat(numArr.reduce((acc, curr) => acc + curr, 0).toFixed(precision))
55
+ }
56
+
57
+ function subtract(...numbers: (number | undefined)[]) {
58
+ const numArr: number[] = numbers.map(n => n || 0)
59
+ const firstNum = numArr.shift() || 0
60
+ const precision = step.toString().split('.')[1]?.length || 0
61
+ return Number.parseFloat(numArr.reduce((acc, curr) => acc - curr, firstNum).toFixed(precision))
62
+ }
63
+
64
+ const canAdd = $computed(() => !(max !== undefined && add(numberValue, step) <= max))
65
+ const canDecrement = $computed(() => min === undefined || subtract(numberValue, step) >= min)
53
66
 
54
67
  // Methods
55
68
  function increment() {
56
69
  if (!canAdd) return
57
- numberValue = (numberValue || 0) + step
70
+ numberValue = add(numberValue || 0, step)
58
71
  emit('update:modelValue', numberValue)
59
72
  }
60
73
 
61
74
  function decrement() {
62
75
  if (!canDecrement) return
63
- numberValue = (numberValue || 0) - step
76
+ numberValue = subtract(numberValue || 0, step)
64
77
  emit('update:modelValue', numberValue)
65
78
  }
66
79
 
67
80
  function formatNumber(num: number) {
68
- let formatted = num.toString()
69
- if (padZero && padZero > 0) {
70
- formatted = formatted.padStart(padZero, '0')
71
- }
72
- // eslint-disable-next-line regexp/no-unused-capturing-group
73
- return formatted.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
81
+ if (Number.isNaN(num)) return ''
82
+ const formatter = new Intl.NumberFormat('en-US', {
83
+ minimumFractionDigits: 0,
84
+ maximumFractionDigits: 20,
85
+ useGrouping: true
86
+ })
87
+
88
+ const formattedNum = formatter.format(num)
89
+ const [integerPart, decimalPart] = formattedNum.split('.')
90
+
91
+ // Add padding zeros if needed
92
+ const padding = padZero && padZero > integerPart.replace(/,/g, '').length
93
+ ? '0'.repeat(padZero - integerPart.replace(/,/g, '').length)
94
+ : ''
95
+
96
+ return decimalPart
97
+ ? `${padding}${integerPart}.${decimalPart}`
98
+ : `${padding}${integerPart}`
74
99
  }
75
100
 
76
101
  let formattedValue = $ref('')
77
-
78
102
  function inputHandler() {
79
- const numeric = formattedValue.replace(/[^\d.-]/g, '')
80
- if (numeric === '' || numeric === '-' || numeric === '.' || numeric === '-.' || numeric.endsWith('.')) return
103
+ let numeric = formattedValue.replace(/[^\d.-]/g, '')
104
+ if (numeric === '-.' || numeric.endsWith('.')) return
105
+ const emptyValue = ['', '-', '.'].includes(numeric)
106
+
107
+ if (emptyValue) numeric = `${min}`
108
+
81
109
  numberValue = Number.parseFloat(numeric)
82
- formattedValue = formatNumber(numberValue)
110
+ formattedValue = emptyValue ? '' : formatNumber(numberValue)
83
111
  emit('update:modelValue', numberValue)
84
112
  }
85
113
 
@@ -108,7 +136,6 @@ watch(() => modelValue, (newVal) => {
108
136
  </label>
109
137
  <div class="gap-025" :class="{ 'column flex': layout === 'vertical', 'flex': layout === 'horizontal' }">
110
138
  <Btn v-if="layout && btnLayouts.includes(layout)" flat icon="add" class="radius" :class="[{ 'bgl-big-ctrl-num-btn': layout === 'vertical' }]" tabindex="-1" @click="increment" />
111
-
112
139
  <input
113
140
  :id
114
141
  v-model.trim="formattedValue"
@@ -2860,6 +2860,14 @@
2860
2860
  width: auto !important;
2861
2861
  }
2862
2862
 
2863
+ .max-width-none {
2864
+ max-width: none !important;
2865
+ }
2866
+
2867
+ .max-height-none {
2868
+ max-height: none !important;
2869
+ }
2870
+
2863
2871
  .h-auto,
2864
2872
  .h-a {
2865
2873
  height: auto !important;
@@ -2151,6 +2151,14 @@
2151
2151
  width: auto !important;
2152
2152
  }
2153
2153
 
2154
+ .m_max-width-none {
2155
+ max-width: none !important;
2156
+ }
2157
+
2158
+ .m_max-height-none {
2159
+ max-height: none !important;
2160
+ }
2161
+
2154
2162
  .m_h-auto,
2155
2163
  .m_h-a {
2156
2164
  height: auto !important;
@@ -1,192 +0,0 @@
1
- import type { App, Component, InjectionKey, Plugin, PropType } from 'vue'
2
- import { createApp, defineComponent, h, inject } from 'vue'
3
-
4
- export interface DialogOptions {
5
- title?: string
6
- content?: string | Component
7
- dismissable?: boolean
8
- width?: string
9
- actions?: Array<{
10
- label: string
11
- onClick: () => void
12
- variant?: 'primary' | 'secondary' | 'danger'
13
- }>
14
- }
15
-
16
- export interface DialogApi {
17
- show: (options: DialogOptions) => void
18
- hide: () => void
19
- }
20
-
21
- const DialogSymbol: InjectionKey<DialogApi> = Symbol('dialog')
22
-
23
- export function useDialog(): DialogApi {
24
- const api = inject(DialogSymbol)
25
- if (!api) throw new Error('Dialog plugin not installed')
26
- return api
27
- }
28
-
29
- const Dialog = defineComponent({
30
- props: {
31
- options: {
32
- type: Object as () => DialogOptions,
33
- required: true
34
- },
35
- onClose: {
36
- type: Function as PropType<(event?: MouseEvent) => void>,
37
- required: true
38
- }
39
- },
40
- setup(props) {
41
- return () => h('div', {
42
- class: 'dialog-overlay',
43
- onClick: (e: MouseEvent) => {
44
- if (props.options.dismissable && e.target === e.currentTarget) {
45
- props.onClose()
46
- }
47
- }
48
- }, [
49
- h('div', {
50
- class: ['dialog', props.options.width ? `w-${props.options.width}` : 'w-96']
51
- }, [
52
- h('div', { class: 'dialog-header' }, [
53
- h('h3', { class: 'dialog-title' }, props.options.title),
54
- props.options.dismissable && h('button', {
55
- class: 'dialog-close',
56
- onClick: props.onClose
57
- }, '×')
58
- ]),
59
- h('div', { class: 'dialog-content' }, [
60
- typeof props.options.content === 'string'
61
- ? props.options.content
62
- : h(props.options.content as any)
63
- ]),
64
- props.options.actions && h('div', { class: 'dialog-actions' }, props.options.actions.map(action => h('button', {
65
- class: ['dialog-btn', action.variant],
66
- onClick: () => {
67
- action.onClick()
68
- props.onClose()
69
- }
70
- }, action.label)
71
- ))
72
- ])
73
- ])
74
- }
75
- })
76
-
77
- export const DialogPlugin: Plugin = {
78
- install: (app: App) => {
79
- // Create a div to mount our dialog
80
- const dialogContainer = document.createElement('div')
81
- document.body.appendChild(dialogContainer)
82
-
83
- let currentDialog: any = null
84
-
85
- const api: DialogApi = {
86
- show: (options: DialogOptions) => {
87
- // Remove existing dialog if any
88
- if (currentDialog) {
89
- currentDialog.unmount()
90
- }
91
-
92
- // Create new dialog instance
93
- const dialogApp = createApp(Dialog, {
94
- options,
95
- onClose: () => { api.hide() }
96
- })
97
-
98
- // Mount it
99
- currentDialog = dialogApp.mount(dialogContainer)
100
- },
101
- hide: () => {
102
- if (currentDialog) {
103
- currentDialog.unmount()
104
- currentDialog = null
105
- }
106
- }
107
- }
108
-
109
- app.provide(DialogSymbol, api)
110
- }
111
- }
112
-
113
- // Add some basic styles
114
- const style = document.createElement('style')
115
- style.textContent = `
116
- .dialog-overlay {
117
- position: fixed;
118
- top: 0;
119
- left: 0;
120
- right: 0;
121
- bottom: 0;
122
- background: rgba(0, 0, 0, 0.5);
123
- display: flex;
124
- align-items: center;
125
- justify-content: center;
126
- z-index: 1000;
127
- }
128
-
129
- .dialog {
130
- background: white;
131
- border-radius: 0.5rem;
132
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
133
- max-width: 90vw;
134
- max-height: 90vh;
135
- overflow: auto;
136
- }
137
-
138
- .dialog-header {
139
- padding: 1rem;
140
- border-bottom: 1px solid #e5e7eb;
141
- display: flex;
142
- justify-content: space-between;
143
- align-items: center;
144
- }
145
-
146
- .dialog-title {
147
- margin: 0;
148
- font-size: 1.25rem;
149
- font-weight: 600;
150
- }
151
-
152
- .dialog-close {
153
- background: none;
154
- border: none;
155
- font-size: 1.5rem;
156
- cursor: pointer;
157
- padding: 0.25rem;
158
- }
159
-
160
- .dialog-content {
161
- padding: 1rem;
162
- }
163
-
164
- .dialog-actions {
165
- padding: 1rem;
166
- border-top: 1px solid #e5e7eb;
167
- display: flex;
168
- justify-content: flex-end;
169
- gap: 0.5rem;
170
- }
171
-
172
- .dialog-btn {
173
- padding: 0.5rem 1rem;
174
- border-radius: 0.375rem;
175
- border: 1px solid #e5e7eb;
176
- background: white;
177
- cursor: pointer;
178
- }
179
-
180
- .dialog-btn.primary {
181
- background: #3b82f6;
182
- color: white;
183
- border-color: #3b82f6;
184
- }
185
-
186
- .dialog-btn.danger {
187
- background: #ef4444;
188
- color: white;
189
- border-color: #ef4444;
190
- }
191
- `
192
- document.head.appendChild(style)