shineout 2.0.5-beta.5 → 2.0.5-beta.7

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.
@@ -307,6 +307,7 @@ export interface ResultItemProps<DataItem> {
307
307
  singleRemove?: boolean;
308
308
  click: (data: DataItem, isPopover: boolean) => void;
309
309
  only: boolean;
310
+ isDisabled: boolean;
310
311
  }
311
312
  /** ------ CascaderProps ------ * */
312
313
  declare type CascaderPropsWithTableConsumber<Item, Value extends CascaderBaseValue> = GetTableConsumerProps<OriginCascaderProps<Item, Value>>;
@@ -55,7 +55,8 @@ function Item(_ref) {
55
55
  isPopover = _ref.isPopover,
56
56
  singleRemove = _ref.singleRemove,
57
57
  click = _ref.click,
58
- only = _ref.only;
58
+ only = _ref.only,
59
+ isDisabled = _ref.isDisabled;
59
60
  var onClose = close ? function (e) {
60
61
  close(data, isPopover, e);
61
62
  } : undefined;
@@ -64,9 +65,9 @@ function Item(_ref) {
64
65
  } : undefined;
65
66
  return _react.default.createElement("a", {
66
67
  tabIndex: -1,
67
- className: (0, _classnames.default)((0, _styles3.cascaderClass)((0, _classname.getDirectionClass)('item'), only && 'item-only'), className),
68
+ className: (0, _classnames.default)((0, _styles3.cascaderClass)((0, _classname.getDirectionClass)('item'), only && 'item-only', isDisabled && 'item-disabled'), className),
68
69
  onClick: onClick
69
- }, children, singleRemove && _react.default.createElement("span", {
70
+ }, children, singleRemove && !isDisabled && _react.default.createElement("span", {
70
71
  className: (0, _styles3.cascaderClass)((0, _classname.getDirectionClass)('single-remove')),
71
72
  onClick: onClose
72
73
  }, _icons.default.Close));
@@ -278,6 +279,7 @@ function (_PureComponent) {
278
279
  singleRemove: singleRemove,
279
280
  close: this.removeTargetNode,
280
281
  isPopover: true,
282
+ isDisabled: datum.isDisabled(datum.getKey(data)),
281
283
  click: this.handleNodeClick
282
284
  }), res);
283
285
  };
@@ -126,6 +126,10 @@
126
126
  font-size: var(--font-size-base, 14px);
127
127
  color: var(--gray-700, #495057);
128
128
  }
