@wix/auto-patterns 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/cjs/collectionData/cms/CmsCollectionData.js +12 -7
  2. package/dist/cjs/collectionData/cms/CmsCollectionData.js.map +1 -1
  3. package/dist/cjs/collectionData/cms/filterUtils.js +2 -1
  4. package/dist/cjs/collectionData/cms/filterUtils.js.map +1 -1
  5. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +13 -15
  6. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  7. package/dist/cjs/components/AutoPatternsEntityPage/Fields/Checkbox.js +5 -8
  8. package/dist/cjs/components/AutoPatternsEntityPage/Fields/Checkbox.js.map +1 -1
  9. package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateInput.js +65 -0
  10. package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -0
  11. package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateTime.js +140 -0
  12. package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -0
  13. package/dist/cjs/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +16 -12
  14. package/dist/cjs/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -1
  15. package/dist/cjs/components/AutoPatternsEntityPage/Fields/LongText.js +36 -0
  16. package/dist/cjs/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -0
  17. package/dist/cjs/components/AutoPatternsEntityPage/Fields/Number.js +36 -0
  18. package/dist/cjs/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -0
  19. package/dist/cjs/components/AutoPatternsEntityPage/Fields/ShortText.js +8 -32
  20. package/dist/cjs/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -1
  21. package/dist/cjs/components/AutoPatternsEntityPage/Fields/Url.js +75 -0
  22. package/dist/cjs/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -0
  23. package/dist/cjs/components/AutoPatternsEntityPage/Fields/types.js +4 -0
  24. package/dist/cjs/components/AutoPatternsEntityPage/Fields/types.js.map +1 -0
  25. package/dist/cjs/components/AutoPatternsEntityPage/Fields/utils/dates.js +16 -0
  26. package/dist/cjs/components/AutoPatternsEntityPage/Fields/utils/dates.js.map +1 -0
  27. package/dist/cjs/index.js +12 -0
  28. package/dist/cjs/index.js.map +1 -1
  29. package/dist/cjs/types/types.js.map +1 -1
  30. package/dist/esm/collectionData/cms/CmsCollectionData.js +11 -6
  31. package/dist/esm/collectionData/cms/CmsCollectionData.js.map +1 -1
  32. package/dist/esm/collectionData/cms/filterUtils.js +2 -1
  33. package/dist/esm/collectionData/cms/filterUtils.js.map +1 -1
  34. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +1 -3
  35. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  36. package/dist/esm/components/AutoPatternsEntityPage/Fields/Checkbox.js +3 -5
  37. package/dist/esm/components/AutoPatternsEntityPage/Fields/Checkbox.js.map +1 -1
  38. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js +46 -0
  39. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -0
  40. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js +97 -0
  41. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -0
  42. package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +16 -12
  43. package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -1
  44. package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js +17 -0
  45. package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -0
  46. package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js +17 -0
  47. package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -0
  48. package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js +4 -27
  49. package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -1
  50. package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js +39 -0
  51. package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -0
  52. package/dist/esm/components/AutoPatternsEntityPage/Fields/types.js +2 -0
  53. package/dist/esm/components/AutoPatternsEntityPage/Fields/types.js.map +1 -0
  54. package/dist/esm/components/AutoPatternsEntityPage/Fields/utils/dates.js +10 -0
  55. package/dist/esm/components/AutoPatternsEntityPage/Fields/utils/dates.js.map +1 -0
  56. package/dist/esm/index.js +2 -0
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/types/types.js.map +1 -1
  59. package/dist/types/collectionData/cms/CmsCollectionData.d.ts +2 -2
  60. package/dist/types/collectionData/cms/CmsCollectionData.d.ts.map +1 -1
  61. package/dist/types/collectionData/cms/filterUtils.d.ts.map +1 -1
  62. package/dist/types/components/AutoPatternsEntityPage/AutoPatternsEntityPage.d.ts.map +1 -1
  63. package/dist/types/components/AutoPatternsEntityPage/Fields/Checkbox.d.ts +1 -1
  64. package/dist/types/components/AutoPatternsEntityPage/Fields/Checkbox.d.ts.map +1 -1
  65. package/dist/types/components/AutoPatternsEntityPage/Fields/DateInput.d.ts +6 -0
  66. package/dist/types/components/AutoPatternsEntityPage/Fields/DateInput.d.ts.map +1 -0
  67. package/dist/types/components/AutoPatternsEntityPage/Fields/DateTime.d.ts +6 -0
  68. package/dist/types/components/AutoPatternsEntityPage/Fields/DateTime.d.ts.map +1 -0
  69. package/dist/types/components/AutoPatternsEntityPage/Fields/FormFieldInput.d.ts +2 -8
  70. package/dist/types/components/AutoPatternsEntityPage/Fields/FormFieldInput.d.ts.map +1 -1
  71. package/dist/types/components/AutoPatternsEntityPage/Fields/LongText.d.ts +6 -0
  72. package/dist/types/components/AutoPatternsEntityPage/Fields/LongText.d.ts.map +1 -0
  73. package/dist/types/components/AutoPatternsEntityPage/Fields/Number.d.ts +6 -0
  74. package/dist/types/components/AutoPatternsEntityPage/Fields/Number.d.ts.map +1 -0
  75. package/dist/types/components/AutoPatternsEntityPage/Fields/ShortText.d.ts +2 -9
  76. package/dist/types/components/AutoPatternsEntityPage/Fields/ShortText.d.ts.map +1 -1
  77. package/dist/types/components/AutoPatternsEntityPage/Fields/Url.d.ts +6 -0
  78. package/dist/types/components/AutoPatternsEntityPage/Fields/Url.d.ts.map +1 -0
  79. package/dist/types/components/AutoPatternsEntityPage/Fields/types.d.ts +11 -0
  80. package/dist/types/components/AutoPatternsEntityPage/Fields/types.d.ts.map +1 -0
  81. package/dist/types/components/AutoPatternsEntityPage/Fields/utils/dates.d.ts +3 -0
  82. package/dist/types/components/AutoPatternsEntityPage/Fields/utils/dates.d.ts.map +1 -0
  83. package/dist/types/index.d.ts +2 -0
  84. package/dist/types/index.d.ts.map +1 -1
  85. package/dist/types/types/types.d.ts +3 -5
  86. package/dist/types/types/types.d.ts.map +1 -1
  87. package/package.json +2 -2
@@ -1,19 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.CmsColumnTypeToPatternsColumnType = void 0;
4
+ exports.CmsFieldTypeToPatternsFieldType = void 0;
5
5
  exports.fetchCmsSchema = fetchCmsSchema;
6
6
  exports.getCmsCollectionData = getCmsCollectionData;
7
7
  var _data = require("@wix/data");
8
8
  var _filterUtils = require("./filterUtils");
9
9
  var _sortUtils = require("./sortUtils");
