1 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
2 |
|
3 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
4 |
|
5 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6 |
|
7 | import { COMPONENT_TYPES, FORM_TYPES, FIELD_NAME } from "../core/component-types";
|
8 | const SEED_DATA_PROPS = {
|
9 | label: {
|
10 | label: "Label",
|
11 | description: "The label to be displayed on the picker",
|
12 | type: FORM_TYPES.string,
|
13 | value: "Date",
|
14 | editable: true,
|
15 | required: true
|
16 | },
|
17 | mode: {
|
18 | label: "Mode",
|
19 | description: "Choose between date, time and datetime",
|
20 | value: "date",
|
21 | editable: true,
|
22 | required: true,
|
23 | type: FORM_TYPES.flatArray,
|
24 | options: ["date", "time", "datetime"]
|
25 | },
|
26 | assistiveText: {
|
27 | label: "Assistive text",
|
28 | description: "Helper text to display below the picker",
|
29 | type: FORM_TYPES.string,
|
30 | value: null,
|
31 | editable: true,
|
32 | required: false
|
33 | },
|
34 | locale: {
|
35 | label: "Locale",
|
36 | description: "Locale for the datepicker. Must be a valid Locale",
|
37 | type: FORM_TYPES.string,
|
38 | value: null,
|
39 | editable: true,
|
40 | required: false
|
41 | },
|
42 | minuteInterval: {
|
43 | label: "Minute Interval",
|
44 | description: "The interval at which minutes can be selected",
|
45 | type: FORM_TYPES.flatArray,
|
46 | options: [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30],
|
47 | value: null,
|
48 | editable: true,
|
49 | required: false
|
50 | },
|
51 | timeZoneOffsetInMinutes: {
|
52 | label: "Time zone offset",
|
53 | description: "By default, the datepicker uses the device's timezone. This will allow you to offset it",
|
54 | type: FORM_TYPES.number,
|
55 | value: null,
|
56 | editable: true,
|
57 | required: false
|
58 | },
|
59 | initialDate: {
|
60 | label: "Initial Date",
|
61 | description: "Optionally set an initial date to make your forms easier to work with",
|
62 | type: FORM_TYPES.date,
|
63 | value: null,
|
64 | editable: true,
|
65 | required: false
|
66 | },
|
67 | options: {
|
68 | label: "Options",
|
69 | description: "Array of picker options. An array of objects containing a label and value.",
|
70 | editable: true,
|
71 | type: FORM_TYPES.array,
|
72 | value: null
|
73 | },
|
74 | disabled: {
|
75 | label: "Disabled",
|
76 | description: "Whether the picker should be disabled. Will prevent selection and show a greyed out state.",
|
77 | type: FORM_TYPES.boolean,
|
78 | value: false,
|
79 | editable: true
|
80 | },
|
81 | error: {
|
82 | label: "Error",
|
83 | description: "Whether the picker should display the error state",
|
84 | type: FORM_TYPES.boolean,
|
85 | value: false,
|
86 | editable: true
|
87 | },
|
88 | leftIconName: {
|
89 | label: "Left icon name",
|
90 | description: "The icon to display on the left",
|
91 | type: FORM_TYPES.icon,
|
92 | value: null,
|
93 | editable: true
|
94 | },
|
95 | leftIconMode: {
|
96 | label: "Left icon mode",
|
97 | description: "The mode of the icon to display on the left. 'inset' or 'outset'.",
|
98 | type: FORM_TYPES.flatArray,
|
99 | value: "inset",
|
100 | options: ["inset", "outset"],
|
101 | editable: true,
|
102 | required: true
|
103 | },
|
104 | rightIconName: {
|
105 | label: "Right icon name",
|
106 | description: "The icon to display on the right",
|
107 | type: FORM_TYPES.icon,
|
108 | value: null,
|
109 | editable: true
|
110 | },
|
111 | fieldName: _objectSpread(_objectSpread({}, FIELD_NAME), {}, {
|
112 | handlerPropName: "onDateChange",
|
113 | valuePropName: "date",
|
114 | value: "date"
|
115 | })
|
116 | };
|
117 | export const SEED_DATA = [{
|
118 | name: "Date Picker - Solid",
|
119 | tag: "DatePicker",
|
120 | description: "A date picker with a solid border",
|
121 | category: COMPONENT_TYPES.field,
|
122 | preview_image_url: "{CLOUDINARY_URL}/DatePicker.png",
|
123 | supports_list_render: false,
|
124 | props: _objectSpread(_objectSpread({}, SEED_DATA_PROPS), {}, {
|
125 | type: {
|
126 | type: FORM_TYPES.string,
|
127 | value: "solid",
|
128 | editable: false
|
129 | }
|
130 | }),
|
131 | layout: {}
|
132 | }, {
|
133 | name: "Date Picker - Underline",
|
134 | tag: "DatePicker",
|
135 | description: "A date picker with an underline",
|
136 | category: COMPONENT_TYPES.field,
|
137 | preview_image_url: "{CLOUDINARY_URL}/DatePicker.png",
|
138 | supports_list_render: false,
|
139 | props: _objectSpread(_objectSpread({}, SEED_DATA_PROPS), {}, {
|
140 | type: {
|
141 | type: FORM_TYPES.string,
|
142 | value: "underline",
|
143 | editable: false
|
144 | }
|
145 | }),
|
146 | layout: {}
|
147 | }];
|
148 |
|
\ | No newline at end of file |