129
+ .so-cascader-result .so-cascader-item-disabled {
130
+ cursor: not-allowed;
131
+ color: var(--input-disabled-color, #999DA8);
132
+ }
129
133
  .so-cascader-result .so-cascader-input {
130
134
  display: -webkit-inline-box;
131
135
  display: -ms-inline-flexbox;
@@ -246,7 +250,7 @@ div.so-cascader-options {
246
250
  }
247
251
  .so-input-rtl .so-cascader-no-data,
248
252
  .so-list-rtl .so-cascader-no-data {
249
- padding: 6px 12px 6px 12px 12;
253
+ padding: 6px 12px 6px 24px;
250
254
  }
251
255
  .so-cascader-no-data:hover {
252
256
  color: var(--select-item-active-color, #292d32);
@@ -185,7 +185,8 @@ function (_PureComponent) {
185
185
  range = _this$props6.range,
186
186
  rangeTemp = _this$props6.rangeTemp,
187
187
  min = _this$props6.min,
188
- max = _this$props6.max;
188
+ max = _this$props6.max,
189
+ type = _this$props6.type;
189
190
 
190
191
  var minD = minDate || min && _utils.default.toDate(_utils.default.format(min, minStr, this.getOptions()), this.getOptions());
191
192
 
@@ -194,18 +195,29 @@ function (_PureComponent) {
194
195
  var isDisabled = disabled && typeof disabled === 'function' ? disabled(date) : false; // only for single, single picker don't has index
195
196
 
196
197
  if (index === undefined && !isDisabled) {
197
- if (minD && _utils.default.compareAsc(date, minD) < 0 || maxD && _utils.default.compareAsc(date, maxD) > 0) isDisabled = true;
198
+ if (type === 'week') {
199
+ if (minD && _utils.default.compareWeek(date, minD, 0, this.getOptions()) < 0) isDisabled = true;
200
+ if (maxD && _utils.default.compareWeek(date, maxD, 0, this.getOptions()) > 0) isDisabled = true;
201
+ } else if (minD && _utils.default.compareAsc(date, minD) < 0 || maxD && _utils.default.compareAsc(date, maxD) > 0) isDisabled = true;
198
202
  }
199
203
 
200
204
  if (!isDisabled && index === 1 && rangeTemp) {
201
- if (typeof range === 'number' && _utils.default.compareAsc(date, _utils.default.addSeconds(rangeTemp, range, this.getOptions())) > 0 || _utils.default.compareAsc(date, _utils.default.clearHMS(rangeTemp, this.getOptions())) < 0 || min && _utils.default.compareAsc(date, _utils.default.clearHMS(min, this.getOptions())) < 0 || _utils.default.compareAsc(date, max) > 0) {
205
+ if (type === 'week') {
206
+ if (typeof range === 'number' && _utils.default.compareWeek(date, _utils.default.addSeconds(rangeTemp, range, this.getOptions()), 0, this.getOptions()) > 0 || _utils.default.compareWeek(date, _utils.default.clearHMS(rangeTemp, this.getOptions()), 0, this.getOptions()) < 0) {
207
+ isDisabled = true;
208
+ }
209
+ } else if (typeof range === 'number' && _utils.default.compareAsc(date, _utils.default.addSeconds(rangeTemp, range, this.getOptions())) > 0 || _utils.default.compareAsc(date, _utils.default.clearHMS(rangeTemp, this.getOptions())) < 0 || min && _utils.default.compareAsc(date, _utils.default.clearHMS(min, this.getOptions())) < 0 || _utils.default.compareAsc(date, max) > 0) {
202
210
  isDisabled = true;
203
211
  } // if (utils.compareAsc(date, min) < 0) isDisabled = true
204
212
 
205
213
  }
206
214
 
207
215
  if (!isDisabled && index === 0) {
208
- if (min && _utils.default.compareAsc(date, _utils.default.clearHMS(min, this.getOptions())) < 0 || _utils.default.compareAsc(date, max) > 0) {
216
+ if (type === 'week') {
217
+ if (min && _utils.default.compareWeek(date, _utils.default.clearHMS(min, this.getOptions()), 0, this.getOptions()) < 0 || max && _utils.default.compareWeek(date, max, 0, this.getOptions()) > 0) {
218
+ isDisabled = true;
219
+ }
220
+ } else if (min && _utils.default.compareAsc(date, _utils.default.clearHMS(min, this.getOptions())) < 0 || _utils.default.compareAsc(date, max) > 0) {
209
221
  isDisabled = true;
210
222
  }
211
223
  }
@@ -280,12 +280,19 @@ label.so-datepicker-r-year {
280
280
  display: -ms-flexbox;
281
281
  display: flex;
282
282
  }
283
+ .so-datepicker-range-picker > div:nth-child(2) {
284
+ padding-left: 6px;
285
+ }
286
+ .so-datepicker-rtl .so-datepicker-range-picker > div:nth-child(2) {
287
+ padding-left: 0;
288
+ padding-right: 6px;
289
+ }
283
290
  .so-datepicker-range-picker > div:nth-last-child(2) {
284
- margin-right: 12px;
291
+ padding-right: 6px;
285
292
  }
286
293
  .so-datepicker-rtl .so-datepicker-range-picker > div:nth-last-child(2) {
287
- margin-right: 0;
288
- margin-left: 12px;
294
+ padding-left: 6px;
295
+ padding-right: 0;
289
296
  }
290
297
  .so-datepicker-range-picker > div:last-child {
291
298
  position: relative;
@@ -293,7 +300,7 @@ label.so-datepicker-r-year {
293
300
  .so-datepicker-range-picker > div:last-child:before {
294
301
  content: ' ';
295
302
  position: absolute;
296
- left: -6px;
303
+ left: 0px;
297
304
  height: 100%;
298
305
  border-left: 1px solid var(--divider-color, #f0f0f0);
299
306
  }
@@ -25,6 +25,7 @@ declare function isInvalid(date: unknown): boolean;
25
25
  declare function toDateWithFormat(dirtyDate: DateTimeType, fmt?: string, def?: Date, options?: DateOptions): Date;
26
26
  declare function compareDay(dateLeft: Date, dateRight: Date, pad: number | undefined, options: DateOptions): number;
27
27
  declare function compareMonth(dateLeft: Date, dateRight: Date, pad: number | undefined, options: DateOptions): number;
28
+ declare function compareWeek(dateLeft: Date, dateRight: Date, pad: number | undefined, options: DateOptions): number;
28
29
  declare function compareYear(dateLeft: Date, dateRight: Date, pad: number | undefined, options: DateOptions): number;
29
30
  declare function compareQuarter(dateLeft: Date, dateRight: Date, pad: number | undefined, options: DateOptions): number;
30
31
  declare function newDate(defaultDate?: Date | DateTimeType, options?: DateOptions): Date;
@@ -44,6 +45,7 @@ declare const _default: {
44
45
  cloneTime: typeof cloneTime;
45
46
  compareAsc: typeof compareAsc;
46
47
  compareMonth: typeof compareMonth;
48
+ compareWeek: typeof compareWeek;
47
49
  compareDay: typeof compareDay;
48
50
  compareQuarter: typeof compareQuarter;
49
51
  getDaysOfMonth: typeof getDaysOfMonth;
@@ -318,6 +318,17 @@ function compareMonth(dateLeft, dateRight, pad, options) {
318
318
  return compareAsc(left, right);
319
319
  }
320
320
 
321
+ function compareWeek(dateLeft, dateRight, pad, options) {
322
+ if (pad === void 0) {
323
+ pad = 0;
324
+ }
325
+
326
+ if (!dateLeft || !dateRight) return 0;
327
+ var left = (0, _dayjs.default)(transDateWithZone(dateLeft, options)).startOf('isoWeek').toDate();
328
+ var right = (0, _dayjs.default)(transDateWithZone(dateRight, options)).startOf('isoWeek').add(pad, 'week').toDate();
329
+ return compareAsc(left, right);
330
+ }
331
+
321
332
  function compareYear(dateLeft, dateRight, pad, options) {
322
333
  if (pad === void 0) {
323
334
  pad = 0;
@@ -431,6 +442,7 @@ var _default = {
431
442
  cloneTime: cloneTime,
432
443
  compareAsc: compareAsc,
433
444
  compareMonth: compareMonth,
445
+ compareWeek: compareWeek,
434
446
  compareDay: compareDay,
435
447
  compareQuarter: compareQuarter,
436
448
  getDaysOfMonth: getDaysOfMonth,
package/css/index.js CHANGED
@@ -220,6 +220,6 @@ exports.Upload = _Upload.default;
220
220
  // Created by scripts/src-index.js.
221
221
  var _default = {
222
222
  utils: utils,
223
- version: '2.0.5-beta.5'
223
+ version: '2.0.5-beta.7'
224
224
  };
225
225
  exports.default = _default;