@mulmoclaude/accounting-plugin 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as resolveFiscalYearEnd, C as currentFiscalYearRange, E as fiscalYearEndMonthLabel, F as isUnknownArray, H as ACCOUNTING_API, I as ACCOUNTING_BOOKS_CHANNEL, L as BOOK_EVENT_KINDS, M as errorMessage, O as previousFiscalYearRange, P as isRecord, R as bookChannel, S as FISCAL_YEAR_END_MONTHS, U as ACCOUNTING_ACTIONS, _ as SUPPORTED_COUNTRY_CODES, a as localDateString, b as localizedCountryName, c as previousMonthString, d as formatAmountNumeric, i as lastMonthOfPreviousQuarterString, k as previousQuarterRange, l as SUPPORTED_CURRENCY_CODES, m as localizedCurrencyName, o as localMonthString, p as inputStepFor, r as decemberOfPreviousYearString, u as formatAmount, v as countryHasFeature, w as currentQuarterRange, y as isSupportedCountryCode, z as ACCOUNT_TYPES } from "./shared-xYPtGNvH.js";
1
+ import { A as resolveFiscalYearEnd, C as currentFiscalYearRange, E as fiscalYearEndMonthLabel, F as isUnknownArray, H as ACCOUNTING_API, I as ACCOUNTING_BOOKS_CHANNEL, L as BOOK_EVENT_KINDS, M as errorMessage, O as previousFiscalYearRange, P as isRecord, R as bookChannel, S as FISCAL_YEAR_END_MONTHS, U as ACCOUNTING_ACTIONS, _ as SUPPORTED_COUNTRY_CODES, a as localDateString, b as localizedCountryName, c as previousMonthString, d as formatAmountNumeric, i as lastMonthOfPreviousQuarterString, k as previousQuarterRange, l as SUPPORTED_CURRENCY_CODES, m as localizedCurrencyName, o as localMonthString, p as inputStepFor, r as decemberOfPreviousYearString, u as formatAmount, v as countryHasFeature, w as currentQuarterRange, y as isSupportedCountryCode, z as ACCOUNT_TYPES } from "./shared-BZAAF-I4.js";
2
2
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, onMounted, onUnmounted, openBlock, reactive, ref, renderList, toDisplayString, unref, vModelSelect, vModelText, watch, withDirectives, withKeys, withModifiers } from "vue";
3
3
  import { createPluginI18n } from "@mulmoclaude/core/plugin-vue/i18n";
4
4
  //#region src/vue/hostContext.ts
@@ -2234,7 +2234,7 @@ function isValidAccountCode(code) {
2234
2234
  }
2235
2235
  function typeForCode(code) {
2236
2236
  if (!isValidAccountCode(code)) return null;
2237
- const leading = Number.parseInt(code[0], 10);
2237
+ const leading = Number.parseInt(code.charAt(0), 10);
2238
2238
  return ACCOUNT_TYPES.find((type) => ACCOUNT_TYPE_PREFIX[type] === leading) ?? null;
2239
2239
  }
2240
2240
  function codeMatchesType(code, type) {
@@ -3756,12 +3756,21 @@ var OpeningBalancesForm_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
3756
3756
  credit: null
3757
3757
  };
3758
3758
  }
3759
+ const accountRows = computed(() => bsAccounts.value.flatMap((account) => {
3760
+ const row = rows.value[account.code];
3761
+ return row ? [{
3762
+ account,
3763
+ row
3764
+ }] : [];
3765
+ }));
3759
3766
  function onDebitInput(code) {
3760
3767
  const row = rows.value[code];
3768
+ if (!row) return;
3761
3769
  if (row.debit !== null && row.debit !== 0) row.credit = null;
3762
3770
  }
3763
3771
  function onCreditInput(code) {
3764
3772
  const row = rows.value[code];
3773
+ if (!row) return;
3765
3774
  if (row.credit !== null && row.credit !== 0) row.debit = null;
3766
3775
  }
