@dropins/storefront-requisition-list 0.4.0-beta → 0.5.0-beta
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/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart.d.ts +1 -1
- package/api/deleteRequisitionList/deleteRequisitionList.d.ts +5 -1
- package/api/fragments/RequisitionListItemsFragment.graphql.d.ts +1 -1
- package/api/fragments.d.ts +16 -0
- package/api.js +2 -2
- package/api.js.map +1 -1
- package/chunks/PageSizePicker2.js +4 -0
- package/chunks/PageSizePicker2.js.map +1 -0
- package/chunks/RequisitionListForm.js +3 -3
- package/chunks/RequisitionListForm.js.map +1 -1
- package/chunks/RequisitionListItemsFragment.graphql.js +0 -20
- package/chunks/RequisitionListItemsFragment.graphql.js.map +1 -1
- package/chunks/{deleteRequisitionListItems.js → addRequisitionListItemsToCart.js} +39 -25
- package/chunks/addRequisitionListItemsToCart.js.map +1 -0
- package/chunks/deleteRequisitionList.js +3 -3
- package/chunks/deleteRequisitionList.js.map +1 -1
- package/chunks/getRequisitionLists.js +3 -3
- package/chunks/getRequisitionLists.js.map +1 -1
- package/chunks/transform-requisition-list.js.map +1 -1
- package/components/BatchActions/BatchActions.d.ts +16 -0
- package/components/BatchActions/index.d.ts +19 -0
- package/components/PageSizePicker/PageSizePicker.d.ts +10 -0
- package/components/ProductListTable/ProductListTable.d.ts +18 -0
- package/components/ProductListTable/__fixtures__/RequisitionListModel.d.ts +50 -0
- package/components/ProductListTable/index.d.ts +19 -0
- package/components/RequisitionListGridWrapper/RequisitionListGridWrapper.d.ts +6 -1
- package/components/index.d.ts +3 -1
- package/containers/RequisitionListForm.js +1 -1
- package/containers/RequisitionListGrid.js +1 -1
- package/containers/RequisitionListGrid.js.map +1 -1
- package/containers/RequisitionListNames/RequisitionListNames.d.ts +2 -0
- package/containers/RequisitionListNames.js +4 -4
- package/containers/RequisitionListNames.js.map +1 -1
- package/containers/RequisitionListView/RequisitionListView.d.ts +3 -1
- package/containers/RequisitionListView.js +1 -1
- package/containers/RequisitionListView.js.map +1 -1
- package/data/transforms/transform-product.d.ts +1 -1
- package/hooks/index.d.ts +3 -1
- package/hooks/useRequisitionListAlert.d.ts +27 -0
- package/hooks/useRequisitionListForm.d.ts +6 -4
- package/hooks/useRequisitionListGrid.d.ts +5 -1
- package/hooks/useRequisitionListSelectedItems.d.ts +14 -0
- package/i18n/en_US.json.d.ts +42 -13
- package/package.json +1 -1
- package/render.js +3 -4
- package/render.js.map +1 -1
- package/chunks/deleteRequisitionListItems.js.map +0 -1
- package/components/RequisitionListView/RequisitionListView.d.ts +0 -29
- package/components/RequisitionListView/index.d.ts +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/graphql/deleteRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/deleteRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_MUTATION = `\n mutation DELETE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n ) {\n deleteRequisitionList(\n requisitionListUid: $requisitionListUid\n ) {\n status\n requisition_lists {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { DELETE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/deleteRequisitionList/graphql/deleteRequisitionList';\n\nexport const deleteRequisitionList = async (\n requisitionListUid: string\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n },\n }).then(({ errors, data }) => {\n if (!requisitionListUid) return null;\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionList?.requisition_lists) {\n return null;\n }\n\n
|
|
1
|
+
{"version":3,"file":"deleteRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/graphql/deleteRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/deleteRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_MUTATION = `\n mutation DELETE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n ) {\n deleteRequisitionList(\n requisitionListUid: $requisitionListUid\n ) {\n status\n requisition_lists {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { DELETE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/deleteRequisitionList/graphql/deleteRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionList = async (\n requisitionListUid: string\n): Promise<{\n items: RequisitionList[];\n page_info: any;\n status: any;\n} | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n },\n }).then(({ errors, data }) => {\n if (!requisitionListUid) return null;\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionList?.requisition_lists) {\n return null;\n }\n\n const reqLists =\n data.deleteRequisitionList.requisition_lists?.items?.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n ) || [];\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.deleteRequisitionList?.requisition_lists?.page_info,\n status: data.deleteRequisitionList?.status,\n };\n });\n};\n"],"names":["DELETE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","deleteRequisitionList","requisitionListUid","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","_c","_b","requisitionList","transformRequisitionList","events","_e","_d","_f"],"mappings":"8HAkBO,MAAMA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqB9CC,CAAyB;AAAA,ECfdC,EAAwB,MACnCC,GAMOC,EAAaJ,EAAkC,CACpD,UAAW,CACT,mBAAAG,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,iBACxB,GAAA,CAACH,EAA2B,OAAA,KAC5B,GAAAE,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,mBACzB,OAAA,KAGT,MAAMC,IACJC,GAAAC,EAAAL,EAAK,sBAAsB,oBAA3B,YAAAK,EAA8C,QAA9C,YAAAD,EAAqD,IAClDE,GAAyBC,EAAyBD,CAAe,KAC/D,CAAC,EAED,OAAAE,EAAA,KAAK,wBAAyBL,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWM,GAAAC,EAAAV,EAAK,wBAAL,YAAAU,EAA4B,oBAA5B,YAAAD,EAA+C,UAC1D,QAAQE,EAAAX,EAAK,wBAAL,YAAAW,EAA4B,MACtC,CAAA,CACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{R as
|
|
3
|
+
import{R as I,f as a,h as c,t as g}from"./transform-requisition-list.js";import{events as m}from"@dropins/tools/event-bus.js";const p=`
|
|
4
4
|
query GET_REQUISITION_LISTS_QUERY(
|
|
5
5
|
$currentPage: Int = 1
|
|
6
6
|
$pageSize: Int = 10,
|
|
@@ -19,6 +19,6 @@ import{R as _,f as I,h as a,t as c}from"./transform-requisition-list.js";const g
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
${
|
|
23
|
-
`,
|
|
22
|
+
${I}
|
|
23
|
+
`,l=async(o,u)=>a(p,{variables:{currentPage:o,pageSize:u}}).then(({errors:t,data:e})=>{var s,r,n;if(t)return c(t);if(!((s=e==null?void 0:e.customer)!=null&&s.requisition_lists))return null;const i=e.customer.requisition_lists.items.map(_=>g(_));return m.emit("requisitionLists/data",i),{items:i,page_info:(n=(r=e.customer)==null?void 0:r.requisition_lists)==null?void 0:n.page_info}});export{l as g};
|
|
24
24
|
//# sourceMappingURL=getRequisitionLists.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRequisitionLists.js","sources":["/@dropins/storefront-requisition-list/src/api/getRequisitionLists/graphql/getRequisitionLists.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionLists/getRequisitionLists.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const GET_REQUISITION_LISTS_QUERY = `\n query GET_REQUISITION_LISTS_QUERY(\n $currentPage: Int = 1\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists(pageSize: $pageSize, currentPage: $currentPage) {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_REQUISITION_LISTS_QUERY } from '@/requisitionList/api/getRequisitionLists/graphql/getRequisitionLists';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport const getRequisitionLists = async (\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(GET_REQUISITION_LISTS_QUERY, {\n variables: {\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n
|
|
1
|
+
{"version":3,"file":"getRequisitionLists.js","sources":["/@dropins/storefront-requisition-list/src/api/getRequisitionLists/graphql/getRequisitionLists.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionLists/getRequisitionLists.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const GET_REQUISITION_LISTS_QUERY = `\n query GET_REQUISITION_LISTS_QUERY(\n $currentPage: Int = 1\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists(pageSize: $pageSize, currentPage: $currentPage) {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_REQUISITION_LISTS_QUERY } from '@/requisitionList/api/getRequisitionLists/graphql/getRequisitionLists';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionLists = async (\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(GET_REQUISITION_LISTS_QUERY, {\n variables: {\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n const reqLists = data.customer.requisition_lists.items.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n );\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.customer?.requisition_lists?.page_info,\n };\n });\n};\n"],"names":["GET_REQUISITION_LISTS_QUERY","REQUISITION_LIST_FRAGMENT","getRequisitionLists","currentPage","pageSize","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","requisitionList","transformRequisitionList","events","_c","_b"],"mappings":"8HAkBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzCC,CAAyB;AAAA,ECbdC,EAAsB,MACjCC,EACAC,IAEOC,EAAaL,EAA6B,CAC/C,UAAW,CACT,YAAAG,EACA,SAAAC,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,WACxB,GAAAD,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,WAAN,MAAAE,EAAgB,mBACZ,OAAA,KAGT,MAAMC,EAAWH,EAAK,SAAS,kBAAkB,MAAM,IACpDI,GAAyBC,EAAyBD,CAAe,CACpE,EAEO,OAAAE,EAAA,KAAK,wBAAyBH,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWI,GAAAC,EAAAR,EAAK,WAAL,YAAAQ,EAAe,oBAAf,YAAAD,EAAkC,SAC/C,CAAA,CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-requisition-list.js","sources":["/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_FRAGMENT = `\nfragment REQUISITION_LIST_FRAGMENT on RequisitionList {\n uid\n name\n description\n items_count\n updated_at\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { RequisitionList } from '../models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\n\n// Interface for raw API response data for a requisition list\nexport interface RawRequisitionListData {\n name: string;\n description: string;\n uid: string;\n updated_at: string;\n items_count: number;\n items: {\n items: RawItemData[];\n page_info: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n };\n}\n\nexport function transformRequisitionList(\n data: RawRequisitionListData\n): RequisitionList | null {\n return {\n uid: data.uid,\n name: data.name,\n description: data.description,\n updated_at: data.updated_at,\n items_count: data.items_count,\n items: transformItems(data.items?.items),\n page_info: data.items?.page_info,\n };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n product: {\n sku: string;\n };\n quantity: number;\n customizable_options?: {\n customizable_option_uid: string;\n is_required: boolean;\n label: string;\n sort_order: number;\n type: string;\n values: {\n customizable_option_value_uid: string;\n label: string;\n price: { type: string; units: string; value: number };\n value: string;\n }[];\n }[];\n bundle_options?: {\n uid: string;\n label: string;\n type: string;\n values: {\n uid: string;\n label: string;\n original_price: { value: number; currency: string };\n priceV2: { value: number; currency: string };\n quantity: number;\n }[];\n }[];\n configurable_options?: {\n configurable_product_option_uid: string;\n option_label: string;\n configurable_product_option_value_uid: string;\n value_label: string;\n }[];\n links?: {\n uid: string;\n price?: number;\n sample_url?: string;\n sort_order?: number;\n title?: string;\n }[];\n samples?: {\n sample_url?: string;\n sort_order?: number;\n title?: string;\n }[];\n gift_card_options?: {\n amount?: {\n value?: number;\n currency?: string;\n };\n custom_giftcard_amount?: {\n value?: number;\n currency?: string;\n };\n message?: string;\n recipient_email?: string;\n recipient_name?: string;\n sender_name?: string;\n sender_email?: string;\n };\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n return {\n uid: item.uid,\n sku: item.product.sku,\n quantity: item.quantity,\n customizable_options: item.customizable_options\n ? item.customizable_options.map((option) => ({\n uid: option.customizable_option_uid,\n is_required: option.is_required,\n label: option.label,\n sort_order: option.sort_order,\n type: option.type,\n values: option.values.map((value) => ({\n uid: value.customizable_option_value_uid,\n label: value.label,\n price: value.price,\n value: value.value,\n })),\n }))\n : [],\n bundle_options: item.bundle_options || [],\n configurable_options: item.configurable_options\n ? item.configurable_options.map((option) => ({\n option_uid: option.configurable_product_option_uid,\n option_label: option.option_label,\n value_uid: option.configurable_product_option_value_uid,\n value_label: option.value_label,\n }))\n : [],\n samples: item.samples\n ? item.samples.map((sample) => ({\n url: sample.sample_url,\n sort_order: sample.sort_order,\n title: sample.title,\n }))\n : [],\n gift_card_options: item.gift_card_options || {},\n };\n });\n}\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleFetchError","errors","errorMessage","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","items","item","option","value","sample"],"mappings":"+
|
|
1
|
+
{"version":3,"file":"transform-requisition-list.js","sources":["/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_FRAGMENT = `\nfragment REQUISITION_LIST_FRAGMENT on RequisitionList {\n uid\n name\n description\n items_count\n updated_at\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { RequisitionList } from '../models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\n\n// Interface for raw API response data for a requisition list\nexport interface RawRequisitionListData {\n name: string;\n description: string;\n uid: string;\n updated_at: string;\n items_count: number;\n items: {\n items: RawItemData[];\n page_info: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n };\n}\n\nexport function transformRequisitionList(\n data: RawRequisitionListData\n): RequisitionList | null {\n return {\n uid: data.uid,\n name: data.name,\n description: data.description,\n updated_at: data.updated_at,\n items_count: data.items_count,\n items: transformItems(data.items?.items),\n page_info: data.items?.page_info,\n };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n product: {\n sku: string;\n };\n quantity: number;\n customizable_options?: {\n customizable_option_uid: string;\n is_required: boolean;\n label: string;\n sort_order: number;\n type: string;\n values: {\n customizable_option_value_uid: string;\n label: string;\n price: { type: string; units: string; value: number };\n value: string;\n }[];\n }[];\n bundle_options?: {\n uid: string;\n label: string;\n type: string;\n values: {\n uid: string;\n label: string;\n original_price: { value: number; currency: string };\n priceV2: { value: number; currency: string };\n quantity: number;\n }[];\n }[];\n configurable_options?: {\n configurable_product_option_uid: string;\n option_label: string;\n configurable_product_option_value_uid: string;\n value_label: string;\n }[];\n links?: {\n uid: string;\n price?: number;\n sample_url?: string;\n sort_order?: number;\n title?: string;\n }[];\n samples?: {\n sample_url?: string;\n sort_order?: number;\n title?: string;\n }[];\n gift_card_options?: {\n amount?: {\n value?: number;\n currency?: string;\n };\n custom_giftcard_amount?: {\n value?: number;\n currency?: string;\n };\n message?: string;\n recipient_email?: string;\n recipient_name?: string;\n sender_name?: string;\n sender_email?: string;\n };\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n return {\n uid: item.uid,\n sku: item.product.sku,\n quantity: item.quantity,\n customizable_options: item.customizable_options\n ? item.customizable_options.map((option) => ({\n uid: option.customizable_option_uid,\n is_required: option.is_required,\n label: option.label,\n sort_order: option.sort_order,\n type: option.type,\n values: option.values.map((value) => ({\n uid: value.customizable_option_value_uid,\n label: value.label,\n price: value.price,\n value: value.value,\n })),\n }))\n : [],\n bundle_options: item.bundle_options || [],\n configurable_options: item.configurable_options\n ? item.configurable_options.map((option) => ({\n option_uid: option.configurable_product_option_uid,\n option_label: option.option_label,\n value_uid: option.configurable_product_option_value_uid,\n value_label: option.value_label,\n }))\n : [],\n samples: item.samples\n ? item.samples.map((sample) => ({\n url: sample.sample_url,\n sort_order: sample.sort_order,\n title: sample.title,\n }))\n : [],\n gift_card_options: item.gift_card_options || {},\n };\n });\n}\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleFetchError","errors","errorMessage","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","items","item","option","value","sample"],"mappings":"+DAmBa,KAAA,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAa,EAAE,WAAW,ECRrBC,EAAoBC,GAAuC,CAChE,MAAAC,EAAeD,EAAO,IAAK,GAAW,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMC,CAAY,CAC1B,ECLaC,EAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECmBlC,SAASC,EACdC,EACwB,SACjB,MAAA,CACL,IAAKA,EAAK,IACV,KAAMA,EAAK,KACX,YAAaA,EAAK,YAClB,WAAYA,EAAK,WACjB,YAAaA,EAAK,YAClB,MAAOC,GAAeC,EAAAF,EAAK,QAAL,YAAAE,EAAY,KAAK,EACvC,WAAWC,EAAAH,EAAK,QAAL,YAAAG,EAAY,SACzB,CACF,CAqEA,SAASF,EAAeG,EAA8B,CACpD,OAAKA,GAAA,MAAAA,EAAO,OAELA,EAAM,IAAKC,IACT,CACL,IAAKA,EAAK,IACV,IAAKA,EAAK,QAAQ,IAClB,SAAUA,EAAK,SACf,qBAAsBA,EAAK,qBACvBA,EAAK,qBAAqB,IAAKC,IAAY,CACzC,IAAKA,EAAO,wBACZ,YAAaA,EAAO,YACpB,MAAOA,EAAO,MACd,WAAYA,EAAO,WACnB,KAAMA,EAAO,KACb,OAAQA,EAAO,OAAO,IAAKC,IAAW,CACpC,IAAKA,EAAM,8BACX,MAAOA,EAAM,MACb,MAAOA,EAAM,MACb,MAAOA,EAAM,KAAA,EACb,CACJ,EAAE,EACF,CAAC,EACL,eAAgBF,EAAK,gBAAkB,CAAC,EACxC,qBAAsBA,EAAK,qBACvBA,EAAK,qBAAqB,IAAKC,IAAY,CACzC,WAAYA,EAAO,gCACnB,aAAcA,EAAO,aACrB,UAAWA,EAAO,sCAClB,YAAaA,EAAO,WACtB,EAAE,EACF,CAAC,EACL,QAASD,EAAK,QACVA,EAAK,QAAQ,IAAKG,IAAY,CAC5B,IAAKA,EAAO,WACZ,WAAYA,EAAO,WACnB,MAAOA,EAAO,KAChB,EAAE,EACF,CAAC,EACL,kBAAmBH,EAAK,mBAAqB,CAAA,CAC/C,EACD,EAxC0B,CAAC,CAyC9B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface BatchActionsProps extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {
|
|
5
|
+
selectedItems: Set<string>;
|
|
6
|
+
deletingItemId: string | null;
|
|
7
|
+
addingToCartItemId: string | null;
|
|
8
|
+
bulkAddingToCart: boolean;
|
|
9
|
+
updatingQuantityItemId: string | null;
|
|
10
|
+
onSelectAll: () => void;
|
|
11
|
+
onSelectNone: () => void;
|
|
12
|
+
onBulkAddToCart: () => void;
|
|
13
|
+
onBulkDelete: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const BatchActions: FunctionComponent<BatchActionsProps>;
|
|
16
|
+
//# sourceMappingURL=BatchActions.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './BatchActions';
|
|
18
|
+
export { BatchActions as default } from './BatchActions';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
+
|
|
3
|
+
export interface PageSizePickerProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
currentPageSize: number;
|
|
5
|
+
onPageSizeChange: (pageSize: number) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
pageSizeOptions?: number[];
|
|
8
|
+
}
|
|
9
|
+
export declare const PageSizePicker: ({ currentPageSize, onPageSizeChange, disabled, pageSizeOptions, }: PageSizePickerProps) => import("preact/compat").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=PageSizePicker.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import { RequisitionListModel } from '../../data/models/requisitionList';
|
|
4
|
+
|
|
5
|
+
export interface ProductListTableProps extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {
|
|
6
|
+
className?: string;
|
|
7
|
+
items: RequisitionListModel['items'];
|
|
8
|
+
selectedItems: Set<string>;
|
|
9
|
+
currentPage: number;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
canEdit?: boolean;
|
|
12
|
+
handleItemSelection: (itemUid: string, isSelected: boolean) => void;
|
|
13
|
+
handleUpdateQuantity: (itemUid: string, newQuantity: number) => void;
|
|
14
|
+
onAddToCart: (itemUids: string[] | undefined) => void;
|
|
15
|
+
onDeleteItem: (itemUids: string[] | undefined) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const ProductListTable: FunctionComponent<ProductListTableProps>;
|
|
18
|
+
//# sourceMappingURL=ProductListTable.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const RequisitionListModel: {
|
|
2
|
+
description: string;
|
|
3
|
+
items: ({
|
|
4
|
+
bundle_options: {
|
|
5
|
+
label: string;
|
|
6
|
+
type: string;
|
|
7
|
+
uid: string;
|
|
8
|
+
values: {
|
|
9
|
+
label: string;
|
|
10
|
+
original_price: {
|
|
11
|
+
currency: string;
|
|
12
|
+
value: number;
|
|
13
|
+
};
|
|
14
|
+
priceV2: {
|
|
15
|
+
currency: string;
|
|
16
|
+
value: number;
|
|
17
|
+
};
|
|
18
|
+
quantity: number;
|
|
19
|
+
uid: string;
|
|
20
|
+
}[];
|
|
21
|
+
}[];
|
|
22
|
+
configurable_options: never[];
|
|
23
|
+
customizable_options: never[];
|
|
24
|
+
gift_card_options: {};
|
|
25
|
+
quantity: number;
|
|
26
|
+
samples: never[];
|
|
27
|
+
sku: string;
|
|
28
|
+
uid: string;
|
|
29
|
+
} | {
|
|
30
|
+
bundle_options: never[];
|
|
31
|
+
configurable_options: {
|
|
32
|
+
option_label: string;
|
|
33
|
+
option_uid: string;
|
|
34
|
+
value_label: string;
|
|
35
|
+
value_uid: string;
|
|
36
|
+
}[];
|
|
37
|
+
customizable_options: never[];
|
|
38
|
+
gift_card_options: {};
|
|
39
|
+
quantity: number;
|
|
40
|
+
samples: never[];
|
|
41
|
+
sku: string;
|
|
42
|
+
uid: string;
|
|
43
|
+
})[];
|
|
44
|
+
items_count: number;
|
|
45
|
+
name: string;
|
|
46
|
+
page_info: undefined;
|
|
47
|
+
uid: string;
|
|
48
|
+
updated_at: string;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=RequisitionListModel.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './ProductListTable';
|
|
18
|
+
export { ProductListTable as default } from './ProductListTable';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,7 +4,6 @@ import { FunctionComponent, VNode } from 'preact';
|
|
|
4
4
|
export interface RequisitionListGridWrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
className?: string;
|
|
6
6
|
isLoading?: boolean;
|
|
7
|
-
addReqList?: boolean;
|
|
8
7
|
header?: VNode;
|
|
9
8
|
rows: Array<Record<string, VNode | string | number | undefined>>;
|
|
10
9
|
expandedRows: Set<number>;
|
|
@@ -12,8 +11,14 @@ export interface RequisitionListGridWrapperProps extends HTMLAttributes<HTMLDivE
|
|
|
12
11
|
pageInfo?: {
|
|
13
12
|
total_pages: number;
|
|
14
13
|
current_page: number;
|
|
14
|
+
page_size: number;
|
|
15
15
|
};
|
|
16
16
|
handlePageChange: (page?: number) => Promise<void>;
|
|
17
|
+
handlePageSizeChange?: (pageSize: number) => Promise<void>;
|
|
18
|
+
defaultPageSize?: number;
|
|
19
|
+
isAdding: boolean;
|
|
20
|
+
handleAddNew: () => void;
|
|
21
|
+
handleCancelCreate: () => void;
|
|
17
22
|
}
|
|
18
23
|
export declare const RequisitionListGridWrapper: FunctionComponent<RequisitionListGridWrapperProps>;
|
|
19
24
|
//# sourceMappingURL=RequisitionListGridWrapper.d.ts.map
|
package/components/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export * from './RequisitionListForm/RequisitionListForm';
|
|
|
18
18
|
export * from './RequisitionListGridWrapper/RequisitionListGridWrapper';
|
|
19
19
|
export * from './RequisitionListActions/RequisitionListActions';
|
|
20
20
|
export * from './RequisitionListModal/RequisitionListModal';
|
|
21
|
-
export * from './RequisitionListView/RequisitionListView';
|
|
22
21
|
export * from './EmptyList/EmptyList';
|
|
22
|
+
export * from './ProductListTable/ProductListTable';
|
|
23
|
+
export * from './BatchActions/BatchActions';
|
|
24
|
+
export * from './PageSizePicker/PageSizePicker';
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{R,R as
|
|
3
|
+
import{R as u,R as d}from"../chunks/RequisitionListForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/i18n.js";import"../chunks/transform-requisition-list.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/event-bus.js";export{u as RequisitionListForm,d as default};
|
|
4
4
|
//# sourceMappingURL=RequisitionListForm.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as u,jsx as i,Fragment as x}from"@dropins/tools/preact-jsx-runtime.js";import*as g from"@dropins/tools/preact-compat.js";import{useState as Z,useCallback as v,useEffect as D,useMemo as E}from"@dropins/tools/preact-compat.js";import{Card as B,Table as z,Pagination as F,Icon as V,Modal as O,ProgressSpinner as U,Button as b,Header as G}from"@dropins/tools/components.js";import{classes as w,VComponent as j,Slot as J}from"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";import{R as T}from"../chunks/RequisitionListForm.js";/* empty css *//* empty css */import{useText as H}from"@dropins/tools/i18n.js";import{g as k}from"../chunks/getRequisitionLists.js";import{d as K}from"../chunks/deleteRequisitionList.js";import"../chunks/transform-requisition-list.js";import"@dropins/tools/fetch-graphql.js";const Q=({className:n,isLoading:s=!1,addReqList:a=!1,header:r,rows:e=[],expandedRows:p,skeletonRowCount:l=10,pageInfo:o,handlePageChange:f,...C})=>{const L=H({name:"RequisitionList.RequisitionListWrapper.name",itemsCount:"RequisitionList.RequisitionListWrapper.itemsCount",lastUpdated:"RequisitionList.RequisitionListWrapper.lastUpdated",actions:"RequisitionList.RequisitionListWrapper.actions",emptyList:"RequisitionList.RequisitionListWrapper.emptyList"}),[h,d]=Z(a),c=((o==null?void 0:o.total_pages)??0)>0,R=!s&&e.length===0&&!c;return u("div",{...C,className:w(["requisition-list-grid-wrapper",n]),"data-testid":"requisition-list-grid-wrapper",children:[r&&i("div",{className:w(["requisition-list-grid-wrapper__header",n]),"data-testid":"requisition-list-grid-wrapper-header",children:i(j,{node:r})}),i("div",{className:w(["requisition-list-grid-wrapper__add-new",n]),children:h?i(B,{variant:"secondary",children:i(T,{mode:"create",onSuccess:async()=>{await f(),d(!1)},onCancel:()=>d(!1)})}):i($,{onAddNew:()=>d(!0)})}),R?i(i1,{textContent:L.emptyList}):u(x,{children:[i(z,{columns:[{key:"name",label:L.name},{key:"items_count",label:L.itemsCount},{key:"last_updated",label:L.lastUpdated},{key:"actions",label:L.actions}],rowData:e,expandedRows:p,loading:s,skeletonRowCount:l}),i("div",{className:w(["requisition-list-grid-wrapper__pagination",n]),children:i(F,{totalPages:o==null?void 0:o.total_pages,currentPage:o==null?void 0:o.current_page,onChange:f})})]})]})},X=n=>g.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...n},g.createElement("g",{id:"Large"},g.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),g.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},g.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),g.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),Y=n=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},g.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"currentColor"})),$=({selectable:n,className:s,onAddNew:a})=>{const r=H({addNewReqListBtn:"RequisitionList.AddNewReqList.addNewReqListBtn"});return u("button",{type:"button","aria-label":r.addNewReqListBtn,role:"button",className:w(["requisition-list-actions",["requisition-list-actions--selectable",n],s]),"data-testid":"requisition-list-actions-button",onClick:a,children:[i("span",{className:"requisition-list-actions__title","data-testid":"requisition-list-actions-button-text",children:r.addNewReqListBtn}),i(V,{source:X,size:"32"})]})},I=({isOpen:n,isLoading:s,title:a,modalContent:r,closeBtnCaption:e,confirmBtnCaption:p,handleModalOnClose:l,handleModalOnConfirm:o})=>n?i(O,{className:"requisition-list-modal--overlay","data-testid":"requisition-list-modal",size:"medium",centered:!1,title:a,onClose:l,backgroundDim:!0,clickToDismiss:!0,escapeToDismiss:!0,children:u("div",{className:"requisition-list-modal",children:[s?i("div",{className:"requisition-list-modal__spinner","data-testid":"progress-spinner",children:i(U,{stroke:"4",size:"large"})}):null,i("p",{children:r}),u("div",{className:"requisition-list-modal__buttons",children:[l&&i(b,{"data-testid":"rl-modal-close-button",type:"button",onClick:l,variant:"secondary",disabled:s,children:e}),o&&i(b,{"data-testid":"rl-modal-confirm-button",type:"button",onClick:o,disabled:s,children:p})]})]})}):null,i1=({className:n,textContent:s,...a})=>u("div",{className:w(["empty-list",n]),"data-testid":"empty-list",...a,children:[i(V,{source:Y,size:"64",stroke:"2"}),s&&i("h4",{children:s})]});function e1(n,s,a){const r=H({actionRemove:"RequisitionList.RequisitionListItem.actionRemove",actionRename:"RequisitionList.RequisitionListItem.actionRename"}),[e,p]=Z(n),[l,o]=Z(null),[f,C]=Z(!1),L=v(t=>o(t),[]),h=v(()=>o(null),[]),d=v(async(t=(_=>(_=e==null?void 0:e.page_info)==null?void 0:_.current_page)()??1)=>{var y,M,A;C(!0);try{const m=await k(t),N=((y=m==null?void 0:m.page_info)==null?void 0:y.current_page)??1,P=((M=m==null?void 0:m.page_info)==null?void 0:M.total_pages)??0;if(!((((A=m==null?void 0:m.items)==null?void 0:A.length)??0)>0)&&N>1&&P>=N-1){const W=N-1,S=await k(W);p(S)}else p(m)}finally{C(!1)}},[e]);D(()=>{e||d(1)},[e,d]);const c=v(t=>d(t),[d]),R=E(()=>((e==null?void 0:e.items)??[]).map(t=>{const _=l===t.uid;return{name:u("div",{className:"requisition-list-grid-wrapper__name",children:[i("div",{className:"requisition-list-grid-wrapper__name__title",children:i("a",{href:"#",onClick:y=>{if(y.preventDefault(),a){const M=a(t.uid);typeof M=="string"&&(window.location.href=M)}},children:t.name})}),t.description&&i("div",{className:"requisition-list-grid-wrapper__name__description",children:t.description})]}),items_count:t.items_count,last_updated:new Date(t.updated_at).toLocaleString(),actions:u("div",{className:"requisition-list-grid-wrapper__actions",children:[i(b,{variant:"tertiary",type:"button","data-testid":"rename-button",onClick:()=>L(t.uid),children:r.actionRename}),i(b,{variant:"tertiary",type:"button","data-testid":"remove-button",onClick:()=>s==null?void 0:s.openRemove(t),children:r.actionRemove})]}),_rowDetails:_?i(B,{variant:"secondary",className:"requisition-list-grid-wrapper__form-row",children:i(T,{mode:"edit",requisitionListUid:t.uid,defaultValues:{name:t.name,description:t.description},onSuccess:async()=>{await c(),o(null)},onCancel:h})}):void 0}}),[e==null?void 0:e.items,l,L,h,r.actionRename,r.actionRemove,s,c,a]),q=E(()=>new Set(R.map((t,_)=>t._rowDetails?_:-1).filter(t=>t>=0)),[R]);return{rows:R,expandedRows:q,isLoading:f||!e,pageInfo:e==null?void 0:e.page_info,handlePageChange:c}}const R1=({requisitionLists:n,routeRequisitionListDetails:s,slots:a})=>{const[r,e]=Z({isOpen:!1,isLoading:!1,rl:null}),p=q=>e({isOpen:!0,isLoading:!1,rl:q}),l=()=>e({isOpen:!1,isLoading:!1,rl:null}),o=async()=>{r.rl&&(e(q=>({...q,isLoading:!0})),await K(r.rl.uid),await d(),l())},{rows:f,expandedRows:C,isLoading:L,pageInfo:h,handlePageChange:d}=e1(n,{openRemove:p},s),c=H({containerTitle:"RequisitionList.containerTitle",confirmRemove:"RequisitionList.RequisitionListWrapper.confirmRemove",confirmRemoveContent:"RequisitionList.RequisitionListWrapper.confirmRemoveContent",cancelAction:"RequisitionList.RequisitionListWrapper.cancelAction",confirmAction:"RequisitionList.RequisitionListWrapper.confirmAction"}),R=v(()=>a!=null&&a.Header?i(J,{name:"Header","aria-label":c.containerTitle,title:c.containerTitle,slot:a.Header}):i(G,{"aria-label":c.containerTitle,role:"region",title:c.containerTitle}),[a,c.containerTitle]);return u(x,{children:[i(Q,{header:R(),rows:f,expandedRows:C,skeletonRowCount:10,isLoading:L,pageInfo:h,handlePageChange:d}),r.isOpen&&i(I,{isOpen:!0,isLoading:r.isLoading,title:c.confirmRemove,modalContent:c.confirmRemoveContent,confirmBtnCaption:c.confirmAction,closeBtnCaption:c.cancelAction,handleModalOnClose:l,handleModalOnConfirm:o})]})};export{R1 as RequisitionListGrid,R1 as default};
|
|
3
|
+
import{jsx as i,jsxs as g,Fragment as U}from"@dropins/tools/preact-jsx-runtime.js";import*as v from"@dropins/tools/preact-compat.js";import{useState as P,useCallback as h,useEffect as H,useMemo as W}from"@dropins/tools/preact-compat.js";import{Card as F,Button as E,Header as Q,InLineAlert as X,Table as Y,Pagination as Z,Icon as $,Modal as I,ProgressSpinner as ii}from"@dropins/tools/components.js";import{Slot as ei,classes as x,VComponent as ti}from"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{R as G}from"../chunks/RequisitionListForm.js";import{u as ni,E as si,P as ai}from"../chunks/PageSizePicker2.js";import{events as _}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";/* empty css */import{useText as T}from"@dropins/tools/i18n.js";import{d as oi}from"../chunks/deleteRequisitionList.js";import{g as O}from"../chunks/getRequisitionLists.js";import"../chunks/transform-requisition-list.js";import"@dropins/tools/fetch-graphql.js";function ri(l,r,s){const a=T({actionDelete:"RequisitionList.RequisitionListItem.actionDelete",actionUpdate:"RequisitionList.RequisitionListItem.actionUpdate"}),[e,q]=P(l),[n,d]=P(null),[C,f]=P(!1),[b,R]=P(!1),L=h(t=>{d(t),f(!1)},[]),w=h(()=>d(null),[]),m=h(()=>{f(!0),d(null)},[]),A=h(()=>f(!1),[]),c=h(async(t=(S=>(S=e==null?void 0:e.page_info)==null?void 0:S.current_page)()??1,y=(k=>(k=e==null?void 0:e.page_info)==null?void 0:k.page_size)()??10)=>{var z,B,M;R(!0);try{const p=await O(t,y),D=((z=p==null?void 0:p.page_info)==null?void 0:z.current_page)??1,V=((B=p==null?void 0:p.page_info)==null?void 0:B.total_pages)??0;if(!((((M=p==null?void 0:p.items)==null?void 0:M.length)??0)>0)&&D>1&&V>=D-1){const J=D-1,K=await O(J,y);q(K)}else q(p)}finally{R(!1)}},[e]);H(()=>{e||c(1)},[e,c]);const o=h(t=>c(t),[c]),N=h(async t=>{await c(1,t)},[c]),u=W(()=>((e==null?void 0:e.items)??[]).map(t=>{const y=n===t.uid;return{name:g("div",{className:"requisition-list-grid-wrapper__name",children:[i("div",{className:"requisition-list-grid-wrapper__name__title",children:i("a",{href:"#",onClick:S=>{if(S.preventDefault(),s){const k=s(t.uid);typeof k=="string"&&(window.location.href=k)}},children:t.name})}),t.description&&i("div",{className:"requisition-list-grid-wrapper__name__description",children:t.description})]}),items_count:t.items_count,last_updated:new Date(t.updated_at).toLocaleString(),actions:g("div",{className:"requisition-list-grid-wrapper__actions",children:[i(E,{variant:"tertiary",type:"button","data-testid":"update-button",onClick:()=>L(t.uid),children:a.actionUpdate}),i(E,{variant:"tertiary",type:"button","data-testid":"delete-button",onClick:()=>r==null?void 0:r.handleOpenModal(t),children:a.actionDelete})]}),_rowDetails:y?i(F,{variant:"secondary",className:"requisition-list-grid-wrapper__form-row",children:i(G,{mode:"update",requisitionListUid:t.uid,defaultValues:{name:t.name,description:t.description},onSuccess:async()=>{await o(),_.emit("requisitionList/alert",{action:"update",type:"success",context:"requisitionList"}),d(null)},onError:()=>{_.emit("requisitionList/alert",{action:"update",type:"error",context:"requisitionList"})},onCancel:w})}):void 0}}),[e==null?void 0:e.items,n,L,w,a.actionUpdate,a.actionDelete,r,o,s]),j=W(()=>new Set(u.map((t,y)=>t._rowDetails?y:-1).filter(t=>t>=0)),[u]);return{rows:u,expandedRows:j,isLoading:b||!e,pageInfo:e==null?void 0:e.page_info,handlePageChange:o,handlePageSizeChange:N,isAdding:C,handleAddNew:m,handleCancelCreate:A}}const xi=({requisitionLists:l,routeRequisitionListDetails:r,slots:s})=>{const[a,e]=P({isOpen:!1,isLoading:!1,rl:null}),q=u=>e({isOpen:!0,isLoading:!1,rl:u}),n=()=>e({isOpen:!1,isLoading:!1,rl:null}),d=async()=>{a.rl&&(e(u=>({...u,isLoading:!0})),await oi(a.rl.uid).then(async()=>{_.emit("requisitionList/alert",{type:"success",action:"delete",context:"requisitionList"})}).catch(()=>{_.emit("requisitionList/alert",{type:"error",action:"delete",context:"requisitionList"})}).finally(async()=>{await L(),n()}))},{rows:C,expandedRows:f,isLoading:b,pageInfo:R,handlePageChange:L,handlePageSizeChange:w,isAdding:m,handleAddNew:A,handleCancelCreate:c}=ri(l,{handleOpenModal:q},r),o=T({containerTitle:"RequisitionList.containerTitle",deleteRequisitionListTitle:"RequisitionList.RequisitionListWrapper.deleteRequisitionListTitle",deleteRequisitionListMessage:"RequisitionList.RequisitionListWrapper.deleteRequisitionListMessage",cancelAction:"RequisitionList.RequisitionListWrapper.cancelAction",confirmAction:"RequisitionList.RequisitionListWrapper.confirmAction"}),N=h(()=>s!=null&&s.Header?i(ei,{name:"Header","aria-label":o.containerTitle,title:o.containerTitle,slot:s.Header}):i(Q,{"aria-label":o.containerTitle,role:"region",title:o.containerTitle}),[s,o.containerTitle]);return g(U,{children:[i(di,{header:N(),rows:C,expandedRows:f,skeletonRowCount:10,isLoading:b,pageInfo:R,handlePageChange:L,handlePageSizeChange:w,defaultPageSize:10,isAdding:m,handleAddNew:A,handleCancelCreate:c}),a.isOpen&&i(ui,{isOpen:!0,isLoading:a.isLoading,title:o.deleteRequisitionListTitle,modalContent:o.deleteRequisitionListMessage,confirmBtnCaption:o.confirmAction,closeBtnCaption:o.cancelAction,handleModalOnClose:n,handleModalOnConfirm:d})]})},li=l=>v.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...l},v.createElement("g",{id:"Large"},v.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),v.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),di=({className:l,isLoading:r=!1,header:s,rows:a=[],expandedRows:e,skeletonRowCount:q=10,pageInfo:n,handlePageChange:d,handlePageSizeChange:C,defaultPageSize:f=10,isAdding:b,handleAddNew:R,handleCancelCreate:L,...w})=>{const m=T({name:"RequisitionList.RequisitionListWrapper.name",itemsCount:"RequisitionList.RequisitionListWrapper.itemsCount",lastUpdated:"RequisitionList.RequisitionListWrapper.lastUpdated",actions:"RequisitionList.RequisitionListWrapper.actions",emptyList:"RequisitionList.RequisitionListWrapper.emptyList"}),A=((n==null?void 0:n.total_pages)??0)>0,c=!r&&a.length===0&&!A,{alert:o,setAlert:N,handleRequisitionListAlert:u}=ni();return H(()=>{_.on("requisitionList/alert",u)},[u]),g("div",{...w,className:x(["requisition-list-grid-wrapper",l]),"data-testid":"requisition-list-grid-wrapper",children:[s&&i("div",{className:x(["requisition-list-grid-wrapper__header",l]),"data-testid":"requisition-list-grid-wrapper-header",children:i(ti,{node:s})}),o&&i(U,{children:i(X,{heading:o.description,type:o.type,variant:"primary",onDismiss:()=>N(null)})}),c?i(si,{textContent:m.emptyList}):g(U,{children:[i(Y,{columns:[{key:"name",label:m.name},{key:"items_count",label:m.itemsCount},{key:"last_updated",label:m.lastUpdated},{key:"actions",label:m.actions}],rowData:a,expandedRows:e,loading:r,skeletonRowCount:q}),i("div",{className:x(["requisition-list-grid-wrapper__pagination",l]),children:g("div",{className:"requisition-list-grid-wrapper__pagination-controls",children:[i(ai,{currentPageSize:(n==null?void 0:n.page_size)||f,onPageSizeChange:C||(()=>Promise.resolve()),disabled:r}),n&&n.total_pages>1&&i(Z,{totalPages:n.total_pages,currentPage:n.current_page,onChange:d})]})})]}),i("div",{className:x(["requisition-list-grid-wrapper__add-new",l]),children:b?i(F,{variant:"secondary",children:i(G,{mode:"create",onSuccess:async()=>{await d(),L(),_.emit("requisitionList/alert",{type:"success",action:"create",context:"requisitionList"})},onError:()=>{_.emit("requisitionList/alert",{type:"error",action:"create",context:"requisitionList"})},onCancel:L})}):i(ci,{onAddNew:R})})]})},ci=({selectable:l,className:r,onAddNew:s})=>{const a=T({addNewReqListBtn:"RequisitionList.AddNewReqList.addNewReqListBtn"});return g("button",{type:"button","aria-label":a.addNewReqListBtn,role:"button",className:x(["requisition-list-actions",["requisition-list-actions--selectable",l],r]),"data-testid":"requisition-list-actions-button",onClick:s,children:[i("span",{className:"requisition-list-actions__title","data-testid":"requisition-list-actions-button-text",children:a.addNewReqListBtn}),i($,{source:li,size:"32"})]})},ui=({isOpen:l,isLoading:r,title:s,modalContent:a,closeBtnCaption:e,confirmBtnCaption:q,handleModalOnClose:n,handleModalOnConfirm:d})=>l?i(I,{className:"requisition-list-modal--overlay","data-testid":"requisition-list-modal",size:"medium",centered:!1,title:s,onClose:n,backgroundDim:!0,clickToDismiss:!0,escapeToDismiss:!0,role:"dialog","aria-label":s,children:g("div",{className:"requisition-list-modal",children:[r?i("div",{className:"requisition-list-modal__spinner","data-testid":"progress-spinner",children:i(ii,{stroke:"4",size:"large"})}):null,i("p",{children:a}),g("div",{className:"requisition-list-modal__buttons",children:[n&&i(E,{"data-testid":"rl-modal-close-button",type:"button",onClick:n,variant:"secondary",disabled:r,children:e}),d&&i(E,{"data-testid":"rl-modal-confirm-button",type:"button",onClick:d,disabled:r,children:q})]})]})}):null;export{xi as RequisitionListGrid,xi as default};
|
|
4
4
|
//# sourceMappingURL=RequisitionListGrid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequisitionListGrid.js","sources":["/@dropins/storefront-requisition-list/src/components/RequisitionListGridWrapper/RequisitionListGridWrapper.tsx","../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","../../node_modules/@adobe-commerce/elsie/src/icons/EmptyBox.svg","/@dropins/storefront-requisition-list/src/components/RequisitionListActions/RequisitionListActions.tsx","/@dropins/storefront-requisition-list/src/components/RequisitionListModal/RequisitionListModal.tsx","/@dropins/storefront-requisition-list/src/components/EmptyList/EmptyList.tsx","/@dropins/storefront-requisition-list/src/hooks/useRequisitionListGrid.tsx","/@dropins/storefront-requisition-list/src/containers/RequisitionListGrid/RequisitionListGrid.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { HTMLAttributes, useState } from 'preact/compat';\nimport { FunctionComponent, VNode } from 'preact';\nimport { VComponent, classes } from '@adobe-commerce/elsie/lib';\nimport {\n RequisitionListActions,\n EmptyList,\n} from '@/requisitionList/components';\nimport { RequisitionListForm } from '@/requisitionList/containers';\nimport { Pagination, Card, Table } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/requisitionList/components/RequisitionListGridWrapper/RequisitionListGridWrapper.css';\n\nexport interface RequisitionListGridWrapperProps\n extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n isLoading?: boolean;\n addReqList?: boolean;\n header?: VNode;\n rows: Array<Record<string, VNode | string | number | undefined>>;\n expandedRows: Set<number>;\n skeletonRowCount: number;\n pageInfo?: {\n total_pages: number;\n current_page: number;\n };\n handlePageChange: (page?: number) => Promise<void>;\n}\n\nexport const RequisitionListGridWrapper: FunctionComponent<\n RequisitionListGridWrapperProps\n> = ({\n className,\n isLoading = false,\n addReqList = false,\n header,\n rows = [],\n expandedRows,\n skeletonRowCount = 10,\n pageInfo,\n handlePageChange,\n ...props\n}) => {\n const translations = useText({\n name: `RequisitionList.RequisitionListWrapper.name`,\n itemsCount: `RequisitionList.RequisitionListWrapper.itemsCount`,\n lastUpdated: `RequisitionList.RequisitionListWrapper.lastUpdated`,\n actions: `RequisitionList.RequisitionListWrapper.actions`,\n emptyList: `RequisitionList.RequisitionListWrapper.emptyList`,\n });\n\n const [isAdding, setIsAdding] = useState(addReqList);\n\n const hasAnyItems = (pageInfo?.total_pages ?? 0) > 0;\n const showEmptyList = !isLoading && rows.length === 0 && !hasAnyItems;\n\n return (\n <div\n {...props}\n className={classes(['requisition-list-grid-wrapper', className])}\n data-testid=\"requisition-list-grid-wrapper\"\n >\n {/* Requisition List Header */}\n {header && (\n <div\n className={classes([\n 'requisition-list-grid-wrapper__header',\n className,\n ])}\n data-testid=\"requisition-list-grid-wrapper-header\"\n >\n <VComponent node={header} />\n </div>\n )}\n\n {/* Requisition Lists Form */}\n <div\n className={classes([\n 'requisition-list-grid-wrapper__add-new',\n className,\n ])}\n >\n {isAdding ? (\n <Card variant=\"secondary\">\n <RequisitionListForm\n mode=\"create\"\n onSuccess={async () => {\n await handlePageChange();\n setIsAdding(false);\n }}\n onCancel={() => setIsAdding(false)}\n />\n </Card>\n ) : (\n <RequisitionListActions onAddNew={() => setIsAdding(true)} />\n )}\n </div>\n\n {showEmptyList ? (\n <EmptyList textContent={translations.emptyList} />\n ) : (\n <>\n {/* Requisition Lists Table */}\n <Table\n columns={[\n { key: 'name', label: translations.name },\n { key: 'items_count', label: translations.itemsCount },\n { key: 'last_updated', label: translations.lastUpdated },\n { key: 'actions', label: translations.actions },\n ]}\n rowData={rows}\n expandedRows={expandedRows}\n loading={isLoading}\n skeletonRowCount={skeletonRowCount}\n />\n <div\n className={classes([\n 'requisition-list-grid-wrapper__pagination',\n className,\n ])}\n >\n <Pagination\n totalPages={pageInfo?.total_pages}\n currentPage={pageInfo?.current_page}\n onChange={handlePageChange}\n />\n </div>\n </>\n )}\n </div>\n );\n};\n","import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","import * as React from \"react\";\nconst SvgEmptyBox = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z\", fill: \"currentColor\" }));\nexport default SvgEmptyBox;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Add } from '@adobe-commerce/elsie/icons';\nimport { Icon } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/requisitionList/components/RequisitionListActions/RequisitionListActions.css';\n\nexport interface RequisitionListActionsProps {\n className?: string;\n selectable?: boolean;\n onAddNew?: () => void;\n}\n\nexport const RequisitionListActions: FunctionComponent<\n RequisitionListActionsProps\n> = ({ selectable, className, onAddNew }) => {\n const translations = useText({\n addNewReqListBtn: `RequisitionList.AddNewReqList.addNewReqListBtn`,\n });\n\n return (\n <button\n type=\"button\"\n aria-label={translations.addNewReqListBtn}\n role=\"button\"\n className={classes([\n 'requisition-list-actions',\n ['requisition-list-actions--selectable', selectable],\n className,\n ])}\n data-testid=\"requisition-list-actions-button\"\n onClick={onAddNew}\n >\n <span\n className=\"requisition-list-actions__title\"\n data-testid=\"requisition-list-actions-button-text\"\n >\n {translations.addNewReqListBtn}\n </span>\n <Icon source={Add} size=\"32\" />\n </button>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent, VNode } from 'preact';\nimport {\n Modal,\n Button,\n ProgressSpinner,\n} from '@adobe-commerce/elsie/components';\nimport '@/requisitionList/components/RequisitionListModal/RequisitionListModal.css';\n\nexport interface RequisitionListModalProps {\n isOpen: boolean;\n isLoading: boolean;\n title: VNode | string;\n modalContent: VNode | string;\n closeBtnCaption?: string;\n confirmBtnCaption?: string;\n handleModalOnClose?: () => void;\n handleModalOnConfirm?: () => void;\n}\n\nexport const RequisitionListModal: FunctionComponent<\n RequisitionListModalProps\n> = ({\n isOpen,\n isLoading,\n title,\n modalContent,\n closeBtnCaption,\n confirmBtnCaption,\n handleModalOnClose,\n handleModalOnConfirm,\n}) => {\n if (!isOpen) return null;\n\n return (\n <Modal\n className=\"requisition-list-modal--overlay\"\n data-testid=\"requisition-list-modal\"\n size={'medium'}\n centered={false}\n title={title}\n onClose={handleModalOnClose}\n backgroundDim={true}\n clickToDismiss={true}\n escapeToDismiss={true}\n >\n <div className=\"requisition-list-modal\">\n {isLoading ? (\n <div\n className=\"requisition-list-modal__spinner\"\n data-testid=\"progress-spinner\"\n >\n <ProgressSpinner stroke={'4'} size={'large'} />\n </div>\n ) : null}\n <p>{modalContent}</p>\n <div className=\"requisition-list-modal__buttons\">\n {handleModalOnClose && (\n <Button\n data-testid=\"rl-modal-close-button\"\n type={'button'}\n onClick={handleModalOnClose}\n variant=\"secondary\"\n disabled={isLoading}\n >\n {closeBtnCaption}\n </Button>\n )}\n {handleModalOnConfirm && (\n <Button\n data-testid=\"rl-modal-confirm-button\"\n type={'button'}\n onClick={handleModalOnConfirm}\n disabled={isLoading}\n >\n {confirmBtnCaption}\n </Button>\n )}\n </div>\n </div>\n </Modal>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Icon } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { EmptyBox } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/EmptyList/EmptyList.css';\n\nexport interface EmptyListProps {\n className?: string;\n textContent?: string | null;\n}\n\nexport const EmptyList: FunctionComponent<EmptyListProps> = ({\n className,\n textContent,\n ...props\n}) => {\n return (\n <div\n className={classes(['empty-list', className])}\n data-testid=\"empty-list\"\n {...props}\n >\n <Icon source={EmptyBox} size={'64'} stroke={'2'} />\n {textContent && <h4>{textContent}</h4>}\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useMemo, useState, useCallback, useEffect } from 'preact/compat';\nimport { VNode } from 'preact';\nimport { Button, Card } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { RequisitionList as RequisitionListModel } from '@/requisitionList/data/models/requisitionList';\nimport { RequisitionListForm } from '@/requisitionList/containers';\nimport { getRequisitionLists } from '@/requisitionList/api/getRequisitionLists';\nimport { RequisitionLists } from '@/requisitionList/data/models/requisitionLists';\n\ntype Row = Record<string, VNode | string | number | undefined>;\ntype Callbacks = { openRemove: (rl: RequisitionListModel) => void };\n\nexport function useRequisitionListGrid(\n initial?: RequisitionLists | null,\n callbacks?: Callbacks,\n routeRequisitionListDetails?: (uid: string) => string | void\n) {\n const translations = useText({\n actionRemove: 'RequisitionList.RequisitionListItem.actionRemove',\n actionRename: 'RequisitionList.RequisitionListItem.actionRename',\n });\n\n const [reqLists, setReqLists] = useState<RequisitionLists | undefined>(\n initial\n );\n const [editingId, setEditingId] = useState<string | null>(null);\n const [isFetching, setIsFetching] = useState(false);\n const onRename = useCallback((uid: string) => setEditingId(uid), []);\n const onEditCancel = useCallback(() => setEditingId(null), []);\n\n const fetchPage = useCallback(\n async (page = reqLists?.page_info?.current_page ?? 1) => {\n setIsFetching(true);\n try {\n const data = await getRequisitionLists(page);\n const currentPage = data?.page_info?.current_page ?? 1;\n const totalPages = data?.page_info?.total_pages ?? 0;\n const hasRows = (data?.items?.length ?? 0) > 0;\n\n if (!hasRows && currentPage > 1 && totalPages >= currentPage - 1) {\n const prev = currentPage - 1;\n const prevData = await getRequisitionLists(prev);\n setReqLists(prevData);\n } else {\n setReqLists(data);\n }\n } finally {\n setIsFetching(false);\n }\n },\n [reqLists]\n );\n\n useEffect(() => {\n if (!reqLists) void fetchPage(1);\n }, [reqLists, fetchPage]);\n\n const handlePageChange = useCallback(\n (page?: number) => fetchPage(page),\n [fetchPage]\n );\n\n const rows: Row[] = useMemo(\n () =>\n (reqLists?.items ?? []).map((rl: RequisitionListModel) => {\n const isEditing = editingId === rl.uid;\n return {\n name: (\n <div className=\"requisition-list-grid-wrapper__name\">\n <div className=\"requisition-list-grid-wrapper__name__title\">\n <a\n href=\"#\"\n onClick={(e: Event): void => {\n e.preventDefault();\n if (routeRequisitionListDetails) {\n const result = routeRequisitionListDetails(rl.uid);\n if (typeof result === 'string') {\n window.location.href = result;\n }\n }\n }}\n >\n {rl.name}\n </a>\n </div>\n {rl.description && (\n <div className=\"requisition-list-grid-wrapper__name__description\">\n {rl.description}\n </div>\n )}\n </div>\n ),\n items_count: rl.items_count,\n last_updated: new Date(rl.updated_at).toLocaleString(),\n actions: (\n <div className=\"requisition-list-grid-wrapper__actions\">\n <Button\n variant=\"tertiary\"\n type=\"button\"\n data-testid=\"rename-button\"\n onClick={() => onRename(rl.uid)}\n >\n {translations.actionRename}\n </Button>\n <Button\n variant=\"tertiary\"\n type=\"button\"\n data-testid=\"remove-button\"\n onClick={() => callbacks?.openRemove(rl)}\n >\n {translations.actionRemove}\n </Button>\n </div>\n ),\n _rowDetails: isEditing ? (\n <Card\n variant=\"secondary\"\n className=\"requisition-list-grid-wrapper__form-row\"\n >\n <RequisitionListForm\n mode=\"edit\"\n requisitionListUid={rl.uid}\n defaultValues={{ name: rl.name, description: rl.description }}\n onSuccess={async () => {\n await handlePageChange();\n setEditingId(null);\n }}\n onCancel={onEditCancel}\n />\n </Card>\n ) : undefined,\n };\n }),\n [\n reqLists?.items,\n editingId,\n onRename,\n onEditCancel,\n translations.actionRename,\n translations.actionRemove,\n callbacks,\n handlePageChange,\n routeRequisitionListDetails,\n ]\n );\n\n const expandedRows = useMemo(\n () =>\n new Set(\n rows\n .map((row, index) => (row._rowDetails ? index : -1))\n .filter((index) => index >= 0) as number[]\n ),\n [rows]\n );\n\n return {\n rows,\n expandedRows,\n isLoading: isFetching || !reqLists,\n pageInfo: reqLists?.page_info,\n handlePageChange,\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { HTMLAttributes, useState, useCallback } from 'preact/compat';\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { RequisitionLists as RequisitionListsModel } from '@/requisitionList/data/models/requisitionLists';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n RequisitionListGridWrapper,\n RequisitionListModal,\n} from '@/requisitionList/components';\nimport { useRequisitionListGrid } from '@/requisitionList/hooks';\nimport { deleteRequisitionList } from '@/requisitionList/api/deleteRequisitionList/deleteRequisitionList';\n\nexport interface RequisitionListGridProps\n extends HTMLAttributes<HTMLDivElement> {\n requisitionLists?: RequisitionListsModel | null;\n routeRequisitionListDetails?: (uid: string) => string | void;\n slots?: {\n Header?: SlotProps;\n };\n}\n\nexport const RequisitionListGrid: Container<RequisitionListGridProps> = ({\n requisitionLists,\n routeRequisitionListDetails,\n slots,\n}: RequisitionListGridProps) => {\n const [modal, setModal] = useState<{\n isOpen: boolean;\n isLoading: boolean;\n rl: RequisitionListsModel | null;\n }>({\n isOpen: false,\n isLoading: false,\n rl: null,\n });\n\n const openRemove = (rl: RequisitionListsModel) =>\n setModal({ isOpen: true, isLoading: false, rl });\n const closeModal = () =>\n setModal({ isOpen: false, isLoading: false, rl: null });\n\n const confirmRemove = async () => {\n if (!modal.rl) return;\n setModal((m) => ({ ...m, isLoading: true }));\n await deleteRequisitionList(modal.rl.uid);\n await handlePageChange();\n closeModal();\n };\n\n const { rows, expandedRows, isLoading, pageInfo, handlePageChange } =\n useRequisitionListGrid(\n requisitionLists,\n { openRemove },\n routeRequisitionListDetails\n );\n\n const translations = useText({\n containerTitle: `RequisitionList.containerTitle`,\n confirmRemove: 'RequisitionList.RequisitionListWrapper.confirmRemove',\n confirmRemoveContent:\n 'RequisitionList.RequisitionListWrapper.confirmRemoveContent',\n cancelAction: 'RequisitionList.RequisitionListWrapper.cancelAction',\n confirmAction: 'RequisitionList.RequisitionListWrapper.confirmAction',\n });\n\n const getHeader = useCallback(() => {\n if (slots?.Header) {\n return (\n <Slot\n name=\"Header\"\n aria-label={translations.containerTitle}\n title={translations.containerTitle}\n slot={slots.Header}\n />\n );\n }\n return (\n <Header\n aria-label={translations.containerTitle}\n role=\"region\"\n title={translations.containerTitle}\n />\n );\n }, [slots, translations.containerTitle]);\n\n return (\n <>\n <RequisitionListGridWrapper\n header={getHeader()}\n rows={rows}\n expandedRows={expandedRows}\n skeletonRowCount={10}\n isLoading={isLoading}\n pageInfo={pageInfo}\n handlePageChange={handlePageChange}\n />\n {modal.isOpen && (\n <RequisitionListModal\n isOpen\n isLoading={modal.isLoading}\n title={translations.confirmRemove}\n modalContent={translations.confirmRemoveContent}\n confirmBtnCaption={translations.confirmAction}\n closeBtnCaption={translations.cancelAction}\n handleModalOnClose={closeModal}\n handleModalOnConfirm={confirmRemove}\n />\n )}\n </>\n );\n};\n"],"names":["RequisitionListGridWrapper","className","isLoading","addReqList","header","rows","expandedRows","skeletonRowCount","pageInfo","handlePageChange","props","translations","useText","isAdding","setIsAdding","useState","hasAnyItems","showEmptyList","jsxs","classes","jsx","VComponent","Card","RequisitionListForm","RequisitionListActions","EmptyList","Fragment","Table","Pagination","SvgAdd","React","SvgEmptyBox","selectable","onAddNew","Icon","Add","RequisitionListModal","isOpen","title","modalContent","closeBtnCaption","confirmBtnCaption","handleModalOnClose","handleModalOnConfirm","Modal","ProgressSpinner","Button","textContent","EmptyBox","useRequisitionListGrid","initial","callbacks","routeRequisitionListDetails","reqLists","setReqLists","editingId","setEditingId","isFetching","setIsFetching","onRename","useCallback","uid","onEditCancel","fetchPage","page","_a","data","getRequisitionLists","currentPage","totalPages","_b","_c","prev","prevData","useEffect","useMemo","rl","isEditing","e","result","row","index","RequisitionListGrid","requisitionLists","slots","modal","setModal","openRemove","closeModal","confirmRemove","m","deleteRequisitionList","getHeader","Slot","Header"],"mappings":"42BA6CO,MAAMA,EAET,CAAC,CACH,UAAAC,EACA,UAAAC,EAAY,GACZ,WAAAC,EAAa,GACb,OAAAC,EACA,KAAAC,EAAO,CAAA,EACP,aAAAC,EACA,iBAAAC,EAAmB,GACnB,SAAAC,EACA,iBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAeC,EAAQ,CAC3B,KAAM,8CACN,WAAY,oDACZ,YAAa,qDACb,QAAS,iDACT,UAAW,kDAAA,CACZ,EAEK,CAACC,EAAUC,CAAW,EAAIC,EAASZ,CAAU,EAE7Ca,IAAeR,GAAA,YAAAA,EAAU,cAAe,GAAK,EAC7CS,EAAgB,CAACf,GAAaG,EAAK,SAAW,GAAK,CAACW,EAE1D,OACEE,EAAC,MAAA,CACE,GAAGR,EACJ,UAAWS,EAAQ,CAAC,gCAAiClB,CAAS,CAAC,EAC/D,cAAY,gCAGX,SAAA,CAAAG,GACCgB,EAAC,MAAA,CACC,UAAWD,EAAQ,CAC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,QACLjE,EAACgB,EAAA,CACC,OAAM,GACN,UAAWiD,EAAM,UACjB,MAAO1E,EAAa,cACpB,aAAcA,EAAa,qBAC3B,kBAAmBA,EAAa,cAChC,gBAAiBA,EAAa,aAC9B,mBAAoB6E,EACpB,qBAAsBC,CAAA,CAAA,CACxB,EAEJ,CAEJ","x_google_ignoreList":[1,2]}
|
|
1
|
+
{"version":3,"file":"RequisitionListGrid.js","sources":["/@dropins/storefront-requisition-list/src/hooks/useRequisitionListGrid.tsx","/@dropins/storefront-requisition-list/src/containers/RequisitionListGrid/RequisitionListGrid.tsx","../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","/@dropins/storefront-requisition-list/src/components/RequisitionListGridWrapper/RequisitionListGridWrapper.tsx","/@dropins/storefront-requisition-list/src/components/RequisitionListActions/RequisitionListActions.tsx","/@dropins/storefront-requisition-list/src/components/RequisitionListModal/RequisitionListModal.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useMemo, useState, useCallback, useEffect } from 'preact/compat';\nimport { VNode } from 'preact';\nimport { Button, Card } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { RequisitionList as RequisitionListModel } from '@/requisitionList/data/models/requisitionList';\nimport { RequisitionListForm } from '@/requisitionList/containers';\nimport { getRequisitionLists } from '@/requisitionList/api/getRequisitionLists';\nimport { RequisitionLists } from '@/requisitionList/data/models/requisitionLists';\nimport { events } from '@adobe-commerce/event-bus';\n\ntype Row = Record<string, VNode | string | number | undefined>;\ntype Callbacks = { handleOpenModal: (rl: RequisitionListModel) => void };\n\nexport function useRequisitionListGrid(\n initial?: RequisitionLists | null,\n callbacks?: Callbacks,\n routeRequisitionListDetails?: (uid: string) => string | void\n) {\n const translations = useText({\n actionDelete: 'RequisitionList.RequisitionListItem.actionDelete',\n actionUpdate: 'RequisitionList.RequisitionListItem.actionUpdate',\n });\n\n const [reqLists, setReqLists] = useState<RequisitionLists | undefined>(\n initial\n );\n const [reqListUid, setReqListUid] = useState<string | null>(null);\n const [isAdding, setIsAdding] = useState(false);\n const [isFetching, setIsFetching] = useState(false);\n const handleClick = useCallback((uid: string) => {\n setReqListUid(uid);\n setIsAdding(false); // Close create form when opening update form\n }, []);\n const handleCancel = useCallback(() => setReqListUid(null), []);\n const handleAddNew = useCallback(() => {\n setIsAdding(true);\n setReqListUid(null); // Close update form when opening create form\n }, []);\n const handleCancelCreate = useCallback(() => setIsAdding(false), []);\n\n const fetchPage = useCallback(\n async (\n page = reqLists?.page_info?.current_page ?? 1,\n pageSize = reqLists?.page_info?.page_size ?? 10\n ) => {\n setIsFetching(true);\n try {\n const data = await getRequisitionLists(page, pageSize);\n const currentPage = data?.page_info?.current_page ?? 1;\n const totalPages = data?.page_info?.total_pages ?? 0;\n const hasRows = (data?.items?.length ?? 0) > 0;\n\n if (!hasRows && currentPage > 1 && totalPages >= currentPage - 1) {\n const prev = currentPage - 1;\n const prevData = await getRequisitionLists(prev, pageSize);\n setReqLists(prevData);\n } else {\n setReqLists(data);\n }\n } finally {\n setIsFetching(false);\n }\n },\n [reqLists]\n );\n\n useEffect(() => {\n if (!reqLists) void fetchPage(1);\n }, [reqLists, fetchPage]);\n\n const handlePageChange = useCallback(\n (page?: number) => fetchPage(page),\n [fetchPage]\n );\n\n const handlePageSizeChange = useCallback(\n async (pageSize: number) => {\n // Reset to page 1 when changing page size\n await fetchPage(1, pageSize);\n },\n [fetchPage]\n );\n\n const rows: Row[] = useMemo(\n () =>\n (reqLists?.items ?? []).map((rl: RequisitionListModel) => {\n const isUpdating = reqListUid === rl.uid;\n return {\n name: (\n <div className=\"requisition-list-grid-wrapper__name\">\n <div className=\"requisition-list-grid-wrapper__name__title\">\n <a\n href=\"#\"\n onClick={(e: Event): void => {\n e.preventDefault();\n if (routeRequisitionListDetails) {\n const result = routeRequisitionListDetails(rl.uid);\n if (typeof result === 'string') {\n window.location.href = result;\n }\n }\n }}\n >\n {rl.name}\n </a>\n </div>\n {rl.description && (\n <div className=\"requisition-list-grid-wrapper__name__description\">\n {rl.description}\n </div>\n )}\n </div>\n ),\n items_count: rl.items_count,\n last_updated: new Date(rl.updated_at).toLocaleString(),\n actions: (\n <div className=\"requisition-list-grid-wrapper__actions\">\n <Button\n variant=\"tertiary\"\n type=\"button\"\n data-testid=\"update-button\"\n onClick={() => handleClick(rl.uid)}\n >\n {translations.actionUpdate}\n </Button>\n <Button\n variant=\"tertiary\"\n type=\"button\"\n data-testid=\"delete-button\"\n onClick={() => callbacks?.handleOpenModal(rl)}\n >\n {translations.actionDelete}\n </Button>\n </div>\n ),\n _rowDetails: isUpdating ? (\n <Card\n variant=\"secondary\"\n className=\"requisition-list-grid-wrapper__form-row\"\n >\n <RequisitionListForm\n mode=\"update\"\n requisitionListUid={rl.uid}\n defaultValues={{ name: rl.name, description: rl.description }}\n onSuccess={async () => {\n await handlePageChange();\n events.emit('requisitionList/alert', {\n action: 'update',\n type: 'success',\n context: 'requisitionList',\n });\n setReqListUid(null);\n }}\n onError={() => {\n events.emit('requisitionList/alert', {\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }}\n onCancel={handleCancel}\n />\n </Card>\n ) : undefined,\n };\n }),\n [\n reqLists?.items,\n reqListUid,\n handleClick,\n handleCancel,\n translations.actionUpdate,\n translations.actionDelete,\n callbacks,\n handlePageChange,\n routeRequisitionListDetails,\n ]\n );\n\n const expandedRows = useMemo(\n () =>\n new Set(\n rows\n .map((row, index) => (row._rowDetails ? index : -1))\n .filter((index) => index >= 0) as number[]\n ),\n [rows]\n );\n\n return {\n rows,\n expandedRows,\n isLoading: isFetching || !reqLists,\n pageInfo: reqLists?.page_info,\n handlePageChange,\n handlePageSizeChange,\n isAdding,\n handleAddNew,\n handleCancelCreate,\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { HTMLAttributes, useState, useCallback } from 'preact/compat';\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { RequisitionLists as RequisitionListsModel } from '@/requisitionList/data/models/requisitionLists';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n RequisitionListGridWrapper,\n RequisitionListModal,\n} from '@/requisitionList/components';\nimport { useRequisitionListGrid } from '@/requisitionList/hooks';\nimport { deleteRequisitionList } from '@/requisitionList/api/deleteRequisitionList/deleteRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface RequisitionListGridProps\n extends HTMLAttributes<HTMLDivElement> {\n requisitionLists?: RequisitionListsModel | null;\n routeRequisitionListDetails?: (uid: string) => string | void;\n slots?: {\n Header?: SlotProps;\n };\n}\n\nexport const RequisitionListGrid: Container<RequisitionListGridProps> = ({\n requisitionLists,\n routeRequisitionListDetails,\n slots,\n}: RequisitionListGridProps) => {\n const [modal, setModal] = useState<{\n isOpen: boolean;\n isLoading: boolean;\n rl: RequisitionListsModel | null;\n }>({\n isOpen: false,\n isLoading: false,\n rl: null,\n });\n\n const handleOpenModal = (rl: RequisitionListsModel) =>\n setModal({ isOpen: true, isLoading: false, rl });\n const handleCloseModal = () =>\n setModal({ isOpen: false, isLoading: false, rl: null });\n\n const handleConfirmModal = async () => {\n if (!modal.rl) return;\n setModal((m) => ({ ...m, isLoading: true }));\n await deleteRequisitionList(modal.rl.uid)\n .then(async () => {\n events.emit('requisitionList/alert', {\n type: 'success',\n action: 'delete',\n context: 'requisitionList',\n });\n })\n .catch(() => {\n events.emit('requisitionList/alert', {\n type: 'error',\n action: 'delete',\n context: 'requisitionList',\n });\n })\n .finally(async () => {\n await handlePageChange();\n handleCloseModal();\n });\n };\n\n const {\n rows,\n expandedRows,\n isLoading,\n pageInfo,\n handlePageChange,\n handlePageSizeChange,\n isAdding,\n handleAddNew,\n handleCancelCreate,\n } = useRequisitionListGrid(\n requisitionLists,\n { handleOpenModal },\n routeRequisitionListDetails\n );\n\n const translations = useText({\n containerTitle: `RequisitionList.containerTitle`,\n deleteRequisitionListTitle:\n 'RequisitionList.RequisitionListWrapper.deleteRequisitionListTitle',\n deleteRequisitionListMessage:\n 'RequisitionList.RequisitionListWrapper.deleteRequisitionListMessage',\n cancelAction: 'RequisitionList.RequisitionListWrapper.cancelAction',\n confirmAction: 'RequisitionList.RequisitionListWrapper.confirmAction',\n });\n\n const getHeader = useCallback(() => {\n if (slots?.Header) {\n return (\n <Slot\n name=\"Header\"\n aria-label={translations.containerTitle}\n title={translations.containerTitle}\n slot={slots.Header}\n />\n );\n }\n return (\n <Header\n aria-label={translations.containerTitle}\n role=\"region\"\n title={translations.containerTitle}\n />\n );\n }, [slots, translations.containerTitle]);\n\n return (\n <>\n <RequisitionListGridWrapper\n header={getHeader()}\n rows={rows}\n expandedRows={expandedRows}\n skeletonRowCount={10}\n isLoading={isLoading}\n pageInfo={pageInfo}\n handlePageChange={handlePageChange}\n handlePageSizeChange={handlePageSizeChange}\n defaultPageSize={10}\n isAdding={isAdding}\n handleAddNew={handleAddNew}\n handleCancelCreate={handleCancelCreate}\n />\n {modal.isOpen && (\n <RequisitionListModal\n isOpen\n isLoading={modal.isLoading}\n title={translations.deleteRequisitionListTitle}\n modalContent={translations.deleteRequisitionListMessage}\n confirmBtnCaption={translations.confirmAction}\n closeBtnCaption={translations.cancelAction}\n handleModalOnClose={handleCloseModal}\n handleModalOnConfirm={handleConfirmModal}\n />\n )}\n </>\n );\n};\n","import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect } from 'preact/compat';\nimport { FunctionComponent, VNode } from 'preact';\nimport { VComponent, classes } from '@adobe-commerce/elsie/lib';\nimport {\n RequisitionListActions,\n EmptyList,\n PageSizePicker,\n} from '@/requisitionList/components';\nimport { RequisitionListForm } from '@/requisitionList/containers';\nimport {\n Pagination,\n Card,\n Table,\n InLineAlert,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport '@/requisitionList/components/RequisitionListGridWrapper/RequisitionListGridWrapper.css';\nimport { useRequisitionListAlert } from '@/requisitionList/hooks';\n\nexport interface RequisitionListGridWrapperProps\n extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n isLoading?: boolean;\n header?: VNode;\n rows: Array<Record<string, VNode | string | number | undefined>>;\n expandedRows: Set<number>;\n skeletonRowCount: number;\n pageInfo?: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n handlePageChange: (page?: number) => Promise<void>;\n handlePageSizeChange?: (pageSize: number) => Promise<void>;\n defaultPageSize?: number;\n isAdding: boolean;\n handleAddNew: () => void;\n handleCancelCreate: () => void;\n}\n\nexport const RequisitionListGridWrapper: FunctionComponent<\n RequisitionListGridWrapperProps\n> = ({\n className,\n isLoading = false,\n header,\n rows = [],\n expandedRows,\n skeletonRowCount = 10,\n pageInfo,\n handlePageChange,\n handlePageSizeChange,\n defaultPageSize = 10,\n isAdding,\n handleAddNew,\n handleCancelCreate,\n ...props\n}) => {\n const translations = useText({\n name: `RequisitionList.RequisitionListWrapper.name`,\n itemsCount: `RequisitionList.RequisitionListWrapper.itemsCount`,\n lastUpdated: `RequisitionList.RequisitionListWrapper.lastUpdated`,\n actions: `RequisitionList.RequisitionListWrapper.actions`,\n emptyList: `RequisitionList.RequisitionListWrapper.emptyList`,\n });\n\n const hasAnyItems = (pageInfo?.total_pages ?? 0) > 0;\n const showEmptyList = !isLoading && rows.length === 0 && !hasAnyItems;\n\n const { alert, setAlert, handleRequisitionListAlert } =\n useRequisitionListAlert();\n\n useEffect(() => {\n events.on('requisitionList/alert', handleRequisitionListAlert);\n }, [handleRequisitionListAlert]);\n\n return (\n <div\n {...props}\n className={classes(['requisition-list-grid-wrapper', className])}\n data-testid=\"requisition-list-grid-wrapper\"\n >\n {/* Requisition List Header */}\n {header && (\n <div\n className={classes([\n 'requisition-list-grid-wrapper__header',\n className,\n ])}\n data-testid=\"requisition-list-grid-wrapper-header\"\n >\n <VComponent node={header} />\n </div>\n )}\n {/* Requisition List alerts go here */}\n {alert && (\n <>\n <InLineAlert\n heading={alert.description}\n type={alert.type}\n variant=\"primary\"\n onDismiss={() => setAlert(null)}\n />\n </>\n )}\n\n {showEmptyList ? (\n <EmptyList textContent={translations.emptyList} />\n ) : (\n <>\n {/* Requisition Lists Table */}\n <Table\n columns={[\n { key: 'name', label: translations.name },\n { key: 'items_count', label: translations.itemsCount },\n { key: 'last_updated', label: translations.lastUpdated },\n { key: 'actions', label: translations.actions },\n ]}\n rowData={rows}\n expandedRows={expandedRows}\n loading={isLoading}\n skeletonRowCount={skeletonRowCount}\n />\n <div\n className={classes([\n 'requisition-list-grid-wrapper__pagination',\n className,\n ])}\n >\n <div className=\"requisition-list-grid-wrapper__pagination-controls\">\n <PageSizePicker\n currentPageSize={pageInfo?.page_size || defaultPageSize}\n onPageSizeChange={\n handlePageSizeChange || (() => Promise.resolve())\n }\n disabled={isLoading}\n />\n {pageInfo && pageInfo.total_pages > 1 && (\n <Pagination\n totalPages={pageInfo.total_pages}\n currentPage={pageInfo.current_page}\n onChange={handlePageChange}\n />\n )}\n </div>\n </div>\n </>\n )}\n\n {/* Requisition Lists Form */}\n <div\n className={classes([\n 'requisition-list-grid-wrapper__add-new',\n className,\n ])}\n >\n {isAdding ? (\n <Card variant=\"secondary\">\n <RequisitionListForm\n mode=\"create\"\n onSuccess={async () => {\n await handlePageChange();\n handleCancelCreate();\n events.emit('requisitionList/alert', {\n type: 'success',\n action: 'create',\n context: 'requisitionList',\n });\n }}\n onError={() => {\n events.emit('requisitionList/alert', {\n type: 'error',\n action: 'create',\n context: 'requisitionList',\n });\n }}\n onCancel={handleCancelCreate}\n />\n </Card>\n ) : (\n <RequisitionListActions onAddNew={handleAddNew} />\n )}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Add } from '@adobe-commerce/elsie/icons';\nimport { Icon } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/requisitionList/components/RequisitionListActions/RequisitionListActions.css';\n\nexport interface RequisitionListActionsProps {\n className?: string;\n selectable?: boolean;\n onAddNew?: () => void;\n}\n\nexport const RequisitionListActions: FunctionComponent<\n RequisitionListActionsProps\n> = ({ selectable, className, onAddNew }) => {\n const translations = useText({\n addNewReqListBtn: `RequisitionList.AddNewReqList.addNewReqListBtn`,\n });\n\n return (\n <button\n type=\"button\"\n aria-label={translations.addNewReqListBtn}\n role=\"button\"\n className={classes([\n 'requisition-list-actions',\n ['requisition-list-actions--selectable', selectable],\n className,\n ])}\n data-testid=\"requisition-list-actions-button\"\n onClick={onAddNew}\n >\n <span\n className=\"requisition-list-actions__title\"\n data-testid=\"requisition-list-actions-button-text\"\n >\n {translations.addNewReqListBtn}\n </span>\n <Icon source={Add} size=\"32\" />\n </button>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent, VNode } from 'preact';\nimport {\n Modal,\n Button,\n ProgressSpinner,\n} from '@adobe-commerce/elsie/components';\nimport '@/requisitionList/components/RequisitionListModal/RequisitionListModal.css';\n\nexport interface RequisitionListModalProps {\n isOpen: boolean;\n isLoading: boolean;\n title: VNode | string;\n modalContent: VNode | string;\n closeBtnCaption?: string;\n confirmBtnCaption?: string;\n handleModalOnClose?: () => void;\n handleModalOnConfirm?: () => void;\n}\n\nexport const RequisitionListModal: FunctionComponent<\n RequisitionListModalProps\n> = ({\n isOpen,\n isLoading,\n title,\n modalContent,\n closeBtnCaption,\n confirmBtnCaption,\n handleModalOnClose,\n handleModalOnConfirm,\n}) => {\n if (!isOpen) return null;\n\n return (\n <Modal\n className=\"requisition-list-modal--overlay\"\n data-testid=\"requisition-list-modal\"\n size={'medium'}\n centered={false}\n title={title}\n onClose={handleModalOnClose}\n backgroundDim={true}\n clickToDismiss={true}\n escapeToDismiss={true}\n role=\"dialog\"\n aria-label={title}\n >\n <div className=\"requisition-list-modal\">\n {isLoading ? (\n <div\n className=\"requisition-list-modal__spinner\"\n data-testid=\"progress-spinner\"\n >\n <ProgressSpinner stroke={'4'} size={'large'} />\n </div>\n ) : null}\n <p>{modalContent}</p>\n <div className=\"requisition-list-modal__buttons\">\n {handleModalOnClose && (\n <Button\n data-testid=\"rl-modal-close-button\"\n type={'button'}\n onClick={handleModalOnClose}\n variant=\"secondary\"\n disabled={isLoading}\n >\n {closeBtnCaption}\n </Button>\n )}\n {handleModalOnConfirm && (\n <Button\n data-testid=\"rl-modal-confirm-button\"\n type={'button'}\n onClick={handleModalOnConfirm}\n disabled={isLoading}\n >\n {confirmBtnCaption}\n </Button>\n )}\n </div>\n </div>\n </Modal>\n );\n};\n"],"names":["useRequisitionListGrid","initial","callbacks","routeRequisitionListDetails","translations","useText","reqLists","setReqLists","useState","reqListUid","setReqListUid","isAdding","setIsAdding","isFetching","setIsFetching","handleClick","useCallback","uid","handleCancel","handleAddNew","handleCancelCreate","fetchPage","page","_a","pageSize","_b","data","getRequisitionLists","currentPage","totalPages","_c","prev","prevData","useEffect","handlePageChange","handlePageSizeChange","rows","useMemo","rl","isUpdating","jsxs","jsx","e","result","Button","Card","RequisitionListForm","events","expandedRows","row","index","RequisitionListGrid","requisitionLists","slots","modal","setModal","handleOpenModal","handleCloseModal","handleConfirmModal","m","deleteRequisitionList","isLoading","pageInfo","getHeader","Slot","Header","Fragment","RequisitionListGridWrapper","RequisitionListModal","SvgAdd","props","React","className","header","skeletonRowCount","defaultPageSize","hasAnyItems","showEmptyList","alert","setAlert","handleRequisitionListAlert","useRequisitionListAlert","classes","VComponent","InLineAlert","EmptyList","Table","PageSizePicker","Pagination","RequisitionListActions","selectable","onAddNew","Icon","Add","isOpen","title","modalContent","closeBtnCaption","confirmBtnCaption","handleModalOnClose","handleModalOnConfirm","Modal","ProgressSpinner"],"mappings":"ohCA8BgB,SAAAA,GACdC,EACAC,EACAC,EACA,CACA,MAAMC,EAAeC,EAAQ,CAC3B,aAAc,mDACd,aAAc,kDAAA,CACf,EAEK,CAACC,EAAUC,CAAW,EAAIC,EAC9BP,CACF,EACM,CAACQ,EAAYC,CAAa,EAAIF,EAAwB,IAAI,EAC1D,CAACG,EAAUC,CAAW,EAAIJ,EAAS,EAAK,EACxC,CAACK,EAAYC,CAAa,EAAIN,EAAS,EAAK,EAC5CO,EAAcC,EAAaC,GAAgB,CAC/CP,EAAcO,CAAG,EACjBL,EAAY,EAAK,CACnB,EAAG,EAAE,EACCM,EAAeF,EAAY,IAAMN,EAAc,IAAI,EAAG,CAAA,CAAE,EACxDS,EAAeH,EAAY,IAAM,CACrCJ,EAAY,EAAI,EAChBF,EAAc,IAAI,CACpB,EAAG,EAAE,EACCU,EAAqBJ,EAAY,IAAMJ,EAAY,EAAK,EAAG,CAAA,CAAE,EAE7DS,EAAYL,EAChB,MACEM,GAAOC,MAAAjB,GA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ASwD,EACT,SAAUvC,EAET,SAAAqC,CAAA,CAAA,CACH,CAEJ,CAAA,CAAA,CACF,CAAA,CAAA,CACF,EAlDkB","x_google_ignoreList":[2]}
|
|
@@ -6,7 +6,9 @@ export interface RequisitionListNamesProps extends HTMLAttributes<HTMLDivElement
|
|
|
6
6
|
items?: RequisitionList[];
|
|
7
7
|
canCreate?: boolean;
|
|
8
8
|
sku: string;
|
|
9
|
+
selectedOptions?: string[];
|
|
9
10
|
quantity?: number;
|
|
11
|
+
beforeAddProdToReqList?: () => Promise<void> | void;
|
|
10
12
|
}
|
|
11
13
|
export declare const RequisitionListNames: Container<RequisitionListNamesProps>;
|
|
12
14
|
//# sourceMappingURL=RequisitionListNames.d.ts.map
|