@g9tm/lynxcontrols-calendar 2.5.9 → 2.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/people.jsx CHANGED
@@ -138,6 +138,9 @@ function G9WorkingHoursEditor(props) {
138
138
  flexDirection: rtl ? 'row-reverse' : 'row',
139
139
  direction: 'ltr'
140
140
  };
141
+ const off = props.disabled ? {
142
+ disabled: true
143
+ } : {};
141
144
  const set = (wd, ranges)=>{
142
145
  const next = {
143
146
  ...props.value
@@ -146,11 +149,11 @@ function G9WorkingHoursEditor(props) {
146
149
  else delete next[wd];
147
150
  props.onChange(next);
148
151
  };
149
- return <view className="g9-work" {...g9IdProps(props.id)}>
152
+ return <view className={props.disabled ? 'g9-work g9-work--disabled' : 'g9-work'} {...g9IdProps(props.id)} user-interaction-enabled={!props.disabled}>
150
153
  {Array.from({
151
154
  length: 7
152
155
  }, (_, i)=>(weekStart + i) % 7).map((wd)=>{
153
- var _props_value_wd, _names_wd, _names_wd1;
156
+ var _props_value_wd, _names_wd, _names_wd1, _props_maxRanges;
154
157
  const ranges = null != (_props_value_wd = props.value[wd]) ? _props_value_wd : [];
155
158
  const on = ranges.length > 0;
156
159
  const pid = (part)=>props.id ? {
@@ -158,7 +161,7 @@ function G9WorkingHoursEditor(props) {
158
161
  } : {};
159
162
  return <view key={wd} className="g9-work__day">
160
163
  <view className="g9-work__head" style={row}>
161
- <G9Switch {...pid('On')} checked={on} onCheckedChange={(c)=>set(wd, c ? [
164
+ <G9Switch {...pid('On')} checked={on} {...off} onCheckedChange={(c)=>set(wd, c ? [
162
165
  first
163
166
  ] : void 0)} accessibilityLabel={null != (_names_wd = names[wd]) ? _names_wd : ''}/>
164
167
  <text className="g9-work__name" style={{
@@ -166,7 +169,7 @@ function G9WorkingHoursEditor(props) {
166
169
  }}>
167
170
  {null != (_names_wd1 = names[wd]) ? _names_wd1 : ''}
168
171
  </text>
169
- {on ? <G9IconButton {...pid('Copy')} icon="refresh" isGhost buttonSize={32} accessibilityText={props.labels.copy} onPress={()=>{
172
+ {on ? <G9IconButton {...pid('Copy')} icon="refresh" isGhost {...off} buttonSize={32} accessibilityText={props.labels.copy} onPress={()=>{
170
173
  var _props_value_d;
171
174
  const all = {};
172
175
  for(let d = 0; d < 7; d++)if ((null != (_props_value_d = props.value[d]) ? _props_value_d : []).length || d === wd) all[d] = ranges;
@@ -175,20 +178,20 @@ function G9WorkingHoursEditor(props) {
175
178
  </view>
176
179
  {ranges.map((r, k)=><view key={k} className="g9-work__range" style={row}>
177
180
  <view className="g9-work__time">
178
- <G9TimeListPicker {...pid(`From${k}`)} label={props.labels.from} value={r.start} onChange={(m)=>set(wd, ranges.map((x, j)=>j === k ? {
181
+ <G9TimeListPicker {...pid(`From${k}`)} label={props.labels.from} value={r.start} {...off} onChange={(m)=>set(wd, ranges.map((x, j)=>j === k ? {
179
182
  start: m,
180
183
  end: Math.max(m + 15, x.end)
181
184
  } : x))}/>
182
185
  </view>
183
186
  <view className="g9-work__time">
184
- <G9TimeListPicker {...pid(`To${k}`)} label={props.labels.to} value={r.end} onChange={(m)=>set(wd, ranges.map((x, j)=>j === k ? {
187
+ <G9TimeListPicker {...pid(`To${k}`)} label={props.labels.to} value={r.end} {...off} onChange={(m)=>set(wd, ranges.map((x, j)=>j === k ? {
185
188
  start: Math.min(x.start, m - 15),
186
189
  end: m
187
190
  } : x))}/>
188
191
  </view>
189
- <G9IconButton {...pid(`Remove${k}`)} icon="close" isGhost buttonSize={32} accessibilityText={props.labels.remove} onPress={()=>set(wd, ranges.filter((_, j)=>j !== k))}/>
192
+ <G9IconButton {...pid(`Remove${k}`)} icon="close" isGhost {...off} buttonSize={32} accessibilityText={props.labels.remove} onPress={()=>set(wd, ranges.filter((_, j)=>j !== k))}/>
190
193
  </view>)}
191
- {on ? <view className="g9-work__add" {...g9IdProps(props.id ? `${props.id}_${wd}_Add` : void 0)} bindtap={()=>{
194
+ {on && ranges.length < (null != (_props_maxRanges = props.maxRanges) ? _props_maxRanges : 1 / 0) ? <view className="g9-work__add" {...g9IdProps(props.id ? `${props.id}_${wd}_Add` : void 0)} bindtap={()=>{
192
195
  const last = ranges[ranges.length - 1];
193
196
  const start = Math.min(1380, last.end + 60);
194
197
  set(wd, [
@@ -41,6 +41,15 @@ export interface G9RepeatPickerProps {
41
41
  readonly editorLabels?: Partial<G9RepeatEditorLabels>;
42
42
  /** Which presets are offered, in order. Default all. */
43
43
  readonly presets?: readonly G9RecurrencePreset[];
44
+ /** Shown, not changed. */
45
+ readonly disabled?: boolean;
46
+ /**
47
+ * «By weekday of the month» (the 2nd Tuesday) in the custom editor and its preset. Default true; false where the
48
+ * server's rules have no week-of-month (G9Hub's task repetition).
49
+ */
50
+ readonly weekOfMonth?: boolean;
51
+ /** Under the picker (the next dates). */
52
+ readonly footer?: ReactNode;
44
53
  }
45
54
  /** Never / daily / weekly / … : the presets from the start date and a full custom editor, or the plain frequency row. */
46
55
  export declare function G9RepeatPicker(props: G9RepeatPickerProps): ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"repeat-picker.d.ts","sourceRoot":"","sources":["../src/repeat-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,WAAW,EAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAOvB,MAAM,cAAc,CAAC;AAEtB,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,M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,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IACnC,iCAAiC;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACtD,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAEjD,0BAA0B;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,yCAAyC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;CAC7B;AAED,yHAAyH;AACzH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAmOpE"}
@@ -42,6 +42,16 @@ const EDITOR_FA = {
42
42
  };
43
43
  function G9RepeatPicker(props) {
44
44
  var _props_words, _props_editorLabels, _props_presets, _custom_interval, _custom_calendar;
45
+ const change = (rule)=>{
46
+ if (!props.disabled) props.onChange(rule);
47
+ };
48
+ const shell = (content)=><view className={`g9-repeat${props.disabled ? ' g9-repeat--disabled' : ''}`} {...g9IdProps(props.id)} {...props.disabled ? {
49
+ 'user-interaction-enabled': false,
50
+ 'accessibility-value': 'disabled'
51
+ } : {}}>
52
+ {content}
53
+ {props.footer ? <view className="g9-repeat__footer">{props.footer}</view> : null}
54
+ </view>;
45
55
  const culture = useG9Culture();
46
56
  const rtl = 'rtl' === useG9Direction();
47
57
  const calendar = culture.calendar;
@@ -73,7 +83,7 @@ function G9RepeatPicker(props) {
73
83
  wd
74
84
  ].sort((a, b)=>a - b);
75
85
  if (0 === next.length && start) return;
76
- props.onChange({
86
+ change({
77
87
  ...rule,
78
88
  freq: 'weekly',
79
89
  weekdays: next
@@ -85,12 +95,12 @@ function G9RepeatPicker(props) {
85
95
  var _ref;
86
96
  var _props_value;
87
97
  const freq = null != (_ref = null == (_props_value = props.value) ? void 0 : _props_value.freq) ? _ref : 'never';
88
- return <view className="g9-repeat" {...g9IdProps(props.id)}>
98
+ return shell(<>
89
99
  <G9Segmented {...props.id ? {
90
100
  id: `${props.id}.Freq`
91
101
  } : {}} size="sm" fit="content" value={freq} onChange={(f)=>{
92
102
  var _props_value;
93
- return props.onChange('never' === f ? null : {
103
+ return change('never' === f ? null : {
94
104
  ...null != (_props_value = props.value) ? _props_value : {},
95
105
  freq: f
96
106
  });
@@ -105,7 +115,7 @@ function G9RepeatPicker(props) {
105
115
  label: props.labels[k]
106
116
  }))}/>
107
117
  {'weekly' === freq && props.value ? weekdayChips(props.value, null) : null}
108
- </view>;
118
+ </>);
109
119
  }
110
120
  const start = props.start;
111
121
  const words = null != (_props_words = props.words) ? _props_words : 'fa' === culture.language ? g9RecurrenceWordsFa : g9RecurrenceWordsEn;
@@ -115,7 +125,7 @@ function G9RepeatPicker(props) {
115
125
  };
116
126
  const matched = presetOf(props.value, start, calendar, culture.language);
117
127
  const current = editing ? 'custom' : matched;
118
- const offered = (null != (_props_presets = props.presets) ? _props_presets : g9RecurrencePresets).filter((p)=>'monthlyWeekday' !== p || void 0 !== nthOfMonth(start, calendar));
128
+ const offered = (null != (_props_presets = props.presets) ? _props_presets : g9RecurrencePresets).filter((p)=>'monthlyWeekday' !== p || false !== props.weekOfMonth && void 0 !== nthOfMonth(start, calendar));
119
129
  const sentence = (p)=>'custom' === p ? 'custom' === current && props.value ? describeRecurrence(props.value, start, culture, {
120
130
  words,
121
131
  weekStart
@@ -140,9 +150,9 @@ function G9RepeatPicker(props) {
140
150
  ...base,
141
151
  ...patch
142
152
  };
143
- props.onChange(next);
153
+ change(next);
144
154
  };
145
- return <view className="g9-repeat" {...g9IdProps(props.id)}>
155
+ return shell(<>
146
156
  <G9RadioGroup {...props.id ? {
147
157
  id: `${props.id}_Preset`
148
158
  } : {}} value={current} options={offered.map((p)=>({
@@ -151,7 +161,7 @@ function G9RepeatPicker(props) {
151
161
  }))} onChange={(p)=>{
152
162
  if ('custom' === p) {
153
163
  setEditing(true);
154
- if (!props.value) props.onChange({
164
+ if (!props.value) change({
155
165
  freq: 'weekly',
156
166
  weekdays: [
157
167
  dayOfWeek(start)
@@ -160,7 +170,7 @@ function G9RepeatPicker(props) {
160
170
  return;
161
171
  }
162
172
  setEditing(false);
163
- props.onChange(presetRule(p, start, calendar, culture.language));
173
+ change(presetRule(p, start, calendar, culture.language));
164
174
  }}/>
165
175
  {custom ? <view className="g9-repeat__custom">
166
176
  <view className="g9-repeat__line" style={row}>
@@ -203,13 +213,13 @@ function G9RepeatPicker(props) {
203
213
  </view>
204
214
  {'weekly' === custom.freq ? weekdayChips(custom, start) : null}
205
215
  {'monthly' === custom.freq || 'yearly' === custom.freq ? <view className="g9-repeat__line" style={row}>
206
- <G9Segmented {...props.id ? {
216
+ {false === props.weekOfMonth ? null : <G9Segmented {...props.id ? {
207
217
  id: `${props.id}_By`
208
218
  } : {}} size="sm" fit="content" value={void 0 === custom.weekOfMonth ? 'date' : 'weekday'} onChange={(by)=>{
209
219
  var _custom_calendar;
210
220
  if ('date' === by) {
211
221
  const { weekOfMonth: _w, ...rest } = custom;
212
- props.onChange(rest);
222
+ change(rest);
213
223
  } else edit({
214
224
  weekOfMonth: nthOfMonth(start, null != (_custom_calendar = custom.calendar) ? _custom_calendar : calendar)
215
225
  });
@@ -222,7 +232,7 @@ function G9RepeatPicker(props) {
222
232
  key: 'weekday',
223
233
  label: ed.byWeekday
224
234
  }
225
- ]}/>
235
+ ]}/>}
226
236
  <G9Segmented {...props.id ? {
227
237
  id: `${props.id}_Calendar`
228
238
  } : {}} size="sm" fit="content" value={null != (_custom_calendar = custom.calendar) ? _custom_calendar : calendar} onChange={(c)=>edit({
@@ -244,12 +254,11 @@ function G9RepeatPicker(props) {
244
254
  id: `${props.id}_End`
245
255
  } : {}} size="sm" fit="content" value={custom.until ? 'until' : custom.count ? 'count' : 'never'} onChange={(e)=>{
246
256
  const { until: _u, count: _c, ...rest } = custom;
247
- if ('never' === e) props.onChange(rest);
248
- else if ('count' === e) props.onChange({
257
+ if ('never' === e) change(rest);
258
+ else 'count' === e ? change({
249
259
  ...rest,
250
260
  count: 10
251
- });
252
- else props.onChange({
261
+ }) : change({
253
262
  ...rest,
254
263
  until: start
255
264
  });
@@ -284,6 +293,6 @@ function G9RepeatPicker(props) {
284
293
  <text className="g9-repeat__label">{ed.times}</text>
285
294
  </view> : null}
286
295
  </view> : null}
287
- </view>;
296
+ </>);
288
297
  }
289
298
  export { G9RepeatPicker };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@g9tm/lynxcontrols-calendar",
3
- "version": "2.5.9",
3
+ "version": "2.5.10",
4
4
  "description": "Calendar controls for G9LynxControls on the culture calendar (Persian or Gregorian): month grids, recurrence, overlap layout, G9MiniMonth, G9MonthView, G9TimeGrid, G9AgendaView, G9DateInput and G9RepeatPicker.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,10 +29,10 @@
29
29
  "build": "rslib build"
30
30
  },
31
31
  "dependencies": {
32
- "@g9tm/lynxcontrols-foundation": "2.5.9"
32
+ "@g9tm/lynxcontrols-foundation": "2.5.10"
33
33
  },
34
34
  "peerDependencies": {
35
- "@g9tm/lynxcontrols": "2.5.9",
35
+ "@g9tm/lynxcontrols": "2.5.10",
36
36
  "@lynx-js/react": ">=0.129.3 <0.130.0"
37
37
  }
38
38
  }