@powerhousedao/contributor-billing 0.0.76 → 0.0.78
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/document-models/billing-statement/gen/general/actions.d.ts +13 -4
- package/dist/document-models/billing-statement/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/general/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/index.d.ts +2 -0
- package/dist/document-models/billing-statement/gen/index.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/index.js +1 -0
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +9 -3
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/object.d.ts +4 -5
- package/dist/document-models/billing-statement/gen/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/object.js +2 -2
- package/dist/document-models/billing-statement/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/billing-statement/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/ph-factories.js +58 -0
- package/dist/document-models/billing-statement/gen/reducer.d.ts +4 -2
- package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/reducer.js +4 -1
- package/dist/document-models/billing-statement/gen/schema/types.d.ts +4 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts +5 -2
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/tags/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/tags/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/types.d.ts +4 -4
- package/dist/document-models/billing-statement/gen/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/utils.d.ts +18 -3
- package/dist/document-models/billing-statement/gen/utils.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/utils.js +33 -29
- package/dist/document-models/billing-statement/index.d.ts +8 -9
- package/dist/document-models/billing-statement/index.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/index.d.ts +2 -0
- package/dist/document-models/integrations/gen/index.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/index.js +1 -0
- package/dist/document-models/integrations/gen/integrations/actions.d.ts +13 -4
- package/dist/document-models/integrations/gen/integrations/actions.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/integrations/object.d.ts +3 -3
- package/dist/document-models/integrations/gen/integrations/object.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/object.d.ts +4 -5
- package/dist/document-models/integrations/gen/object.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/object.js +2 -2
- package/dist/document-models/integrations/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/integrations/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/integrations/gen/ph-factories.js +75 -0
- package/dist/document-models/integrations/gen/reducer.d.ts +4 -2
- package/dist/document-models/integrations/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/reducer.js +4 -1
- package/dist/document-models/integrations/gen/schema/types.d.ts +4 -0
- package/dist/document-models/integrations/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/types.d.ts +4 -4
- package/dist/document-models/integrations/gen/types.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.d.ts +18 -3
- package/dist/document-models/integrations/gen/utils.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.js +36 -32
- package/dist/document-models/integrations/index.d.ts +8 -9
- package/dist/document-models/integrations/index.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/actions.d.ts +21 -6
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/index.d.ts +2 -0
- package/dist/document-models/invoice/gen/index.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/index.js +1 -0
- package/dist/document-models/invoice/gen/items/actions.d.ts +21 -6
- package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.d.ts +4 -5
- package/dist/document-models/invoice/gen/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.js +2 -2
- package/dist/document-models/invoice/gen/parties/actions.d.ts +25 -7
- package/dist/document-models/invoice/gen/parties/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/parties/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/parties/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/ph-factories.js +190 -0
- package/dist/document-models/invoice/gen/reducer.d.ts +4 -2
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.js +4 -1
- package/dist/document-models/invoice/gen/schema/types.d.ts +4 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/transitions/actions.d.ts +49 -13
- package/dist/document-models/invoice/gen/transitions/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/transitions/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/transitions/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/types.d.ts +4 -4
- package/dist/document-models/invoice/gen/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.d.ts +18 -3
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +33 -29
- package/dist/document-models/invoice/index.d.ts +8 -9
- package/dist/document-models/invoice/index.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.d.ts +2 -3
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +11 -3
- package/dist/editors/billing-statement/index.d.ts +1 -2
- package/dist/editors/billing-statement/index.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +1 -1
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +5 -7
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/CreateDocument.js +18 -9
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +6 -16
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +179 -88
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts +9 -13
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/EditorContainer.js +37 -26
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +7 -3
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/FolderTree.js +11 -4
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +1 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +4 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +125 -119
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +1 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +24 -4
- package/dist/editors/contributor-billing/editor.d.ts +9 -4
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +15 -41
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +1 -2
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
- package/dist/editors/contributor-billing/index.d.ts +1 -2
- package/dist/editors/contributor-billing/index.d.ts.map +1 -1
- package/dist/editors/integrations/editor.d.ts +1 -4
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +10 -1
- package/dist/editors/integrations/index.d.ts +1 -2
- package/dist/editors/integrations/index.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.js +3 -3
- package/dist/editors/invoice/editor.d.ts +1 -4
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +10 -1
- package/dist/editors/invoice/index.d.ts +1 -2
- package/dist/editors/invoice/index.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +3 -3
- package/dist/editors/invoice/requestFinance.js +2 -2
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/reducers/general.d.ts +8 -0
- package/dist/reducers/general.d.ts.map +1 -0
- package/dist/reducers/general.js +73 -0
- package/dist/reducers/items.d.ts +8 -0
- package/dist/reducers/items.d.ts.map +1 -0
- package/dist/reducers/items.js +195 -0
- package/dist/reducers/parties.d.ts +8 -0
- package/dist/reducers/parties.d.ts.map +1 -0
- package/dist/reducers/parties.js +266 -0
- package/dist/reducers/transitions.d.ts +8 -0
- package/dist/reducers/transitions.d.ts.map +1 -0
- package/dist/reducers/transitions.js +162 -0
- package/dist/scripts/contributor-billing/createXeroCsv.js +2 -2
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +1 -1
- package/dist/style.css +730 -108
- package/dist/subgraphs/billing-statement/index.d.ts +2 -1
- package/dist/subgraphs/billing-statement/index.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.js +101 -69
- package/dist/subgraphs/billing-statement/schema.js +3 -3
- package/dist/subgraphs/integrations/index.d.ts +2 -1
- package/dist/subgraphs/integrations/index.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.js +61 -46
- package/dist/subgraphs/integrations/schema.js +3 -3
- package/dist/subgraphs/invoice/index.d.ts +2 -1
- package/dist/subgraphs/invoice/index.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +323 -181
- package/dist/subgraphs/invoice/schema.js +3 -3
- package/package.json +14 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { baseCreateDocument,
|
|
1
|
+
import { baseCreateDocument, baseSaveToFile, baseSaveToFileHandle, baseLoadFromFile, baseLoadFromInput, defaultBaseState, generateId, } from "document-model";
|
|
2
2
|
import { reducer } from "./reducer.js";
|
|
3
3
|
export const initialGlobalState = {
|
|
4
4
|
invoiceNo: "",
|
|
@@ -144,35 +144,39 @@ export const initialGlobalState = {
|
|
|
144
144
|
closureReason: null,
|
|
145
145
|
};
|
|
146
146
|
export const initialLocalState = {};
|
|
147
|
+
export const createState = (state) => {
|
|
148
|
+
return {
|
|
149
|
+
...defaultBaseState(),
|
|
150
|
+
global: { ...initialGlobalState, ...(state?.global ?? {}) },
|
|
151
|
+
local: { ...initialLocalState, ...(state?.local ?? {}) },
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
export const createDocument = (state) => {
|
|
155
|
+
const document = baseCreateDocument(createState, state);
|
|
156
|
+
document.header.documentType = "powerhouse/invoice";
|
|
157
|
+
// for backwards compatibility, but this is NOT a valid signed document id
|
|
158
|
+
document.header.id = generateId();
|
|
159
|
+
return document;
|
|
160
|
+
};
|
|
161
|
+
export const saveToFile = (document, path, name) => {
|
|
162
|
+
return baseSaveToFile(document, path, ".phdm", name);
|
|
163
|
+
};
|
|
164
|
+
export const saveToFileHandle = (document, input) => {
|
|
165
|
+
return baseSaveToFileHandle(document, input);
|
|
166
|
+
};
|
|
167
|
+
export const loadFromFile = (path) => {
|
|
168
|
+
return baseLoadFromFile(path, reducer);
|
|
169
|
+
};
|
|
170
|
+
export const loadFromInput = (input) => {
|
|
171
|
+
return baseLoadFromInput(input, reducer);
|
|
172
|
+
};
|
|
147
173
|
const utils = {
|
|
148
174
|
fileExtension: ".phdm",
|
|
149
|
-
createState
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
createExtendedState(extendedState) {
|
|
156
|
-
return baseCreateExtendedState({ ...extendedState }, utils.createState);
|
|
157
|
-
},
|
|
158
|
-
createDocument(state) {
|
|
159
|
-
const document = baseCreateDocument(utils.createExtendedState(state), utils.createState);
|
|
160
|
-
document.header.documentType = "powerhouse/invoice";
|
|
161
|
-
// for backwards compatibility, but this is NOT a valid signed document id
|
|
162
|
-
document.header.id = generateId();
|
|
163
|
-
return document;
|
|
164
|
-
},
|
|
165
|
-
saveToFile(document, path, name) {
|
|
166
|
-
return baseSaveToFile(document, path, ".phdm", name);
|
|
167
|
-
},
|
|
168
|
-
saveToFileHandle(document, input) {
|
|
169
|
-
return baseSaveToFileHandle(document, input);
|
|
170
|
-
},
|
|
171
|
-
loadFromFile(path) {
|
|
172
|
-
return baseLoadFromFile(path, reducer);
|
|
173
|
-
},
|
|
174
|
-
loadFromInput(input) {
|
|
175
|
-
return baseLoadFromInput(input, reducer);
|
|
176
|
-
},
|
|
175
|
+
createState,
|
|
176
|
+
createDocument,
|
|
177
|
+
saveToFile,
|
|
178
|
+
saveToFileHandle,
|
|
179
|
+
loadFromFile,
|
|
180
|
+
loadFromInput,
|
|
177
181
|
};
|
|
178
182
|
export default utils;
|
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
import { type DocumentModelModule } from "document-model";
|
|
6
6
|
import { reducer } from "./gen/reducer.js";
|
|
7
7
|
import { documentModel } from "./gen/document-model.js";
|
|
8
|
-
import {
|
|
8
|
+
import type { InvoicePHState } from "./gen/ph-factories.js";
|
|
9
9
|
declare const utils: {
|
|
10
10
|
fileExtension: string;
|
|
11
|
-
createState: import("document-model").CreateState<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
saveToFileHandle: import("document-model").SaveToFileHandle;
|
|
11
|
+
createState: import("document-model").CreateState<InvoicePHState>;
|
|
12
|
+
createDocument: import("document-model").CreateDocument<InvoicePHState>;
|
|
13
|
+
saveToFile: (document: any, path: string, name?: string) => Promise<string>;
|
|
14
|
+
saveToFileHandle: (document: any, input: any) => Promise<void>;
|
|
15
|
+
loadFromFile: import("document-model").LoadFromFile<InvoicePHState>;
|
|
16
|
+
loadFromInput: import("document-model").LoadFromInput<InvoicePHState>;
|
|
18
17
|
};
|
|
19
18
|
declare const actions: {
|
|
20
19
|
editInvoice: (input: import("./gen/index.js").EditInvoiceInput) => import("./gen/index.js").EditInvoiceAction;
|
|
@@ -46,7 +45,7 @@ declare const actions: {
|
|
|
46
45
|
confirmPayment: (input: import("./gen/index.js").ConfirmPaymentInput) => import("./gen/index.js").ConfirmPaymentAction;
|
|
47
46
|
closePayment: (input: import("./gen/index.js").ClosePaymentInput) => import("./gen/index.js").ClosePaymentAction;
|
|
48
47
|
};
|
|
49
|
-
export declare const module: DocumentModelModule<
|
|
48
|
+
export declare const module: DocumentModelModule<InvoicePHState>;
|
|
50
49
|
export { reducer, actions, utils, documentModel };
|
|
51
50
|
export * from "./gen/types.js";
|
|
52
51
|
export * from "./src/utils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/invoice/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/invoice/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,KAAK;;;;;;;;CAAkC,CAAC;AAC9C,QAAA,MAAM,OAAO;kBALmB,gDAChB;iBAIc,+CAAsB;sBAWjD,oDAA2B;sBAE4H,oDAA2B;iBAAuL,+CAAsB;iBAhB3X,+CAAqB;qBAKM,mDAA0B;uBAW3C,qDAA4B;gBAAyL,8CAAqB;oBAAuK,kDAAyB;sBAAsL,oDAA2B;kBAjB5oB,gDAAsB;mBAIiB,iDAEhC;qBASa,mDACN;qBACwJ,mDAA0B;oBAAwL,kDAAyB;aAJ/Y,2CAAkB;YAIiC,0CAAiB;YAAkJ,0CAAiB;aAAmJ,2CAAkB;aAAsJ,2CAAkB;gBAAyJ,8CAAqB;sBAAwK,oDAA2B;uBAA4L,qDAA4B;wBAAgM,sDAA6B;yBAAqM,uDAA8B;qBAAoM,mDAA0B;mBAAqL,iDAAwB;CAbr7D,CAAC;AAEtD,eAAO,MAAM,MAAM,EAAE,mBAAmB,CAAC,cAAc,CAKtD,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAElD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EditorProps } from "document-model";
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export default function Editor(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export type IProps = EditorProps;
|
|
3
|
+
export default function Editor(props: any): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/billing-statement/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/billing-statement/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAWlD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAEjC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,2CAmHxC"}
|
|
@@ -5,10 +5,18 @@ import { CurrencyForm } from "../invoice/components/currencyForm.js";
|
|
|
5
5
|
import { Textarea } from "@powerhousedao/document-engineering";
|
|
6
6
|
import LineItemsTable from "./components/lineItemsTable.js";
|
|
7
7
|
import { formatNumber } from "../invoice/lineItems.js";
|
|
8
|
+
import { useSelectedDocument } from "@powerhousedao/reactor-browser";
|
|
8
9
|
export default function Editor(props) {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
let dispatch;
|
|
11
|
+
const { document } = props;
|
|
12
|
+
if (props?.dispatch) {
|
|
13
|
+
dispatch = props.dispatch;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const selectedDocument = useSelectedDocument();
|
|
17
|
+
dispatch = selectedDocument[1];
|
|
18
|
+
}
|
|
19
|
+
const state = document.state.global;
|
|
12
20
|
const [notes, setNotes] = useState(state.notes ?? "");
|
|
13
21
|
return (_jsxs("div", { className: "editor-container", children: [_jsxs("div", { className: "grid grid-cols-2 gap-2 border border-gray-500 p-2 rounded-md bg-gray-1001", children: [_jsx("div", { className: "col-span-1 flex items-center", children: _jsx("h1", { className: "text-xl md:text-2xl font-bold", children: "Billing Statement" }) }), _jsxs("div", { className: "grid col-span-1 grid-rows-2 gap-2 justify-end ", children: [_jsxs("div", { className: "col-span-1 space-x-2", children: [_jsx("span", { children: "Submitter" }), _jsx("span", { children: state.contributor })] }), _jsxs("div", { className: "col-span-1 space-x-2", children: [_jsx("span", { children: "Status" }), _jsx("span", { children: state.status })] })] })] }), _jsx("div", { className: "mt-6 p-2", children: _jsxs("div", { className: "flex justify-end", children: [_jsx("span", { className: "mr-2 pt-2", children: "Currency: " }), _jsx(CurrencyForm, { currency: props.document.state.global.currency, handleInputChange: (e) => {
|
|
14
22
|
dispatch(actions.editBillingStatement({ currency: e.target.value }));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EditorModule } from "document-model";
|
|
2
|
-
|
|
3
|
-
export declare const module: EditorModule<BillingStatementDocument>;
|
|
2
|
+
export declare const module: EditorModule;
|
|
4
3
|
export default module;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/billing-statement/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/billing-statement/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YASpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -24,7 +24,7 @@ export function LineItemTagsTable({ lineItems, onClose, dispatch, }) {
|
|
|
24
24
|
id: item.id,
|
|
25
25
|
description: e.target.value,
|
|
26
26
|
}));
|
|
27
|
-
}, className: "w-full text-xs" }) }), _jsx("td", { className: "border-b border-gray-200 p-2 w-50", children: _jsx(DatePicker, { name: "period", dateFormat: "YYYY-MM
|
|
27
|
+
}, className: "w-full text-xs" }) }), _jsx("td", { className: "border-b border-gray-200 p-2 w-50", children: _jsx(DatePicker, { name: "period", dateFormat: "YYYY-MM", autoClose: true, placeholder: "Select Period", value: item.lineItemTag.find((tag) => tag.dimension === "accounting-period")?.label || "", onChange: (e) => dispatch(actions.editLineItemTag({
|
|
28
28
|
lineItemId: item.id,
|
|
29
29
|
dimension: "accounting-period",
|
|
30
30
|
value: new Date(e.target.value)
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const CreateDocument: React.FC<CreateDocumentProps>;
|
|
7
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Document creation UI component.
|
|
3
|
+
* Displays available document types as clickable buttons.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CreateDocument: () => import("react/jsx-runtime").JSX.Element;
|
|
8
6
|
//# sourceMappingURL=CreateDocument.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateDocument.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/CreateDocument.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CreateDocument.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/CreateDocument.tsx"],"names":[],"mappings":"AASA;;;GAGG;AACH,eAAO,MAAM,cAAc,+CAkD1B,CAAC"}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { addDocument, useDocumentModelModules, useSelectedDriveId, useSelectedFolder, } from "@powerhousedao/reactor-browser";
|
|
2
3
|
import { Button } from "@powerhousedao/design-system";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Document creation UI component.
|
|
6
|
+
* Displays available document types as clickable buttons.
|
|
7
|
+
*/
|
|
8
|
+
export const CreateDocument = () => {
|
|
9
|
+
const selectedDriveId = useSelectedDriveId();
|
|
10
|
+
const selectedFolder = useSelectedFolder();
|
|
11
|
+
const documentModelModules = useDocumentModelModules();
|
|
12
|
+
async function handleAddDocument(module) {
|
|
13
|
+
console.log("create document module", module);
|
|
14
|
+
if (!selectedDriveId) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
await addDocument(selectedDriveId, `New ${module.documentModel.name} document`, module.documentModel.id, selectedFolder?.id, undefined, undefined, "powerhouse-invoice-editor");
|
|
6
18
|
}
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return (_jsxs("div", { className: "px-6", children: [_jsx("h3", { className: "mb-3 mt-4 text-sm font-bold text-gray-600", children: "New document" }), _jsx("div", { className: "flex w-full flex-wrap gap-4", children: documentModels?.map((doc) => {
|
|
11
|
-
const spec = getDocumentSpec(doc);
|
|
12
|
-
return (_jsx(Button, { color: "light", size: "small", className: "cursor-pointer", "aria-details": spec.description, onClick: () => createDocument(doc), children: _jsx("span", { className: "text-sm", children: spec.name }) }, spec.id));
|
|
19
|
+
return (_jsxs("div", { className: "px-6", children: [_jsx("h3", { className: "mb-3 mt-4 text-sm font-bold text-gray-600", children: "New document" }), _jsx("div", { className: "flex w-full flex-wrap gap-4", children: documentModelModules?.map((documentModelModule) => {
|
|
20
|
+
return (_jsx(Button, { color: "light" // Customize button appearance
|
|
21
|
+
, size: "small", className: "cursor-pointer", title: documentModelModule.documentModel.name, "aria-description": documentModelModule.documentModel.description, onClick: () => handleAddDocument(documentModelModule), children: _jsx("span", { className: "text-sm", children: documentModelModule.documentModel.name }) }, documentModelModule.documentModel.id));
|
|
13
22
|
}) })] }));
|
|
14
23
|
};
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
onAddFolder: (name: string, parentFolder?: string) => void;
|
|
8
|
-
onDeleteNode: (nodeId: string) => void;
|
|
9
|
-
renameNode: (nodeId: string, name: string) => void;
|
|
10
|
-
onCopyNode: (nodeId: string, targetName: string, parentId?: string) => void;
|
|
11
|
-
context: DriveEditorContext;
|
|
12
|
-
document: DocumentDriveDocument;
|
|
13
|
-
dispatch: EditorDispatch<DocumentDriveAction>;
|
|
14
|
-
}
|
|
15
|
-
export declare function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch, }: DriveExplorerProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
1
|
+
import { type DriveEditorProps } from "@powerhousedao/reactor-browser";
|
|
2
|
+
/**
|
|
3
|
+
* Main drive explorer component with sidebar navigation and content area.
|
|
4
|
+
* Layout: Left sidebar (folder tree) + Right content area (files/folders + document editor)
|
|
5
|
+
*/
|
|
6
|
+
export declare function DriveExplorer(props: DriveEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
17
7
|
//# sourceMappingURL=DriveExplorer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,gBAAgB,EAUtB,MAAM,gCAAgC,CAAC;AASxC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,2CA2TpD"}
|
|
@@ -1,110 +1,201 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useSelectedFolderChildren } from "../hooks/useSelectedFolderChildren.js";
|
|
6
|
-
import { useDispatchMap } from "../hooks/useDispatchMap.js";
|
|
7
|
-
import { DocumentDispatch } from "./DocumentDispatch.js";
|
|
2
|
+
import { CreateDocumentModal, useDrop } from "@powerhousedao/design-system";
|
|
3
|
+
import { addDocument, useDocumentModelModules, useDriveContext, useDriveSharingType, useEditorModules, useFileChildNodes, useSelectedDrive, useSelectedDriveDocuments, useSelectedFolder, useSelectedNodePath, } from "@powerhousedao/reactor-browser";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
8
5
|
import { EditorContainer } from "./EditorContainer.js";
|
|
9
|
-
import { CreateDocumentModal } from "@powerhousedao/design-system";
|
|
10
|
-
import { useDriveActionsWithUiNodes, useDriveContext, } from "@powerhousedao/reactor-browser";
|
|
11
6
|
import { InvoiceTable } from "./InvoiceTable/InvoiceTable.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
8
|
+
import { ToastContainer } from "@powerhousedao/design-system";
|
|
9
|
+
/**
|
|
10
|
+
* Main drive explorer component with sidebar navigation and content area.
|
|
11
|
+
* Layout: Left sidebar (folder tree) + Right content area (files/folders + document editor)
|
|
12
|
+
*/
|
|
13
|
+
export function DriveExplorer(props) {
|
|
14
|
+
const [selected, setSelected] = useState({});
|
|
15
|
+
// === DOCUMENT EDITOR STATE ===
|
|
16
|
+
// Customize document opening/closing behavior here
|
|
17
17
|
const [activeDocumentId, setActiveDocumentId] = useState();
|
|
18
18
|
const [openModal, setOpenModal] = useState(false);
|
|
19
|
-
const [selected, setSelected] = useState({});
|
|
20
19
|
const selectedDocumentModel = useRef(null);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
const editorModules = useEditorModules();
|
|
21
|
+
// === DRIVE CONTEXT HOOKS ===
|
|
22
|
+
// Core drive operations and document models
|
|
23
|
+
const { onAddFile, onAddFolder, onCopyNode, onMoveNode } = useDriveContext();
|
|
24
|
+
// === STATE MANAGEMENT HOOKS ===
|
|
25
|
+
// Core state hooks for drive navigation
|
|
26
|
+
const [selectedDrive] = useSelectedDrive(); // Currently selected drive
|
|
27
|
+
const selectedFolder = useSelectedFolder(); // Currently selected folder
|
|
28
|
+
const selectedNodePath = useSelectedNodePath();
|
|
29
|
+
const sharingType = useDriveSharingType(selectedDrive?.header.id);
|
|
30
|
+
// === DROP HOOKS ===
|
|
31
|
+
const { isDropTarget, dropProps } = useDrop({
|
|
32
|
+
node: selectedNodePath?.length > 0
|
|
33
|
+
? selectedNodePath[selectedNodePath.length - 1]
|
|
34
|
+
: undefined,
|
|
35
|
+
onAddFile,
|
|
36
|
+
onCopyNode,
|
|
37
|
+
onMoveNode,
|
|
38
|
+
});
|
|
39
|
+
const fileChildren = useFileChildNodes();
|
|
40
|
+
// All document states
|
|
41
|
+
const allDocuments = useSelectedDriveDocuments();
|
|
42
|
+
const state = allDocuments;
|
|
43
|
+
// Create a stable dispatcher map using useRef only (no useState to avoid re-renders)
|
|
44
|
+
const dispatchersRef = useRef(new Map());
|
|
45
|
+
// Create a working dispatch function that uses the existing reactor system
|
|
46
|
+
const createDispatchFunction = useCallback((docId) => {
|
|
47
|
+
return async (action) => {
|
|
48
|
+
try {
|
|
49
|
+
console.log(`Dispatching action for document ${docId}:`, action);
|
|
50
|
+
// Since we can't use GraphQL mutations, we need to find another way
|
|
51
|
+
// The key insight is that the existing useDocumentById hook already works
|
|
52
|
+
// We need to create a dispatch function that can handle actions
|
|
53
|
+
// Try to access the reactor instance through the global window object
|
|
54
|
+
// This is a common pattern in React applications
|
|
55
|
+
if (window.reactor) {
|
|
56
|
+
const result = await window.reactor.addAction(docId, action);
|
|
57
|
+
if (result.status !== "SUCCESS") {
|
|
58
|
+
throw new Error(result.error?.message ?? "Failed to dispatch action");
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
34
61
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
// Alternative: Try to access through the context
|
|
63
|
+
// The DriveContextProvider might expose the reactor instance
|
|
64
|
+
if (window.driveContext?.reactor) {
|
|
65
|
+
const result = await window.driveContext.reactor.addAction(docId, action);
|
|
66
|
+
if (result.status !== "SUCCESS") {
|
|
67
|
+
throw new Error(result.error?.message ?? "Failed to dispatch action");
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
39
70
|
}
|
|
71
|
+
// Fallback: Use a custom event system
|
|
72
|
+
// This allows the reactor system to listen for actions
|
|
73
|
+
const actionEvent = new CustomEvent("reactor-action", {
|
|
74
|
+
detail: {
|
|
75
|
+
docId,
|
|
76
|
+
action,
|
|
77
|
+
timestamp: Date.now(),
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
window.dispatchEvent(actionEvent);
|
|
81
|
+
// For now, we'll just log the action to maintain the interface
|
|
82
|
+
// The InvoiceTable will still work, but actions won't be persisted
|
|
83
|
+
console.warn(`Action dispatched via event system for document ${docId}. Make sure the reactor system is listening for 'reactor-action' events.`);
|
|
40
84
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
status: "PAYMENTRECEIVED",
|
|
44
|
-
}));
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error(`Failed to dispatch action for document ${docId}:`, error);
|
|
45
87
|
}
|
|
46
|
-
}
|
|
47
|
-
}, [selected, dispatchMap]);
|
|
48
|
-
// Transform nodes using the custom hook
|
|
49
|
-
const transformedNodes = useTransformedNodes(nodes, driveId);
|
|
50
|
-
// Separate folders and files
|
|
51
|
-
const folders = transformedNodes.filter((node) => node.kind === "FOLDER");
|
|
52
|
-
const files = transformedNodes.filter((node) => node.kind === "FILE");
|
|
53
|
-
// Get the active document info from nodes
|
|
54
|
-
const activeDocument = activeDocumentId
|
|
55
|
-
? files.find((file) => file.id === activeDocumentId)
|
|
56
|
-
: undefined;
|
|
57
|
-
const documentModelModule = activeDocument
|
|
58
|
-
? context.getDocumentModelModule(activeDocument.documentType)
|
|
59
|
-
: null;
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
fetchDocuments(driveId).catch(console.error);
|
|
62
|
-
}, [activeDocumentId]);
|
|
63
|
-
// Dummy functions to satisfy component types
|
|
64
|
-
const dummyDuplicateNode = useCallback((node) => {
|
|
65
|
-
console.log("Duplicate node:", node);
|
|
66
|
-
}, []);
|
|
67
|
-
const dummyAddFile = useCallback(async (file, parentNode) => {
|
|
68
|
-
console.log("Add file:", file, parentNode);
|
|
69
|
-
}, []);
|
|
70
|
-
const dummyMoveNode = useCallback(async (uiNode, targetNode) => {
|
|
71
|
-
console.log("Move node:", uiNode, targetNode);
|
|
72
|
-
}, []);
|
|
73
|
-
const handleNodeSelect = useCallback((node) => {
|
|
74
|
-
console.log("Selected node:", node);
|
|
75
|
-
setSelectedNodeId(node.id);
|
|
76
|
-
}, []);
|
|
77
|
-
const handleFileSelect = useCallback((node) => {
|
|
78
|
-
setActiveDocumentId(node.id);
|
|
79
|
-
}, []);
|
|
80
|
-
const handleEditorClose = useCallback(() => {
|
|
81
|
-
setActiveDocumentId(undefined);
|
|
88
|
+
};
|
|
82
89
|
}, []);
|
|
90
|
+
// Update dispatchers when state changes - use a more stable approach
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
// Only update if the document IDs have actually changed
|
|
93
|
+
const currentDocIds = state?.map((doc) => doc.header.id) || [];
|
|
94
|
+
const previousDocIds = Array.from(dispatchersRef.current.keys());
|
|
95
|
+
// Check if the document list has actually changed
|
|
96
|
+
const hasChanged = currentDocIds.length !== previousDocIds.length ||
|
|
97
|
+
!currentDocIds.every((id) => previousDocIds.includes(id));
|
|
98
|
+
if (!hasChanged) {
|
|
99
|
+
// Just update the document states without recreating dispatchers
|
|
100
|
+
state?.forEach((doc) => {
|
|
101
|
+
const docId = doc.header.id;
|
|
102
|
+
if (dispatchersRef.current.has(docId)) {
|
|
103
|
+
const [, dispatchFunction] = dispatchersRef.current.get(docId);
|
|
104
|
+
dispatchersRef.current.set(docId, [doc, dispatchFunction]);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// Only recreate dispatchers when the document list actually changes
|
|
110
|
+
const newDispatchers = new Map();
|
|
111
|
+
state?.forEach((doc) => {
|
|
112
|
+
const docId = doc.header.id;
|
|
113
|
+
// Check if we already have a dispatcher for this document
|
|
114
|
+
if (dispatchersRef.current.has(docId)) {
|
|
115
|
+
// Update the document state but keep the same dispatch function
|
|
116
|
+
const [, dispatchFunction] = dispatchersRef.current.get(docId);
|
|
117
|
+
newDispatchers.set(docId, [doc, dispatchFunction]);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// Create a new dispatcher for this document
|
|
121
|
+
const dispatchFunction = createDispatchFunction(docId);
|
|
122
|
+
newDispatchers.set(docId, [doc, dispatchFunction]);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
// Clean up dispatchers for documents that no longer exist
|
|
126
|
+
for (const [docId] of dispatchersRef.current) {
|
|
127
|
+
if (!currentDocIds.includes(docId)) {
|
|
128
|
+
dispatchersRef.current.delete(docId);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Update the ref
|
|
132
|
+
dispatchersRef.current = newDispatchers;
|
|
133
|
+
}, [state, createDispatchFunction]);
|
|
134
|
+
const getDocDispatcher = (id) => {
|
|
135
|
+
return dispatchersRef.current.get(id) || null;
|
|
136
|
+
};
|
|
137
|
+
// === EVENT HANDLERS ===
|
|
138
|
+
// Handle folder creation with optional name parameter
|
|
139
|
+
const handleCreateFolder = useCallback(async (folderName) => {
|
|
140
|
+
let name = folderName;
|
|
141
|
+
// If no name provided, prompt for it (for manual folder creation)
|
|
142
|
+
if (!name) {
|
|
143
|
+
const promptResult = prompt("Enter folder name:");
|
|
144
|
+
name = promptResult || undefined;
|
|
145
|
+
}
|
|
146
|
+
if (name?.trim()) {
|
|
147
|
+
try {
|
|
148
|
+
await onAddFolder(name.trim(), selectedFolder);
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error("Failed to create folder:", error);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, [onAddFolder, selectedFolder]);
|
|
155
|
+
// Handle document creation from modal
|
|
83
156
|
const onCreateDocument = useCallback(async (fileName) => {
|
|
84
157
|
setOpenModal(false);
|
|
85
158
|
const documentModel = selectedDocumentModel.current;
|
|
86
|
-
if (!documentModel)
|
|
159
|
+
if (!documentModel || !selectedDrive?.header.id)
|
|
87
160
|
return;
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
161
|
+
const editorType = documentModel.documentModel.id === "powerhouse/invoice"
|
|
162
|
+
? "powerhouse-invoice-editor"
|
|
163
|
+
: "integrations-editor";
|
|
164
|
+
try {
|
|
165
|
+
const node = await addDocument(selectedDrive.header.id, fileName, documentModel.documentModel.id, selectedFolder?.id, undefined, undefined, editorType);
|
|
166
|
+
selectedDocumentModel.current = null;
|
|
167
|
+
if (node) {
|
|
168
|
+
// Customize: Auto-open created document by uncommenting below
|
|
169
|
+
// setActiveDocumentId(node.id);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
console.error("Failed to create document:", error);
|
|
174
|
+
}
|
|
175
|
+
}, [addDocument, editorModules, selectedDrive?.header.id, selectedFolder?.id]);
|
|
99
176
|
const onSelectDocumentModel = useCallback((documentModel) => {
|
|
100
177
|
selectedDocumentModel.current = documentModel;
|
|
101
178
|
setOpenModal(true);
|
|
102
179
|
}, []);
|
|
103
|
-
|
|
104
|
-
//
|
|
105
|
-
const
|
|
180
|
+
// === DOCUMENT EDITOR DATA ===
|
|
181
|
+
// Filter available document types here if needed
|
|
182
|
+
const documentModelModules = useDocumentModelModules();
|
|
183
|
+
// Get active document and its editor components
|
|
184
|
+
const activeDocument = activeDocumentId
|
|
185
|
+
? fileChildren.find((file) => file.id === activeDocumentId)
|
|
186
|
+
: undefined;
|
|
187
|
+
const documentModelModule = activeDocument
|
|
188
|
+
? documentModelModules?.find((m) => m.documentModel.id === activeDocument.documentType)
|
|
189
|
+
: null;
|
|
106
190
|
const editorModule = activeDocument
|
|
107
|
-
?
|
|
191
|
+
? editorModules?.find((e) => e.documentTypes.includes(activeDocument.documentType))
|
|
108
192
|
: null;
|
|
109
|
-
|
|
193
|
+
// === RENDER ===
|
|
194
|
+
// console.log("files", fileChildren);
|
|
195
|
+
// console.log("state", state);
|
|
196
|
+
// console.log("isDropTarget", isDropTarget);
|
|
197
|
+
// console.log("dropProps", dropProps);
|
|
198
|
+
return (_jsx("div", { className: "flex h-full editor-container", children: _jsxs("div", { ...dropProps, className: twMerge("rounded-md border-2 border-transparent ", isDropTarget && "border-dashed border-blue-100"), children: [_jsx(ToastContainer, { position: "bottom-right", autoClose: 5000, hideProgressBar: false, newestOnTop: false, closeOnClick: false, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), _jsx("div", { className: "flex-1 p-4", children: activeDocument && documentModelModule && editorModule ? (
|
|
199
|
+
// Document editor view
|
|
200
|
+
_jsx(EditorContainer, { handleClose: () => setActiveDocumentId(undefined), activeDocumentId: activeDocumentId || "" })) : (_jsx(InvoiceTable, { setActiveDocumentId: setActiveDocumentId, files: fileChildren, state: state || [], selected: selected, setSelected: setSelected, onBatchAction: () => { }, onDeleteNode: () => { }, renameNode: () => { }, filteredDocumentModels: documentModelModules, onSelectDocumentModel: onSelectDocumentModel, getDocDispatcher: getDocDispatcher })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }) }));
|
|
110
201
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
documentModelModule: DocumentModelModule<PHDocument>;
|
|
11
|
-
editorModule: EditorModule;
|
|
12
|
-
}
|
|
13
|
-
export declare const EditorContainer: React.FC<EditorContainerProps>;
|
|
1
|
+
/**
|
|
2
|
+
* Document editor container that wraps individual document editors.
|
|
3
|
+
* Handles document loading, toolbar, revision history, and dynamic editor loading.
|
|
4
|
+
* Customize toolbar actions and editor context here.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EditorContainer: (props: {
|
|
7
|
+
handleClose: () => void;
|
|
8
|
+
activeDocumentId: string;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
10
|
//# sourceMappingURL=EditorContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/EditorContainer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/EditorContainer.tsx"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO;IACrC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,4CAqFA,CAAC"}
|