@corva/ui 3.74.1 → 3.74.3
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/cjs-bundle/components/OffsetWellPickerV5/components/Filter/Filter.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/Filter.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/DateCell/DateCell.js +2 -0
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/DateCell/DateCell.js.map +1 -0
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableHead/OffsetWellsTableHead.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableHead/OffsetWellsTableHead.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableRow/OffsetWellsTableRow.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableRow/OffsetWellsTableRow.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/components/SkeletonTableRow/SkeletonTableRow.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/components/SkeletonTableRow/SkeletonTableRow.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/hooks/useTableColumns.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/hooks/useTableColumns.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/useRowInteractions.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/useRowInteractions.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/constants.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/constants.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/useWellDataPipeline.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/useWellDataPipeline.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/hooks/useSortedWells.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/hooks/useSortedWells.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/utils/doesWellPassFilters.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/utils/doesWellPassFilters.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/utils/sortWellsBy.js +2 -0
- package/cjs-bundle/components/OffsetWellPickerV5/utils/sortWellsBy.js.map +1 -0
- package/cjs-bundle/components/UserMention/index.js +1 -1
- package/cjs-bundle/components/UserMention/index.js.map +1 -1
- package/components/OffsetWellPickerV5/components/Filter/Filter.js +1 -1
- package/components/OffsetWellPickerV5/components/Filter/Filter.js.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/DateCell/DateCell.d.ts +12 -0
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/DateCell/DateCell.d.ts.map +1 -0
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/DateCell/DateCell.js +2 -0
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/DateCell/DateCell.js.map +1 -0
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/DateCell/index.d.ts +2 -0
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/{LastActiveCell → DateCell}/index.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/index.d.ts +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/index.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableHead/OffsetWellsTableHead.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableHead/OffsetWellsTableHead.js +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableHead/OffsetWellsTableHead.js.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableRow/OffsetWellsTableRow.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableRow/OffsetWellsTableRow.js +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/OffsetWellsTableRow/OffsetWellsTableRow.js.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/SkeletonTableRow/SkeletonTableRow.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/SkeletonTableRow/SkeletonTableRow.js +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/components/SkeletonTableRow/SkeletonTableRow.js.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/hooks/useTableColumns.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/hooks/useTableColumns.js +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/hooks/useTableColumns.js.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/useRowInteractions.d.ts +2 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/useRowInteractions.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/useRowInteractions.js +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/useRowInteractions.js.map +1 -1
- package/components/OffsetWellPickerV5/constants.d.ts +10 -3
- package/components/OffsetWellPickerV5/constants.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/constants.js +1 -1
- package/components/OffsetWellPickerV5/constants.js.map +1 -1
- package/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/useWellDataPipeline.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/useWellDataPipeline.js +1 -1
- package/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/useWellDataPipeline.js.map +1 -1
- package/components/OffsetWellPickerV5/hooks/useSortedWells.d.ts +1 -4
- package/components/OffsetWellPickerV5/hooks/useSortedWells.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/hooks/useSortedWells.js +1 -1
- package/components/OffsetWellPickerV5/hooks/useSortedWells.js.map +1 -1
- package/components/OffsetWellPickerV5/utils/__tests__/sortWellsBy.test.d.ts +2 -0
- package/components/OffsetWellPickerV5/utils/__tests__/sortWellsBy.test.d.ts.map +1 -0
- package/components/OffsetWellPickerV5/utils/doesWellPassFilters.d.ts +0 -1
- package/components/OffsetWellPickerV5/utils/doesWellPassFilters.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/utils/doesWellPassFilters.js +1 -1
- package/components/OffsetWellPickerV5/utils/doesWellPassFilters.js.map +1 -1
- package/components/OffsetWellPickerV5/utils/sortWellsBy.d.ts +22 -0
- package/components/OffsetWellPickerV5/utils/sortWellsBy.d.ts.map +1 -0
- package/components/OffsetWellPickerV5/utils/sortWellsBy.js +2 -0
- package/components/OffsetWellPickerV5/utils/sortWellsBy.js.map +1 -0
- package/components/UserMention/index.js +1 -1
- package/components/UserMention/index.js.map +1 -1
- package/mcp-server/server.mjs +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/LastActiveCell/LastActiveCell.js +0 -2
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/LastActiveCell/LastActiveCell.js.map +0 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/LastActiveCell/LastActiveCell.d.ts +0 -10
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/LastActiveCell/LastActiveCell.d.ts.map +0 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/LastActiveCell/LastActiveCell.js +0 -2
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/LastActiveCell/LastActiveCell.js.map +0 -1
- package/components/OffsetWellPickerV5/components/OffsetWellsTable/cells/LastActiveCell/index.d.ts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortWellsBy.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/OffsetWellPickerV5/utils/__tests__/sortWellsBy.test.ts"],"names":[],"mappings":""}
|
|
@@ -2,7 +2,6 @@ import type { FilterState, PickerSegmentId } from '../stores/filter-store/types'
|
|
|
2
2
|
export declare const WELL_PROPERTY_FILTER_KEYS: (keyof FilterState)[];
|
|
3
3
|
export type FilterableWell = {
|
|
4
4
|
name?: string;
|
|
5
|
-
lastActive?: number;
|
|
6
5
|
lastDrillingAt?: number;
|
|
7
6
|
status?: string;
|
|
8
7
|
companyId?: number | string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doesWellPassFilters.d.ts","sourceRoot":"","sources":["../../../../src/components/OffsetWellPickerV5/utils/doesWellPassFilters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQjF,eAAO,MAAM,yBAAyB,EAAE,CAAC,MAAM,WAAW,CAAC,EAY1D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"doesWellPassFilters.d.ts","sourceRoot":"","sources":["../../../../src/components/OffsetWellPickerV5/utils/doesWellPassFilters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQjF,eAAO,MAAM,yBAAyB,EAAE,CAAC,MAAM,WAAW,CAAC,EAY1D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,CAAC,EAAE,CAAC,MAAM,WAAW,CAAC,EAAE,CAAC;IACpC,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,0BAErC,CAAC;AAEF,eAAO,MAAM,mBAAmB,SACxB,cAAc,WACX,WAAW,GAAG,IAAI,YACjB,0BAA0B,KACnC,OA8EF,CAAC;AAEF,eAAO,MAAM,gCAAgC,SACrC,qBAAqB,WAClB,WAAW,GAAG,IAAI,iBACZ,OAAO,YACZ,0BAA0B,KACnC,OACuF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"@babel/runtime/helpers/slicedToArray";import{getTimestampByPeriod as e}from"./getTimestampByPeriod.js";import{isAssetVisibleToUser as i}from"./isAssetVisibleToUser.js";import{isDrillingOnlyWell as n}from"./isDrillingOnlyWell.js";var t=/\sST0/,l=["status","companyId","rigName","programName","basin","county","area","formation","stringDesign","interventionAsset","padName"],s={excludeKeys:["rigName"]},a=function(i,s,a){var u,o;if(!s)return!0;var m=null==a?void 0:a.excludeKeys;if(!l.every((function(r){if(null!=m&&m.includes(r))return!0;var e=s[r];if(Array.isArray(e)&&e.length>0){var n=i[r],t=e.map(String);return null==n||"Null"===n?t.includes("Null"):Array.isArray(n)?n.some((function(r){return t.includes(String(r))})):t.includes(String(n))}return!0})))return!1;if("intervention"===(null==a?void 0:a.segment)){var v=s.status;if(Array.isArray(v)&&v.map(String).includes("active")&&"active"===i.status&&"intervention"!==i.wellState)return!1}if(s.sideTracks&&t.test(null!==(u=i.name)&&void 0!==u?u:""))return!1;if("intervention"!==(null==a?void 0:a.segment)&&s.drillingWells&&!n(i))return!1;if(s.activeInterventionWells&&(null===(o=i.interventionAsset)||void 0===o||!o.length))return!1;var d=s.period,f=s.timeRangeFrom,g=s.timeRangeTo,c=e(d,f,g),y=r(c,2),p=y[0],A=y[1];if(null!==p&&null!==A&&Number.isFinite(p)&&Number.isFinite(A)){var N=i.lastDrillingAt;if(void 0===N||!(N>=p&&N<=A))return!1}return!0},u=function(r,e,n,t){return i(r,n)&&a(r,e,t)};export{s as EXCLUDE_RIG_NAME_FILTER,l as WELL_PROPERTY_FILTER_KEYS,a as doesWellPassFilters,u as doesWellPassVisibilityAndFilters};
|
|
2
2
|
//# sourceMappingURL=doesWellPassFilters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doesWellPassFilters.js","sources":["../../../../src/components/OffsetWellPickerV5/utils/doesWellPassFilters.ts"],"sourcesContent":["import type { FilterState, PickerSegmentId } from '../stores/filter-store/types';\n\nimport { getTimestampByPeriod } from './getTimestampByPeriod';\nimport { isAssetVisibleToUser } from './isAssetVisibleToUser';\nimport { isDrillingOnlyWell } from './isDrillingOnlyWell';\n\nconst SIDE_TRACK_REGEX = /\\sST0/;\n\nexport const WELL_PROPERTY_FILTER_KEYS: (keyof FilterState)[] = [\n 'status',\n 'companyId',\n 'rigName',\n 'programName',\n 'basin',\n 'county',\n 'area',\n 'formation',\n 'stringDesign',\n 'interventionAsset',\n 'padName',\n];\n\nexport type FilterableWell = {\n name?: string;\n
|
|
1
|
+
{"version":3,"file":"doesWellPassFilters.js","sources":["../../../../src/components/OffsetWellPickerV5/utils/doesWellPassFilters.ts"],"sourcesContent":["import type { FilterState, PickerSegmentId } from '../stores/filter-store/types';\n\nimport { getTimestampByPeriod } from './getTimestampByPeriod';\nimport { isAssetVisibleToUser } from './isAssetVisibleToUser';\nimport { isDrillingOnlyWell } from './isDrillingOnlyWell';\n\nconst SIDE_TRACK_REGEX = /\\sST0/;\n\nexport const WELL_PROPERTY_FILTER_KEYS: (keyof FilterState)[] = [\n 'status',\n 'companyId',\n 'rigName',\n 'programName',\n 'basin',\n 'county',\n 'area',\n 'formation',\n 'stringDesign',\n 'interventionAsset',\n 'padName',\n];\n\nexport type FilterableWell = {\n name?: string;\n lastDrillingAt?: number;\n status?: string;\n companyId?: number | string;\n rigName?: string;\n programName?: string;\n basin?: string;\n county?: string;\n area?: string;\n formation?: string;\n stringDesign?: unknown;\n interventionAsset?: string[];\n padName?: string;\n wellState?: string;\n lastInterventionAt?: number;\n};\n\nexport type FilterableVisibleWell = FilterableWell & { visibility?: string };\n\nexport type DoesWellPassFiltersOptions = {\n excludeKeys?: (keyof FilterState)[];\n segment?: PickerSegmentId;\n};\n\nexport const EXCLUDE_RIG_NAME_FILTER: DoesWellPassFiltersOptions = {\n excludeKeys: ['rigName'],\n};\n\nexport const doesWellPassFilters = (\n well: FilterableWell,\n filters: FilterState | null,\n options?: DoesWellPassFiltersOptions\n): boolean => {\n if (!filters) return true;\n\n const excludeKeys = options?.excludeKeys;\n\n // Check array property filters\n const passesPropertyFilters = WELL_PROPERTY_FILTER_KEYS.every(filterKey => {\n if (excludeKeys?.includes(filterKey)) return true;\n\n const filterValue = filters[filterKey];\n if (Array.isArray(filterValue) && filterValue.length > 0) {\n const wellValue = well[filterKey as keyof FilterableWell];\n const normalized = (filterValue as (string | number)[]).map(String);\n\n if (wellValue == null || wellValue === 'Null') {\n return normalized.includes('Null');\n }\n\n if (Array.isArray(wellValue)) {\n return (wellValue as string[]).some(v => normalized.includes(String(v)));\n }\n\n return normalized.includes(String(wellValue));\n }\n return true;\n });\n\n if (!passesPropertyFilters) {\n return false;\n }\n\n // Intervention segment: \"active\" status additionally requires wellState === 'intervention'\n if (options?.segment === 'intervention') {\n const statusFilter = filters.status;\n if (\n Array.isArray(statusFilter) &&\n statusFilter.map(String).includes('active') &&\n well.status === 'active' &&\n well.wellState !== 'intervention'\n ) {\n return false;\n }\n }\n\n // Check sideTracks filter\n if (filters.sideTracks && SIDE_TRACK_REGEX.test(well.name ?? '')) {\n return false;\n }\n\n if (options?.segment !== 'intervention' && filters.drillingWells && !isDrillingOnlyWell(well)) {\n return false;\n }\n\n // Check activeInterventionWells toggle: only show wells active on an intervention unit\n if (filters.activeInterventionWells && !well.interventionAsset?.length) {\n return false;\n }\n\n // Check time range filter\n const { period, timeRangeFrom, timeRangeTo } = filters;\n const [startTimestamp, endTimestamp] = getTimestampByPeriod(period, timeRangeFrom, timeRangeTo);\n\n if (\n startTimestamp !== null &&\n endTimestamp !== null &&\n Number.isFinite(startTimestamp) &&\n Number.isFinite(endTimestamp)\n ) {\n const { lastDrillingAt } = well;\n if (\n lastDrillingAt === undefined ||\n !(lastDrillingAt >= startTimestamp && lastDrillingAt <= endTimestamp)\n ) {\n return false;\n }\n }\n\n return true;\n};\n\nexport const doesWellPassVisibilityAndFilters = (\n well: FilterableVisibleWell,\n filters: FilterState | null,\n includeHidden: boolean,\n options?: DoesWellPassFiltersOptions\n): boolean =>\n isAssetVisibleToUser(well, includeHidden) && doesWellPassFilters(well, filters, options);\n"],"names":["SIDE_TRACK_REGEX","WELL_PROPERTY_FILTER_KEYS","EXCLUDE_RIG_NAME_FILTER","excludeKeys","doesWellPassFilters","well","filters","options","_well$name","_well$interventionAss","every","filterKey","includes","filterValue","Array","isArray","length","wellValue","normalized","map","String","some","v","segment","statusFilter","status","wellState","sideTracks","test","name","drillingWells","isDrillingOnlyWell","activeInterventionWells","interventionAsset","period","timeRangeFrom","timeRangeTo","_getTimestampByPeriod","getTimestampByPeriod","_getTimestampByPeriod2","_slicedToArray","startTimestamp","endTimestamp","Number","isFinite","lastDrillingAt","undefined","doesWellPassVisibilityAndFilters","includeHidden","isAssetVisibleToUser"],"mappings":"mPAMA,IAAMA,EAAmB,QAEZC,EAAmD,CAC9D,SACA,YACA,UACA,cACA,QACA,SACA,OACA,YACA,eACA,oBACA,WA4BWC,EAAsD,CACjEC,YAAa,CAAC,YAGHC,EAAsB,SACjCC,EACAC,EACAC,GACY,IAAAC,EAAAC,EACZ,IAAKH,EAAS,OAAO,EAErB,IAAMH,EAAcI,aAAAA,EAAAA,EAASJ,YAwB7B,IArB8BF,EAA0BS,OAAM,SAAAC,GAC5D,GAAIR,SAAAA,EAAaS,SAASD,GAAY,OAAO,EAE7C,IAAME,EAAcP,EAAQK,GAC5B,GAAIG,MAAMC,QAAQF,IAAgBA,EAAYG,OAAS,EAAG,CACxD,IAAMC,EAAYZ,EAAKM,GACjBO,EAAcL,EAAoCM,IAAIC,QAE5D,OAAiB,MAAbH,GAAmC,SAAdA,EAChBC,EAAWN,SAAS,QAGzBE,MAAMC,QAAQE,GACRA,EAAuBI,MAAK,SAAAC,GAAC,OAAIJ,EAAWN,SAASQ,OAAOE,OAG/DJ,EAAWN,SAASQ,OAAOH,GACpC,CACA,OAAO,CACT,IAGE,OAAO,EAIT,GAAyB,kBAArBV,aAAO,EAAPA,EAASgB,SAA4B,CACvC,IAAMC,EAAelB,EAAQmB,OAC7B,GACEX,MAAMC,QAAQS,IACdA,EAAaL,IAAIC,QAAQR,SAAS,WAClB,WAAhBP,EAAKoB,QACc,iBAAnBpB,EAAKqB,UAEL,OAAO,CAEX,CAGA,GAAIpB,EAAQqB,YAAc3B,EAAiB4B,KAAkB,QAAbvB,EAAAA,EAAKwB,YAAQ,IAAArB,EAAAA,EAAA,IAC3D,OAAO,EAGT,GAAyB,kBAArBD,eAAAA,EAASgB,UAA8BjB,EAAQwB,gBAAkBC,EAAmB1B,GACtF,OAAO,EAIT,GAAIC,EAAQ0B,0BAAkD,QAAvBvB,EAACJ,EAAK4B,yBAAiB,IAAAxB,IAAtBA,EAAwBO,QAC9D,OAAO,EAIT,IAAQkB,EAAuC5B,EAAvC4B,OAAQC,EAA+B7B,EAA/B6B,cAAeC,EAAgB9B,EAAhB8B,YAC/BC,EAAuCC,EAAqBJ,EAAQC,EAAeC,GAAYG,EAAAC,EAAAH,EAAA,GAAxFI,EAAcF,EAAA,GAAEG,EAAYH,EAAA,GAEnC,GACqB,OAAnBE,GACiB,OAAjBC,GACAC,OAAOC,SAASH,IAChBE,OAAOC,SAASF,GAChB,CACA,IAAQG,EAAmBxC,EAAnBwC,eACR,QACqBC,IAAnBD,KACEA,GAAkBJ,GAAkBI,GAAkBH,GAExD,OAAO,CAEX,CAEA,OAAO,CACT,EAEaK,EAAmC,SAC9C1C,EACAC,EACA0C,EACAzC,GAAoC,OAEpC0C,EAAqB5C,EAAM2C,IAAkB5C,EAAoBC,EAAMC,EAASC,EAAQ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SortDirectionType } from '../constants';
|
|
2
|
+
export type SortableWell = Record<string, unknown> & {
|
|
3
|
+
id: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Sorts wells by a column, leaving the input array untouched.
|
|
7
|
+
*
|
|
8
|
+
* Two rules, both of which the table relies on:
|
|
9
|
+
* - wells with no value sink to the bottom in *both* directions, so sorting never
|
|
10
|
+
* surfaces gaps ahead of data;
|
|
11
|
+
* - anything that is not strictly greater or smaller — equal values, arrays with the
|
|
12
|
+
* same contents, coercively equal values of mismatched types (`5` and `"5"`) — is a
|
|
13
|
+
* tie and returns 0, so the stable sort keeps the incoming order instead of
|
|
14
|
+
* shuffling those rows on every re-sort.
|
|
15
|
+
*
|
|
16
|
+
* Values within a column are assumed to share one type (numbers, strings, or string
|
|
17
|
+
* arrays). Mixing numbers with strings in the same column is not supported: the
|
|
18
|
+
* numeric and textual branches of `compareValues` use different orderings, so a mixed
|
|
19
|
+
* column has no consistent order to sort by.
|
|
20
|
+
*/
|
|
21
|
+
export declare const sortWellsBy: (wells: SortableWell[], sortByKey: string, sortDir: SortDirectionType) => SortableWell[];
|
|
22
|
+
//# sourceMappingURL=sortWellsBy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortWellsBy.d.ts","sourceRoot":"","sources":["../../../../src/components/OffsetWellPickerV5/utils/sortWellsBy.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE5E,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAyCpE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,UACf,YAAY,EAAE,aACV,MAAM,WACR,iBAAiB,KACzB,YAAY,EAuBd,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import r from"@babel/runtime/helpers/toConsumableArray";import{ColumnType as t,SortDirection as n}from"../constants.js";var e=new Set([t.lastDrillingAt,t.lastInterventionAt]),o=function(r){return Array.isArray(r)?r.join(", "):String(r)},i=function(r,t){return"string"==typeof r?!r||"null"===r.toLowerCase():0===r?t:!r},u=function(t,u,a){var f=e.has(u),s=a===n.ASC;return r(t).sort((function(r,t){var n=r[u],e=t[u],a=i(n,f),l=i(e,f);if(a&&l)return 0;if(a)return 1;if(l)return-1;if("string"==typeof n&&"string"==typeof e)return s?n.localeCompare(e):e.localeCompare(n);var p=function(r,t){if("number"==typeof r&&"number"==typeof t)return r===t?0:r>t?1:-1;var n=o(r),e=o(t);return n===e?0:n>e?1:-1}(n,e);return s?p:-p}))};export{u as sortWellsBy};
|
|
2
|
+
//# sourceMappingURL=sortWellsBy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortWellsBy.js","sources":["../../../../src/components/OffsetWellPickerV5/utils/sortWellsBy.ts"],"sourcesContent":["import { ColumnType, SortDirection, SortDirectionType } from '../constants';\n\nexport type SortableWell = Record<string, unknown> & { id: number };\n\n/**\n * Columns holding a unix timestamp, where `0` means \"no date\" rather than a real\n * value — the cell renders it as an em dash, so sorting treats it as missing too.\n */\nconst DATE_COLUMNS: Set<string> = new Set([\n ColumnType.lastDrillingAt,\n ColumnType.lastInterventionAt,\n]);\n\n/** Renders a value the way the table does, so ordering follows what the user reads. */\nconst toText = (value: unknown): string =>\n Array.isArray(value) ? value.join(', ') : String(value);\n\n/** Three-way comparison: 0 means \"tie\", which the caller turns into a stable order. */\nconst compareValues = (a: unknown, b: unknown): number => {\n if (typeof a === 'number' && typeof b === 'number') {\n if (a === b) return 0;\n return a > b ? 1 : -1;\n }\n\n const aText = toText(a);\n const bText = toText(b);\n\n if (aText === bText) return 0;\n return aText > bText ? 1 : -1;\n};\n\nconst isMissing = (value: unknown, treatZeroAsMissing: boolean): boolean => {\n if (typeof value === 'string') {\n return !value || value.toLowerCase() === 'null';\n }\n\n if (value === 0) {\n return treatZeroAsMissing;\n }\n\n return !value;\n};\n\n/**\n * Sorts wells by a column, leaving the input array untouched.\n *\n * Two rules, both of which the table relies on:\n * - wells with no value sink to the bottom in *both* directions, so sorting never\n * surfaces gaps ahead of data;\n * - anything that is not strictly greater or smaller — equal values, arrays with the\n * same contents, coercively equal values of mismatched types (`5` and `\"5\"`) — is a\n * tie and returns 0, so the stable sort keeps the incoming order instead of\n * shuffling those rows on every re-sort.\n *\n * Values within a column are assumed to share one type (numbers, strings, or string\n * arrays). Mixing numbers with strings in the same column is not supported: the\n * numeric and textual branches of `compareValues` use different orderings, so a mixed\n * column has no consistent order to sort by.\n */\nexport const sortWellsBy = (\n wells: SortableWell[],\n sortByKey: string,\n sortDir: SortDirectionType\n): SortableWell[] => {\n const treatZeroAsMissing = DATE_COLUMNS.has(sortByKey);\n const isAscending = sortDir === SortDirection.ASC;\n\n return [...wells].sort((a, b) => {\n const aVal = a[sortByKey];\n const bVal = b[sortByKey];\n\n const aMissing = isMissing(aVal, treatZeroAsMissing);\n const bMissing = isMissing(bVal, treatZeroAsMissing);\n\n if (aMissing && bMissing) return 0;\n if (aMissing) return 1;\n if (bMissing) return -1;\n\n if (typeof aVal === 'string' && typeof bVal === 'string') {\n return isAscending ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);\n }\n\n const order = compareValues(aVal, bVal);\n\n return isAscending ? order : -order;\n });\n};\n"],"names":["DATE_COLUMNS","Set","ColumnType","lastDrillingAt","lastInterventionAt","toText","value","Array","isArray","join","String","isMissing","treatZeroAsMissing","toLowerCase","sortWellsBy","wells","sortByKey","sortDir","has","isAscending","SortDirection","ASC","_toConsumableArray","sort","a","b","aVal","bVal","aMissing","bMissing","localeCompare","order","aText","bText","compareValues"],"mappings":"wHAQA,IAAMA,EAA4B,IAAIC,IAAI,CACxCC,EAAWC,eACXD,EAAWE,qBAIPC,EAAS,SAACC,GAAc,OAC5BC,MAAMC,QAAQF,GAASA,EAAMG,KAAK,MAAQC,OAAOJ,EAAM,EAgBnDK,EAAY,SAACL,EAAgBM,GACjC,MAAqB,iBAAVN,GACDA,GAAiC,SAAxBA,EAAMO,cAGX,IAAVP,EACKM,GAGDN,CACV,EAkBaQ,EAAc,SACzBC,EACAC,EACAC,GAEA,IAAML,EAAqBZ,EAAakB,IAAIF,GACtCG,EAAcF,IAAYG,EAAcC,IAE9C,OAAOC,EAAIP,GAAOQ,MAAK,SAACC,EAAGC,GACzB,IAAMC,EAAOF,EAAER,GACTW,EAAOF,EAAET,GAETY,EAAWjB,EAAUe,EAAMd,GAC3BiB,EAAWlB,EAAUgB,EAAMf,GAEjC,GAAIgB,GAAYC,EAAU,OAAO,EACjC,GAAID,EAAU,OAAO,EACrB,GAAIC,EAAU,OAAQ,EAEtB,GAAoB,iBAATH,GAAqC,iBAATC,EACrC,OAAOR,EAAcO,EAAKI,cAAcH,GAAQA,EAAKG,cAAcJ,GAGrE,IAAMK,EAhEY,SAACP,EAAYC,GACjC,GAAiB,iBAAND,GAA+B,iBAANC,EAClC,OAAID,IAAMC,EAAU,EACbD,EAAIC,EAAI,GAAK,EAGtB,IAAMO,EAAQ3B,EAAOmB,GACfS,EAAQ5B,EAAOoB,GAErB,OAAIO,IAAUC,EAAc,EACrBD,EAAQC,EAAQ,GAAK,CAC9B,CAqDkBC,CAAcR,EAAMC,GAElC,OAAOR,EAAcY,GAASA,CAChC,GACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"@babel/runtime/helpers/defineProperty";import{useEffect as e,useCallback as r}from"react";import{debounce as i}from"lodash";import n from"prop-types";import{withStyles as t}from"@material-ui/core/styles";import{MentionsInput as s,Mention as a}from"react-mentions";import l from"@material-ui/core/colors/blue";import{handleFetchUsers as u}from"./utils/index.js";import{URL_CAPTURE_PATTERN as c}from"../../utils/links.js";import{USER_MARKUP as p,LINK_MARKUP as m}from"./constants.js";import d from"./style.css.js";import{AvatarComponent as g}from"../Avatar/index.js";import"../../permissions/PermissionsContext.js";import{PERMISSIONS as f}from"../../permissions/constants/index.js";import"@babel/runtime/helpers/slicedToArray";import{withPermissionsHOC as b}from"../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import{jsxs as h,jsx as y}from"react/jsx-runtime";function v(o,e){var r=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.push.apply(r,i)}return r}function j(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?v(Object(i),!0).forEach((function(r){o(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(i,o))}))}return e}var _={backgroundColor:l[100]},w={color:"#00bcd4"},O={color:"var(--palette-info-light)",backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.04)",outline:"1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)",borderRadius:"4px"},P
|
|
1
|
+
import o from"@babel/runtime/helpers/defineProperty";import{useEffect as e,useCallback as r}from"react";import{debounce as i}from"lodash";import n from"prop-types";import{withStyles as t}from"@material-ui/core/styles";import{MentionsInput as s,Mention as a}from"react-mentions";import l from"@material-ui/core/colors/blue";import{handleFetchUsers as u}from"./utils/index.js";import{URL_CAPTURE_PATTERN as c}from"../../utils/links.js";import{USER_MARKUP as p,LINK_MARKUP as m}from"./constants.js";import d from"./style.css.js";import{AvatarComponent as g}from"../Avatar/index.js";import"../../permissions/PermissionsContext.js";import{PERMISSIONS as f}from"../../permissions/constants/index.js";import"@babel/runtime/helpers/slicedToArray";import{withPermissionsHOC as b}from"../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import{jsxs as h,jsx as y}from"react/jsx-runtime";function v(o,e){var r=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.push.apply(r,i)}return r}function j(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?v(Object(i),!0).forEach((function(r){o(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(i,o))}))}return e}var _={backgroundColor:l[100]},w={color:"#00bcd4"},O={color:"var(--palette-info-light)",backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.04)",outline:"1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)",borderRadius:"4px"},P=/(?!)/,C=[],x={suggestions:{item:{"&focused":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},S=j(j({},x),{},{input:{color:"#fff",caretColor:"#fff",zIndex:1},highlighter:{color:"#fff"}}),k=j(j({},x),{},{input:{color:"#000"}}),R=function(o){var n=o.onChange,t=void 0===n?A:n,l=o.singleLine,f=void 0!==l&&l,b=o.suggestionsPortalHost,v=void 0===b?null:b,x=o.value,R=void 0===x?"":x,U=o.inputRef,q=void 0===U?null:U,H=o.classes,I=o.style,M=void 0===I?D:I,V=o.withLightTheme,B=void 0!==V&&V,Q=o.placeholder,z=void 0===Q?"Mention people using '@'":Q,G=o.onMount,J=void 0===G?N:G,W=o.onKeyDown,X=void 0===W?T:W,Y=o.onKeyUp,Z=void 0===Y?F:Y,$=o.onFocus,oo=void 0===$?K:$,eo=o.onBlur,ro=void 0===eo?E:eo,io=o.autoFocus,no=void 0===io||io,to=o.disabled,so=void 0!==to&&to,ao=o.companyId,lo=void 0===ao?null:ao,uo=o.currentUser,co=void 0===uo?null:uo,po=o.isCompanySelectVisible,mo=o.mentionProps,go=void 0===mo?L:mo,fo=o.allowSuggestionsAboveCursor,bo=void 0!==fo&&fo,ho=o.allowEmptyQuery,yo=void 0!==ho&&ho,vo=o.highlightLinks,jo=void 0!==vo&&vo;e(J,[]);var _o=r(i((function(o,e){var r=po&&co&&co.company_id!==lo?[co.company_id,lo]:null;u(o,e,r,yo)}),400),[lo,yo]),wo=j(j({},B?k:S),M);if(jo){var Oo,Po=null===(Oo=wo.input)||void 0===Oo?void 0:Oo.color;wo.input=j(j({caretColor:Po},wo.input),{},{color:"transparent"}),wo.highlighter=j(j({color:Po},wo.highlighter),{},{substring:{visibility:"visible"}})}return h(s,{value:R,onChange:function(o,e){t(e)},singleLine:f,allowSpaceInQuery:!0,classNames:d,placeholder:z,suggestionsPortalHost:v,inputRef:q,style:wo,onKeyDown:X,onKeyUp:Z,autoFocus:no,onFocus:oo,onBlur:ro,disabled:so,allowSuggestionsAboveCursor:bo,children:[y(a,j({markup:p,renderSuggestion:function(o){return function(o,e){return h("div",{className:d.mention__suggestion,children:[y(g,{alt:o.display,displayName:o.display,className:e.avatar,imgSrc:o.photo}),h("div",{className:d.mention__suggestion__info,children:[y("span",{"data-testid":"".concat("userMention","_name_").concat(o.display),className:d.mention__suggestion__info__name,children:o.display}),o.title&&y("span",{className:d.mention__suggestion__info__group,children:o.title})]})]})}(o,H)},trigger:"@",data:_o,displayTransform:function(o,e){return"@".concat(e)},style:B?_:w,appendSpaceOnAdd:!0},go)),jo&&y(a,{markup:m,regex:c,trigger:P,data:C,displayTransform:function(o){return o},style:O})]})};R.propTypes={onChange:n.func,singleLine:n.bool,suggestionsPortalHost:n.shape({current:n.instanceOf(Element)}),value:n.string,inputRef:n.shape({}),classes:n.shape({avatar:n.string.isRequired}).isRequired,withLightTheme:n.bool,placeholder:n.string,style:n.shape({}),mentionProps:n.shape({}),onMount:n.func,onKeyDown:n.func,onKeyUp:n.func,onFocus:n.func,onBlur:n.func,autoFocus:n.bool,disabled:n.bool,currentUser:n.shape({company_id:n.number.isRequired}),companyId:n.number,isCompanySelectVisible:n.bool.isRequired,allowSuggestionsAboveCursor:n.bool,highlightLinks:n.bool,allowEmptyQuery:n.bool};var A=function(){},D={suggestions:{list:{background:"#414141"},item:{color:"white",height:30,"&focused":{backgroundColor:"rgba(255, 255, 255, 0.08)"}}}},L={},N=function(){},T=function(){},F=function(){},K=function(){},E=function(){},U=b({isCompanySelectVisible:f.companySelectorView})(t({avatar:{height:45,width:45,border:"1.5px solid #fff"}})(R));export{U as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/UserMention/index.js"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { debounce } from 'lodash';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { MentionsInput, Mention } from 'react-mentions';\nimport blue from '@material-ui/core/colors/blue';\n\nimport { handleFetchUsers } from './utils';\n\nimport { URL_CAPTURE_PATTERN } from '~/utils/links';\nimport { USER_MARKUP, LINK_MARKUP } from './constants';\n\nimport styles from './style.css';\n\nimport Avatar from '~components/Avatar';\nimport { withPermissionsHOC, PERMISSIONS } from '~/permissions';\n\nconst PAGE_NAME = 'userMention';\n\nconst muiStyles = {\n avatar: {\n height: 45,\n width: 45,\n border: '1.5px solid #fff',\n },\n};\n\nconst mentionLightStyle = {\n backgroundColor: blue[100],\n};\nconst mentionDarkStyle = {\n color: '#00bcd4',\n};\n\n// Matches the mirror token in `LinkedText`, which react-mentions cannot share as a class.\n// Off the palette, not literal white, or the tint vanishes against a light theme.\nconst linkStyle = {\n color: 'var(--palette-info-light)',\n backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.04)',\n // Outline, not border: a border takes space and would shift the text.\n outline: '1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)',\n borderRadius: '4px',\n};\n\n// This mention exists to paint existing text, never to offer a suggestion.\nconst NEVER_TRIGGERS = /$^/;\nconst NO_SUGGESTIONS = [];\n\n// NOTE: IMPORTANT! 'input', 'mention' and 'highliter' should always have same font/latter/height/line etc values\nconst inputStyles = {\n suggestions: {\n item: {\n '&focused': {\n backgroundColor: 'rgba(0, 0, 0, 0.08)',\n },\n },\n },\n};\n\nconst darkThemeInputStyles = {\n ...inputStyles,\n input: {\n color: '#fff',\n caretColor: '#fff',\n zIndex: 1,\n },\n highlighter: {\n color: '#fff',\n },\n};\n\nconst lightThemeInputStyles = {\n ...inputStyles,\n input: { color: '#000' },\n};\n\nconst renderSuggestion = (entry, classes) => (\n <div className={styles.mention__suggestion}>\n <Avatar\n alt={entry.display}\n displayName={entry.display}\n className={classes.avatar}\n imgSrc={entry.photo}\n />\n <div className={styles.mention__suggestion__info}>\n <span\n data-testid={`${PAGE_NAME}_name_${entry.display}`}\n className={styles.mention__suggestion__info__name}\n >\n {entry.display}\n </span>\n {entry.title && (\n <span className={styles.mention__suggestion__info__group}>{entry.title}</span>\n )}\n </div>\n </div>\n);\n\nconst UserMention = ({\n onChange = DEFAULT_USER_MENTION_ON_CHANGE,\n singleLine = false,\n suggestionsPortalHost = null,\n value = '',\n inputRef = null,\n classes,\n style = DEFAULT_USER_MENTION_STYLE,\n withLightTheme = false,\n placeholder = \"Mention people using '@'\",\n onMount = DEFAULT_USER_MENTION_ON_MOUNT,\n onKeyDown = DEFAULT_USER_MENTION_ON_KEY_DOWN,\n onKeyUp = DEFAULT_USER_MENTION_ON_KEY_UP,\n onFocus = DEFAULT_USER_MENTION_ON_FOCUS,\n onBlur = DEFAULT_USER_MENTION_ON_BLUR,\n autoFocus = true,\n disabled = false,\n companyId = null,\n currentUser = null,\n isCompanySelectVisible,\n mentionProps = DEFAULT_USER_MENTION_MENTION_PROPS,\n allowSuggestionsAboveCursor = false,\n allowEmptyQuery = false,\n highlightLinks = false,\n}) => {\n useEffect(onMount, []);\n\n const fetchUsers = (search, callback) => {\n const companyIds =\n isCompanySelectVisible && currentUser && currentUser.company_id !== companyId\n ? [currentUser.company_id, companyId]\n : null;\n\n handleFetchUsers(search, callback, companyIds, allowEmptyQuery);\n };\n\n const debouncedUsersFetch = useCallback(debounce(fetchUsers, 400), [companyId, allowEmptyQuery]);\n\n const onInputChange = (event, newValue) => {\n onChange(newValue);\n };\n\n const themedStyle = {\n ...(withLightTheme ? lightThemeInputStyles : darkThemeInputStyles),\n ...style,\n };\n\n // react-mentions paints the text in the textarea and keeps the highlighter behind it, so a\n // mention's colour never shows through. Handing the text to the highlighter instead is what\n // lets a link carry the same token as the plain textareas do.\n if (highlightLinks) {\n const textColor = themedStyle.input?.color;\n\n themedStyle.input = { caretColor: textColor, ...themedStyle.input, color: 'transparent' };\n themedStyle.highlighter = {\n color: textColor,\n ...themedStyle.highlighter,\n substring: { visibility: 'visible' },\n };\n }\n\n return (\n <MentionsInput\n value={value}\n onChange={onInputChange}\n singleLine={singleLine}\n allowSpaceInQuery\n classNames={styles}\n placeholder={placeholder}\n suggestionsPortalHost={suggestionsPortalHost}\n inputRef={inputRef}\n style={themedStyle}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n autoFocus={autoFocus}\n onFocus={onFocus}\n onBlur={onBlur}\n disabled={disabled}\n allowSuggestionsAboveCursor={allowSuggestionsAboveCursor}\n >\n <Mention\n markup={USER_MARKUP}\n renderSuggestion={entry => renderSuggestion(entry, classes)}\n trigger=\"@\"\n data={debouncedUsersFetch}\n displayTransform={(id, display) => `@${display}`}\n style={withLightTheme ? mentionLightStyle : mentionDarkStyle}\n appendSpaceOnAdd\n {...mentionProps}\n />\n\n {/* Highlight only: a `regex` makes react-mentions style matching text without any markup\n of its own, so the url stays exactly as typed in the value it hands back. */}\n {highlightLinks && (\n <Mention\n markup={LINK_MARKUP}\n regex={URL_CAPTURE_PATTERN}\n trigger={NEVER_TRIGGERS}\n data={NO_SUGGESTIONS}\n displayTransform={display => display}\n style={linkStyle}\n />\n )}\n </MentionsInput>\n );\n};\n\nUserMention.propTypes = {\n onChange: PropTypes.func,\n singleLine: PropTypes.bool,\n suggestionsPortalHost: PropTypes.shape({\n current: PropTypes.instanceOf(Element),\n }),\n value: PropTypes.string,\n inputRef: PropTypes.shape({}),\n classes: PropTypes.shape({\n avatar: PropTypes.string.isRequired,\n }).isRequired,\n withLightTheme: PropTypes.bool,\n placeholder: PropTypes.string,\n style: PropTypes.shape({}),\n mentionProps: PropTypes.shape({}),\n onMount: PropTypes.func,\n onKeyDown: PropTypes.func,\n onKeyUp: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n currentUser: PropTypes.shape({\n company_id: PropTypes.number.isRequired,\n }),\n companyId: PropTypes.number,\n isCompanySelectVisible: PropTypes.bool.isRequired,\n allowSuggestionsAboveCursor: PropTypes.bool,\n highlightLinks: PropTypes.bool,\n /** Show default users when only \"@\" is typed, instead of waiting for a search term. */\n allowEmptyQuery: PropTypes.bool,\n};\n\nconst DEFAULT_USER_MENTION_ON_CHANGE = () => undefined;\n\nconst DEFAULT_USER_MENTION_STYLE = {\n suggestions: {\n list: {\n background: '#414141',\n },\n item: {\n color: 'white',\n height: 30,\n '&focused': {\n backgroundColor: 'rgba(255, 255, 255, 0.08)',\n },\n },\n },\n};\n\nconst DEFAULT_USER_MENTION_MENTION_PROPS = {};\nconst DEFAULT_USER_MENTION_ON_MOUNT = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_DOWN = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_UP = () => undefined;\nconst DEFAULT_USER_MENTION_ON_FOCUS = () => undefined;\nconst DEFAULT_USER_MENTION_ON_BLUR = () => undefined;\n\nexport default withPermissionsHOC({ isCompanySelectVisible: PERMISSIONS.companySelectorView })(\n withStyles(muiStyles)(UserMention)\n);\n"],"names":["mentionLightStyle","backgroundColor","blue","mentionDarkStyle","color","linkStyle","outline","borderRadius","NEVER_TRIGGERS","NO_SUGGESTIONS","inputStyles","suggestions","item","darkThemeInputStyles","input","caretColor","zIndex","highlighter","lightThemeInputStyles","UserMention","_ref","_ref$onChange","onChange","DEFAULT_USER_MENTION_ON_CHANGE","_ref$singleLine","singleLine","_ref$suggestionsPorta","suggestionsPortalHost","_ref$value","value","_ref$inputRef","inputRef","classes","_ref$style","style","DEFAULT_USER_MENTION_STYLE","_ref$withLightTheme","withLightTheme","_ref$placeholder","placeholder","_ref$onMount","onMount","DEFAULT_USER_MENTION_ON_MOUNT","_ref$onKeyDown","onKeyDown","DEFAULT_USER_MENTION_ON_KEY_DOWN","_ref$onKeyUp","onKeyUp","DEFAULT_USER_MENTION_ON_KEY_UP","_ref$onFocus","onFocus","DEFAULT_USER_MENTION_ON_FOCUS","_ref$onBlur","onBlur","DEFAULT_USER_MENTION_ON_BLUR","_ref$autoFocus","autoFocus","_ref$disabled","disabled","_ref$companyId","companyId","_ref$currentUser","currentUser","isCompanySelectVisible","_ref$mentionProps","mentionProps","DEFAULT_USER_MENTION_MENTION_PROPS","_ref$allowSuggestions","allowSuggestionsAboveCursor","_ref$allowEmptyQuery","allowEmptyQuery","_ref$highlightLinks","highlightLinks","useEffect","debouncedUsersFetch","useCallback","debounce","search","callback","companyIds","company_id","handleFetchUsers","themedStyle","_themedStyle$input","textColor","_objectSpread","substring","visibility","_jsxs","MentionsInput","event","newValue","allowSpaceInQuery","classNames","styles","children","_jsx","Mention","markup","USER_MARKUP","renderSuggestion","entry","className","mention__suggestion","Avatar","alt","display","displayName","avatar","imgSrc","photo","mention__suggestion__info","concat","mention__suggestion__info__name","title","mention__suggestion__info__group","trigger","data","displayTransform","id","appendSpaceOnAdd","LINK_MARKUP","regex","URL_CAPTURE_PATTERN","propTypes","PropTypes","func","bool","shape","current","instanceOf","Element","string","isRequired","number","list","background","height","UserMention$1","withPermissionsHOC","PERMISSIONS","companySelectorView","withStyles","width","border"],"mappings":"2kDAiBA,IAUMA,EAAoB,CACxBC,gBAAiBC,EAAK,MAElBC,EAAmB,CACvBC,MAAO,WAKHC,EAAY,CAChBD,MAAO,4BACPH,gBAAiB,uDAEjBK,QAAS,iEACTC,aAAc,OAIVC,EAAiB,KACjBC,EAAiB,GAGjBC,EAAc,CAClBC,YAAa,CACXC,KAAM,CACJ,WAAY,CACVX,gBAAiB,0BAMnBY,SACDH,GAAW,CAAA,EAAA,CACdI,MAAO,CACLV,MAAO,OACPW,WAAY,OACZC,OAAQ,GAEVC,YAAa,CACXb,MAAO,UAILc,SACDR,GAAW,CAAA,EAAA,CACdI,MAAO,CAAEV,MAAO,UAyBZe,EAAc,SAwBdC,GAAA,IAAAC,EAAAD,EAvBJE,SAAAA,aAAWC,EAA8BF,EAAAG,EAAAJ,EACzCK,WAAAA,cAAkBD,EAAAE,EAAAN,EAClBO,sBAAAA,aAAwB,KAAID,EAAAE,EAAAR,EAC5BS,MAAAA,aAAQ,GAAED,EAAAE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B3H"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/UserMention/index.js"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { debounce } from 'lodash';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { MentionsInput, Mention } from 'react-mentions';\nimport blue from '@material-ui/core/colors/blue';\n\nimport { handleFetchUsers } from './utils';\n\nimport { URL_CAPTURE_PATTERN } from '~/utils/links';\nimport { USER_MARKUP, LINK_MARKUP } from './constants';\n\nimport styles from './style.css';\n\nimport Avatar from '~components/Avatar';\nimport { withPermissionsHOC, PERMISSIONS } from '~/permissions';\n\nconst PAGE_NAME = 'userMention';\n\nconst muiStyles = {\n avatar: {\n height: 45,\n width: 45,\n border: '1.5px solid #fff',\n },\n};\n\nconst mentionLightStyle = {\n backgroundColor: blue[100],\n};\nconst mentionDarkStyle = {\n color: '#00bcd4',\n};\n\n// Matches the mirror token in `LinkedText`, which react-mentions cannot share as a class.\n// Off the palette, not literal white, or the tint vanishes against a light theme.\nconst linkStyle = {\n color: 'var(--palette-info-light)',\n backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.04)',\n // Outline, not border: a border takes space and would shift the text.\n outline: '1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)',\n borderRadius: '4px',\n};\n\n// This mention exists to paint existing text, never to offer a suggestion.\n// `/$^/` looks like it never matches but matches the empty string, and react-mentions then reads\n// capture groups this regex does not have — every caret at the start of an empty composer threw.\nconst NEVER_TRIGGERS = /(?!)/;\nconst NO_SUGGESTIONS = [];\n\n// NOTE: IMPORTANT! 'input', 'mention' and 'highliter' should always have same font/latter/height/line etc values\nconst inputStyles = {\n suggestions: {\n item: {\n '&focused': {\n backgroundColor: 'rgba(0, 0, 0, 0.08)',\n },\n },\n },\n};\n\nconst darkThemeInputStyles = {\n ...inputStyles,\n input: {\n color: '#fff',\n caretColor: '#fff',\n zIndex: 1,\n },\n highlighter: {\n color: '#fff',\n },\n};\n\nconst lightThemeInputStyles = {\n ...inputStyles,\n input: { color: '#000' },\n};\n\nconst renderSuggestion = (entry, classes) => (\n <div className={styles.mention__suggestion}>\n <Avatar\n alt={entry.display}\n displayName={entry.display}\n className={classes.avatar}\n imgSrc={entry.photo}\n />\n <div className={styles.mention__suggestion__info}>\n <span\n data-testid={`${PAGE_NAME}_name_${entry.display}`}\n className={styles.mention__suggestion__info__name}\n >\n {entry.display}\n </span>\n {entry.title && (\n <span className={styles.mention__suggestion__info__group}>{entry.title}</span>\n )}\n </div>\n </div>\n);\n\nconst UserMention = ({\n onChange = DEFAULT_USER_MENTION_ON_CHANGE,\n singleLine = false,\n suggestionsPortalHost = null,\n value = '',\n inputRef = null,\n classes,\n style = DEFAULT_USER_MENTION_STYLE,\n withLightTheme = false,\n placeholder = \"Mention people using '@'\",\n onMount = DEFAULT_USER_MENTION_ON_MOUNT,\n onKeyDown = DEFAULT_USER_MENTION_ON_KEY_DOWN,\n onKeyUp = DEFAULT_USER_MENTION_ON_KEY_UP,\n onFocus = DEFAULT_USER_MENTION_ON_FOCUS,\n onBlur = DEFAULT_USER_MENTION_ON_BLUR,\n autoFocus = true,\n disabled = false,\n companyId = null,\n currentUser = null,\n isCompanySelectVisible,\n mentionProps = DEFAULT_USER_MENTION_MENTION_PROPS,\n allowSuggestionsAboveCursor = false,\n allowEmptyQuery = false,\n highlightLinks = false,\n}) => {\n useEffect(onMount, []);\n\n const fetchUsers = (search, callback) => {\n const companyIds =\n isCompanySelectVisible && currentUser && currentUser.company_id !== companyId\n ? [currentUser.company_id, companyId]\n : null;\n\n handleFetchUsers(search, callback, companyIds, allowEmptyQuery);\n };\n\n const debouncedUsersFetch = useCallback(debounce(fetchUsers, 400), [companyId, allowEmptyQuery]);\n\n const onInputChange = (event, newValue) => {\n onChange(newValue);\n };\n\n const themedStyle = {\n ...(withLightTheme ? lightThemeInputStyles : darkThemeInputStyles),\n ...style,\n };\n\n // react-mentions paints the text in the textarea and keeps the highlighter behind it, so a\n // mention's colour never shows through. Handing the text to the highlighter instead is what\n // lets a link carry the same token as the plain textareas do.\n if (highlightLinks) {\n const textColor = themedStyle.input?.color;\n\n themedStyle.input = { caretColor: textColor, ...themedStyle.input, color: 'transparent' };\n themedStyle.highlighter = {\n color: textColor,\n ...themedStyle.highlighter,\n substring: { visibility: 'visible' },\n };\n }\n\n return (\n <MentionsInput\n value={value}\n onChange={onInputChange}\n singleLine={singleLine}\n allowSpaceInQuery\n classNames={styles}\n placeholder={placeholder}\n suggestionsPortalHost={suggestionsPortalHost}\n inputRef={inputRef}\n style={themedStyle}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n autoFocus={autoFocus}\n onFocus={onFocus}\n onBlur={onBlur}\n disabled={disabled}\n allowSuggestionsAboveCursor={allowSuggestionsAboveCursor}\n >\n <Mention\n markup={USER_MARKUP}\n renderSuggestion={entry => renderSuggestion(entry, classes)}\n trigger=\"@\"\n data={debouncedUsersFetch}\n displayTransform={(id, display) => `@${display}`}\n style={withLightTheme ? mentionLightStyle : mentionDarkStyle}\n appendSpaceOnAdd\n {...mentionProps}\n />\n\n {/* Highlight only: a `regex` makes react-mentions style matching text without any markup\n of its own, so the url stays exactly as typed in the value it hands back. */}\n {highlightLinks && (\n <Mention\n markup={LINK_MARKUP}\n regex={URL_CAPTURE_PATTERN}\n trigger={NEVER_TRIGGERS}\n data={NO_SUGGESTIONS}\n displayTransform={display => display}\n style={linkStyle}\n />\n )}\n </MentionsInput>\n );\n};\n\nUserMention.propTypes = {\n onChange: PropTypes.func,\n singleLine: PropTypes.bool,\n suggestionsPortalHost: PropTypes.shape({\n current: PropTypes.instanceOf(Element),\n }),\n value: PropTypes.string,\n inputRef: PropTypes.shape({}),\n classes: PropTypes.shape({\n avatar: PropTypes.string.isRequired,\n }).isRequired,\n withLightTheme: PropTypes.bool,\n placeholder: PropTypes.string,\n style: PropTypes.shape({}),\n mentionProps: PropTypes.shape({}),\n onMount: PropTypes.func,\n onKeyDown: PropTypes.func,\n onKeyUp: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n currentUser: PropTypes.shape({\n company_id: PropTypes.number.isRequired,\n }),\n companyId: PropTypes.number,\n isCompanySelectVisible: PropTypes.bool.isRequired,\n allowSuggestionsAboveCursor: PropTypes.bool,\n highlightLinks: PropTypes.bool,\n /** Show default users when only \"@\" is typed, instead of waiting for a search term. */\n allowEmptyQuery: PropTypes.bool,\n};\n\nconst DEFAULT_USER_MENTION_ON_CHANGE = () => undefined;\n\nconst DEFAULT_USER_MENTION_STYLE = {\n suggestions: {\n list: {\n background: '#414141',\n },\n item: {\n color: 'white',\n height: 30,\n '&focused': {\n backgroundColor: 'rgba(255, 255, 255, 0.08)',\n },\n },\n },\n};\n\nconst DEFAULT_USER_MENTION_MENTION_PROPS = {};\nconst DEFAULT_USER_MENTION_ON_MOUNT = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_DOWN = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_UP = () => undefined;\nconst DEFAULT_USER_MENTION_ON_FOCUS = () => undefined;\nconst DEFAULT_USER_MENTION_ON_BLUR = () => undefined;\n\nexport default withPermissionsHOC({ isCompanySelectVisible: PERMISSIONS.companySelectorView })(\n withStyles(muiStyles)(UserMention)\n);\n"],"names":["mentionLightStyle","backgroundColor","blue","mentionDarkStyle","color","linkStyle","outline","borderRadius","NEVER_TRIGGERS","NO_SUGGESTIONS","inputStyles","suggestions","item","darkThemeInputStyles","input","caretColor","zIndex","highlighter","lightThemeInputStyles","UserMention","_ref","_ref$onChange","onChange","DEFAULT_USER_MENTION_ON_CHANGE","_ref$singleLine","singleLine","_ref$suggestionsPorta","suggestionsPortalHost","_ref$value","value","_ref$inputRef","inputRef","classes","_ref$style","style","DEFAULT_USER_MENTION_STYLE","_ref$withLightTheme","withLightTheme","_ref$placeholder","placeholder","_ref$onMount","onMount","DEFAULT_USER_MENTION_ON_MOUNT","_ref$onKeyDown","onKeyDown","DEFAULT_USER_MENTION_ON_KEY_DOWN","_ref$onKeyUp","onKeyUp","DEFAULT_USER_MENTION_ON_KEY_UP","_ref$onFocus","onFocus","DEFAULT_USER_MENTION_ON_FOCUS","_ref$onBlur","onBlur","DEFAULT_USER_MENTION_ON_BLUR","_ref$autoFocus","autoFocus","_ref$disabled","disabled","_ref$companyId","companyId","_ref$currentUser","currentUser","isCompanySelectVisible","_ref$mentionProps","mentionProps","DEFAULT_USER_MENTION_MENTION_PROPS","_ref$allowSuggestions","allowSuggestionsAboveCursor","_ref$allowEmptyQuery","allowEmptyQuery","_ref$highlightLinks","highlightLinks","useEffect","debouncedUsersFetch","useCallback","debounce","search","callback","companyIds","company_id","handleFetchUsers","themedStyle","_themedStyle$input","textColor","_objectSpread","substring","visibility","_jsxs","MentionsInput","event","newValue","allowSpaceInQuery","classNames","styles","children","_jsx","Mention","markup","USER_MARKUP","renderSuggestion","entry","className","mention__suggestion","Avatar","alt","display","displayName","avatar","imgSrc","photo","mention__suggestion__info","concat","mention__suggestion__info__name","title","mention__suggestion__info__group","trigger","data","displayTransform","id","appendSpaceOnAdd","LINK_MARKUP","regex","URL_CAPTURE_PATTERN","propTypes","PropTypes","func","bool","shape","current","instanceOf","Element","string","isRequired","number","list","background","height","UserMention$1","withPermissionsHOC","PERMISSIONS","companySelectorView","withStyles","width","border"],"mappings":"2kDAiBA,IAUMA,EAAoB,CACxBC,gBAAiBC,EAAK,MAElBC,EAAmB,CACvBC,MAAO,WAKHC,EAAY,CAChBD,MAAO,4BACPH,gBAAiB,uDAEjBK,QAAS,iEACTC,aAAc,OAMVC,EAAiB,OACjBC,EAAiB,GAGjBC,EAAc,CAClBC,YAAa,CACXC,KAAM,CACJ,WAAY,CACVX,gBAAiB,0BAMnBY,SACDH,GAAW,CAAA,EAAA,CACdI,MAAO,CACLV,MAAO,OACPW,WAAY,OACZC,OAAQ,GAEVC,YAAa,CACXb,MAAO,UAILc,SACDR,GAAW,CAAA,EAAA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