10
- const CmsColumnTypeToPatternsColumnType = exports.CmsColumnTypeToPatternsColumnType = {
11
- [_data.collections.Type.TEXT]: 'STRING',
12
- [_data.collections.Type.ARRAY]: 'ARRAY',
10
+ const CmsFieldTypeToPatternsFieldType = exports.CmsFieldTypeToPatternsFieldType = {
11
+ [_data.collections.Type.TEXT]: 'SHORT_TEXT',
13
12
  [_data.collections.Type.DATE]: 'DATE',
14
13
  [_data.collections.Type.DATETIME]: 'DATETIME',
15
14
  [_data.collections.Type.NUMBER]: 'NUMBER',
16
- [_data.collections.Type.BOOLEAN]: 'BOOLEAN'
15
+ [_data.collections.Type.BOOLEAN]: 'BOOLEAN',
16
+ [_data.collections.Type.URL]: 'URL',
17
+ [_data.collections.Type.ADDRESS]: 'SHORT_TEXT',
18
+ [_data.collections.Type.OBJECT]: 'LONG_TEXT',
19
+ [_data.collections.Type.RICH_TEXT]: 'LONG_TEXT',
20
+ [_data.collections.Type.RICH_CONTENT]: 'SHORT_TEXT',
21
+ [_data.collections.Type.ARRAY]: 'ARRAY',
22
+ [_data.collections.Type.ARRAY_STRING]: 'ARRAY'
17
23
  };
18
24
  async function fetchCmsSchema(collectionId) {
19
25
  const schema = await _data.collections.getDataCollection(collectionId);
@@ -26,8 +32,7 @@ async function fetchCmsSchema(collectionId) {
26
32
  }
27
33
  acc[field.key] = {
28
34
  id: field.key,
29
- type: field.type ? CmsColumnTypeToPatternsColumnType[field.type] || 'STRING' : 'STRING',
30
- originalType: field.type ?? _data.collections.Type.TEXT,
35
+ type: field.type ? CmsFieldTypeToPatternsFieldType[field.type] || 'SHORT_TEXT' : 'SHORT_TEXT',
31
36
  displayName: field.displayName || '',
32
37
  capabilities: {
33
38
  supportedQueryOperators: ((_field$capabilities = field.capabilities) == null ? void 0 : _field$capabilities.queryOperators) || [],
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_filterUtils","_sortUtils","CmsColumnTypeToPatternsColumnType","exports","collections","Type","TEXT","ARRAY","DATE","DATETIME","NUMBER","BOOLEAN","fetchCmsSchema","collectionId","schema","getDataCollection","displayField","fields","reduce","acc","field","_field$capabilities","_field$capabilities2","key","id","type","originalType","displayName","capabilities","supportedQueryOperators","queryOperators","sortable","actions","get","entityId","items","create","entity","insert","update","delete","remove","getCmsCollectionData","config","visibleFieldIds","collection","fetchData","query","dataQuery","addSearchToDataQuery","addFiltersToDataQuery","addSortToDataQuery","res","skip","offset","limit","find","returnTotalCount","total","totalCount","entityIdKey","entityNameKey"],"sources":["../../../../src/collectionData/cms/CmsCollectionData.ts"],"sourcesContent":["import { Field, SchemaConfig, PatternsColumnType } from '../../types';\nimport { collections, items } from '@wix/data';\nimport { CollectionData } from '../CollectionData';\nimport { ComputedQuery } from '@wix/patterns';\nimport { addFiltersToDataQuery, addSearchToDataQuery } from './filterUtils';\nimport { addSortToDataQuery } from './sortUtils';\nimport { CollectionConfig } from '../../types/CollectionPageConfig';\n\nexport const CmsColumnTypeToPatternsColumnType: Partial<\n Record<collections.Type, PatternsColumnType>\n> = {\n [collections.Type.TEXT]: 'STRING',\n [collections.Type.ARRAY]: 'ARRAY',\n [collections.Type.DATE]: 'DATE',\n [collections.Type.DATETIME]: 'DATETIME',\n [collections.Type.NUMBER]: 'NUMBER',\n [collections.Type.BOOLEAN]: 'BOOLEAN',\n};\n\nexport async function fetchCmsSchema(\n collectionId: CollectionConfig['collectionId'],\n): Promise<SchemaConfig> {\n const schema = await collections.getDataCollection(collectionId);\n return {\n displayField: schema.displayField ?? '_id',\n fields: schema.fields.reduce((acc, field) => {\n if (!field.key) {\n return acc;\n }\n\n acc[field.key] = {\n id: field.key,\n type: field.type\n ? CmsColumnTypeToPatternsColumnType[field.type] || 'STRING'\n : 'STRING',\n originalType: field.type ?? collections.Type.TEXT,\n displayName: field.displayName || '',\n capabilities: {\n supportedQueryOperators: field.capabilities?.queryOperators || [],\n sortable: field.capabilities?.sortable || false,\n },\n };\n\n return acc;\n }, {} as Record<string, Field>),\n actions: {\n get: (entityId: string) => {\n return items.get(collectionId, entityId);\n },\n create: (entity) => {\n return items.insert(collectionId, entity);\n },\n update: (entity) => {\n return items.update(collectionId, entity);\n },\n delete: (entityId) => {\n return items.remove(collectionId, entityId);\n },\n },\n };\n}\n\nexport async function getCmsCollectionData(\n config: CollectionConfig,\n visibleFieldIds: string[],\n): Promise<CollectionData> {\n const schema = await fetchCmsSchema(config.collectionId);\n\n const collection = {\n fetchData: async (query: ComputedQuery<any>) => {\n let dataQuery = items.query(config.collectionId);\n dataQuery = addSearchToDataQuery({\n dataQuery,\n query,\n schema,\n visibleFieldIds,\n });\n dataQuery = addFiltersToDataQuery({\n dataQuery,\n query,\n schema,\n });\n dataQuery = addSortToDataQuery({\n dataQuery,\n query,\n schema,\n });\n const res = await dataQuery\n .skip(query.offset)\n .limit(query.limit)\n .find({ returnTotalCount: true });\n\n return {\n items: res.items,\n total: res.totalCount,\n };\n },\n };\n\n return {\n schema,\n collection,\n entityIdKey: '_id',\n entityNameKey: schema.displayField,\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAGO,MAAMG,iCAEZ,GAAAC,OAAA,CAAAD,iCAAA,GAAG;EACF,CAACE,iBAAW,CAACC,IAAI,CAACC,IAAI,GAAG,QAAQ;EACjC,CAACF,iBAAW,CAACC,IAAI,CAACE,KAAK,GAAG,OAAO;EACjC,CAACH,iBAAW,CAACC,IAAI,CAACG,IAAI,GAAG,MAAM;EAC/B,CAACJ,iBAAW,CAACC,IAAI,CAACI,QAAQ,GAAG,UAAU;EACvC,CAACL,iBAAW,CAACC,IAAI,CAACK,MAAM,GAAG,QAAQ;EACnC,CAACN,iBAAW,CAACC,IAAI,CAACM,OAAO,GAAG;AAC9B,CAAC;AAEM,eAAeC,cAAcA,CAClCC,YAA8C,EACvB;EACvB,MAAMC,MAAM,GAAG,MAAMV,iBAAW,CAACW,iBAAiB,CAACF,YAAY,CAAC;EAChE,OAAO;IACLG,YAAY,EAAEF,MAAM,CAACE,YAAY,IAAI,KAAK;IAC1CC,MAAM,EAAEH,MAAM,CAACG,MAAM,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;MAAA,IAAAC,mBAAA,EAAAC,oBAAA;MAC3C,IAAI,CAACF,KAAK,CAACG,GAAG,EAAE;QACd,OAAOJ,GAAG;MACZ;MAEAA,GAAG,CAACC,KAAK,CAACG,GAAG,CAAC,GAAG;QACfC,EA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C,KAAyB,IAAK;MAC9C,IAAIC,SAAS,GAAGb,WAAK,CAACY,KAAK,CAACJ,MAAM,CAAC9B,YAAY,CAAC;MAChDmC,SAAS,GAAG,IAAAC,iCAAoB,EAAC;QAC/BD,SAAS;QACTD,KAAK;QACLjC,MAAM;QACN8B;MACF,CAAC,CAAC;MACFI,SAAS,GAAG,IAAAE,kCAAqB,EAAC;QAChCF,SAAS;QACTD,KAAK;QACLjC;MACF,CAAC,CAAC;MACFkC,SAAS,GAAG,IAAAG,6BAAkB,EAAC;QAC7BH,SAAS;QACTD,KAAK;QACLjC;MACF,CAAC,CAAC;MACF,MAAMsC,GAAG,GAAG,MAAMJ,SAAS,CACxBK,IAAI,CAACN,KAAK,CAACO,MAAM,CAAC,CAClBC,KAAK,CAACR,KAAK,CAACQ,KAAK,CAAC,CAClBC,IAAI,CAAC;QAAEC,gBAAgB,EAAE;MAAK,CAAC,CAAC;MAEnC,OAAO;QACLtB,KAAK,EAAEiB,GAAG,CAACjB,KAAK;QAChBuB,KAAK,EAAEN,GAAG,CAACO;MACb,CAAC;IACH;EACF,CAAC;EAED,OAAO;IACL7C,MAAM;IACN+B,UAAU;IACVe,WAAW,EAAE,KAAK;IAClBC,aAAa,EAAE/C,MAAM,CAACE;EACxB,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_filterUtils","_sortUtils","CmsFieldTypeToPatternsFieldType","exports","collections","Type","TEXT","DATE","DATETIME","NUMBER","BOOLEAN","URL","ADDRESS","OBJECT","RICH_TEXT","RICH_CONTENT","ARRAY","ARRAY_STRING","fetchCmsSchema","collectionId","schema","getDataCollection","displayField","fields","reduce","acc","field","_field$capabilities","_field$capabilities2","key","id","type","displayName","capabilities","supportedQueryOperators","queryOperators","sortable","actions","get","entityId","items","create","entity","insert","update","delete","remove","getCmsCollectionData","config","visibleFieldIds","collection","fetchData","query","dataQuery","addSearchToDataQuery","addFiltersToDataQuery","addSortToDataQuery","res","skip","offset","limit","find","returnTotalCount","total","totalCount","entityIdKey","entityNameKey"],"sources":["../../../../src/collectionData/cms/CmsCollectionData.ts"],"sourcesContent":["import { Field, SchemaConfig, PatternsFieldType } from '../../types';\nimport { collections, items } from '@wix/data';\nimport { CollectionData } from '../CollectionData';\nimport { ComputedQuery } from '@wix/patterns';\nimport { addFiltersToDataQuery, addSearchToDataQuery } from './filterUtils';\nimport { addSortToDataQuery } from './sortUtils';\nimport { CollectionConfig } from '../../types/CollectionPageConfig';\n\nexport const CmsFieldTypeToPatternsFieldType: Partial<\n Record<collections.Type, PatternsFieldType>\n> = {\n [collections.Type.TEXT]: 'SHORT_TEXT',\n [collections.Type.DATE]: 'DATE',\n [collections.Type.DATETIME]: 'DATETIME',\n [collections.Type.NUMBER]: 'NUMBER',\n [collections.Type.BOOLEAN]: 'BOOLEAN',\n [collections.Type.URL]: 'URL',\n [collections.Type.ADDRESS]: 'SHORT_TEXT',\n [collections.Type.OBJECT]: 'LONG_TEXT',\n [collections.Type.RICH_TEXT]: 'LONG_TEXT',\n [collections.Type.RICH_CONTENT]: 'SHORT_TEXT',\n [collections.Type.ARRAY]: 'ARRAY',\n [collections.Type.ARRAY_STRING]: 'ARRAY',\n};\n\nexport async function fetchCmsSchema(\n collectionId: CollectionConfig['collectionId'],\n): Promise<SchemaConfig> {\n const schema = await collections.getDataCollection(collectionId);\n return {\n displayField: schema.displayField ?? '_id',\n fields: schema.fields.reduce((acc, field) => {\n if (!field.key) {\n return acc;\n }\n\n acc[field.key] = {\n id: field.key,\n type: field.type\n ? CmsFieldTypeToPatternsFieldType[field.type] || 'SHORT_TEXT'\n : 'SHORT_TEXT',\n displayName: field.displayName || '',\n capabilities: {\n supportedQueryOperators: field.capabilities?.queryOperators || [],\n sortable: field.capabilities?.sortable || false,\n },\n };\n\n return acc;\n }, {} as Record<string, Field>),\n actions: {\n get: (entityId: string) => {\n return items.get(collectionId, entityId);\n },\n create: (entity) => {\n return items.insert(collectionId, entity);\n },\n update: (entity) => {\n return items.update(collectionId, entity);\n },\n delete: (entityId) => {\n return items.remove(collectionId, entityId);\n },\n },\n };\n}\n\nexport async function getCmsCollectionData(\n config: CollectionConfig,\n visibleFieldIds: string[],\n): Promise<CollectionData> {\n const schema = await fetchCmsSchema(config.collectionId);\n\n const collection = {\n fetchData: async (query: ComputedQuery<any>) => {\n let dataQuery = items.query(config.collectionId);\n dataQuery = addSearchToDataQuery({\n dataQuery,\n query,\n schema,\n visibleFieldIds,\n });\n dataQuery = addFiltersToDataQuery({\n dataQuery,\n query,\n schema,\n });\n dataQuery = addSortToDataQuery({\n dataQuery,\n query,\n schema,\n });\n const res = await dataQuery\n .skip(query.offset)\n .limit(query.limit)\n .find({ returnTotalCount: true });\n\n return {\n items: res.items,\n total: res.totalCount,\n };\n },\n };\n\n return {\n schema,\n collection,\n entityIdKey: '_id',\n entityNameKey: schema.displayField,\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAGO,MAAMG,+BAEZ,GAAAC,OAAA,CAAAD,+BAAA,GAAG;EACF,CAACE,iBAAW,CAACC,IAAI,CAACC,IAAI,GAAG,YAAY;EACrC,CAACF,iBAAW,CAACC,IAAI,CAACE,IAAI,GAAG,MAAM;EAC/B,CAACH,iBAAW,CAACC,IAAI,CAACG,QAAQ,GAAG,UAAU;EACvC,CAACJ,iBAAW,CAACC,IAAI,CAACI,MAAM,GAAG,QAAQ;EACnC,CAACL,iBAAW,CAACC,IAAI,CAACK,OAAO,GAAG,SAAS;EACrC,CAACN,iBAAW,CAACC,IAAI,CAACM,GAAG,GAAG,KAAK;EAC7B,CAACP,iBAAW,CAACC,IAAI,CAACO,OAAO,GAAG,YAAY;EACxC,CAACR,iBAAW,CAACC,IAAI,CAACQ,MAAM,GAAG,WAAW;EACtC,CAACT,iBAAW,CAACC,IAAI,CAACS,SAAS,GAAG,WAAW;EACzC,CAACV,iBAAW,CAACC,IAAI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;IAClBC,aAAa,EAAE9C,MAAM,CAACE;EACxB,CAAC;AACH","ignoreList":[]}
@@ -70,6 +70,7 @@ function addFiltersToDataQuery({
70
70
  }
71
71
  return dataQueryWithFilters;
72
72
  }
73
+ const TEXT_FIELD_TYPES = ['LONG_TEXT', 'SHORT_TEXT'];
73
74
  function addSearchToDataQuery({
74
75
  dataQuery,
75
76
  query,
@@ -79,7 +80,7 @@ function addSearchToDataQuery({
79
80
  const searchableFields = Object.keys(schema.fields).filter(key => {
80
81
  const field = schema.fields[key];
81
82
  const column = visibleFieldIds.find(id => id === key);
82
- return column && field && field.type === 'STRING';
83
+ return column && field && TEXT_FIELD_TYPES.includes(field.type);
83
84
  });
84
85
  if (query.search && searchableFields.length > 0) {
85
86
  let searchFilter = null;
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_constants","FilterPropToMethod","from","to","isValidFilterProp","prop","getOperatorForFilter","undefined","isSupportedOperator","schema","filterProp","filterKey","field","fields","operator","FilterPropToOperator","supportedOperators","capabilities","supportedQueryOperators","includes","addFiltersToDataQuery","dataQuery","query","dataQueryWithFilters","filters","fieldKey","filter","Array","isArray","_schema$fields$fieldK","filterArray","type","some","item","id","BooleanFilters","checked","eq","hasSome","map","filterObj","value","addSearchToDataQuery","visibleFieldIds","searchableFields","Object","keys","key","column","find","search","length","searchFilter","forEach","currentFilter","items","contains","or","and"],"sources":["../../../../src/collectionData/cms/filterUtils.ts"],"sourcesContent":["import { ComputedQuery } from '@wix/patterns';\nimport { items } from '@wix/data';\nimport { BooleanFilters, FilterProp, FilterPropToOperator } from '../constants';\nimport { SchemaConfig } from '../../types';\n\nexport type CmsOperatorMethod = 'ge' | 'le';\n\nconst FilterPropToMethod: Record<FilterProp, CmsOperatorMethod> = {\n from: 'ge',\n to: 'le',\n};\n\nfunction isValidFilterProp(prop: string): prop is FilterProp {\n return prop in FilterPropToMethod;\n}\n\nfunction getOperatorForFilter(prop: string): CmsOperatorMethod | undefined {\n if (isValidFilterProp(prop)) {\n return FilterPropToMethod[prop];\n }\n return undefined;\n}\n\nconst isSupportedOperator = (\n schema: SchemaConfig,\n filterProp: string,\n filterKey: string,\n) => {\n const field = schema.fields[filterKey];\n if (!field) {\n return false;\n }\n\n if (!isValidFilterProp(filterProp)) {\n return false;\n }\n\n const operator = FilterPropToOperator[filterProp];\n const supportedOperators = field.capabilities.supportedQueryOperators;\n return supportedOperators.includes(operator);\n};\n\nexport function addFiltersToDataQuery({\n dataQuery,\n query,\n schema,\n}: {\n dataQuery: items.WixDataQuery;\n query: ComputedQuery<any>;\n schema: SchemaConfig;\n}) {\n let dataQueryWithFilters = dataQuery;\n const { filters } = query;\n for (const fieldKey in filters) {\n const filter = filters[fieldKey];\n if (filter) {\n if (Array.isArray(filter)) {\n const filterArray = filter as { [key: string]: any }[];\n if (schema.fields[fieldKey]?.type === 'BOOLEAN') {\n if (filterArray.some((item) => item.id === BooleanFilters.checked)) {\n dataQueryWithFilters = dataQueryWithFilters.eq(fieldKey, true);\n } else {\n dataQueryWithFilters = dataQueryWithFilters.eq(fieldKey, false);\n }\n } else {\n dataQueryWithFilters = dataQueryWithFilters.hasSome(\n fieldKey,\n filterArray.map((item) => item.id),\n );\n }\n } else if (typeof filter === 'object') {\n const filterObj = filter as Record<string, any>;\n\n for (const filterProp in filterObj) {\n const operator = getOperatorForFilter(filterProp);\n if (\n operator &&\n typeof dataQuery[operator] === 'function' &&\n isSupportedOperator(schema, filterProp, fieldKey)\n ) {\n const value = filterObj[filterProp];\n if (value !== undefined && value !== null) {\n dataQueryWithFilters = dataQueryWithFilters[operator](\n fieldKey,\n value,\n );\n }\n }\n }\n }\n }\n }\n\n return dataQueryWithFilters;\n}\n\nexport function addSearchToDataQuery({\n dataQuery,\n query,\n schema,\n visibleFieldIds,\n}: {\n dataQuery: items.WixDataQuery;\n query: ComputedQuery<any>;\n schema: SchemaConfig;\n visibleFieldIds: string[];\n}) {\n const searchableFields = Object.keys(schema.fields).filter((key) => {\n const field = schema.fields[key];\n const column = visibleFieldIds.find((id) => id === key);\n\n return column && field && field.type === 'STRING';\n });\n\n if (query.search && searchableFields.length > 0) {\n let searchFilter: items.WixDataFilter | null = null;\n\n searchableFields.forEach((field) => {\n const currentFilter = items.filter().contains(field, query.search!);\n searchFilter = searchFilter\n ? searchFilter.or(currentFilter)\n : currentFilter;\n });\n\n if (searchFilter) {\n dataQuery = dataQuery.and(searchFilter);\n }\n }\n\n return dataQuery;\n}\n"],"mappings":";;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,MAAME,kBAAyD,GAAG;EAChEC,IAAI,EAAE,IAAI;EACVC,EAAE,EAAE;AACN,CAAC;AAED,SAASC,iBAAiBA,CAACC,IAAY,EAAsB;EAC3D,OAAOA,IAAI,IAAIJ,kBAAkB;AACnC;AAEA,SAASK,oBAAoBA,CAACD,IAAY,EAAiC;EACzE,IAAID,iBAAiB,CAACC,IAAI,CAAC,EAAE;IAC3B,OAAOJ,kBAAkB,CAACI,IAAI,CAAC;EACjC;EACA,OAAOE,SAAS;AAClB;AAEA,MAAMC,mBAAmB,GAAGA,CAC1BC,MAAoB,EACpBC,UAAkB,EAClBC,SAAiB,KACd;EACH,MAAMC,KAAK,GAAGH,MAAM,CAACI,MAAM,CAACF,SAAS,CAAC;EACtC,IAAI,CAACC,KAAK,EAAE;IACV,OAAO,KAAK;EACd;EAEA,IAAI,CAACR,iBAAiB,CAACM,UAAU,CAAC,EAAE;IAClC,OAAO,KAAK;EACd;EAEA,MAAMI,QAAQ,GAAGC,+BAAoB,CAACL,UAAU,CAAC;EACjD,MAAMM,kBAAkB,GAAGJ,KAAK,CAACK,YAAY,CAACC,uBAAuB;EACrE,OAAOF,kBAAkB,CAACG,QAAQ,CAACL,QAAQ,CAAC;AAC9C,CAAC;AAEM,SAASM,qBAAqBA,CAAC;EACpCC,SAAS;EACTC,KAAK;EACLb;AAKF,CAAC,EAAE;EACD,IAAIc,oBAAoB,GAAGF,SAAS;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K,KAAKlC,SAAS,IAAIkC,KAAK,KAAK,IAAI,EAAE;cACzClB,oBAAoB,GAAGA,oBAAoB,CAACT,QAAQ,CAAC,CACnDW,QAAQ,EACRgB,KACF,CAAC;YACH;UACF;QACF;MACF;IACF;EACF;EAEA,OAAOlB,oBAAoB;AAC7B;AAEO,SAASmB,oBAAoBA,CAAC;EACnCrB,SAAS;EACTC,KAAK;EACLb,MAAM;EACNkC;AAMF,CAAC,EAAE;EACD,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,IAAI,CAACrC,MAAM,CAACI,MAAM,CAAC,CAACa,MAAM,CAAEqB,GAAG,IAAK;IAClE,MAAMnC,KAAK,GAAGH,MAAM,CAACI,MAAM,CAACkC,GAAG,CAAC;IAChC,MAAMC,MAAM,GAAGL,eAAe,CAACM,IAAI,CAAEf,EAAE,IAAKA,EAAE,KAAKa,GAAG,CAAC;IAEvD,OAAOC,MAAM,IAAIpC,KAAK,IAAIA,KAAK,CAACmB,IAAI,KAAK,QAAQ;EACnD,CAAC,CAAC;EAEF,IAAIT,KAAK,CAAC4B,MAAM,IAAIN,gBAAgB,CAACO,MAAM,GAAG,CAAC,EAAE;IAC/C,IAAIC,YAAwC,GAAG,IAAI;IAEnDR,gBAAgB,CAACS,OAAO,CAAEzC,KAAK,IAAK;MAClC,MAAM0C,aAAa,GAAGC,WAAK,CAAC7B,MAAM,CAAC,CAAC,CAAC8B,QAAQ,CAAC5C,KAAK,EAAEU,KAAK,CAAC4B,MAAO,CAAC;MACnEE,YAAY,GAAGA,YAAY,GACvBA,YAAY,CAACK,EAAE,CAACH,aAAa,CAAC,GAC9BA,aAAa;IACnB,CAAC,CAAC;IAEF,IAAIF,YAAY,EAAE;MAChB/B,SAAS,GAAGA,SAAS,CAACqC,GAAG,CAACN,YAAY,CAAC;IACzC;EACF;EAEA,OAAO/B,SAAS;AAClB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_constants","FilterPropToMethod","from","to","isValidFilterProp","prop","getOperatorForFilter","undefined","isSupportedOperator","schema","filterProp","filterKey","field","fields","operator","FilterPropToOperator","supportedOperators","capabilities","supportedQueryOperators","includes","addFiltersToDataQuery","dataQuery","query","dataQueryWithFilters","filters","fieldKey","filter","Array","isArray","_schema$fields$fieldK","filterArray","type","some","item","id","BooleanFilters","checked","eq","hasSome","map","filterObj","value","TEXT_FIELD_TYPES","addSearchToDataQuery","visibleFieldIds","searchableFields","Object","keys","key","column","find","search","length","searchFilter","forEach","currentFilter","items","contains","or","and"],"sources":["../../../../src/collectionData/cms/filterUtils.ts"],"sourcesContent":["import { ComputedQuery } from '@wix/patterns';\nimport { items } from '@wix/data';\nimport { BooleanFilters, FilterProp, FilterPropToOperator } from '../constants';\nimport { SchemaConfig } from '../../types';\n\nexport type CmsOperatorMethod = 'ge' | 'le';\n\nconst FilterPropToMethod: Record<FilterProp, CmsOperatorMethod> = {\n from: 'ge',\n to: 'le',\n};\n\nfunction isValidFilterProp(prop: string): prop is FilterProp {\n return prop in FilterPropToMethod;\n}\n\nfunction getOperatorForFilter(prop: string): CmsOperatorMethod | undefined {\n if (isValidFilterProp(prop)) {\n return FilterPropToMethod[prop];\n }\n return undefined;\n}\n\nconst isSupportedOperator = (\n schema: SchemaConfig,\n filterProp: string,\n filterKey: string,\n) => {\n const field = schema.fields[filterKey];\n if (!field) {\n return false;\n }\n\n if (!isValidFilterProp(filterProp)) {\n return false;\n }\n\n const operator = FilterPropToOperator[filterProp];\n const supportedOperators = field.capabilities.supportedQueryOperators;\n return supportedOperators.includes(operator);\n};\n\nexport function addFiltersToDataQuery({\n dataQuery,\n query,\n schema,\n}: {\n dataQuery: items.WixDataQuery;\n query: ComputedQuery<any>;\n schema: SchemaConfig;\n}) {\n let dataQueryWithFilters = dataQuery;\n const { filters } = query;\n for (const fieldKey in filters) {\n const filter = filters[fieldKey];\n if (filter) {\n if (Array.isArray(filter)) {\n const filterArray = filter as { [key: string]: any }[];\n if (schema.fields[fieldKey]?.type === 'BOOLEAN') {\n if (filterArray.some((item) => item.id === BooleanFilters.checked)) {\n dataQueryWithFilters = dataQueryWithFilters.eq(fieldKey, true);\n } else {\n dataQueryWithFilters = dataQueryWithFilters.eq(fieldKey, false);\n }\n } else {\n dataQueryWithFilters = dataQueryWithFilters.hasSome(\n fieldKey,\n filterArray.map((item) => item.id),\n );\n }\n } else if (typeof filter === 'object') {\n const filterObj = filter as Record<string, any>;\n\n for (const filterProp in filterObj) {\n const operator = getOperatorForFilter(filterProp);\n if (\n operator &&\n typeof dataQuery[operator] === 'function' &&\n isSupportedOperator(schema, filterProp, fieldKey)\n ) {\n const value = filterObj[filterProp];\n if (value !== undefined && value !== null) {\n dataQueryWithFilters = dataQueryWithFilters[operator](\n fieldKey,\n value,\n );\n }\n }\n }\n }\n }\n }\n\n return dataQueryWithFilters;\n}\n\nconst TEXT_FIELD_TYPES = ['LONG_TEXT', 'SHORT_TEXT'];\nexport function addSearchToDataQuery({\n dataQuery,\n query,\n schema,\n visibleFieldIds,\n}: {\n dataQuery: items.WixDataQuery;\n query: ComputedQuery<any>;\n schema: SchemaConfig;\n visibleFieldIds: string[];\n}) {\n const searchableFields = Object.keys(schema.fields).filter((key) => {\n const field = schema.fields[key];\n const column = visibleFieldIds.find((id) => id === key);\n\n return column && field && TEXT_FIELD_TYPES.includes(field.type);\n });\n\n if (query.search && searchableFields.length > 0) {\n let searchFilter: items.WixDataFilter | null = null;\n\n searchableFields.forEach((field) => {\n const currentFilter = items.filter().contains(field, query.search!);\n searchFilter = searchFilter\n ? searchFilter.or(currentFilter)\n : currentFilter;\n });\n\n if (searchFilter) {\n dataQuery = dataQuery.and(searchFilter);\n }\n }\n\n return dataQuery;\n}\n"],"mappings":";;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,MAAME,kBAAyD,GAAG;EAChEC,IAAI,EAAE,IAAI;EACVC,EAAE,EAAE;AACN,CAAC;AAED,SAASC,iBAAiBA,CAACC,IAAY,EAAsB;EAC3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GH,MAAM,CAACI,MAAM,CAACmC,GAAG,CAAC;IAChC,MAAMC,MAAM,GAAGL,eAAe,CAACM,IAAI,CAAEhB,EAAE,IAAKA,EAAE,KAAKc,GAAG,CAAC;IAEvD,OAAOC,MAAM,IAAIrC,KAAK,IAAI8B,gBAAgB,CAACvB,QAAQ,CAACP,KAAK,CAACmB,IAAI,CAAC;EACjE,CAAC,CAAC;EAEF,IAAIT,KAAK,CAAC6B,MAAM,IAAIN,gBAAgB,CAACO,MAAM,GAAG,CAAC,EAAE;IAC/C,IAAIC,YAAwC,GAAG,IAAI;IAEnDR,gBAAgB,CAACS,OAAO,CAAE1C,KAAK,IAAK;MAClC,MAAM2C,aAAa,GAAGC,WAAK,CAAC9B,MAAM,CAAC,CAAC,CAAC+B,QAAQ,CAAC7C,KAAK,EAAEU,KAAK,CAAC6B,MAAO,CAAC;MACnEE,YAAY,GAAGA,YAAY,GACvBA,YAAY,CAACK,EAAE,CAACH,aAAa,CAAC,GAC9BA,aAAa;IACnB,CAAC,CAAC;IAEF,IAAIF,YAAY,EAAE;MAChBhC,SAAS,GAAGA,SAAS,CAACsC,GAAG,CAACN,YAAY,CAAC;IACzC;EACF;EAEA,OAAOhC,SAAS;AAClB","ignoreList":[]}
@@ -28,15 +28,13 @@ const AutoPatternsEntityPage = ({
28
28
  parentPath,
29
29
  form,
30
30
  onSave: async () => {
31
- var _state$entity;
32
31
  const formValues = form.getValues();
33
32
  const updatedEntity = {
34
33
  ...state.entity,
35
34
  ...formValues
36
35
  };
37
36
  let newUpdatedEntity;
38
- // TODO: Works only for CMS collections, need to be extracted from collection data somehow or share similar context
39
- if ((_state$entity = state.entity) != null && _state$entity._id) {
37
+ if (entityId) {
40
38
  newUpdatedEntity = await schema.actions.update(updatedEntity);
41
39
  } else {
42
40
  newUpdatedEntity = await schema.actions.create(updatedEntity);
@@ -65,7 +63,7 @@ const AutoPatternsEntityPage = ({
65
63
  __self: void 0,
66
64
  __source: {
67
65
  fileName: _jsxFileName,
68
- lineNumber: 65,
66
+ lineNumber: 64,
69
67
  columnNumber: 5
70
68
  }
71
69
  }, /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.Header, {
@@ -76,21 +74,21 @@ const AutoPatternsEntityPage = ({
76
74
  __self: void 0,
77
75
  __source: {
78
76
  fileName: _jsxFileName,
79
- lineNumber: 66,
77
+ lineNumber: 65,
80
78
  columnNumber: 7
81
79
  }
82
80
  }), /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.Content, {
83
81
  __self: void 0,
84
82
  __source: {
85
83
  fileName: _jsxFileName,
86
- lineNumber: 72,
84
+ lineNumber: 71,
87
85
  columnNumber: 7
88
86
  }
89
87
  }, /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.MainContent, {
90
88
  __self: void 0,
91
89
  __source: {
92
90
  fileName: _jsxFileName,
93
- lineNumber: 73,
91
+ lineNumber: 72,
94
92
  columnNumber: 9
95
93
  }
96
94
  }, /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.Card, {
@@ -98,7 +96,7 @@ const AutoPatternsEntityPage = ({
98
96
  __self: void 0,
99
97
  __source: {
100
98
  fileName: _jsxFileName,
101
- lineNumber: 74,
99
+ lineNumber: 73,
102
100
  columnNumber: 11
103
101
  }
104
102
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Card.Header, {
@@ -107,21 +105,21 @@ const AutoPatternsEntityPage = ({
107
105
  __self: void 0,
108
106
  __source: {
109
107
  fileName: _jsxFileName,
110
- lineNumber: 75,
108
+ lineNumber: 74,
111
109
  columnNumber: 13
112
110
  }
113
111
  }), /*#__PURE__*/_react.default.createElement(_designSystem.Card.Divider, {
114
112
  __self: void 0,
115
113
  __source: {
116
114
  fileName: _jsxFileName,
117
- lineNumber: 79,
115
+ lineNumber: 78,
118
116
  columnNumber: 13
119
117
  }
120
118
  }), /*#__PURE__*/_react.default.createElement(_designSystem.Card.Content, {
121
119
  __self: void 0,
122
120
  __source: {
123
121
  fileName: _jsxFileName,
124
- lineNumber: 80,
122
+ lineNumber: 79,
125
123
  columnNumber: 13
126
124
  }
127
125
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
@@ -130,7 +128,7 @@ const AutoPatternsEntityPage = ({
130
128
  __self: void 0,
131
129
  __source: {
132
130
  fileName: _jsxFileName,
133
- lineNumber: 81,
131
+ lineNumber: 80,
134
132
  columnNumber: 15
135
133
  }
136
134
  }, visibleFieldIds.map(fieldId => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
@@ -138,7 +136,7 @@ const AutoPatternsEntityPage = ({
138
136
  __self: void 0,
139
137
  __source: {
140
138
  fileName: _jsxFileName,
141
- lineNumber: 83,
139
+ lineNumber: 82,
142
140
  columnNumber: 19
143
141
  }
144
142
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Cell, {
@@ -146,7 +144,7 @@ const AutoPatternsEntityPage = ({
146
144
  __self: void 0,
147
145
  __source: {
148
146
  fileName: _jsxFileName,
149
- lineNumber: 84,
147
+ lineNumber: 83,
150
148
  columnNumber: 21
151
149
  }
152
150
  }, /*#__PURE__*/_react.default.createElement(_FormFieldInput.FormFieldInput, {
@@ -155,7 +153,7 @@ const AutoPatternsEntityPage = ({
155
153
  __self: void 0,
156
154
  __source: {
157
155
  fileName: _jsxFileName,
158
- lineNumber: 85,
156
+ lineNumber: 84,
159
157
  columnNumber: 23
160
158
  }
161
159
  }))))))))));
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_patterns","_form","_designSystem","_FormFieldInput","_reactRouterDom","_SchemaContext","_jsxFileName","AutoPatternsEntityPage","configuration","title","subtitle","visibleFieldIds","collectionPagePath","parentPath","form","useForm","params","useParams","entityId","schema","useSchema","state","useEntityPage","onSave","_state$entity","formValues","getValues","updatedEntity","entity","newUpdatedEntity","_id","actions","update","create","saveErrorToast","fetch","undefined","get","useEntity","default","createElement","EntityPage","dataHook","__self","__source","fileName","lineNumber","columnNumber","Header","text","displayField","Content","MainContent","Card","minHeight","Divider","Box","gap","direction","map","fieldId","Fragment","key","Cell","span","FormFieldInput","field","fields","exports"],"sources":["../../../../src/components/AutoPatternsEntityPage/AutoPatternsEntityPage.tsx"],"sourcesContent":["import React from 'react';\nimport { EntityPageConfig } from '../../types';\nimport {\n EntityPage,\n EntityPageState,\n useEntity,\n useEntityPage,\n} from '@wix/patterns';\nimport { useForm } from '@wix/patterns/form';\nimport { Box, Card, Cell } from '@wix/design-system';\nimport { FormFieldInput } from './Fields/FormFieldInput';\nimport { useParams } from 'react-router-dom';\nimport { useSchema } from '../../providers/SchemaContext';\n\nexport interface AutoPatternsEntityPageProps {\n configuration: EntityPageConfig;\n}\n\nexport const AutoPatternsEntityPage: React.FC<AutoPatternsEntityPageProps> = ({\n configuration,\n}) => {\n const {\n title,\n subtitle,\n visibleFieldIds = [],\n collectionPagePath: parentPath,\n } = configuration;\n const form = useForm<any>();\n const params = useParams();\n const entityId = params.entityId;\n const schema = useSchema();\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath,\n form,\n onSave: async () => {\n const formValues = form.getValues();\n const updatedEntity: any = {\n ...state.entity,\n ...formValues,\n };\n\n let newUpdatedEntity;\n // TODO: Works only for CMS collections, need to be extracted from collection data somehow or share similar context\n if (state.entity?._id) {\n newUpdatedEntity = await schema.actions.update(updatedEntity);\n } else {\n newUpdatedEntity = await schema.actions.create(updatedEntity);\n }\n\n return { updatedEntity: newUpdatedEntity };\n },\n saveErrorToast: () => 'Failed to save',\n fetch: async () => {\n if (!entityId) {\n return { entity: undefined };\n }\n\n const entity = await schema.actions.get(entityId);\n return { entity };\n },\n });\n const entity = useEntity<any, any>(state);\n\n return (\n <EntityPage state={state} dataHook=\"auto-patterns-entity-page\">\n <EntityPage.Header\n title={\n title ?? { text: entity?.[schema.displayField] ?? 'Edit Entity' }\n }\n subtitle={subtitle}\n />\n <EntityPage.Content>\n <EntityPage.MainContent>\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title=\"Item details\"\n subtitle=\"Modify the details of your selected item below\"\n />\n <Card.Divider />\n <Card.Content>\n <Box gap=\"SP2\" direction=\"vertical\">\n {visibleFieldIds.map((fieldId) => (\n <React.Fragment key={fieldId}>\n <Cell span={12}>\n <FormFieldInput\n key={fieldId}\n field={schema.fields[fieldId]}\n />\n </Cell>\n </React.Fragment>\n ))}\n </Box>\n </Card.Content>\n </EntityPage.Card>\n </EntityPage.MainContent>\n </EntityPage.Content>\n </EntityPage>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAA0D,IAAAO,YAAA;AAMnD,MAAMC,sBAA6D,GAAGA,CAAC;EAC5EC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,KAAK;IACLC,QAAQ;IACRC,eAAe,GAAG,EAAE;IACpBC,kBAAkB,EAAEC;EACtB,CAAC,GAAGL,aAAa;EACjB,MAAMM,IAAI,GAAG,IAAAC,aAAO,EAAM,CAAC;EAC3B,MAAMC,MAAM,GAAG,IAAAC,yBAAS,EAAC,CAAC;EAC1B,MAAMC,QAAQ,GAAGF,MAAM,CAACE,QAAQ;EAChC,MAAMC,MAAM,GAAG,IAAAC,wBAAS,EAAC,CAAC;EAC1B,MAAMC,KAA2B,GAAG,IAAAC,uBAAa,EAAW;IAC1DT,UAAU;IACVC,IAAI;IACJS,MAAM,EAAE,MAAAA,CAAA,KAAY;MAAA,IAAAC,aAAA;MAClB,MAAMC,UAAU,GAAGX,IAAI,CAACY,SAAS,CAAC,CAAC;MACnC,MAAMC,aAAkB,GAAG;QACzB,GAAGN,KAAK,CAACO,MAAM;QACf,GAAGH;MACL,CAAC;MAED,IAAII,gBAAgB;MACpB;MACA,KAAAL,aAAA,G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ACC,GAAG,EAAC,KAAK;IAACC,SAAS,EAAC,UAAU;IAAAf,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAvC,YAAA;MAAAwC,UAAA;MAAAC,YAAA;IAAA;EAAA,GAChCpC,eAAe,CAACgD,GAAG,CAAEC,OAAO,iBAC3B/D,MAAA,CAAA0C,OAAA,CAAAC,aAAA,CAAC3C,MAAA,CAAA0C,OAAK,CAACsB,QAAQ;IAACC,GAAG,EAAEF,OAAQ;IAAAjB,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAvC,YAAA;MAAAwC,UAAA;MAAAC,YAAA;IAAA;EAAA,gBAC3BlD,MAAA,CAAA0C,OAAA,CAAAC,aAAA,CAACtC,aAAA,CAAA6D,IAAI;IAACC,IAAI,EAAE,EAAG;IAAArB,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAvC,YAAA;MAAAwC,UAAA;MAAAC,YAAA;IAAA;EAAA,gBACblD,MAAA,CAAA0C,OAAA,CAAAC,aAAA,CAACrC,eAAA,CAAA8D,cAAc;IACbH,GAAG,EAAEF,OAAQ;IACbM,KAAK,EAAE/C,MAAM,CAACgD,MAAM,CAACP,OAAO,CAAE;IAAAjB,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAvC,YAAA;MAAAwC,UAAA;MAAAC,YAAA;IAAA;EAAA,CAC/B,CACG,CACQ,CACjB,CACE,CACO,CACC,CACK,CACN,CACV,CAAC;AAEjB,CAAC;AAACqB,OAAA,CAAA7D,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_patterns","_form","_designSystem","_FormFieldInput","_reactRouterDom","_SchemaContext","_jsxFileName","AutoPatternsEntityPage","configuration","title","subtitle","visibleFieldIds","collectionPagePath","parentPath","form","useForm","params","useParams","entityId","schema","useSchema","state","useEntityPage","onSave","formValues","getValues","updatedEntity","entity","newUpdatedEntity","actions","update","create","saveErrorToast","fetch","undefined","get","useEntity","default","createElement","EntityPage","dataHook","__self","__source","fileName","lineNumber","columnNumber","Header","text","displayField","Content","MainContent","Card","minHeight","Divider","Box","gap","direction","map","fieldId","Fragment","key","Cell","span","FormFieldInput","field","fields","exports"],"sources":["../../../../src/components/AutoPatternsEntityPage/AutoPatternsEntityPage.tsx"],"sourcesContent":["import React from 'react';\nimport { EntityPageConfig } from '../../types';\nimport {\n EntityPage,\n EntityPageState,\n useEntity,\n useEntityPage,\n} from '@wix/patterns';\nimport { useForm } from '@wix/patterns/form';\nimport { Box, Card, Cell } from '@wix/design-system';\nimport { FormFieldInput } from './Fields/FormFieldInput';\nimport { useParams } from 'react-router-dom';\nimport { useSchema } from '../../providers/SchemaContext';\n\nexport interface AutoPatternsEntityPageProps {\n configuration: EntityPageConfig;\n}\n\nexport const AutoPatternsEntityPage: React.FC<AutoPatternsEntityPageProps> = ({\n configuration,\n}) => {\n const {\n title,\n subtitle,\n visibleFieldIds = [],\n collectionPagePath: parentPath,\n } = configuration;\n const form = useForm<any>();\n const params = useParams();\n const entityId = params.entityId;\n const schema = useSchema();\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath,\n form,\n onSave: async () => {\n const formValues = form.getValues();\n const updatedEntity: any = {\n ...state.entity,\n ...formValues,\n };\n\n let newUpdatedEntity;\n if (entityId) {\n newUpdatedEntity = await schema.actions.update(updatedEntity);\n } else {\n newUpdatedEntity = await schema.actions.create(updatedEntity);\n }\n\n return { updatedEntity: newUpdatedEntity };\n },\n saveErrorToast: () => 'Failed to save',\n fetch: async () => {\n if (!entityId) {\n return { entity: undefined };\n }\n\n const entity = await schema.actions.get(entityId);\n return { entity };\n },\n });\n const entity = useEntity(state);\n\n return (\n <EntityPage state={state} dataHook=\"auto-patterns-entity-page\">\n <EntityPage.Header\n title={\n title ?? { text: entity?.[schema.displayField] ?? 'Edit Entity' }\n }\n subtitle={subtitle}\n />\n <EntityPage.Content>\n <EntityPage.MainContent>\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title=\"Item details\"\n subtitle=\"Modify the details of your selected item below\"\n />\n <Card.Divider />\n <Card.Content>\n <Box gap=\"SP2\" direction=\"vertical\">\n {visibleFieldIds.map((fieldId) => (\n <React.Fragment key={fieldId}>\n <Cell span={12}>\n <FormFieldInput\n key={fieldId}\n field={schema.fields[fieldId]}\n />\n </Cell>\n </React.Fragment>\n ))}\n </Box>\n </Card.Content>\n </EntityPage.Card>\n </EntityPage.MainContent>\n </EntityPage.Content>\n </EntityPage>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAA0D,IAAAO,YAAA;AAMnD,MAAMC,sBAA6D,GAAGA,CAAC;EAC5EC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,KAAK;IACLC,QAAQ;IACRC,eAAe,GAAG,EAAE;IACpBC,kBAAkB,EAAEC;EACtB,CAAC,GAAGL,aAAa;EACjB,MAAMM,IAAI,GAAG,IAAAC,aAAO,EAAM,CAAC;EAC3B,MAAMC,MAAM,GAAG,IAAAC,yBAAS,EAAC,CAAC;EAC1B,MAAMC,QAAQ,GAAGF,MAAM,CAACE,QAAQ;EAChC,MAAMC,MAAM,GAAG,IAAAC,wBAAS,EAAC,CAAC;EAC1B,MAAMC,KAA2B,GAAG,IAAAC,uBAAa,EAAW;IAC1DT,UAAU;IACVC,IAAI;IACJS,MAAM,EAAE,MAAAA,CAAA,KAAY;MAClB,MAAMC,UAAU,GAAGV,IAAI,CAACW,SAAS,CAAC,CAAC;MACnC,MAAMC,aAAkB,GAAG;QACzB,GAAGL,KAAK,CAACM,MAAM;QACf,GAAGH;MACL,CAAC;MAED,IAAII,gBAAgB;MACpB,IAAIV,QAAQ,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AA;MAAAC,QAAA,EAAArC,YAAA;MAAAsC,UAAA;MAAAC,YAAA;IAAA;EAAA,GAChClC,eAAe,CAAC8C,GAAG,CAAEC,OAAO,iBAC3B7D,MAAA,CAAAwC,OAAA,CAAAC,aAAA,CAACzC,MAAA,CAAAwC,OAAK,CAACsB,QAAQ;IAACC,GAAG,EAAEF,OAAQ;IAAAjB,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAArC,YAAA;MAAAsC,UAAA;MAAAC,YAAA;IAAA;EAAA,gBAC3BhD,MAAA,CAAAwC,OAAA,CAAAC,aAAA,CAACpC,aAAA,CAAA2D,IAAI;IAACC,IAAI,EAAE,EAAG;IAAArB,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAArC,YAAA;MAAAsC,UAAA;MAAAC,YAAA;IAAA;EAAA,gBACbhD,MAAA,CAAAwC,OAAA,CAAAC,aAAA,CAACnC,eAAA,CAAA4D,cAAc;IACbH,GAAG,EAAEF,OAAQ;IACbM,KAAK,EAAE7C,MAAM,CAAC8C,MAAM,CAACP,OAAO,CAAE;IAAAjB,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAArC,YAAA;MAAAsC,UAAA;MAAAC,YAAA;IAAA;EAAA,CAC/B,CACG,CACQ,CACjB,CACE,CACO,CACC,CACK,CACN,CACV,CAAC;AAEjB,CAAC;AAACqB,OAAA,CAAA3D,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,30 +1,27 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  exports.__esModule = true;
4
5
  exports.Checkbox = void 0;
5
- var _react = _interopRequireWildcard(require("react"));
6
+ var _react = _interopRequireDefault(require("react"));
6
7
  var _designSystem = require("@wix/design-system");
7
8
  var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/components/AutoPatternsEntityPage/Fields/Checkbox.tsx";
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
9
  const Checkbox = props => {
11
10
  const {
12
11
  field,
13
- initialValue,
14
- onChange
12
+ onChange,
13
+ value
15
14
  } = props;
16
- const [value, setValue] = (0, _react.useState)(initialValue);
17
15
  return /*#__PURE__*/_react.default.createElement(_designSystem.Checkbox, {
18
16
  checked: value,
19
17
  onChange: e => {
20
- setValue(e.target.checked);
21
18
  onChange(e.target.checked);
22
19
  },
23
20
  dataHook: `checkbox-${field.id}`,
24
21
  __self: void 0,
25
22
  __source: {
26
23
  fileName: _jsxFileName,
27
- lineNumber: 12,
24
+ lineNumber: 11,
28
25
  columnNumber: 5
29
26
  }
30
27
  }, field.displayName);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_designSystem","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Checkbox","props","field","initialValue","onChange","value","setValue","useState","createElement","checked","target","dataHook","id","__self","__source","fileName","lineNumber","columnNumber","displayName","exports"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/Checkbox.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Checkbox as CheckboxWSR } from '@wix/design-system';\nimport { BaseInputProps } from './FormFieldInput';\n\nexport interface CheckboxProps extends BaseInputProps<boolean> {}\n\nexport const Checkbox = (props: CheckboxProps) => {\n const { field, initialValue, onChange } = props;\n const [value, setValue] = useState(initialValue);\n\n return (\n <CheckboxWSR\n checked={value}\n onChange={(e) => {\n setValue(e.target.checked);\n onChange(e.target.checked);\n }}\n dataHook={`checkbox-${field.id}`}\n >\n {field.displayName}\n </CheckboxWSR>\n );\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAA6D,IAAAE,YAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAKtD,MAAMW,QAAQ,GAAIC,KAAoB,IAAK;EAChD,MAAM;IAAEC,KAAK;IAAEC,YAAY;IAAEC;EAAS,CAAC,GAAGH,KAAK;EAC/C,MAAM,CAACI,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACJ,YAAY,CAAC;EAEhD,oBACE5B,MAAA,CAAAW,OAAA,CAAAsB,aAAA,CAAC9B,aAAA,CAAAsB,QAAW;IACVS,OAAO,EAAEJ,KAAM;IACfD,QAAQ,EAAGvB,CAAC,IAAK;MACfyB,QAAQ,CAACzB,CAAC,CAAC6B,MAAM,CAACD,OAAO,CAAC;MAC1BL,QAAQ,CAACvB,CAAC,CAAC6B,MAAM,CAACD,OAAO,CAAC;IAC5B,CAAE;IACFE,QAAQ,EAAE,YAAYT,KAAK,CAACU,EAAE,EAAG;IAAAC,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAApC,YAAA;MAAAqC,UAAA;MAAAC,YAAA;IAAA;EAAA,GAEhCf,KAAK,CAACgB,WACI,CAAC;AAElB,CAAC;AAACC,OAAA,CAAAnB,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_designSystem","_jsxFileName","Checkbox","props","field","onChange","value","default","createElement","checked","e","target","dataHook","id","__self","__source","fileName","lineNumber","columnNumber","displayName","exports"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { Checkbox as CheckboxWSR } from '@wix/design-system';\nimport { BaseInputProps } from './types';\n\nexport interface CheckboxProps extends BaseInputProps<boolean> {}\n\nexport const Checkbox = (props: CheckboxProps) => {\n const { field, onChange, value } = props;\n\n return (\n <CheckboxWSR\n checked={value}\n onChange={(e) => {\n onChange(e.target.checked);\n }}\n dataHook={`checkbox-${field.id}`}\n >\n {field.displayName}\n </CheckboxWSR>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAA6D,IAAAE,YAAA;AAKtD,MAAMC,QAAQ,GAAIC,KAAoB,IAAK;EAChD,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAGH,KAAK;EAExC,oBACEN,MAAA,CAAAU,OAAA,CAAAC,aAAA,CAACR,aAAA,CAAAE,QAAW;IACVO,OAAO,EAAEH,KAAM;IACfD,QAAQ,EAAGK,CAAC,IAAK;MACfL,QAAQ,CAACK,CAAC,CAACC,MAAM,CAACF,OAAO,CAAC;IAC5B,CAAE;IACFG,QAAQ,EAAE,YAAYR,KAAK,CAACS,EAAE,EAAG;IAAAC,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAf,YAAA;MAAAgB,UAAA;MAAAC,YAAA;IAAA;EAAA,GAEhCd,KAAK,CAACe,WACI,CAAC;AAElB,CAAC;AAACC,OAAA,CAAAlB,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.DateInput = void 0;
5
+ var _react = _interopRequireWildcard(require("react"));
6
+ var _designSystem = require("@wix/design-system");
7
+ var _dates = require("./utils/dates");
8
+ var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/components/AutoPatternsEntityPage/Fields/DateInput.tsx";
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ const DateInput = props => {
12
+ const {
13
+ field,
14
+ value,
15
+ onChange
16
+ } = props;
17
+ const [date, setDate] = (0, _react.useState)(() => value ? (0, _dates.getDateWithoutTimezone)((0, _dates.getISODateStringWithFixedTimezone)(value)) : undefined);
18
+ const ref = (0, _react.useRef)({});
19
+ const [statusMessage, setStatusMessage] = (0, _react.useState)('');
20
+ return /*#__PURE__*/_react.default.createElement(_designSystem.FormField, {
21
+ label: field.displayName,
22
+ __self: void 0,
23
+ __source: {
24
+ fileName: _jsxFileName,
25
+ lineNumber: 24,
26
+ columnNumber: 5
27
+ }
28
+ }, /*#__PURE__*/_react.default.createElement(_designSystem.DatePicker, {
29
+ dataHook: `date-${field.id}`,
30
+ width: "100%",
31
+ value: date,
32
+ onChange: newValue => {
33
+ const formattedDate = (0, _dates.getISODateStringWithFixedTimezone)(newValue);
34
+ setDate(newValue);
35
+ onChange(formattedDate.split('T')[0]);
36
+ },
37
+ onValidate: ({
38
+ validationType,
39
+ value: newValue
40
+ }) => {
41
+ if (validationType === 'valid') {
42
+ setStatusMessage('');
43
+ ref.current.invalid = false;
44
+ } else if (validationType === 'formatError' && newValue === '') {
45
+ setDate(undefined);
46
+ onChange(null);
47
+ setStatusMessage('');
48
+ ref.current.invalid = false;
49
+ } else {
50
+ setStatusMessage('Invalid date');
51
+ ref.current.invalid = true;
52
+ }
53
+ },
54
+ status: ref.current.invalid ? 'error' : undefined,
55
+ statusMessage: statusMessage,
56
+ __self: void 0,
57
+ __source: {
58
+ fileName: _jsxFileName,
59
+ lineNumber: 25,
60
+ columnNumber: 7
61
+ }
62
+ }));
63
+ };
64
+ exports.DateInput = DateInput;
65
+ //# sourceMappingURL=DateInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_designSystem","_dates","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DateInput","props","field","value","onChange","date","setDate","useState","getDateWithoutTimezone","getISODateStringWithFixedTimezone","undefined","ref","useRef","statusMessage","setStatusMessage","createElement","FormField","label","displayName","__self","__source","fileName","lineNumber","columnNumber","DatePicker","dataHook","id","width","newValue","formattedDate","split","onValidate","validationType","current","invalid","status","exports"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/DateInput.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\nimport { FormField, DatePicker } from '@wix/design-system';\nimport {\n getDateWithoutTimezone,\n getISODateStringWithFixedTimezone,\n} from './utils/dates';\nimport { BaseInputProps, BaseInputRef } from './types';\n\nexport interface DateProps extends BaseInputProps<string | null> {}\n\nexport const DateInput = (props: DateProps) => {\n const { field, value, onChange } = props;\n\n const [date, setDate] = useState<Date | undefined>(() =>\n value\n ? getDateWithoutTimezone(getISODateStringWithFixedTimezone(value))\n : undefined,\n );\n\n const ref = useRef<BaseInputRef>({});\n const [statusMessage, setStatusMessage] = useState('');\n\n return (\n <FormField label={field.displayName}>\n <DatePicker\n dataHook={`date-${field.id}`}\n width=\"100%\"\n value={date}\n onChange={(newValue: Date) => {\n const formattedDate = getISODateStringWithFixedTimezone(newValue);\n setDate(newValue);\n onChange(formattedDate.split('T')[0]);\n }}\n onValidate={({ validationType, value: newValue }) => {\n if (validationType === 'valid') {\n setStatusMessage('');\n ref.current.invalid = false;\n } else if (validationType === 'formatError' && newValue === '') {\n setDate(undefined);\n onChange(null);\n setStatusMessage('');\n ref.current.invalid = false;\n } else {\n setStatusMessage('Invalid date');\n ref.current.invalid = true;\n }\n }}\n status={ref.current.invalid ?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H,GAAG,CAACsB,OAAO,CAACC,OAAO,GAAG,KAAK;MAC7B,CAAC,MAAM,IAAIF,cAAc,KAAK,aAAa,IAAIJ,QAAQ,KAAK,EAAE,EAAE;QAC9DtB,OAAO,CAACI,SAAS,CAAC;QAClBN,QAAQ,CAAC,IAAI,CAAC;QACdU,gBAAgB,CAAC,EAAE,CAAC;QACpBH,GAAG,CAACsB,OAAO,CAACC,OAAO,GAAG,KAAK;MAC7B,CAAC,MAAM;QACLpB,gBAAgB,CAAC,cAAc,CAAC;QAChCH,GAAG,CAACsB,OAAO,CAACC,OAAO,GAAG,IAAI;MAC5B;IACF,CAAE;IACFC,MAAM,EAAExB,GAAG,CAACsB,OAAO,CAACC,OAAO,GAAG,OAAO,GAAGxB,SAAU;IAClDG,aAAa,EAAEA,aAAc;IAAAM,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAA1C,YAAA;MAAA2C,UAAA;MAAAC,YAAA;IAAA;EAAA,CAC9B,CACQ,CAAC;AAEhB,CAAC;AAACa,OAAA,CAAApC,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.DateTime = void 0;
5
+ var _react = _interopRequireWildcard(require("react"));
6
+ var _designSystem = require("@wix/design-system");
7
+ var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/components/AutoPatternsEntityPage/Fields/DateTime.tsx";
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ const DateTime = props => {
11
+ const {
12
+ field,
13
+ value,
14
+ onChange
15
+ } = props;
16
+ const date = (0, _react.useMemo)(() => {
17
+ if (!value) {
18
+ return undefined;
19
+ }
20
+ const d = new Date(value);
21
+ return isNaN(d.getTime()) ? undefined : d;
22
+ }, [value]);
23
+ const [statusMessage, setStatusMessage] = (0, _react.useState)('');
24
+ const ref = (0, _react.useRef)({});
25
+ const dateRef = (0, _react.useRef)({});
26
+ const timeRef = (0, _react.useRef)({});
27
+ const [dateValue, setDateValue] = (0, _react.useState)(date == null ? void 0 : date.getDate());
28
+ const [timeValue, setTimeValue] = (0, _react.useState)(date == null ? void 0 : date.getTime());
29
+ return /*#__PURE__*/_react.default.createElement(_designSystem.FormField, {
30
+ label: field.displayName,
31
+ __self: void 0,
32
+ __source: {
33
+ fileName: _jsxFileName,
34
+ lineNumber: 35,
35
+ columnNumber: 5
36
+ }
37
+ }, /*#__PURE__*/_react.default.createElement(_designSystem.Layout, {
38
+ __self: void 0,
39
+ __source: {
40
+ fileName: _jsxFileName,
41
+ lineNumber: 36,
42
+ columnNumber: 7
43
+ }
44
+ }, /*#__PURE__*/_react.default.createElement(_designSystem.Cell, {
45
+ span: 6,
46
+ __self: void 0,
47
+ __source: {
48
+ fileName: _jsxFileName,
49
+ lineNumber: 37,
50
+ columnNumber: 9
51
+ }
52
+ }, /*#__PURE__*/_react.default.createElement(_designSystem.DatePicker, {
53
+ width: "100%",
54
+ value: date
55
+ // onChange is triggered only when you have valid, non-empty value. and onValidate is triggered on every change to we use onValidate
56
+ ,
57
+ onChange: () => {},
58
+ onValidate: ({
59
+ validationType,
60
+ value: newValue
61
+ }) => {
62
+ if (validationType === 'valid') {
63
+ const dateWithNewDate = date ? new Date(date) : new Date(newValue);
64
+ const _value = new Date(newValue);
65
+ dateWithNewDate.setFullYear(_value.getFullYear());
66
+ dateWithNewDate.setMonth(_value.getMonth());
67
+ dateWithNewDate.setDate(_value.getDate());
68
+ onChange(dateWithNewDate.toISOString());
69
+ setDateValue(new Date(newValue).getDate());
70
+ setStatusMessage('');
71
+ dateRef.current.invalid = false;
72
+ } else if (validationType === 'formatError' && value === '') {
73
+ setStatusMessage('');
74
+ dateRef.current.invalid = false;
75
+ setDateValue(value);
76
+ if (!timeValue) {
77
+ onChange(null);
78
+ }
79
+ } else {
80
+ setStatusMessage('Invalid date');
81
+ dateRef.current.invalid = true;
82
+ }
83
+ ref.current.invalid = dateRef.current.invalid || timeRef.current.invalid;
84
+ },
85
+ status: ref.current.invalid ? 'error' : undefined,
86
+ statusMessage: statusMessage,
87
+ dataHook: `datetime-date-${field.id}`,
88
+ __self: void 0,
89
+ __source: {
90
+ fileName: _jsxFileName,
91
+ lineNumber: 38,
92
+ columnNumber: 11
93
+ }
94
+ })), /*#__PURE__*/_react.default.createElement(_designSystem.Cell, {
95
+ span: 6,
96
+ __self: void 0,
97
+ __source: {
98
+ fileName: _jsxFileName,
99
+ lineNumber: 76,
100
+ columnNumber: 9
101
+ }
102
+ }, /*#__PURE__*/_react.default.createElement(_designSystem.TimeInput, {
103
+ dataHook: `datetime-time-${field.id}`,
104
+ value: date ?? null,
105
+ invalidMessage: "Invalid time",
106
+ onInvalid: () => {
107
+ timeRef.current.invalid = true;
108
+ ref.current.invalid = dateRef.current.invalid || timeRef.current.invalid;
109
+ },
110
+ onChange: ({
111
+ date: newValue
112
+ }) => {
113
+ timeRef.current.invalid = false;
114
+ ref.current.invalid = dateRef.current.invalid || timeRef.current.invalid;
115
+ if (newValue) {
116
+ const dateWithNewTime = date ? new Date(date) : newValue;
117
+ dateWithNewTime.setHours(newValue.getHours());
118
+ dateWithNewTime.setMinutes(newValue.getMinutes());
119
+ dateWithNewTime.setSeconds(newValue.getSeconds());
120
+ dateWithNewTime.setMilliseconds(newValue.getMilliseconds());
121
+ onChange(dateWithNewTime.toISOString());
122
+ } else if (!ref.current.invalid) {
123
+ if (!newValue) {
124
+ setTimeValue('');
125
+ if (!dateValue) {
126
+ onChange(null);
127
+ }
128
+ }
129
+ }
130
+ },
131
+ __self: void 0,
132
+ __source: {
133
+ fileName: _jsxFileName,
134
+ lineNumber: 77,
135
+ columnNumber: 11
136
+ }
137
+ }))));
138
+ };
139
+ exports.DateTime = DateTime;
140
+ //# sourceMappingURL=DateTime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_designSystem","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DateTime","props","field","value","onChange","date","useMemo","undefined","d","Date","isNaN","getTime","statusMessage","setStatusMessage","useState","ref","useRef","dateRef","timeRef","dateValue","setDateValue","getDate","timeValue","setTimeValue","createElement","FormField","label","displayName","__self","__source","fileName","lineNumber","columnNumber","Layout","Cell","span","DatePicker","width","onValidate","validationType","newValue","dateWithNewDate","_value","setFullYear","getFullYear","setMonth","getMonth","setDate","toISOString","current","invalid","status","dataHook","id","TimeInput","invalidMessage","onInvalid","dateWithNewTime","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","setMilliseconds","getMilliseconds","exports"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/DateTime.tsx"],"sourcesContent":["import React, { useRef, useMemo, useState } from 'react';\nimport {\n Cell,\n DatePicker,\n FormField,\n Layout,\n TimeInput,\n} from '@wix/design-system';\nimport { BaseInputProps, BaseInputRef } from './types';\n\nexport interface DateTimeProps extends BaseInputProps<string | null> {}\nexport const DateTime = (props: DateTimeProps) => {\n const { field, value, onChange } = props;\n\n const date = useMemo(() => {\n if (!value) {\n return undefined;\n }\n const d = new Date(value);\n return isNaN(d.getTime()) ? undefined : d;\n }, [value]);\n const [statusMessage, setStatusMessage] = useState('');\n\n const ref = useRef<BaseInputRef>({});\n const dateRef = useRef<BaseInputRef>({});\n const timeRef = useRef<BaseInputRef>({});\n const [dateValue, setDateValue] = useState<number | string | undefined>(\n date?.getDate(),\n );\n const [timeValue, setTimeValue] = useState<number | string | undefined>(\n date?.getTime(),\n );\n\n return (\n <FormField label={field.displayName}>\n <Layout>\n <Cell span={6}>\n <DatePicker\n width=\"100%\"\n value={date}\n // onChange is triggered only when you have valid, non-empty value. and onValidate is triggered on every change to we use onValidate\n onChange={() => {}}\n onValidate={({ validationType, value: newValue }) => {\n if (validationType === 'valid') {\n const dateWithNewDate = date\n ? new Date(date)\n : new Date(newValue);\n const _value = new Date(newValue);\n dateWithNewDate.setFullYear(_value.getFullYear());\n dateWithNewDate.setMonth(_value.getMonth());\n dateWithNewDate.setDate(_value.getDate());\n onChange(dateWithNewDate.toISOString());\n setDateValue(new Date(newValue).getDate());\n setStatusMessage('');\n dateRef.current.invalid = false;\n } else if (validationType === 'formatError' && value === '') {\n setStatusMessage('');\n dateRef.current.invalid = false;\n setDateValue(value);\n if (!timeValue) {\n onChange(null);\n }\n } else {\n setStatusMessage('Invalid date');\n dateRef.current.invalid = true;\n }\n\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n }}\n status={ref.current.invalid ? 'error' : undefined}\n statusMessage={statusMessage}\n dataHook={`datetime-date-${field.id}`}\n />\n </Cell>\n <Cell span={6}>\n <TimeInput\n dataHook={`datetime-time-${field.id}`}\n value={date ?? null}\n invalidMessage=\"Invalid time\"\n onInvalid={() => {\n timeRef.current.invalid = true;\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n }}\n onChange={({ date: newValue }) => {\n timeRef.current.invalid = false;\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n\n if (newValue) {\n const dateWithNewTime = date ? new Date(date) : newValue;\n dateWithNewTime.setHours(newValue.getHours());\n dateWithNewTime.setMinutes(newValue.getMinutes());\n dateWithNewTime.setSeconds(newValue.getSeconds());\n dateWithNewTime.setMilliseconds(newValue.getMilliseconds());\n onChange(dateWithNewTime.toISOString());\n } else if (!ref.current.invalid) {\n if (!newValue) {\n setTimeValue('');\n if (!dateValue) {\n onChange(null);\n }\n }\n }\n }}\n />\n </Cell>\n </Layout>\n </FormField>\n );\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAM4B,IAAAE,YAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,C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