3767
3776
  const imbalance = computed(() => {
@@ -3881,7 +3890,7 @@ var OpeningBalancesForm_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
3881
3890
  createElementVNode("th", _hoisted_11$5, toDisplayString(unref(t)("pluginAccounting.entryForm.accountLabel")), 1),
3882
3891
  createElementVNode("th", _hoisted_12$5, toDisplayString(unref(t)("pluginAccounting.entryForm.debitLabel")), 1),
3883
3892
  createElementVNode("th", _hoisted_13$5, toDisplayString(unref(t)("pluginAccounting.entryForm.creditLabel")), 1)
3884
- ])]), createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(bsAccounts.value, (account) => {
3893
+ ])]), createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(accountRows.value, ({ account, row }) => {
3885
3894
  return openBlock(), createElementBlock("tr", {
3886
3895
  key: account.code,
3887
3896
  class: "border-b border-gray-100"
@@ -3892,7 +3901,7 @@ var OpeningBalancesForm_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
3892
3901
  createElementVNode("span", _hoisted_16$4, toDisplayString(account.type), 1)
3893
3902
  ]),
3894
3903
  createElementVNode("td", _hoisted_17$4, [withDirectives(createElementVNode("input", {
3895
- "onUpdate:modelValue": ($event) => rows.value[account.code].debit = $event,
3904
+ "onUpdate:modelValue": ($event) => row.debit = $event,
3896
3905
  type: "number",
3897
3906
  step: step.value,
3898
3907
  min: "0",
@@ -3901,12 +3910,12 @@ var OpeningBalancesForm_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
3901
3910
  onInput: ($event) => onDebitInput(account.code)
3902
3911
  }, null, 40, _hoisted_18$4), [[
3903
3912
  vModelText,
3904
- rows.value[account.code].debit,
3913
+ row.debit,
3905
3914
  void 0,
3906
3915
  { number: true }
3907
3916
  ]])]),
3908
3917
  createElementVNode("td", _hoisted_19$4, [withDirectives(createElementVNode("input", {
3909
- "onUpdate:modelValue": ($event) => rows.value[account.code].credit = $event,
3918
+ "onUpdate:modelValue": ($event) => row.credit = $event,
3910
3919
  type: "number",
3911
3920
  step: step.value,
3912
3921
  min: "0",
@@ -3915,7 +3924,7 @@ var OpeningBalancesForm_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
3915
3924
  onInput: ($event) => onCreditInput(account.code)
3916
3925
  }, null, 40, _hoisted_20$4), [[
3917
3926
  vModelText,
3918
- rows.value[account.code].credit,
3927
+ row.credit,
3919
3928
  void 0,
3920
3929
  { number: true }
3921
3930
  ]])])
@@ -3941,7 +3950,7 @@ var OpeningBalancesForm_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
3941
3950
  }, null, 8, ["book-id", "accounts"])) : createCommentVNode("", true)], 64);
3942
3951
  };
3943
3952
  }
3944
- }), [["__scopeId", "data-v-60e71a73"]]);
3953
+ }), [["__scopeId", "data-v-eb577d9f"]]);
3945
3954
  //#endregion
3946
3955
  //#region src/vue/components/AccountsList.vue?vue&type=script&setup=true&lang.ts
3947
3956
  var _hoisted_1$6 = {
@@ -5001,10 +5010,11 @@ var View_default = /* @__PURE__ */ defineComponent({
5001
5010
  const { version: bookVersion } = useAccountingChannel(activeBookId);
5002
5011
  useAccountingBooksChannel(() => void refetchBooks());
5003
5012
  function pickInitialBookId() {
5004
- if (books.value.length === 0) return null;
5013
+ const [firstBook] = books.value;
5014
+ if (!firstBook) return null;
5005
5015
  const requested = initialPayload.value.bookId;
5006
5016
  if (requested && books.value.some((book) => book.id === requested)) return requested;
5007
- return books.value[0].id;
5017
+ return firstBook.id;
5008
5018
  }
5009
5019
  async function refetchBooks() {
5010
5020
  loadingBooks.value = true;